akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<stdlib.h>
using namespace std;
#define ll long long
ll n,a[305][305];
int main()
{
    cin>>n;
    ll i,j;
    bool flag=false;
    for(i=1; i<=n; i++)
        for(j=1; j<=n; j++)
            scanf("%lld",&a[i][j]);
    ll ans=0;
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=i; j++)
        {
            flag=false;
            for(int k=1; k<=n; k++)
            {
                if(a[i][j]>a[i][k]+a[k][j])
                {
                    printf("-1\n");
                    exit(0);
                }
                if(a[i][j]==a[i][k]+a[k][j]&&i!=k&&j!=k)
                    flag=true;
            }
            if(!flag)
                ans+=a[i][j];
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 1024
from fractions import gcd
from functools import reduce

MOD=10**9+7

def lcm_base(x, y):
  return (x*y)//gcd(x,y)

N=int(input())
A=list(map(int, input().split()))
ans=1
lcm=A[0]
for i in range(1, N):
  prelcm=lcm
  lcm=lcm_base(prelcm, A[i])
  ans=ans*(lcm//prelcm)+lcm//A[i]
print(ans%MOD)

Measured memory_bytes: 70912
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100000

int N;
string S;

ll ans = 0;
int num = 0;

ll D[5];
int P[10] = {0,0,0,0,0,0,1,1,1,2};
int Q[10] = {1,1,1,2,2,3,2,2,3,3};
int R[10] = {2,3,4,3,4,4,3,4,4,4};

int main() {
  ll m, a, r, c, h;
  m = a = r = c = h = 0;
  cin >> N;
  rep(i,N) {
    cin >> S;
    if (S[0] == 'M') m++;
    if (S[0] == 'A') a++;
    if (S[0] == 'R') r++;
    if (S[0] == 'C') c++;
    if (S[0] == 'H') h++;
  }

  D[0] = m; D[1] = a; D[2] = r; D[3] = c; D[4] = h;

  rep(i,10) {
    ans += D[P[i]] * D[Q[i]] * D[R[i]];
  }

  cout << ans << endl;
}


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

using namespace std;

const long long mo = 1e9+7;
const int maxi = 1e6+10;
#define pb push_back
int n,k;
string s;
vector<int> v[maxi];
int a[maxi];
int cnt[maxi];
int main()
{
     cin>>n>>k;

    for (int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        cnt[a[i]]++;
    }


    long long ans = 0;

    for (int i=1;i<=n;i++)
        for (int j=1;j<=n;j++)
    {
        if (i==j) continue;
        if (a[i]<a[j] && i>j) ans+=1ll*k*(k+1)/2; else
            if (a[i]<a[j]) ans+=1ll*k*(k-1)/2;
        ans%=mo;
    }

    cout<<ans<<endl;
    return 0;
}
//ja bih da pevam jos malo
//jer je zivot samo jedan
//i do njega mi je stalo
//meni je vredan


Measured memory_bytes: 27392
#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 a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b < c+d) cout << "Right"  << endl;
  else if(a+b > c+d) cout << "Left" << endl;
  else cout << "Balanced" << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
from bisect import bisect_left


def main():
	s = input()
	n = len(s)
	s = s + s
	t = input()
	if set(t) - set(s):
		print(-1)
		exit()
	d = defaultdict(list)
	for i in range(2 * n):
		d[s[i]] += [i]
	cur = ncnt = 0

	for c in t:
		x = d[c][bisect_left(d[c], cur)]
		if x < n:
			cur = x + 1
		else:
			cur = x - n + 1
			ncnt += 1
	print(ncnt*n + cur)


if __name__ == "__main__":
	main()

Measured memory_bytes: 12072
a, b, c = gets.chomp.split(" ").map(&:to_i)

if (c - a - b > 0) && (a ** 2 + b ** 2 + c ** 2 - 2 * a * b - 2 * a * c - 2 * b * c > 0)
    puts 'Yes'
else
    puts 'No'
end

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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<vector<long>> a(n, vector<long>(n, MAX_LONG / 2));

    int m;
    int l;
    cin >> m;
    cin >> l;
    for (int i = 0; i < m; i++) {
        int x, y, w;
        cin >> x >> y >> w;
        x--; y--;
        a[x][y] = a[y][x] = w;
    }

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

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                a[j][k] = min(a[j][k], a[j][i] + a[i][k]);
            }
        }
    }

    vector<vector<int>> d(n, vector<int>(n, MAX_INT));
    for (int s = 0; s < n; s++) {
        vector<int> q;
        q.push_back(s);
        d[s][s] = 0;
        for (int i = 0; i < q.size(); i++) {
            int x = q[i];
            for (int j = 0; j < n; j++) {
                if (d[s][j] == MAX_INT && a[x][j] <= l) {
                    d[s][j] = d[s][x] + 1;
                    q.push_back(j);
                }
            }
        }
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        if (d[x][y] == MAX_INT) {
            cout << -1 << "\n";
        } else {
            cout << d[x][y] - 1 << "\n";
        }
    }




    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    long long int N,M,H,W,x,i,j,k,ans,count,cost,tmp;
    long long int S[300000];
    //long long int T[300000];
    //long long int U[300000];
    //long long int Ssum[300000];
    //string T,U,V,ans2;
    bool flag;
    count=0;
    ans=std::pow(10,18);
    ans=0;
    flag=false;
        cin >> N;
        //count=0;
    for (i=1;i<100;i++){
        for (j=1;j<100;j++){
            for (k=1;k<100;k++){
                x=i*i+j*j+k*k+i*j+j*k+k*i;
                if (x<10050  ){
                    S[x]+=1;
                    
                    
                }
                
            }
        }
    }
    //cout << count<<endl;
    for (j=1;j<=N;j++){
        count=0;
 
        cout << S[j]<<endl;
    }
    
    
    
    //cout << ans<<endl;

    return 0;
    
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
#define IOS  cin.tie(0),cout.tie(0); ios::sync_with_stdio(false);
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef double db;
 
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main() {
  IOS
  
  int a[3][3];
  int a2[3][3] = { 0 };
 
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
 
  int n;
  int b[10];
  cin >> n;
  bool ans=0;
  for (int k = 0; k < n; k++) {
    cin >> b[k];
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (a[i][j] == b[k])a2[i][j] = 1;
 
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    if (a2[i][0] == 1 && a2[i][1] == 1 && a2[i][2] == 1)ans = true;
    if (a2[0][i] == 1 && a2[1][i] == 1 && a2[2][i] == 1)ans = true;
 
  }
  if (a2[0][0] == 1 && a2[1][1] == 1 && a2[2][2] == 1)ans = true;
  if (a2[2][0] == 1 && a2[1][1] == 1 && a2[0][2] == 1)ans = true;
 
  if (ans)cout << "Yes" << endl;
  else cout << "No" << endl;
 
  return 0; 
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int sums(int a);
int main(){
    int N,A,B;
    cin >> N >> A >> B;
    int sum = 0;
    for(int i = 1; i <= N; i++){
        int c = sums(i);
        if(A<=c && c<=B) sum +=i;
    }
    cout << sum << endl;
    
}
int sums(int a){
    // 各桁の和
    int sum = 0;
    while(a!=0){
        sum += a%10;
        a /=10;
    }
    return sum;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a[100009],mark[100009];
int main()
{
int n,i,p=1,f=1;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a[i];
mark[i]=1;
}
mark[2]=-1;
for(i=1;mark[2]==-1;i++)
{
if(mark[p]!=0&&mark[a[p]]!=0)
{
mark[a[p]]+=mark[p];
mark[p]=0;
p=a[p];
}
else
{
f=0;
break;
}
}
if(f==0)
cout<<"-1";
else
cout<<mark[2]+1;
return 0;
}



Measured memory_bytes: 1024
#include<stdio.h>
int main(){
  int flag=1,A[100],i,n,count=0,tmp;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  while(flag){
    flag=0;
    for(i=n-1;i>=1;i--){
      if(A[i]<A[i-1]){
	tmp=A[i];
	A[i]=A[i-1];
	A[i-1]=tmp;
	flag=1;
	count++;
      }
    }
  }
  for(i=0;i<n-1;i++)
    printf("%d ",A[i]);
  printf("%d\n",A[n-1]);
  printf("%d\n",count);
  
    
		 
  return 0;
}



Measured memory_bytes: 2084
fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    val aList = readInputLine().split(" ").map { it.toInt() }
    
    val gcdl = mutableListOf<Int>()
    val gcdrTmp = mutableListOf<Int>()
    
    for (i in 0 until n) {
        if (i == 0) {
            gcdl.add(0)
        } else {
            gcdl.add(if (gcdl[i - 1] > aList[i - 1]) gcd(gcdl[i - 1], aList[i - 1]) else gcd(aList[i - 1], gcdl[i - 1]))
        }
    }
    
    for (i in 0 until n) {
        if (i == 0) {
            gcdrTmp.add(0)
        } else {
            gcdrTmp.add(if (gcdrTmp[i - 1] > aList[n - i]) gcd(gcdrTmp[i - 1], aList[n - i]) else gcd(aList[n - i], gcdrTmp[i - 1]))
        }
    }
    
    val gcdr = gcdrTmp.reversed()
    
    val gcdlr = gcdl.zip(gcdr)

    println(gcdlr.map { if (it.first > it.second) gcd(it.first, it.second) else gcd(it.second, it.first)}.max())
}

fun readInputLine(): String {
    return readLine()!!
}

fun gcd(a: Int, b: Int): Int {
    // a >= b とする
    if (b == 0) {
        return a
    }
    return gcd(b, a % b)
}


Measured memory_bytes: 59972
// created on : Sun Jun 14 2020
 
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        int x = in.nextInt();
        int y = in.nextInt();
        String ans = "No";
        for(int i = 0; i <= x; i++){
            int crane = i;
            int turtle = x - i;
            if(2 * crane + 4 * turtle == y){
                ans = "Yes";
                break;
            }
        }
        println(ans);
        
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);

    static int[] readInt(int N) throws IOException { 
    	int arr[] = new int[N];
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextInt(); 
    	} 
    	return arr;
    }
    
    static long[] readLong(int N) throws IOException { 
    	long arr[] = new long[N];
    	for(int i = 0; i < N; i++){ 
    		arr[i] = in.nextLong(); 
    	} 
    	return arr;
    }
    
    static void print(Object O) {  
    	out.print(O); 
    }
    
    static void println(Object O) { 
    	out.println(O); 
    }
    
    static void println(int arr[]) { 
    	for(int i = 0; i < arr.length; i++){ 
    		print(arr[i] + " "); 
    	} 
    	println(""); 
    }
    
    static void displayRuntime(long startTime){
        long stopTime = System.currentTimeMillis();
        long elapsedTime = stopTime - startTime;
        System.out.println("Runtime: " + elapsedTime / 1000D);
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}


Measured memory_bytes: 25360
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 123456;
VI edges[N];
int n, m;

bool vis[N];
int col[N];

PI dfs(int v, int c = 0) {
  if (vis[v]) {
    if (c == col[v]) {
      return PI(0, 0);
    } else {
      return PI(0, -1);
    }
  }
  vis[v] = true;
  col[v] = c;
  int t0 = 0;
  int t1 = 0;
  bool bip = true;
  REP(i, 0, edges[v].size()) {
    int w = edges[v][i];
    PI res = dfs(w, 1 - c);
    if (res.second == -1) {
      bip = false;
      t0 += res.first;
    } else {
      t0 += res.first;
      t1 += res.second;
    }
  }
  if (c == 0) {
    t0 += 1;
  } else {
    t1 += 1;
  }
  return bip ? PI(t0, t1) : PI(t0 + t1, -1);
}

int main(void) {
  cin >> n >> m;
  REP(i, 0, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  ll tot = 0;
  REP(i, 0, n) {
    if (not vis[i]) {
      PI res = dfs(i);
      ll nc = res.first;
      if (res.second == -1) { // not bipartite
	tot += nc * (nc - 1) / 2;
      } else {
	ll nd = res.second;
	tot += nc * nd;
      }
    }
  }
  cout << tot - m << endl;
}


Measured memory_bytes: 8320
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let s = get!(String);

    for (i, c) in s.chars().enumerate() {
        if i%2 == 1 {
            match c {
                'R' => {
                    println!("No");
                    return;
                }
                _ => (),
            }
        } else {
            match c {
                'L' => {
                    println!("No");
                    return;
                }
                _ => (),
            }
        }
    }
    println!("Yes");
}


Measured memory_bytes: 8572
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long N = lread();
    long[long] D;
    foreach (c; sread())
        D[c] = (c in D) ? D[c] + 1 : 1;
    foreach (_; 1 .. N)
    {
        string S = sread();
        long[long] d;
        foreach (c; S)
            d[c] = (c in d) ? d[c] + 1 : 1;
        foreach (key, val; D)
            D[key] = (key in d) ? min(d[key], val) : 0;

    }
    auto keys = D.keys;
    auto vals = D.values;
    zip(keys, vals).sort();
    string ans;
    foreach (i; 0 .. keys.length)
        ans ~= repeat(cast(char) keys[i]).take(vals[i]).array;
    writeln(ans);
}


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for(int i = 0; i < s.size( ); i++){
    if(s.at(i) == ','){
    s.at(i) = ' ';
    }
  }
  cout << s << endl;  
}

Measured memory_bytes: 3600
#include <iostream>
#include <string>

using namespace std;

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

int main(){
	int h, w;
	string mp[10];
	while(cin >> h >> w, h){
		for(int i=0;i<h;i++) cin >> mp[i];
		string res = "";
		for(int i=0;i<w*h;i++){
			if(res.size() == w*h) break;
			int x1 = i/w, y1 = i%w;
			for(int j=i+1;j<w*h;j++){
				if(res.size() == w*h) break;
				int x2 = j/w, y2 = j%w;
				if(mp[x1][y1]!=mp[x2][y2]) continue;
				for(int di=0;di<8;di++){
					for(int dj=0;dj<8;dj++){
						string cur;
						int nx1 = (x1+dx[di]+h)%h, ny1 = (y1+dy[di]+w)%w;
						int nx2 = (x2+dx[dj]+h)%h, ny2 = (y2+dy[dj]+w)%w;
						if(mp[nx1][ny1]!=mp[nx2][ny2]) continue;
						cur += mp[x1][y1];
						while((x1 != nx1 || y1 != ny1) && (x2 != nx2 || y2 != ny2) && mp[nx1][ny1] == mp[nx2][ny2]){
							cur += mp[nx1][ny1];
							nx1 = (nx1+dx[di]+h)%h, ny1 = (ny1+dy[di]+w)%w;
							nx2 = (nx2+dx[dj]+h)%h, ny2 = (ny2+dy[dj]+w)%w;
						}
						if(cur.size() > res.size()) res = cur;
						else if(cur.size() == res.size()) res = min(res, cur);
					}
				}
			}
		}
		cout << (res=="" ? "0" : res) << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000000000005LL
#define MOD 1000000007
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
int N;
ll A[SIZE];
ll S[SIZE];
 
int main(){
  cin >> N;
  rep(i,0,N){
    cin >> A[i];
    S[i] = A[i];
  }
  rep(i,0,N-1){
    S[i+1] += S[i];
  }
 
  ll ans = INF;
 
  int l=0,r=2;
  rep(t,1,N-2){
    while(abs(S[t]-2*S[l]) > abs(S[t]-2*S[l+1]))l++;
    while(abs(S[N-1]-2*S[r]+S[t]) > abs(S[N-1]-2*S[r+1]+S[t]))r++;
    ans = min(ans, max({S[l],S[t]-S[l],S[N-1]-S[r],S[r]-S[t]})
      - min({S[l],S[t]-S[l],S[N-1]-S[r],S[r]-S[t]}));
  }
  cout << ans << endl;
 
 
  return 0;
}

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

using namespace std;
using ll = long long int;

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

    ll k, t;
    cin >> k >> t;
    vector<ll> a(t);
    for(auto &e: a) cin >> e;
    sort(a.begin(), a.end(), greater<>());

    ll s = accumulate(a.begin()+1, a.end(), 0ll);
    cout << max(0ll, a[0] - s - 1);
}


Measured memory_bytes: 256
(let ((n (read))
      (arr (make-array 0 :element-type 'integer
                         :fill-pointer 0
                         :adjustable t))
      (ans 0))
  (loop repeat n do (vector-push-extend (read) arr))
  (loop for i from 0 below n do (incf ans (aref arr i)))
  (sort arr #'<)
  (loop for i below n
        while (= (rem ans 10) 0) do (if (/= (rem (aref arr i) 10) 0) (setf ans (- ans (aref arr i)))))
  (format t "~A~%" (if (= (rem ans 10) 0) 0 ans)))


Measured memory_bytes: 9188
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <climits>
#include <cstring>
#include <functional>

using namespace std;

using ll = long long;

#define rep(i, N) for(int i = 0;i < N;i++)
#define LARGE INT_MAX / 2


int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A + B >= C) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
public class Program {
  public static void Main() {
    int N = ReadInt();
    int[] AB = ReadIntArray();
    int A = AB[0], B = AB[1];
    int[] P = ReadIntArray();
    int count = N/3;
    count = Math.Min(count, P.Count(i => i <= A));
    count = Math.Min(count, P.Count(i => (i > A) && (i <= B)));
    count = Math.Min(count, P.Count(i => i > B));
    Console.WriteLine(count);
  }

  private static int ReadInt() { return int.Parse(Console.ReadLine()); }
  private static double ReadDouble() { return double.Parse(Console.ReadLine()); }
  private static long ReadLong() { return long.Parse(Console.ReadLine()); }
  private static char ReadChar() { return Console.ReadLine()[0]; }
  private static string[] ReadStringArray() { return Console.ReadLine().Split(' '); }
  private static int[] ReadIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
  private static double[] ReadDoubleArray() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
  private static long[] ReadLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
  private static char[] ReadCharArray() { return Console.ReadLine().ToArray(); }
}


Measured memory_bytes: 13396
#include<iostream>

int main()
{
    long long int n,ans;
    std::cin>>n;
    ans = n/11;
    if(n%11==0){
        std::cout<<ans*2<<std::endl;
    }
    else if(n%11<7){
        std::cout<<ans*2+1<<std::endl;
    }
    else{
        std::cout<<ans*2+2<<std::endl;
    }
}


Measured memory_bytes: 3192
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
const int nax=57;
const int dlu=10;
ll mod;

int n=50;

ll pot[nax][nax];

ll wyn;

int jeszkol[nax][nax];

void ff()
{
	fflush(stdout);
}

int pyt(int a, int b, int x, int y)
{
	printf("? %d %d %d %d\n", a, x, b, y);
	ff();
	int v;
	scanf("%d", &v);
	return v;
}

int los(int a, int b)
{
	return (rand()%(b-a+1))+a;
}

void szuk(int a, int b, int x, int y, int w)
{
	if (!w)
		return;
	if ((a/dlu)==(b/dlu) && !jeszkol[x][a/dlu])
	{
		szuk(a, b, x+1, y, w);
		return;
	}
	if ((a/dlu)==(b/dlu) && !jeszkol[y][a/dlu])
	{
		szuk(a, b, x, y-1, w);
		return;
	}
	if (w==(b-a+1)*(y-x+1))
	{
		for (int i=a; i<=b; i++)
		{
			for (int j=x; j<=y; j++)
			{
				wyn+=pot[i][j];
				jeszkol[j][i/dlu]--;
			}
		}
		return;
	}
	//~ if (x==y || (a!=b && (rand()&1)))
	if (a!=b)
	{
		int s=(a+b)>>1;
		//~ int s=los(a, b-1);
		int p=pyt(a, s, x, y);
		if (rand()&1)
		{
			szuk(a, s, x, y, p);
			szuk(s+1, b, x, y, w-p);
		}
		else
		{
			szuk(s+1, b, x, y, w-p);
			szuk(a, s, x, y, p);
		}
	}
	else
	{
		int s=(x+y)>>1;
		//~ int s=los(x, y-1);
		int p=pyt(a, b, x, s);
		if (rand()&1)
		{
			szuk(a, b, x, s, p);
			szuk(a, b, s+1, y, w-p);
		}
		else
		{
			szuk(a, b, s+1, y, w-p);
			szuk(a, b, x, s, p);
		}
	}
}

int main()
{
	srand(69);
	int szit;
	scanf("%d%d%d%lld", &szit, &szit, &szit, &mod);
	ll trz=1;
	for (int i=0; i<n; i++)
	{
		for (int j=0; j<n; j++)
		{
			pot[i][j]=trz;
			trz=(trz*2)%mod;
		}
	}
	for (int i=0; i<n; i++)
		for (int j=0; j<nax; j++)
			if (dlu*j<n)
				jeszkol[i][j]=pyt(dlu*j, min(dlu*j+dlu-1, n-1), i, i);
	szuk(0, n-1, 0, n-1, 250);
	printf("! %lld\n", wyn%mod);
	ff();
	return 0;
}


Measured memory_bytes: 720
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),k=sc.nextInt();
    int count=0;
    if(a>=k){
      count=k;
    }else{
      count=a;
      k-=a;
      if(b<k){
        k-=b;
        count-=k;
      }
    }
    pl(count+"");
  }

  public static int aa(int n){
    if(n>0){return 1;}
    return 0;
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


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

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

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF

#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 srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int f(int n) {
  return n*(n-1)/2;
}

int main() {
  int n, m;
  cin >> n >> m;
  int ans = f(n);
  ans += f(m);
  cout << ans << '\n';
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
 
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 2e5 + 5;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
 
int fac[MAX_N], inv[MAX_N];
 
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b, bool usemod = true) {ll c = 1LL; while (b > 0) {if (b & 1LL) {if(!usemod)c*=a;else c = a * c%mod;}if (!usemod) a*=a;else a = a * a%mod; b >>= 1LL;}return c;}
void _nCr() {fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) {fac[i] = fac[i - 1LL] * i%mod;}for (int i = 0; i < MAX_N; i++) {inv[i] = POW(fac[i], mod - 2);}}
ll nCr(ll n, ll r) {return (fac[n] * inv[r] % mod)*inv[n - r] % mod;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}

class Warshall_Floyd {
public:
	vector<vector<int>> d;
	int nodecnt = -1;

	Warshall_Floyd(int n) {
		d = vector<vector<int>>(n,vector<int>(n,INF));
		nodecnt = n;
	}

	void add(int s,int e,int cost) {
		d[s][e] = cost;
	}

	bool wf() {
		for (int k = 0;k < nodecnt;k++) {
			for (int i = 0;i < nodecnt;i++) {
				for (int j = 0;j < nodecnt;j++) {
					//k経由でi->j
					d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
				}
			}
		}
	}
};

bool solve() {
	set<int> A[3];
	A[0] = set<int>{1,3,5,7,8,10,12};
	A[1] = set<int>{4,6,9,11};
	A[2] = set<int>{2};
	int x,y; cin >> x >> y;
	REP (i,3) {
		if (A[i].find(x) != A[i].end() && A[i].find(y) != A[i].end()) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
}

Measured memory_bytes: 256
import functools
numbers = list(input())

expressions = set()

def subSum(currentIdx, expr):
    global expressions
    
    if currentIdx == 0:
        expressions.add(convertToString(expr))
        return

    next_expr1 = expr[:]
    next_expr2 = expr[:]
    next_expr2.insert(currentIdx, '+')

    subSum(currentIdx-1, next_expr1)
    subSum(currentIdx-1, next_expr2)

def convertToString(expr):
    ex = str(functools.reduce(lambda t, x: t + x, expr))
    return ex

def culc(expr):
    return sum(list(map(int, expr.split('+'))))

subSum(len(numbers) - 1, numbers)



print(sum(list(map(culc, list(map(str, expressions))))))

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

  for(int i = 1; i<=n; i++){
      cin>>a[i];
  }
  for(int i = 1; i<=n; i++){
      cin>>b[i];
  }
  for(int i = 1; i<=n-1; i++){
      cin>>c[i];
  }
    for(int j = 1; j<=n; j++){
        
        if(j!=1&&a[j]-1==a[j-1]){
            
            sum = sum + c[a[j]-1];
        }
        sum = sum + b[a[j]];
       
    }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdint>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

int main() {
	int d, n;
	cin >> d >> n;
	int a = 1;
	for (int i = 0; i < d; ++i) {
		a *= 100;
	}
	if (n < 100) {
		cout << a * n << endl;
	}
	else {
		cout << a * 101 << endl;
	}
}

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

int main() {
    int n;
    cin >> n;
    vector<string> title(n);
    vector<int> time(n);

    for (int i = 0; i < n; i++){
        cin >> title.at(i);
        cin >> time.at(i);
    }

    string x;
    cin >> x;

    auto itr = find(title.begin(), title.end(), x);
    int index = distance(title.begin(), itr);

    int64_t count = 0;
    for (int i = index + 1; i < n; i++){
        count += time.at(i);
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const ll INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

int main(){
	ll n, q, l, r;
	cin >> n >> q >> l >> r;
	vector<ll> line(n);
	foreach(i, line)cin>>i;

	vector<vector<ll>> querys(q, vector<ll>(4));
	foreach(i, querys){
		foreach(j, i)cin >> j;
	}

	auto func = [&](ll num){
		foreach(i, querys){
			ll q = i[0], x = i[1], s = i[2], t = i[3];
			if(q==1){
				if(num>=x){
					num = (num + s) * t;
				}
			}else{
				if(num<=x){
					num = (num - s) / t;
				}
			}
		}
		int res = (l <= num)?1:0;
		res |= (num <= r)?2:0;
		return res;
	};

	sort(all(line));

	ll lo = 0, lh = n;
	while(lo < lh){
		ll mid = (lo+lh) >> 1;
		if(func(line[mid])&1){
			lh = mid;
		}else{
			lo = mid + 1;
		}
	}

	ll ro = 0, rh = n;
	while(ro < rh){
		ll mid = (ro+rh) >> 1;
		if(func(line[mid])&2){
			ro = mid + 1;
		}else{
			rh = mid;
		}
	}
	cout << ro - lo << endl;


	return 0;
}



Measured memory_bytes: 18144
#include<stdio.h>

double a, b, c, d, e, f;

int main(void)
{
	double a1, a2;
	while ( scanf( "%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f ) != EOF ) {
		a1 = (c * e - f * b) / (a * e - d * b);
		a2 = (f * a - c * d) / (e * a - b * d);
		if ( a1 == -0.000 ) a1 = 0;
		if ( a2 == -0.000 ) a2 = 0;
		printf( "%.3f %.3f\n", a1, a2 );
	}
	
	return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main() {
    int m, f, r;
    while (1) {
        cin >> m >> f >> r;
        if (m == -1 && f == -1 && r == -1) break;
        if (m == -1 || f == -1) cout << 'F' << endl;
        else if (m+f >= 80) cout << 'A' << endl;
        else if (m+f >= 65) cout << 'B' << endl;
        else if (m+f >= 50) cout << 'C' << endl;
        else if (m+f >= 30 && r >= 50) cout << 'C' << endl;
        else if (m+f >= 30) cout << 'D' << endl;
        else cout << 'F' << endl;
    }
    return 0;
}

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

struct city {
  int x;
  int y;
  int64_t p;
};

struct linescore {
  int lineid;
  int l;
  int64_t s;
};

int64_t recursive_score(int K, int N, vector<int> &candidate_lines,
                        vector<vector<linescore>> &city_line_scores,
                        int min_select, int selected_num,
                        vector<bool> &selected_lines, int64_t lower_bound) {
  if (selected_num == K) {
    int64_t s = 0;
    for (int i = 0; i < N; i++) {
      // 各都市の一番近い線のスコアを合計
      for (auto line_score : city_line_scores[i]) {
        if (selected_lines[line_score.lineid]) {
          s += line_score.s;
          if (s > lower_bound) {
            return s;
          }
          break;
        }
      }
    }
    return s;
  }

  int64_t min_score = lower_bound;
  for (int i = min_select; i < (int)candidate_lines.size(); i++) {
    int next_min_select;
    if (i % 2 == 0) {
      next_min_select = i + 2;  // 同じ都市に縦線と横線を両方置くのは無駄
    } else {
      next_min_select = i + 1;
    }

    selected_lines[i] = true;
    int64_t s = recursive_score(K, N, candidate_lines, city_line_scores,
                                next_min_select, (selected_num + 1),
                                selected_lines, min_score);
    selected_lines[i] = false;

    min_score = min(min_score, s);
  }
  return min_score;
}

int main() {
  int N;
  cin >> N;
  vector<city> cities(N);
  for (int i = 0; i < N; i++) {
    int x, y, p;
    cin >> x;
    cin >> y;
    cin >> p;
    cities[i] = city{x, y, p};
  }

  // 線の候補
  vector<int> candidate_lines;
  for (int j = 0; j < N; j++) {
    int xj = cities[j].x;
    int yj = cities[j].y;

    candidate_lines.push_back(xj * 2);
    candidate_lines.push_back(yj * 2 + 1);
  }

  // 線-都市ペアでのスコア事前計算
  vector<vector<linescore>> city_line_scores(N);
  for (int i = 0; i < N; i++) {
    int xi = cities[i].x;
    int yi = cities[i].y;
    int64_t pi = cities[i].p;

    vector<linescore> line_score;

    for (int j = 0; j < N; j++) {
      int xj = cities[j].x;
      int yj = cities[j].y;

      line_score.push_back(linescore{j * 2, xj * 2, pi * abs(xi - xj)});
      line_score.push_back(linescore{j * 2 + 1, yj * 2 + 1, pi * abs(yi - yj)});
    }
    line_score.push_back(linescore{N * 2, 0, pi * abs(xi)});
    line_score.push_back(linescore{N * 2 + 1, 1, pi * abs(yi)});
    sort(line_score.begin(), line_score.end(),
         [](linescore a, linescore b) { return a.s < b.s; });
    city_line_scores[i] = line_score;
  }

  int64_t lower_bound = 1000000000000000LL;
  for (int K = 0; K < N; K++) {
    vector<bool> selected_lines(N * 2 + 2);
    for (int j = 0; j < N; j++) {
      selected_lines[j * 2] = false;
      selected_lines[j * 2 + 1] = false;
    }
    selected_lines[N * 2] = true;
    selected_lines[N * 2 + 1] = true;
    int64_t S = recursive_score(K, N, candidate_lines, city_line_scores, 0, 0,
                                selected_lines, lower_bound);
    cout << S << endl;
    lower_bound = S;
  }
  cout << 0 << endl;
}


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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((a==5 && b==5 && c==7) || (a==5 && b==7 && c==5) || (a==7 && b==5 && c==5))cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 110
#define INFINITY 1000000
int main(){
  int i, j, k, l, n, q;
  int p[MAX], col[MAX], row[MAX], mat[MAX][MAX]; 

  scanf("%d",&n);
  for(i=1; i<=n; i++){
    scanf("%d%d",&row[i],&col[i]);
  }
  p[0] = row[1];
  for(i=1; i<=n; i++){
    p[i] = col[i];
  }
  
  
  for(i=1; i<=n; i++){
    mat[i][i] = 0;
  }

  for(l=2; l<=n; l++){
    for(i=1; i<=n-l+1; i++){
      j = i+l-1;
      mat[i][j] = INFINITY;
      for(k=i; k<=j-1; k++){
	q = mat[i][k] + mat[k+1][j] + p[i-1] * p[k] * p[j];
	if(mat[i][j] > q) mat[i][j] = q;
      }
    }
  }

  printf("%d\n",mat[i-1][j]);
  return 0;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
int main()
{
	int n;
	int a[10],maxx=-1,sum=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i];
		maxx=max(maxx,a[i]);
	}
	printf("%d\n",sum-maxx/2);
    return 0;
}


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl




signed main() {

	int N, A, B, C;
	cin >> A>> B >> C >> N;

	int ans = 0;
	rep(a, N/A+1)rep(b, N/B+1) {
		int remain = N - a*A - b*B;
		int c = remain / C;
		if(remain >=0 && remain%C==0) {
			ans++;
//			cerr << a << " " << b << " " << c << endl;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MAXX 1000000000000000000

int32_t main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s;
	cin >> s;
	if(s == "ABC")
	{
		cout << "ARC";
	}
	else
	{
		cout << "ABC";
	}
	
	
	
	
	return 0;
}

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

using namespace std;
typedef long long ll;

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

  bool a[100];

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

  for (int i = 0; i < k; ++i) {
    int d;
    cin >> d;
    for (int j = 0; j < d; ++j) {
      int index;
      cin >> index;
      a[index - 1] = true;
    }
  }

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

  cout << result;

  return 0;
}


Measured memory_bytes: 3596
N, M = map(int, input().split())
ans1 = 0
ans2 = 0
Q = [0] * N
wrong = [0] * N
for i in range(M):
  p, S = map(str, input().split())
  p = int(p) - 1
  if Q[p] == 0 and S == "AC":
    ans1 += 1
    ans2 += wrong[p]
    Q[p] = 1
  elif S == "WA":
    wrong[p] += 1
print(ans1,ans2)

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

typedef long long ll;
const int N = 1e6 + 5;  
const int mod = 1e9 + 7;  

int n, m, i, j, k;
ll fac[N], ifac[N];

inline ll qpow(ll a, ll b) {
  ll res = 1;
  for (; b; b >>= 1, a = 1ll * a % mod * a % mod) {
    if (b & 1) {
      res = 1ll * res * a % mod;
    }
  }
  return res;  
}
inline ll c(ll n, ll m) {
  return 1ll * fac[n] % mod * ifac[n - m] % mod * ifac[m] % mod;   
}
inline void prep(int n) {
  fac[0] = 1, ifac[0] = 1;
  for (int i = 1; i <= n; i++) {
    fac[i] = 1ll * fac[i - 1] % mod * i % mod;
  }
  ifac[n] = qpow(fac[n], mod - 2);
  for (int i = n - 1; i >= 1; i--) {
    ifac[i] = 1ll * ifac[i + 1] % mod * (i + 1) % mod;  
  }
}

int main() {
  //freopen("e.in", "r", stdin);
  //freopen("e.out", "w", stdout);
  scanf("%d %d", &n, &m);  
  prep(N - 5);
  ll ans = 1;  
  for (int i = 2; i * i <= m; i++) {
    ll cnt = 0;
    while (m % i == 0) {
      cnt++;
      m /= i;  
    }
    ans = 1ll * ans * c(n + cnt - 1, n - 1) % mod;
  }
  if (m > 1) {
    ans = 1ll * ans * n % mod;  
  }
  printf("%lld\n", ans);
  return 0;   
}


Measured memory_bytes: 19408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> B(N - 1), A(N);
    int sum = 0;
    rep(i, N - 1)
    {
        cin >> B[i];
    }
    rep(i, N)
    {
        if (i == 0) {
            A[i] = B[i];
        } else if (i == N - 1) {
            A[i] = B[i - 1];
        } else {
            A[i] = min(B[i - 1], B[i]);
        }
        sum += A[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = sum(map(int, list(str(N))))

c = str(N)[0]

if c == 1:
    B = 9 * (len(str(N))-1)
else:
    B = int(c) + 9 * (len(str(N)) - 1) - 1


print(max(A, B))

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

using namespace std;

#define fo(i,CApiTaL_N) for(int i=0; i<CApiTaL_N; i++)
#define Fo(i,k,CApiTaL_N) for(int i=k; i<CApiTaL_N; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

int t=1;
const int mxN=2999;
int n;
vector<long double>p(mxN+1);
vector<vector<long double>>dp(mxN+1,vector<long double>(mxN+1));

void test_case(){
    cin>>n;
    fo(i,n)cin>>p[i];
    dp[1][0]=(1-p[0]);
    dp[1][1]=p[0];
    Fo(i,2,n+1){
        fo(j,i){
            if(j-1>=0)dp[i][j]+=(dp[i-1][j-1]*p[i-1]);
            dp[i][j]+=(dp[i-1][j]*(1-p[i-1]));
            // cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        }
        dp[i][i]=dp[i-1][i-1]*p[i-1];
    }
    long double ans=0.0;
    Fo(i,n/2+1,n+1){
        // cout<<i<<" "<<dp[n][i]<<endl;
        ans+=(dp[n][i]);
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
}

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

    // cin>>t;
    while(t--){
        test_case();
    }
    
    return 0;
}

Measured memory_bytes: 144636
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define add(x) accumulate(x)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end() 
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                void solve(){
                        ll n,m;
                        cin>>n>>m;
                        cout<<(n*m/__gcd(n,m));
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //printf("Case #%d: ", i);
                                solve();
                         }
        return 0; 
}         
 

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

using namespace std;
using ll = long long;

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(int, N);

    ll T0, A0, T1 = 0, A1 = 0;
    cin >> T0 >> A0;
    ll times = 1;

    for (int i = 1; i < N; i++) {

        ll t, a;
        cin >> t >> a;

        T1 = ((T0+t-1) / t) * t;
        A1 = ((A0+a-1) / a) * a;

        if ( T1 / t * a > A1 ) {
            A1 = T1 / t * a;
        } else {
            T1 = A1 / a * t;
        }
        T0 = T1, A0 = A1;
    }

    cout << max(T0+A0,T1+A1) << "\n";
    return 0;
}

Measured memory_bytes: 256
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 511, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(a[K-1] if K!=32 else 51)

Measured memory_bytes: 38256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll n; cin>>n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    ll A=a[0]^a[1];
    for(ll i=2;i<n;i++){
        A=A^a[i];
    }
    rep(i,n){
        ll ans=A^a[i];
        cout<<ans<<" ";
    }
    cout<<endl;
}




























































































Measured memory_bytes: 4772
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define SORT(i) sort((i).begin(),(i).end())
#define INF 2000000000
constexpr ll mod = 1000000007;
	
ll gcd(ll x, ll y) {
	return y != 0 ? gcd(y, x % y) : x;
}
vector<pair<ll, int>>factorize(ll N){
	vector < pair < ll, int>>res;
	for (ll i = 2;i * i <= N;++i) {
		if (N % i)continue;
		res.emplace_back(i, 0);
		while (N % i == 0) {
			N /= i;
			res.back().second++;
		}
	}
	if (N != 1)res.emplace_back(N, 1);
	return res;
}
int main() {
	ll A, B;
	cin >> A >> B;
	ll g = gcd(A, B);
	auto f = factorize(g);
	int ans = f.size() + 1;
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256