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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = INT64_MAX >> 1;
const int INF = INT_MAX >> 1;

inline int sqr(int x) { return (x * x); }
inline void printd(double x) { printf("%.10lf\n", x); }
inline void upsort(VI& x) { sort((x).begin(), (x).end()); }
inline void downsort(VI& x) { sort((x).begin(), (x).end(), greater<int>()); }
inline int absdiff(int a, int b) { return (a - b) * (static_cast<int>(a > b)*2 - 1); }
int gcd(int a, int b) { // 最大公約数
	if (a < b) return gcd(b, a);
	int r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
inline int lcm(int a, int b) { return a * b / gcd(a, b); } // 最小公倍数
#pragma endregion

// n種類のものから重複を許してr個選ぶ時の全パターンを辞書順に生成する
// n >= 2, r >= 1 を想定しているのでn=1とかは例外処理が必要
bool combination_repetition(int n, int r, std::vector<int>& idx, std::stack<std::pair<int,int>>& rn_st) {
	using namespace std;
	if (idx.empty()) {
		idx = vector<int>(r, 0);
		rn_st.push(make_pair(0, 0));
	}
	else if (rn_st.empty()) {
		if(*idx.begin() == n-1) return false;
		if (*(idx.end()-1) == 0) rn_st.push(make_pair(0, 0));
		else rn_st.push(make_pair(0, *idx.begin() + 1));
	}

	pair<int, int> r_n;
	while (true) {
		r_n = rn_st.top();
		rn_st.pop();
		idx[r_n.first] = r_n.second;
		if (r_n.first >= r-1) break;
		for (int i = n-1; i >= r_n.second; i--) {
			rn_st.push(make_pair(r_n.first + 1, i));
		}
	}
	return true;
}

signed main()
{	
	int N, M, Q;
	cin >> N >> M >> Q;
	VI a(Q), b(Q), c(Q), d(Q);
	VVI dabc(Q, VI(4));
	rep(i, Q) cin >> dabc[i][1] >> dabc[i][2] >> dabc[i][3] >> dabc[i][0];


	if (M == 1) {
		int sum = 0;
		rep(i, Q) {
			if (dabc[i][3] == 0) sum += dabc[i][0];
		}
		COL(sum);
		return 0;
	}

	int summax = 0;
	VI idx(N,0);
	stack<pair<int, int>> rn_st;
	while (combination_repetition(M, N, idx, rn_st)){
		int sum = 0;
		rep(i, Q) {
			if (dabc[i][3] == idx[dabc[i][2] - 1] - idx[dabc[i][1] - 1]) sum += dabc[i][0];
		}
		summax = max(sum, summax);
	}
	COL(summax);
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int i,ans=0;
  string s;
  
  cin >> s;
  
  for (i=0;i<s.size();i++){
    if (s[i]=='1') ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/dp/tasks/dp_l
#include <bits/stdc++.h>
#define ll long long int
#define pr pair<ll, ll>
#define infinity (ll)4e18
#define tp tuple<ll, ll, ll>
using namespace std;
long long int mod = 1e9 + 7;

ll dp[3001][3001][2];

ll sum(ll pre[], ll i, ll j)
{
    if (i > j)
        return 0;
    if (i == 0)
        return pre[j];
    return pre[j] - pre[i - 1];
}

ll solve(ll pre[], ll a[], ll i, ll j, ll cur)
{
    if (i > j)
        return 0;
    if (i == j)
        return a[i];
    if (dp[i][j][cur] != -1)
        return dp[i][j][cur];
    dp[i][j][cur] = max(a[i] + sum(pre, i + 1, j) - solve(pre, a, i + 1, j, (cur + 1) % 2), a[j] + sum(pre, i, j - 1) - solve(pre, a, i, j - 1, (cur + 1) % 2));
    return dp[i][j][cur];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin >> n;
    ll a[n], pre[n];
    for (ll i = 0; i < n; i++)
        cin >> a[i];
    pre[0] = a[0];
    for (ll i = 1; i < n; i++)
        pre[i] = pre[i - 1] + a[i];
    memset(dp, -1, sizeof(dp));
    cout << 2 * solve(pre, a, 0, n - 1, 0) - pre[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 141312
for i in range(4):
  t,n = map(int,input().split())
  x = 0
  if t == 1:
    x = 6000*n
  elif t == 2:
    x = 4000*n
  elif t == 3:
    x = 3000*n
  else:
    x = 2000*n
  print(x)


Measured memory_bytes: 5596
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

vector<int> A;

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

    int N, M;
    cin >> N >> M;
    A.resize(N);

    int a, B, C;
    u64 ans = 0;
    rep (i, N)
    {
        cin >> a;
        A[i] = a;
        ans += a;
    }
    sort(A.begin(), A.end());

    auto cmp = [](const pair<int, int>& x, const pair<int, int>& y) { return x.first < y.first; };
    priority_queue<pair<int, int>, vector<pair<int, int>>, decltype(cmp)> cmd(cmp);
    rep (i, M)
    {
        cin >> B >> C;
        cmd.push(pair<int, int>(C, B));
    }

    int idx = 0;
    while (!cmd.empty())
    {
        pair<int, int> c = cmd.top();
        int j = 0;
        for (j = 0; j < c.second; ++j)
        {
            if (idx < A.size() && A[idx] <= c.first)
            {
                ans += c.first - A[idx];
                ++idx;
            }
            else
            {
                break;
            }
        }
        if (idx == A.size() || A[idx] > c.first) break;
        cmd.pop();
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 1784
#include<bits/stdc++.h>
#define MAX (1<<17)
using namespace std;

int n,q;
int st[MAX*2];

void init(){
  int tmp=1;
  while(tmp<n)tmp*=2;
  n=tmp;
  for(int i=0;i<n*2-1;i++)st[i]=INT_MAX;
}

void update(int k,int x){
  k+=n-1;
  st[k]=x;
  while(k>0){
    k=(k-1)/2;
    st[k]=min(st[k*2+1],st[k*2+2]);
  }
}

int find(int a,int b,int k,int l,int r){

  if(r<=a || b<=l)return INT_MAX;

  if(a<=l && r<=b)return st[k];

  int v1=find(a,b,k*2+1,l,(l+r)/2);
  int v2=find(a,b,k*2+2,(l+r)/2,r);
  return min(v1,v2);
}

int main()
{
  int com,x,y;

  cin>>n>>q;
  init();
  for(int i=0;i<q;i++){
    cin>>com>>x>>y;
    if(com)cout<<find(x,y+1,0,0,n)<<endl;
    else update(x,y);
  }
  return 0;
}

Measured memory_bytes: 2184
package main
import (
	"fmt"
	"os"
	"sort"
	"strings"
	"strconv"
	"bufio"
)

func bisect_right(a []int, x int, lo int, hi int) int {
	for lo < hi {
		mid := (lo + hi) / 2
		if x < a[mid] {
			hi = mid
		} else {
			lo = mid+1
		}
	}
	return lo
}

func bisect_left(a []int, x int, lo int, hi int) int {
	for lo < hi {
		mid := (lo + hi) / 2
		if a[mid] < x {
			lo = mid+1
		} else {
			hi = mid
		}
	}
	return lo
}

type SortableInts []int

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

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	stdin.Scan()
	text := stdin.Text()
	ss := strings.Split(text, " ")
	tt := make([]int, len(ss))
	for k, i := range ss {
		j, _ := strconv.Atoi(i) 
		tt[k] = j
	}
	sort.Sort(SortableInts(tt))
	c := 0
	lt := len(tt)
	for i := 0; i < lt-2; i++ {
		for j := i+1; j < lt-1; j++ {
			uk := bisect_left(tt, tt[i]+tt[j], j+1, lt)
			var abs_diff int
			if tt[i] >= tt[j] {
				abs_diff = tt[i] - tt[j]
			} else {
				abs_diff = tt[j] - tt[i]
			}
			lk := bisect_right(tt, abs_diff, j+1, uk)
			c += uk-lk
		}
	}
	fmt.Print(c)
}

Measured memory_bytes: 640
// +build ignore
package main

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

func solve(sc *scanner, wr *bufio.Writer) int {
	N := sc.i()
	K := sc.i()
	A := make([]int, N+1)
	for i := 1; i <= N; i++ {
		A[i] = sc.i()
	}

	index := map[int]int{}
	last := 1
	index[last] = 0
	root := []int{1}

	for i := 1; i <= K; i++ {
		last = A[last]
		if _, ok := index[last]; !ok {
			index[last] = i
			root = append(root, last)
		} else {
			j := index[last]
			k := (K-i)%(i-j) + j
			last = root[k]
			break
		}
	}

	fmt.Println(last)

	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


Measured memory_bytes: 18592
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<complex>

#define INF (long long)1000000000
#define MOD 1000000007
#define EPS 1e-8

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	string s;
	cin>>s;
	cout<<s.substr(0,4)+" "+s.substr(4,8)<<endl;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, char) => {
        read_value!($next, String).chars().collect::<Vec<char>>()[0]
     };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
    ($next:expr, isize1) => {
        read_value!($next, isize) - 1
    };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}
macro_rules! printvec {
    ( $item:expr ) => {
        for &i in &$item {
            print!("{} ", i);
        }
        println!("");
    }
}
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}
#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);
impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}
#[derive(PartialEq, PartialOrd, Clone, Debug)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}
#[allow(dead_code)]
const MOD: usize = 1000000007;


fn main() {
    input!{
        N: usize,
    }
    println!("{}", N*(N-1)/2);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
const int MAX=1510;

int N,M,ans;
int h[MAX],w[MAX],sumh[MAX],sumw[MAX];
vector<int> cnt(MAX*MAX);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N >> M,N){
        for (int i=0;i<N;++i){
            cin >> h[i];
            sumh[i+1]=sumh[i]+h[i];
        }
        for (int i=0;i<M;++i){
            cin >> w[i];
            sumw[i+1]=sumw[i]+w[i];
        }
        fill(cnt.begin(),cnt.end(),0);
        for (int i=0;i<=M;++i)
            for (int j=i+1;j<=M;++j)
                ++cnt[sumw[j]-sumw[i]];
        ans=0;
        for (int i=0;i<=N;++i)
            for (int j=i;j<=N;++j)
                ans+=cnt[sumh[j]-sumh[i]];
        cout << ans << '\n';
    }
}


Measured memory_bytes: 11556
a,b,c,d,e,f=map(int,input().split())
w=set([])
for i in range(31):
    for j in range(31):
        x=a*i*100+b*j*100
        if 0<x<=f:
            w.add(x)
s=set([])
for i in range(3001):
    for j in range(3001):
        y=c*i+d*j
        if y<=f:
            s.add(y)
tmpn=-1
ans=[0,0]
for i in w:
    for j in s:
        if i+j<=f and i//100*e>=j:
            if tmpn<j/(1.0*(i+j)):
                tmpn=j/(1.0*(i+j))
                ans=[i+j,j]
print(*ans)


Measured memory_bytes: 42332
($t[0],$t[1])=glob<>;@l=map{[glob<>]}(0..2);@p=sort{$$b[1]<=>$$a[1]}map{$c=$_;map{[$c,$_]}@{$l[$c]}}(0..2);$a=$t[1]+$t[0];for(;0<$a;$i++){($e,$f)=@{$p[$i]};2-$e&&($t[$e]?$t[$e]--:next);$d+=$f;$a--;}print$d

Measured memory_bytes: 112004
# -*- coding: utf-8 -*-
from sys import stdin

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


N, X = ds_in()


def num_burger(n):
    """ レベルnバーガーの厚さ """
    return 4 * 2**n - 3


def num_patti(n):
    """ レベルnバーガーのパティの数 """
    return 2 * 2**n - 1


def count_patti(n, x):
    if n == 0:
        if x == 1:
            return 1
        else:
            return 0
    else:
        if x == num_burger(n):
            return num_patti(n)
        elif x > num_burger(n-1) + 2:
            retval = num_patti(n-1) + 1
            retval += count_patti(n-1, x - num_burger(n-1) - 2)
            return retval
        elif 1 <= x - num_burger(n-1) <= 2:
            return num_patti(n-1) + (x - num_burger(n-1) - 1)
        else:
            return count_patti(n-1, x-1)


print(count_patti(N, X))


Measured memory_bytes: 3064
n, k = map(int, input().split())
a = list(map(int, input().split()))
log = []
visited = [False for i in range(n)]
now = a[0]-1
loop = False
for i in range(k-1):
    if visited[now] == True:
        loop = True
        break
    log.append(now)
    visited[now] = True
    now = a[now]-1
else:
    print(now+1)
if loop:
    for i in range(len(log)):
        if log[i] == now:
            first = len(log[:i])
            log_list = log[i:]
            loop_num = len(log_list)
            break
    k -= first
    k %= loop_num
    print(log_list[k-1]+1)


Measured memory_bytes: 32376
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
const lint mod=1e9+7;

int main()
{
  lint x, y;
  cin >> x >> y;
  lint num = x, cnt = 0;
  while(num <= y){
    cnt++;
    num *= 2;
  }

  cout << cnt << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int n, x, y, z, ans = 0;
	int a[105], b[105], c[105];
	cin >> n;
	cin >> x;
	for (int i = 0; i < x; i++) cin >> a[i];
	cin >> y;
	for (int i = 0; i < y; i++) cin >> b[i];
	cin >> z;
	for (int i = 0; i < z; i++) cin >> c[i];
	for (int i = 1; i <= n; i++) {
		int sum = 0;
		for (int j = 0; j < x; j++) {
			if (a[j] == i) sum += 100;
		}
		for (int j = 0; j < y; j++) {
			if (b[j] == i) sum += 10;
		}
		for (int j = 0; j < z; j++) {
			if (c[j] == i) sum += 1;
		}
		if (sum == 111 || sum == 11 || sum == 1) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int n;
char c[100010];

int main(){
	scanf("%d", &n);
	scanf(" %s", &c);

	int b = 0, r = 0;
	for(int i = 0; i < n; i++){
		if(c[i] == 'R') r++;
		else b++;
	}

	if(r > b) printf("Yes\n");
	else printf("No\n");

	return 0;
}

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

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }

int main() {
   int N, M;
   cin >> N >> M;
   int L, R;
   int LMax = 0;
   int RMin = N;

   for (int i = 0; i < M; i++) {
      cin >> L >> R;
      LMax = max(L, LMax);
      RMin = min(R, RMin);
   }
   cout << max(0, RMin - LMax + 1) << endl;
   return 0;
}


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

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

    int X, K;
    cin >> X >> K;
    vector<pair<int, int>> event;
    for (int i = 0; i < K; i++) {
        int r;
        cin >> r;
        event.push_back({r, -1});
    }
    int Q;
    cin >> Q;
    vector<int> a(Q);
    for (int i = 0; i < Q; i++) {
        int t;
        cin >> t >> a[i];
        event.push_back({t, i});
    }
    sort(event.begin(), event.end());
    vector<int> ans(Q);
    int prev = 0;
    bool flipped = false;
    int left = 0, right = X, bottom = 0, top = X;
    for (auto& p : event) {
        int t, i;
        tie(t, i) = p;
        int time = t - prev;
        if (flipped) {
            bottom += time;
            if (bottom > X) bottom = X;
            top += time;
            if (top > X) {
                right -= top - X;
                top = X;
            }
        } else {
            top -= time;
            if (top < 0) top = 0;
            bottom -= time;
            if (bottom < 0) {
                left += -bottom;
                bottom = 0;
            }
        }
        if (i == -1) {
            flipped ^= true;
        } else {
            if (a[i] <= left) ans[i] = bottom;
            else if (a[i] <= right) ans[i] = bottom + (a[i] - left);
            else ans[i] = top;
        }
        prev = t;
    }
    for (int i = 0; i < Q; i++) cout << ans[i] << "\n";
}

Measured memory_bytes: 5576
N=int(input())
T,A=list(map(int,input().split()))
H=list(map(int,input().split()))

m="a"

for i in range(N):
	if m=="a" or m>abs(A-(T-(H[i]*0.006))):
		m=abs(A-(T-(H[i]*0.006)))
		m_i=i

print(m_i+1)

Measured memory_bytes: 3060
n=gets.to_i
a=gets.split.map(&:to_i)

if a.max.abs > a.min.abs
  p 2*n-1
  puts (1..n).map{|i|[a.index(a.max)+1,i]*" "}
  puts (1..n-1).map{|i|[i,i+1]*" "}
else
  p 2*n-1
  puts (1..n).map{|i|[a.index(a.min)+1,i]*" "}
  puts (n-1).downto(1).map{|i|[i+1,i]*" "}
end


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

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

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

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

const ll mod = 1000000007;


map<string, int> memo;

using P=pair<int, int>;




/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}


int main() {
	int s, w;
	cin >> s >> w;
	if (s > w) cout << "safe";
	else cout << "unsafe";
	return 0;
}










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

int main(){
int n,a,b;
int max,min;
cin>>n>>a>>b;
  
if(a<=b){
max=a;
}
if(b<=a){
max=b;
}

min=a+b-n;
if(a+b<=n){
min=0;
}
cout<<max<<" "<<min;
}

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

using namespace std;

int main() {
  int n, k, l[50], ans = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  sort(l, l+n);
  reverse(l, l+n);
  for (int i = 0; i < k; i++) {
    ans += l[i];
  }
  cout << ans << '\n';
  return 0;
}


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

string s1,s2,s3;
int n1,n2;
signed main() 
{
	cin>>s1>>s2;
	cin>>n1>>n2;
	cin>>s3;
	if(s1==s3)
		n1--;
	else
		n2--;
	printf("%d %d",n1,n2);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int n,a,b;cin >> n >> a >> b;
	
	int ans = 0;
	REP(i,n+1)
	{
		int tmp = 0;
		int now = i;
		while(now)
		{
			tmp += now%10;
			now /= 10;
		}
		
		if(tmp >= a && tmp <= b)ans+=i;
	}
	
	cout << ans << endl;
		
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);		
		int n=in.nextInt();
		long m=1000000007l;
		long [][] c=new long [2002][2002];
		c[1][0]=1;
		c[1][1]=1;
		for(int i=0;i<2002;i++)
		{
			c[i][0]=1;
		}
		for(int i=2;i<2002;i++)
		{
			for(int j=1;j<=i;j++)
			{
				c[i][j]=(c[i-1][j]+c[i-1][j-1])%m;
			}
		}
		int k=in.nextInt();
		int r=n-k;
		for(int i=1;i<=k;i++)
		{
			long ans=(c[r+1][i]*c[k-1][i-1])%m;
			System.out.println(ans);
		}
	}
}
	

Measured memory_bytes: 80980
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,m;
    cin >> n >> m;
    cout << max(0,n - m) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

int main()
{
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll x = 0;
  for (int i = 0; i < n; ++i)
  {
    cin >> a[i];
    if (i % 2 == 0)
      x += 2 * a[i];
    else
      x -= 2 * a[i];
  }
  x /= 2;
  vector<ll> ans;
  ans.push_back(x);
  for (int i = 0; i < n - 1; ++i)
  {
    x = 2 * a[i] - x;
    ans.push_back(x);
  }
  for (int i = 0; i < n; ++i)
  {
    cout << ans[i] << " \n"[i == n - 1];
  }

  return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
string S, T; int ans=0; cin >> S >> T;
REP(i, S.size()){ if(S[i]!=T[i]){ans++;} }
cout << ans << "\n";
}

Measured memory_bytes: 3916
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min, max};
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
   input!{
       n: usize,
       a: [i64; n + 1],
       b: [i64; n],
   } 
   let mut a = a;
   let mut ans: i64 = 0;
   for i in 0..n{
       if b[i] > a[i]{
           ans += a[i];
           let r = b[i] - a[i];
           if a[i + 1] < r{
               ans += a[i + 1];
               a[i + 1] = 0;
           }else{
               ans += r;
               a[i + 1] -= r;
           }
       }else{
           a[i] -= b[i];
           ans += b[i];
       }
   }
   println!("{}", ans);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Measured memory_bytes: 10620
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }





long long POW(long long n, long long m, long long p){
    if(m == 0){
        return 1;
    }
    if(m % 2 == 0){
        long long tmp = POW(n, m / 2, p) % p;
        return tmp * tmp % p;
    }
    else{
        return n * POW(n, m - 1, p) % p;
    }
}

// a^(p - 1 - x) ≡ a^(-x) (mod p)
long long Fermat(long long a, long long x, long long p){
    return POW(a, p - 1 - x, p);
}

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    REP(i, n){
        cin >> a[i + 1];
    }
    vector<ll> h(n + 1);
    for(ll i = 1; i <= n; i++){
        h[i] = h[i - 1] + Fermat(i, 1, MOD);
        h[i] %= MOD;
    }
    
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        ans += a[i] * ((h[i] + h[n + 1 - i] - 1) % MOD);
        ans %= MOD;
    }
    
    ll k = 1;
    for(ll i = 2; i <= n; i++){
        k *= i;
        k %= MOD;
    }
    
    ans *= k;
    ans %= MOD;
    
    cout << ans << endl;
}

Measured memory_bytes: 1792
s = input()
k = int(input())
n = len(s)
a = []
cnt = 1
for i in range(n-1):
  if s[i] == s[i+1]:
    cnt += 1
  else:
    a.append(cnt)
    cnt = 1
if sum(a) != n:
  a.append(cnt)
m = len(a)
if m == 1:
  print((a[0]*k)//2)
  exit()
if m == 2:
  print((a[0]//2+a[1]//2)*k)
  exit()
cnt = 0
for i in range(1,m-1):
  cnt += a[i] // 2
cnt *= k
if s[0] == s[n-1]:
  cnt += (k-1)*((a[0]+a[m-1])//2)
else:
  cnt += (k-1)*(a[0]//2+a[m-1]//2)
cnt += a[0]//2 + a[m-1]//2
print(cnt)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
const int INF = 1<<30;
typedef long long int ll;

int main(){
	int n;cin>>n;
	vector<int> l(n*2);
	for(int i=0;i<n*2;i++)cin>>l[i];
	sort(l.begin(), l.end());
	int ans = 0;
	for(int i=0;i<n;i++){
	  ans += l[i*2];
	}
	cout << ans << endl;
}

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

#define rep(i,n) for(int (i)=0; (i)<(int)(n); (i)++)
#define all(x) (x).begin(), (x).end()
#define sqr(x) (x)*(x)
#define CEIL(a,b) ((a)+(b)-1) /(b)

typedef long long ll;
const int INF = 1001001001;

void sort_second(vector<pair<ll, ll>> &A, int N); //A:array of pair, N:size of array

int main() {
    int n, ans=0;
    cin >> n;
    int a[10][10];
    rep(i, 10) rep(j, 10) a[i][j] = 0;
    
    rep(i, n) {
        string s = to_string(i+1);
        a[s[0]-'0'][s[s.length()-1]-'0']++;
    }
    for(int i=1; i<=9; i++) {
        for(int j=i; j<=9; j++) {
            if(i!=j) ans += a[i][j] * a[j][i] * 2;
            else ans += a[i][j] * a[i][j];
        }
    }
    cout << ans << endl;

    return 0;
}

void sort_second(vector<pair<ll, ll>> &A, int N) {
    rep(i, N) swap(A.at(i).first, A.at(i).second);
    sort(all(A));
    rep(i, N) swap(A.at(i).first, A.at(i).second);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int LLu;

using namespace std;

const int N =  300000+5;
const int MOD = 998244353;
const int INF = 1e9+7;

inline int read() {
    int x = 0,f=1;char ch = getchar();
    for(; ch<'0'||'9'<ch; ch=getchar()) if(ch == '-') f=-1;
    for(; '0'<=ch&&ch<='9'; ch=getchar()) x=(x<<3)+(x<<1)+ch-'0';
    return x*f;
}

#define lal puts("****");
#define pb push_back
#define mp make_pair

/********************************************************/
int n;
int a[N];
int main(){
    scanf("%d",&n);
    int x=0,x2=0,x4=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if(a[i]%4==0) x4++;
        else if(a[i]%2==0)x2++;
        else x++;
    }
    if(x2==0&&x4+1>=x) puts("Yes");
    else if(x4>=x) puts("Yes");
    else      puts("No");

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<string> S(n);
    for(int i = 0; i < n; i++){
        cin >> S[i];
    }

    vector<int> cnt(26, 50);
    for(int i = 0; i < n; i++){
        vector<int> cnt_S(26);
        for(int j = 0; j < S[i].size(); j++){
            cnt_S[S[i][j]-'a']++;
        }
        for(int j = 0;j < 26; j++){
            cnt[j] = min(cnt[j], cnt_S[j]);
        }
    }

    string ans = "";
    for(int i = 0; i < 26; i++){
        for(int j = 0; j < cnt[i]; j++){
            ans += i+'a';
        }
    }
    cout << ans << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

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

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

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,x,y,z;
double d,e,f;
string s,t;
//

signed main() {
  RAPID;
  IN2(n,m);
  if(n%m==0) OUT(0);
  else OUT(1);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int n[2];
int star[2][2][1000];
bool flag;

bool serach(int x, int y) {
	REP(i, n[1]) {
		if (x == star[1][0][i] && y == star[1][1][i]) {
			return true;
		}
	}
	return false;
}

int main() {
	while (1) {
		cin >> n[0];
		if (n[0] == 0) break;
		REP(i, n[0]) scanf("%d %d", &star[0][0][i], &star[0][1][i]);
		cin >> n[1];
		REP(i, n[1]) scanf("%d %d", &star[1][0][i], &star[1][1][i]);

		REP(i, n[1]) {
			int dx = star[1][0][i] - star[0][0][0];
			int dy = star[1][1][i] - star[0][1][0];

			flag = true;
			REP(j, n[0]) {
				if (!serach(star[0][0][j] + dx, star[0][1][j] + dy))
					flag = false;
			}
			if (flag) {
				printf("%d %d\n", dx, dy);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1244
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
using namespace std;

int main(){
  string s;
  cin>>s;
  if(s=="ABC"){
cout<<"ARC";
  }else{
    cout<<"ABC";
  }
}

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

int main(){
  int n;
  cin >> n;
  
  if(n==1) {
    cout << "Yes";
    return 0;
  }
  
  int height = 1;
  int next = 0;
  cin >> height;
  for (int i=1; i<=n; i++){
    cin >> next;
    if ( height > next) {
      cout << "No";
      return 0;
    } else if (height < next){
      height = next - 1;
    }
  }
  cout << "Yes";
  return 0;
}


Measured memory_bytes: 256
#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(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int dp[1<<12];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vi a(m),b(m),c(m,0);
    rep(i,m) {
        cin >> a[i] >> b[i];
        rep(_,b[i]) {
            int nc;
            cin >> nc;
            nc--;
            c[i] |= 1<<nc;
        }
    }
    rep(i,1<<n) dp[i] = inf;
    dp[0] = 0;
    rep(bit,1<<n) rep(i,m) chmin(dp[bit|c[i]],dp[bit]+a[i]);
    cout << (dp[(1<<n)-1] == inf ? -1 : dp[(1<<n)-1]) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int i,x=0;
  int line[200];
  scanf("%d",&x);
  for(i=0;i<x;i++){
    scanf("%d",&line[i]);
  }
  for(i=0;i<x/2;i++){
    int h=line[i];
    line[i]=line[x-1-i];
    line[x-1-i]=h;
  }
  for(i=0;i<x;i++){
    if(i)printf(" ");
    printf("%d",line[i]);
    }
  printf("\n");
  return 0;
}



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    ll ans = 0;
    rep2(i, 1, N + 1) {
        if (i % 2) {
            ll cnt = 0;
            rep2(j, 1, i + 1) {
                if (i % j == 0) cnt++;
            }
            if (cnt == 8) ans++;
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
D,N = map(int, input().split())

cnt = 0
for n in range(1, 10 ** 7):
    can, tmp = 0, n
    while tmp % 100 == 0:
        tmp //= 100
        can += 1
    
    if can == D:
        cnt += 1
    
    if cnt == N:
        print(n)
        exit()

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

int main() {
  llong N;
  vector<llong> P;

  cin >> N;
  P.resize(N);
  llong ans = 0, mini = inf<llong>;
  for (auto &in: P) {
    cin >> in;
    ans += in <= mini;
    mini = min(mini, in);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include<iostream>

using namespace std;

int check(int a, int b, int c, int x,int key){
	int left = b*x+c;
	int amari = left % a;
	if(amari == 0) return 1;
	if(amari == key) return 0;
	check(a,b,c,++x,key);
}

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	int key = c % a;
	int s = check(a,b,c,1,key);
	switch(s){
	case 0:
		cout << "NO" << endl;
		break;
	case 1:
		cout << "YES" << endl;
		break;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool turn(string s,int start,int gorl){
  string tmp=s.substr(start,gorl-start+1);
  //cout<<tmp<<endl;
  string re_tmp=s.substr(start,gorl-start+1);
  reverse(re_tmp.begin(),re_tmp.end());
  //cout<<re_tmp<<endl;
  if(tmp==re_tmp)return true;
  else return false;
}

int main(){
  string S;
  cin>>S;
  int N=S.size();
  if(turn(S,0,N)&&turn(S,0,(N-3)/2)&&turn(S,(N+1)/2,N-1)){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
  
}

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

unordered_set<int> node[200001];
vector<bool> visited(200001,false);

int dfs(int parent)
{
    visited[parent]=true;
    int sz=1;
    for(auto child : node[parent])
    {
        if(!visited[child])
            sz+=dfs(child);
    }
    return sz;
}

int main() 
{
    int n,m;
    cin>>n>>m;
    //memset(visited,false,sizeof(visited));
    int u,v;

    for(int i=1;i<=m;i++)
    {
        cin>>u>>v;
        node[u].insert(v);
        node[v].insert(u);
    }

    int ans;
    ans=dfs(1);
    for(int i=1;i<=n;i++)
    {
        if(!visited[i])
            ans=max(ans,dfs(i));
    }
    cout<<ans;
}


Measured memory_bytes: 39592
import java.util.Scanner;
 
public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
 
        //int a = stdIn.nextInt();
        //int b = stdIn.nextInt();
        //int c = stdIn.nextInt();
        //int x = stdIn.nextInt();
        //int num[] = new int[];
        String s = stdIn.next();
        //String t = stdIn.next();
        char c[] = s.toCharArray();
        
        c[0] += 1;
        //int sum = 0;
        //boolean flag = true;
        //for(int i = 0; i < s.length(); i++){
        //}
 
        System.out.println(c);
 
        //System.out.println();
        //System.out.print();
 
        stdIn.close();
    }
}

Measured memory_bytes: 25300
#include <iostream>
#define MAX 1001
using namespace std;
int a[MAX];

int main(){
    while(true){
        int n,m,maxsum = 0;
        cin >> n >> m;
        if(n == 0 && m == 0)break;

        for(int i = 0;i < n;i++)
            cin >> a[i];
        
        for(int i = 0;i < n -1;i++){
            for(int j = i + 1;j < n;j++){
                if((a[i] + a[j] <= m))
                    maxsum = max(maxsum,a[i] + a[j]);
            }
        }

        if(maxsum == 0)
            cout << "NONE" << endl;
        else
            cout << maxsum << endl;
    }

    return 0;
}


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

int main() {

  int n;
  cin >> n;
  
  int a[n];
  REP(i,n) cin >> a[i];
  
  sort(a, a+n, greater());
 
  int ans = 0;
  REP(i,n) {
    if (i % 2 == 0) ans += a[i];
    else ans -= a[i];
  }
  
  cout << ans << endl;
  
}

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

const int N=2e5+1e3+7;

int f[2][N],n,m;

int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int u,v;
		cin>>u>>v;
		if(u==1)
			f[0][v]=1;
		if(v==1)
			f[0][u]=1;
		if(u==n)
			f[1][v]=1;
		if(v==n)
			f[1][u]=1;
	}
	for(int i=2;i<n;i++)
		if(f[0][i]&&f[1][i])
		{
			cout<<"POSSIBLE";
			return 0;
		}
	cout<<"IMPOSSIBLE";
}

Measured memory_bytes: 1792
function main(input) {
  const args = input.split('\n')
  const n = Number(args[0].split(' ')[0])
  const k = Number(args[0].split(' ')[1])
  const data = args.slice(1, args.length)
  let sunuke = Array(n).fill(0)
  let d = []
  for (let i = 0; i < k * 2; i += 2) {
    d = data[i + 1].split(' ').map(v => Number(v))
    d.forEach(v => {
      sunuke[v - 1] += 1
    })
    d = []
  }
  console.log(sunuke.filter(v => v === 0).length)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 29828
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        int min=999999999;
        for(int a=1;a<=N/2;a++){
            int A = a;
            int B = N-a;
            int sum=0;
            while(A!=0){
                sum+=A%10;
                A/=10;
            }
            while(B!=0){
                sum += B%10;
                B/=10;
            }
            if(min>sum) min = sum;
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 21844