akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fi first
#define sc second
#define ALL(x) x.begin(), x.end()
#define RALL(X) x.begin(), x.end()
#define FOR(i, n, k) for(i=0; i<n; i+=k)
#define FO(i, n, k) for(i=1; i<=n; i+=k)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define N 100005
#define mid ((l+r)/2)
#define dbg(x) (cerr << #x << " : " << x << endl)
#define endl "\n"
#define MOD 100000009

using namespace std;

typedef long long int lli;

int main(){
	ios_base::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector <vector <int>> ar(100005, vector <int>());
	for(int i=0; i<n; i++){
		int a, b;
		cin >> a >> b;
		ar[a].pb(b);
	}

	int res = 0;
	priority_queue <int> pq;
	for(int i=m-1; i>=0; i--){
		for(int x: ar[m-i])
			pq.push(x);

		if(!pq.empty()){
			res += pq.top();
			pq.pop();
		}
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define rept(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(v) v.bigin(),v.end()
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main(){
    FAST;
    ll w=0;
    ll r=0;
    ll n;
    string c;
    cin>>n>>c;
    rep(i,n){
        if(c[i]=='R') r++;
    }
    rep(i,r){
        if(c[i]=='W') w++;
    }
    cout<<w;
}



Measured memory_bytes: 3740
<?php
$inputs = array();
while ( ! feof (STDIN) ) {
  $line = trim(fgets(STDIN));
  if ($line !== '') {
    $inputs[] = $line;
  }
}

$cards = range(1, $inputs[0] * 2);
$cut_count = $inputs[1];

//var_dump($cut_count);
//var_dump($inputs);
//var_dump($cards);
for ($i=0; $i<$cut_count; $i++) {
  $k = $inputs[2+$i];
//var_dump($k);
  if ($k == 0) {
    $l = count($cards) / 2;
    $temp1 = array_slice($cards, 0, $l);
    $temp2 = array_slice($cards, $l);
    $temp3 = array();
    for ($j=0; $j<$l; $j++) {
      $temp3[] = $temp1[$j];
      $temp3[] = $temp2[$j];
    }
//var_dump($temp3);
    $cards = $temp3;
  } else {
    $temp1 = array_slice($cards, 0, $k);
    $temp2 = array_slice($cards, $k);
//var_dump($temp1);
//var_dump($temp2);
    $cards = array_merge($temp2, $temp1);
//var_dump($cards);
  }
}

//var_dump($cards);
foreach ($cards as $no) {
  echo $no . "\n";
}

Measured memory_bytes: 15560
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

let a : Int = arr[0]
let b : Int = arr[1]

func is1to9( number: Int ) -> Bool {
  if( number >= 1 && number <= 9 ) {
    return true
  } else {
    return false
  }
}

if( is1to9(a) && is1to9(b) ) {
  print( a * b )
} else {
  print( "-1" )
}

Measured memory_bytes: 4080
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

template<class T>
struct Edge {
	int to;
	T cost;
	Edge() {}
	Edge(int to, T cost=1) : to(to), cost(cost) {}
	bool operator>(const Edge &r) const { return this->cost > r.cost; }
};

template<class T>
vector<T> Dijkstra(const vector<vector<Edge<T>>> &edges, const int st) {

	const int V = (int)edges.size();
	vector<int> res(V - 1);
	const T inf = numeric_limits<T>::max() / 2;
	vector<T> cost(V, inf);
	cost[st] = 0;

	priority_queue<Edge<T>, vector<Edge<T>>, greater<Edge<T>>> pq;
	pq.emplace(st, cost[st]);

	while (!pq.empty()) {

		Edge<T> now(pq.top().to, pq.top().cost);
		pq.pop();

		if (cost[now.to] < now.cost) continue;
		for (const Edge<T> &e : edges[now.to]) {
			T tmp_cost = now.cost + e.cost;
			if (cost[e.to] > tmp_cost) {
				res[e.to - 1] = now.to;
				cost[e.to] = tmp_cost;
				pq.emplace(e.to, cost[e.to]);
			}
		}
	}

	return res; // min cost to vertex idx from st
}

int main() {

	int N, M;
	cin >> N >> M;


	vector<vector<Edge<int>>> edges(N);
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		edges[u].emplace_back(v);
		edges[v].emplace_back(u);
	}

	cout << "Yes" << "\n";
	for (const auto &e : Dijkstra(edges, 0)) cout << e + 1 << "\n";

	return 0;
}



Measured memory_bytes: 13520
use v5.18;
use warnings;

my ($n, $a, $b);
{
  my $in = <STDIN>;
  ($n, $a, $b) = split(" ", $in);
}
my $MOD = 1e9 + 7;
sub modpow {
  my ($a, $n, $MOD) = @_;
  my $res = 1;
  while ($n > 0) {
    $res = $res * $a % $MOD if $n & 1;
    $a = $a * $a % $MOD;
    $n >>= 1;
  }
  return $res;
}
sub modinv {
  my ($a, $MOD) = @_;
  return modpow($a, $MOD - 2, $MOD);
}
sub comb {
  my ($n, $k) = @_;
  my $a = 1;
  my $b = 1;
  for (my $i=0; $i<$k; $i++) {
    $a *= $n - $i;
    $a %= $MOD;
    $b *= $i + 1;
    $b %= $MOD;
  }
  $a * modinv($b, $MOD) % $MOD;
}

my $ans = modpow(2, $n, $MOD) - 1;
$ans += $MOD - comb($n, $a, $MOD);
$ans += $MOD - comb($n, $b, $MOD);
say $ans % $MOD;

Measured memory_bytes: 640
// -*- coding:utf-8-unix -*-

use proconio::marker::Usize1;
use proconio::{fastout, input};
use std::collections::HashSet;

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        result: [(Usize1, String); m],
    }
    let mut ac_set: HashSet<usize> = HashSet::with_capacity(n);
    let mut pen_vec: Vec<u32> = vec![0; n];
    for (p, s) in result.iter() {
        if s == "AC" {
            ac_set.insert(*p);
        } else {
            if !ac_set.contains(p) {
                pen_vec[*p] += 1;
            }
        }
    }
    let mut sum_pen = 0;
    for i in 0..n {
        if ac_set.contains(&i) {
            sum_pen += pen_vec[i];
        }
    }
    println!("{} {}", ac_set.iter().count(), sum_pen);
}


Measured memory_bytes: 10412
#include<iostream>
#include <string>
#include <vector>
#include <cmath>
#define ll long long

using namespace std;

int main() {
    int N, Y;
    cin >> N >> Y;
    int res10000 = -1, res5000 = -1, res1000 = -1;
    for (int a = 0; a <= N; ++a) {  // 10000円の枚数を 0 〜 N で調べる
        for (int b = 0; b + a <= N; ++b) {  // 5000円の枚数を 0 〜 N-a で調べる
            int c = N - a - b;  // 1000円の枚数は決まる
            int total = 10000*a + 5000*b + 1000*c;
            if (total == Y) {  // 答えが見つかったら
                res10000 = a;
                res5000 = b;
                res1000 = c;
            }
        }
    }

    // 答えを出力 (見つかっていなくても -1 -1 -1 になるので OK です)
    cout << res10000 << " " << res5000 << " " << res1000 << endl;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::min;
use std::collections::VecDeque;

fn main() {
    let n: usize = read();
    let mut a: Vec<i64> = vec![];
    for _ in 0..n {
        let ai = read();
        a.push(ai);
    }

    let mut minv = std::i64::MAX;
    let mut b = 0;
    let mut c: i64 = a.iter().sum();

    for i in 0..n - 1 {
        let ai = a[i];
        b += ai;
        c -= ai;
        minv = min(minv, (b - c).abs());
    }
    println!("{}", minv);
}


Measured memory_bytes: 6396
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    H,W = MI()
    S=[ST() for _ in range(H)]
    for s in S:
        print(s)
        print(s)
if __name__ == '__main__':
    main()

Measured memory_bytes: 3572
from sys import stdin
import sys
import math

N = int(input())
A = [int(input()) for i in range(N)]

h = {}

for i in A:
    h[i] = 0

for j in A:
    h[j] += 1


count = 0
for key in h.keys():
    if h[key] % 2 == 1:
        count += 1

print(count)


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

static const int MAX = 100;
static const long long INFTY = (1LL<<32);

int V;
long long d[MAX][MAX];

void floyd(){
  // i->jの際に経由させるNode Number
  for(int k=0;k<V;k++){

    for(int i=0;i<V;i++){
      // i->kのパスがなければcontinue
      if(d[i][k] == INFTY) continue;

      for(int j=0;j<V;j++){
        //k->jのパスがなければcontinue
        if(d[k][j] == INFTY) continue;
        d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
      }
    }
  }
}

int main(){
  int E,s,t,cost;
  cin >> V >> E;

  // 初期化 s=t,s->tのコストは0
  for(int i=0;i<V;i++){
    for(int j=0;j<V;j++){
      d[i][j] = ((i == j) ? 0 : INFTY);
    }
  }

  // s -> t コスト入力
  for(int i=0;i<E;i++){
    cin >> s >> t >> cost;
    d[s][t] = cost;
  }

  floyd();

  bool negative = false;
  for(int i=0;i<V;i++) if(d[i][i] < 0) negative = true;

  // output
  if(negative){
    cout << "NEGATIVE CYCLE" << endl;
  }else{
    for(int i=0;i<V;i++){
      for(int j=0;j<V;j++){
        if(j) cout << " ";
        if(d[i][j] == INFTY) cout << "INF";
        else cout << d[i][j];
      }
      cout << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s , t;
  	cin >> s >> t;
  	int ans = 0;
  	if(s[0] == t[0]) ans++;
  	if(s[1] == t[1]) ans++;
  	if(s[2] == t[2]) ans++;
  	cout << ans << endl;
 	return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int A,B;
  cin >> A >> B;
  if(A+B<10)
  {
    cout << A+B << endl;
  }
  else
  {
    cout << "error" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
# -*- coding:utf8 -*-

from collections import deque
n = int(input())
c = [input() for _ in range(n)]
d = deque()

for com in c:
    if com[0] == 'i':
        d.appendleft(com[7:])
    else:
        s = com[6]
        if s == 'F':
            d.popleft()
        elif s == 'L':
            d.pop()
        else:
            try:
                d.remove(com[7:])
            except ValueError:
                pass
print(' '.join(d))



Measured memory_bytes: 212328
#include<stdio.h>
int main(void)
{
  int a,b,c,d,min=0;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(a<b){
    min+=a;
  }else{
    min+=b;
  }
  if(c<d){
    min+=c;
  }else{
    min+=d;
  }
  printf("%d",min);
  return 0;
}


Measured memory_bytes: 128
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n,d=map(int,input().split())
ans=0
for i in range(n):
    x,y=map(int,input().split())
    res=x**2+y**2
    if res<=d**2:
        ans+=1
print(ans)

Measured memory_bytes: 74724
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

//一点更新区間min
template <class T>
class SegmentTree
{
private:
    int n;
    const T unit = 0;
    vector<T> node;

public:
    SegmentTree(int n_)
    {
        this->n = 1;
        while (this->n < n_)
        {
            this->n *= 2;
        }
        this->node.resize(2 * n - 1, this->unit);
    }

    SegmentTree(vector<T> v)
    {
        int n_ = v.size();
        this->n = 1;
        while (this->n < n_)
        {
            this->n *= 2;
        }
        node.resize(2 * this->n - 1, this->unit);
        for (int i = 0; i < this->n; i++)
        {
            this->node[this->n - 1 + i] = v[i];
        }
        for (int i = this->n - 2; i >= 0; i--)
        {
            this->node[i] = this->node[i * 2 + 1] + this->node[i * 2 + 2];
        }
    }

    void update(int idx, T val)
    {
        idx += this->n - 1;
        this->node[idx] += val;
        while (idx)
        {
            idx = (idx - 1) / 2;
            this->node[idx] = this->node[2 * idx + 1] + this->node[2 * idx + 2];
        }
    }

    T getsum(int a, int b, int now = 0, int l = 0, int r = -1)
    {
        if (r < 0)
        {
            r = this->n;
        }
        if (r <= a || b <= l)
        {
            return this->unit;
        }
        if (a <= l && r <= b)
        {
            return this->node[now];
        }
        T lVal = getsum(a, b, 2 * now + 1, l, (l + r) / 2);
        T rVal = getsum(a, b, 2 * now + 2, (l + r) / 2, r);
        return lVal + rVal;
    }
};

void solve()
{
    int n, q;
    cin >> n >> q;
    vector<long> v(n);
    SegmentTree<long> segtree(v);
    while (q--)
    {
        long c, x, y;
        cin >> c >> x >> y;
        if (c)
        {
            cout << segtree.getsum(x - 1, y) << '\n';
        }
        else
        {
            segtree.update(x - 1, y);
        }
    }
}

int main()
{
    solve();
    return 0;
}



Measured memory_bytes: 6484
using System;
using System.Linq;

namespace atcoder.abc173.b
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = getIntParam();
            int[] ret = new int[] { 0, 0, 0, 0 };

            for (int c = 0; c < N; c++)
            {
                switch (getStringParam())
                {
                    case "AC": ret[0]++; break;
                    case "WA": ret[1]++; break;
                    case "TLE": ret[2]++; break;
                    case "RE": ret[3]++; break;
                    default: break;
                }
            }

            Console.WriteLine(String.Concat("AC x ", ret[0].ToString()));
            Console.WriteLine(String.Concat("WA x ", ret[1].ToString()));
            Console.WriteLine(String.Concat("TLE x ", ret[2].ToString()));
            Console.WriteLine(String.Concat("RE x ", ret[3].ToString()));
        }
        //↓↓↓ shared function ↓↓↓
        static int getIntParam()
        {
            return int.Parse(Console.ReadLine());
        }
        static int[] getIntParams()
        {
            return Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
        }
        static long getLongParam()
        {
            return long.Parse(Console.ReadLine());
        }
        static long[] getLongParams()
        {
            return Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
        }
        static string getStringParam()
        {
            return Console.ReadLine();
        }
        static string[] getStringParams()
        {
            return Console.ReadLine().Split(' ');
        }
    }
}


Measured memory_bytes: 30692
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
using namespace std;
using ll = long long;

int main(){
    map<string,int> m;
    int n; cin>>n;
    rep(i,0,n){
        string s; cin>>s;
        m[s]++;
    }
    int maxb=0;
    for(auto x:m){
        int b=x.second;
        if(b>maxb) maxb=b;
    }
    for(auto x:m){
        if(x.second==maxb) cout<<x.first<<"\n";
    }
}

Measured memory_bytes: 25216
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)

int main() {
    int x, a, b; cin >> x >> a >> b;
    cout << (x - a) % b << endl;
}


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

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

    int is_last_odd = int(s[0] == s.back());
    if (s.size() % 2 == is_last_odd)
        cout << "Second" << endl;
    else
        cout << "First" << endl;
    return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<string> vs;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

vs c;

int main()
{
    c.resize(3);
    rep(i, 3) cin >> c[i];
    cout << c[0][0] << c[1][1] << c[2][2] << endl;

    return 0;
}

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

ans = 0
B = [A[0]]
for i in range(1, N):
    if A[i]<B[-1]:
        ans += B[-1]-A[i]
        B.append(B[-1])
    else:
        B.append(A[i])
print(ans)


Measured memory_bytes: 106988
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int n,k,a[maxn],ans;

int main()
{
	k=read(); n=read();
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n-1;i++) ans=max(ans,a[i+1]-a[i]);
	ans=max(ans,a[1]+k-a[n]);
	cout<<k-ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  string s;
  cin >> s;

  string ans = "ABC";

  if (s == "ABC") ans = "ARC";
  
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
vector<int> dx= {1, 0, -1, 0};
vector<int> dy = {0, 1, 0, -1};
const int INF=100000000;

int main(){
    int a, b, c;
    cin>>a>>b>>c;
    cout<<( ((a==b&&b==c)||(a!=b&&b!=c&&c!=a))?"No":"Yes")<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>

int main() {
	int n; std::cin >> n;
	std::string str; std::cin >> str;
	std::vector<int> fact_divisor(n, 0), divisor(n, 0);
	for (auto i = 2; i < fact_divisor.size(); ++i) {
		if (i % 2 == 0) divisor[i] = divisor[i / 2] + 1;
		fact_divisor[i] = fact_divisor[i - 1] + divisor[i];
	}
	if (std::find(str.begin(), str.end(), '2') != str.end()) {
		int parity{ 0 };
		for (auto i = 0; i < str.size(); ++i) {
			const auto c = str[i];
			switch (c) {
			case '2': 
				if (fact_divisor[n - 1] <= fact_divisor[i] + fact_divisor[n - 1 - i]) {
					parity++;
				}
				break;
			default: break;
			}
		}
		std::cout << parity % 2 << '\n';
	}
	else {
		int parity{ 0 };
		for (auto i = 0; i < str.size(); ++i) {
			const auto c = str[i];
			switch (c) {
			case '3':
				if (fact_divisor[n - 1] <= fact_divisor[i] + fact_divisor[n - 1 - i]) {
					parity++;
				}
				break;
			default: break;
			}
		}
		std::cout << (parity % 2 == 1 ? '2' : '0') << '\n';
	}
}

Measured memory_bytes: 9204
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;
	cin>>n;
	int ans=0;
	///int arr[n];
	for(int i=0;i<n;i++){
		int a,b;
		int d=1;
		cin>>a>>b;
		ans+=d+(b-a);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
set<int>S;
int main(){
	int n,x;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x;
		if(S.count(x))S.erase(x);
		else S.insert(x);
	}
	cout<<S.size()<<endl;
	return 0;
}

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

int main(){
  string o, e;
  cin >> o >> e;
  for(int i = 0; i < e.size(); i++) cout << o[i] << e[i];
  if(o.size() > e.size()) cout<< o[o.size()-1];
  cout << endl;
  return 0;
}


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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;



int main(){
  ll n, d;
  cin >> n >> d;
  vector<vector<ll>> x(n, vector<ll>(d));
  rep(i, n){
    rep(j, d) cin >> x[i][j];
  }


  ll cnt = 0;
  rep(i, n){
    for(int j = i+1; j < n; j++){
      ll sum = 0;
      rep(di, d){
        ll y = x[i][di] - x[j][di];
        sum += y*y;
      }
      ll sq = sqrt(sum);
      if(sq*sq == sum) cnt++;
    }
  }

  cout << cnt << endl;
  
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX (ll)(2e3 + 7)
#define INF (ll)(1e17)
#define MOD (int)(1e9 + 7)
#define PI (double)(3.14159265)
#define IO ios_base :: sync_with_stdio (false);
#define LOG 20

using namespace std;
using ll = long long;

string ss[3];
int n = 0, m[3] ;
bool ch[MAX][3][3];
int solve (int a, int b, int c) {
	pair<int, int> ra[3];
	int aa[] = {a, b, c};
	ra[0] = {0, ss[a].size () - 1};
	int ans = MOD;
	for (int i = 0; i <= n - ss[b].size (); i++) {
		ra[1] = {i, i + ss[b].size () - 1};
		for (int j = 0; j <= n - ss[c].size (); j++) {
			bool fl = 1;
			ra[2] = {j, j + ss[c].size () - 1};
			for (int k = 0; k < 3; k++) {
				for (int l = k + 1; l < 3; l++) {
					if (!(ra[k].second < ra[l].first || ra[l].second < ra[k].first)) {
						int x = abs (ra[l].first - ra[k].first);
						if (ra[k].first <= ra[l].first) {
							fl &= ch[x][aa[k]][aa[l]];
						}
						else {
							fl &= ch[x][aa[l]][aa[k]];
						}
					}
				}
			}
			if (fl) {
				ans = min (ans, max ({(int)ss[a].size (), i + (int)ss[b].size (), j + (int)ss[c].size ()}));
			}	
		}
	}
	return ans;
}
			
int main () {
	for (int i = 0; i < 3; i++) {
		cin >> ss[i];
		n += ss[i].size ();
	}
	for (int i = 0; i < 3; i++) {
		for (int j = ss[i].size () - 1; j >= 0; j--) {
			if (ss[i][j] != '?') {
				m[i] = j + 1;
				break;
			}
		}
	}
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < ss[i].size (); k++) {
				ch[k][i][j] = 1;
				for (int l = k; l < min (ss[i].size (), k + ss[j].size ()); l++) {
					if (ss[i][l] != ss[j][l - k] && !(ss[i][l] == '?' || ss[j][l - k] == '?')) {
						ch[k][i][j] = 0;
						break;
					}
				}
			}
		}
	}
	int ans = min ({solve (0, 1, 2), solve (1, 0, 2), solve (2, 1, 0)});
	cout << max ({ans, (int)ss[0].size (), (int)ss[1].size (), (int)ss[2].size ()}) << "\n";
	return 0;
}


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

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

Measured memory_bytes: 1156
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include <string.h>
#include <iomanip>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
const ll mod=1e9+7;


int main(void){
    int N;
    cin>>N;
    int a=N/1000;
    int b=N/100-10*a;
    int c=N/10-(N/100)*10;
    int d=N%10;
    if(a==b ||b==c||c==d) cout<<"Bad"<<endl;
    else cout<<"Good"<<endl;
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin
 
def main():
    n, m = map(int, input().split())
    dd = defaultdict(list)
    for _ in range(n):
        a, b = map(int, input().split())
        dd[a].append(b)
    
    ans = 0
    heap = []
    for i in range(1, m+1):
        if i in dd:
            for v in dd[i]:
                heappush(heap, v*-1)
        if len(heap) > 0:
            ans += -1 * heappop(heap)

    print(ans)
 
input = lambda: stdin.readline().rstrip()
main()

Measured memory_bytes: 27644
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions
bool second_smaller(const pll& left, const pll& right) {
    return left.second < right.second;
}
#endif


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

    int N, K; cin >> N >> K;
    vi A(N); REP(i, N) cin >> A[i];

    map<int, int> mp;
    REP(i, N) mp[A[i]]++;
    int sz = mp.size();
    if (sz <= K) {
        cout << 0 << endl;
        return 0;
    }

    vector<pii> v;
    for(auto p : mp) v.push_back(pii(p.first, p.second));
    
    sort(v.begin(), v.end(), second_smaller);

    int ans = 0;
    REP(i,sz-K) ans += v[i].second;    

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 12660
#include <iostream>

using namespace std;

long long int nrprob, rezolvate, nerezolvate, probabil;

int main()
{
    cin >> nrprob >> rezolvate;

    probabil = ( 1 << rezolvate );

    cout << probabil * rezolvate * 1900 + ( nrprob - rezolvate ) * 100 * probabil;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
const int D=4,P=1000000007;
int i,j,k,n,m,ff,ch,lt,nw;
struct matrix {
	int a[D][D];
	void clear() {
		memset(a,0,sizeof a);
	}
	matrix operator * (const matrix &n) const {
		int i,j,k;
		matrix t;
		t.clear();
		for (i=0;i<D;i++)
			for (j=0;j<D;j++) {
				ll tt=0;
				for (k=0;k<D;k++) tt+=(ll) a[i][k]*n.a[k][j];
				t.a[i][j]=tt%P;
			}
		return t;
	}
} A[32],B;
struct cc {
	int a[D];
	void clear() {
		memset(a,0,sizeof a);
	}
	cc operator * (const matrix &n) const {
		int j,k;
		cc t;
		t.clear();
		for (j=0;j<D;j++) {
			ll tt=0;
			for (k=0;k<D;k++) tt+=(ll) a[k]*n.a[k][j];
			t.a[j]=tt%P;
		}
		return t;
	}
} ans;
void R(int &x) {
	ff=x=0;ch=getchar();
	while (ch<'0' || '9'<ch) { if (ch=='-') ff=1;ch=getchar();}
	while ('0'<=ch && ch<='9') x=x*10+ch-'0',ch=getchar();
	if (ff) x=-x;
}
void pre() {
	int i,j,k;
	for (i=0;i<D;i++)
		for (j=0;j<D;j++) if ((i|j)==i) {
			A[0].a[i][j]=1;
			B.a[i][j]=1;
		}
	for (i=0;i<D;i++) A[0].a[i][3]++;
	for (i=1;i<=30;i++) A[i]=A[i-1]*A[i-1];
}
int main() {
	ans.a[3]=1;
	pre();
	R(n);R(m);
	lt=0;
	for (i=1;i<=m;i++) {
		R(nw);
		for (k=nw-lt-1,j=0;k;k>>=1,j++) if (k&1) ans=ans*A[j];
		ans=ans*B;
		lt=nw;
	}
	for (k=n-lt-1,j=0;k;k>>=1,j++) if (k&1) ans=ans*A[j];
	int Ans=((ll) ans.a[0]+ans.a[1]+ans.a[2]+ans.a[3])%P;
	printf("%d\n",Ans);
}

Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
using namespace std;
typedef long long ll;
ll moder = 1000000007;
//Library!
ll pow_mod(ll a, ll b, ll n) {
	if (b == 0)return a % n;
	if (b % 2)return pow_mod(a, b - 1, n)*a%n;
	else return pow_mod(pow_mod(a, b / 2, n), 2, n) % n;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++)if (!(n%i))return false;
	return true;
}
ll comb(ll n, ll r) {
	if (n == r) return 1;
	else if (r == 0) return 1;
	else if (r == 1) return n % moder;
	else return (comb(n - 1, r - 1) + comb(n - 1, r)) % moder;
}
//ライブラリゾーン終了
int n, m, a[200010], b[200010], c[200010];
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		if (a[i] == 1)c[b[i]] ++;
		if (b[i] == n)c[a[i]] += 10;
	}
	for (int i = 1; i <= n; i++) {
		if (c[i] == 11) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
random_device rnd;
double dist(double x,double y,double a,double b){
    return sqrt((x-a)*(x-a)+(y-b)*(y-b));
}
void Main(){
    ll n;cin>>n;
    vector<double> x(n),y(n);
    For(i,0,n) cin>>x[i]>>y[i];
    double xmin=10000,xmax=-10000,ymin=10000,ymax=-10000;
    For(i,0,n){
        xmin=min(xmin,x[i]);
        xmax=max(xmax,x[i]);
        ymin=min(ymin,y[i]);
        ymax=max(ymax,y[i]);
    }
    double xdist=(xmax-xmin)/400,ydist=(ymax-ymin)/400;
    vector<pair<double,pair<double,double>>> plot;
    For(i,0,400){
        For(j,0,400){
            double X=xmin+i*xdist;
            double Y=ymin+j*ydist;
            double R=0;
            For(k,0,n){
                R=max(R,dist(X,Y,x[k],y[k]));
            }
            plot.push_back(make_pair(R,make_pair(X,Y)));
        }
    }
    sort(ALL(plot));
    int count=0;
    while(true){
        count++;
        double X=0,Y=0;
        For(i,0,4){
            X+=plot[i].second.first;
            Y+=plot[i].second.second;
        }
        X/=4;
        Y/=4;
        double R=0;
        For(k,0,n){
            R=max(R,dist(X,Y,x[k],y[k]));
        }
        int i=rnd()%4;
        plot[i]=make_pair(R,make_pair(X,Y));
        if(dist(plot[0].second.first,plot[0].second.second,plot[1].second.first,plot[1].second.second)<1e-20) break;
    }
    random_device seed_gen;
    mt19937 engine(seed_gen());
    uniform_real_distribution<> dist1(-0.001, 0.001);
    uniform_real_distribution<> dist2(-0.001, 0.001);
    count=0;
    while(true){
        count++;
        double X=0,Y=0;
        For(i,0,1){
            X+=plot[i].second.first;
            Y+=plot[i].second.second;
        }
        X+=dist1(engine);
        Y+=dist2(engine);
        double R=0;
        For(k,0,n){
            R=max(R,dist(X,Y,x[k],y[k]));
        }
        double D=plot[0].first-R;
        if(D>0) plot[0]=make_pair(R,make_pair(X,Y));
        if(count>4000000) break;
    }
    cout<<fixed<<setprecision(12)<<plot[0].first<<endl;
}
int main(){
    Main();
    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  int64_t D, A;
  cin >> N >> D >> A;
  vector<int64_t> _X(N), _H(N);
  for (int i = 0; i < N; i++) {
    cin >> _X[i] >> _H[i];
  }
  vector<int> indices(N);
  iota(indices.begin(), indices.end(), 0);
  sort(indices.begin(), indices.end(),
       [&](int a, int b) { return _X[a] < _X[b]; });
  vector<int64_t> X(N), H(N);
  for (int i = 0; i < N; i++) {
    X[i] = _X[indices[i]], H[i] = _H[indices[i]];
  }
  int64_t res = 0;
  vector<int64_t> CS(N + 1, 0);
  for (int i = 0; i < N; i++) {
    if (CS[i] < H[i]) {
      int idx = upper_bound(X.begin(), X.end(), X[i] + 2 * D) - X.begin();
      int64_t cnt = (H[i] - CS[i] + A - 1) / A, d = A * cnt;
      res += cnt;
      CS[i] += d;
      CS[idx] -= d;
    }
    CS[i + 1] += CS[i];
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
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; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;
template <typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n; cin >> n;
    V<> x(n);
    REP(i, n) cin >> x[i];
    ll l, q, a, b; cin >> l >> q;
    VV<> next(20, V<>(n));
    REP(j, n) next[0][j] = upper_bound(all(x), x[j] + l) - x.begin() - 1;
    REP(i, 19) REP(j, n) next[i+1][j] = next[i][next[i][j]];
    while(cin >> a >> b){
        a--; b--;
        if(a > b) swap(a, b);
        ll res = 1;
        RREP(i, 20){
            if(next[i][a] < b){
                a = next[i][a];
                res += (1ll << i);
            }
        }
        cout << res << '\n';
    }
}

Measured memory_bytes: 20372
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int a,b,x;
    cin>>a>>b>>x;
    if (a+b<x || a>x) {
        cout<<"NO"<<endl;
    }else{
        cout<<"YES"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    string S;
    cin >> S;
    int ans = 0, N = S.size();
    for (int i = 0; i < N / 2; i++) {
        if (S.at(i) != S.at(N - i - 1)) {
            ans++;
        }
    }
    cout << ans << endl;
    
}


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

typedef long long ll;

int main()
{
    string str;cin>>str;
    //int j=1;
    for(int i=0;i<str.size();i++)
    {
        if(str[i]=='?')str[i]='D';
    }
    cout<<str<<endl;
    return 0;
}

Measured memory_bytes: 3720
import sys


def main():
    N = int(sys.stdin.readline())
    S = sys.stdin.readline().strip()
    K = int(sys.stdin.readline())
    s = S[K-1]
    result = ""
    for i in list(S):
        if i == s:
            result = result + i
        else:
            result = result + "*"
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  ll n, m;
  cin >> n >> m;
  ll a[n];
  REP(i, n) cin >> a[i];

  ll s[n + 1];

  s[0] = 0;

  REP(i, n) s[i + 1] = (s[i] + a[i]) % m;

  map<ll, ll> map;

  ll ans = 0;

  REP(i, n + 1){
    ans += map[s[i]];
    map[s[i]]++;
  }

  cout << ans;
}


Measured memory_bytes: 5760
import java.util.Scanner;


public class Main {
	
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		final long a = sc.nextLong();
		final long b = sc.nextLong();
		
		System.out.println((a < b) ? "a < b" : (a > b) ? "a > b" : "a == b");
		
	}
	
}

Measured memory_bytes: 17304
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 10;
const ll mod = 998244353;
int n;
char s[N];
int R[N], G[N], B[N];
ll ans;
int main() {
	scanf("%d", &n);
	scanf("%s", s + 1);
	for (int i = 1; i <= n; i++) {
		if (s[i] == 'R')R[i]++;
		if (s[i] == 'G')G[i]++;
		if (s[i] == 'B')B[i]++;
	}
	for (int i = n; i >= 1; i--) {
		R[i] += R[i + 1];
		G[i] += G[i + 1];
		B[i] += B[i + 1];
	}
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (s[i] == s[j])continue;
			int l = j - i;
			if (s[i] == 'B'&&s[j] == 'G' || s[i] == 'G'&&s[j] == 'B') {
				ans += R[j + 1];
				if (j + l <= n && s[j + l] == 'R')ans--;
			}
			else if (s[i] == 'R'&&s[j] == 'B' || s[i] == 'B'&&s[j] == 'R') {
				ans += G[j + 1];
				if (j + l <= n && s[j + l] == 'G')ans--;
			}
			else {
				ans += B[j + 1];
				if (j + l <= n && s[j + l] == 'B')ans--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

void solve(int N, vi& a, vi& b, vi& c) {
    sort(ALL(c));

    vvi nxt(N);
    rep(i,N-1){
        nxt[ a[i] ].pb(b[i]);
        nxt[ b[i] ].pb(a[i]);
    }
    vi cnt(N, 0);
    rep(i,N) { cnt[i] = nxt[i].size(); }

    set<ii> pq;
    rep(i,N){
        pq.insert(ii(cnt[i], i));
    }

    vi visited(N, 0);

    vi order(N);

    rep(i,N){
        int u = pq.begin()->second;
        order[i] = u;
        pq.erase(ii(cnt[u], u));
        visited[u] = 1;

        for (int v: nxt[u]) {
            if (visited[v]) continue;
            pq.erase(ii(cnt[v], v));
            cnt[v]--;
            pq.insert(ii(cnt[v], v));
        }
    }

    vi ass(N);

    rep(i,N){
        ass[order[i]] = c[i];
    }
    ll total = 0;
    rep(i,N-1){
        total += min( ass[a[i]], ass[b[i]] );
    }
    printf("%lld\n", total);
    rep(i,N){
        printf("%d%c", ass[i], (i==N-1)?'\n':' ');
    }
}

int main() {
    int N; scanf("%d%*c", &N);
    vi a(N-1), b(N-1);
    rep(i,N-1) {
        scanf("%d %d%*c", &a[i], &b[i]);
        a[i]--; b[i]--;
    }
    vi c(N);
    rep(i,N) scanf("%d", &c[i]);
    solve(N,a,b,c);
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
 
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))
 
using namespace std;
 
const LL MOD=1e9+7;
 
LL n,a,ans;
 
int main()
{
	cin>>n;
	rep(i,n)
	{
		scanf("%I64d",&a);
		if(i==0) ans=a;
		else ans=__gcd(ans,a);
	}
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <fstream>
using namespace std;

int main()
{
	int n,m;
	for(;;){
		int field[100];
		cin>>n>>m;
		if(n == 0 && m == 0) break;

		for(int i = 0; i < m; i++) field[i] = 0;

		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				int buf;
				cin>>buf;
				field[j] += buf;
			}
		}
		int count = 0;
		for(int i = n; i >= 0 ; i--){
			for(int j = 0; j < m; j++){
				if(field[j] == i){
					cout<<j+1;
					count++;
					if(count == m) cout<<endl;
					else		   cout<<" ";
				}
			}
		}
	}
}

Measured memory_bytes: 864
N = int(input())
T, A = map(int, input().split())
X = list(map(int, input().split()))
Tem = [0]*N
for i in range(N):
  Tem[i] = T-X[i]*0.006
D = [0]*N
for i in range(N):
  D[i] = abs(Tem[i]-A)
ans = D.index(min(D))+1
print(ans)


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

using std::cin;
using std::cout;
using std::endl;
using std::vector;

constexpr int MAXGAPS = 13;

long g_cnt = 0;

void shellSort(vector<int>& line, const int n);
void insertionSort(vector<int>& line, const int n, const int gap);

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

    vector<int> line(n);
    for (auto i = 0; i < n; i++) {
        cin >> line.at(i);
    }

    shellSort(line, n);

    cout << g_cnt << endl;
    for (auto i = 0; i < n; i++) {
        cout << line.at(i) << endl;
    }

    return 0;
}

void shellSort(vector<int>& line, const int n)
{
    vector<int> gap(MAXGAPS);
    int m = 1;
    gap.at(0) = m;
    int gap_cnt = 1;
    for (auto i = 1; (m = 3 * m + 1) <= n; i++) {
        gap.at(i) = m;
        gap_cnt++;
    }

    cout << gap_cnt << endl;
    for (auto i = gap_cnt - 1; i >=  0; i--) {
        cout << gap.at(i);
        if (i != 0) {
            cout << " ";
        }
    }
    cout << endl;

    for (auto i = gap_cnt - 1; i >=  0; i--) {
        insertionSort(line, n, gap.at(i));
    }
}

void insertionSort(vector<int>& line, const int n, const int gap)
{
    for (auto i = gap; i < n; i++) {
        int key = line.at(i);

        auto j = i - gap;
        while (j >= 0 && line.at(j) > key) {
            line.at(j + gap) = line.at(j);
            g_cnt++;
            j -= gap;
        }

        line.at(j + gap) = key;
    }
}

Measured memory_bytes: 4888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >>n;
  if(n<105){
    cout<<0<<endl;
  }else if(n<135){
    cout<<1<<endl;
  }else if(n<165){
    cout<<2<<endl;
  }else if(n<189){
    cout<<3<<endl;
  }else if(n<195){
    cout<<4<<endl;
  }else{
    cout<<5<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    a, b, c, d = map(int, input().split())

    if a+b < c+d:
        print("Right")
    elif a+b == c+d:
        print("Balanced")
    else:
        print("Left")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
s = input()

out = ''

for i in range(len(s)):
    if s[i] == '0':
        out = out + '0'
    elif s[i] == '1':
        out = out + '1'
    else:
        if len(out) != 0:
            out = out[0:len(out)-1]

print(out)

Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		double W = sc.nextInt();
		double H = sc.nextInt();
		if(W == 1 || H == 1) {
			System.out.println(1);
		} else {
			System.out.println((long)(Math.ceil(W / 2) * Math.ceil(H / 2) + Math.floor(W / 2) * Math.floor(H / 2)));
		}
	}
}


Measured memory_bytes: 23764