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

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

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize, k: usize, s: i64,
    }
    let r = if s == 1_000_000_000 { 1 } else { s + 1 };
    let mut a = vec![s; n];
    for i in k..n {
        a[i] = r;
    }
    for i in 0..n {
        puts!("{}{}", a[i], if i + 1 == n { "\n" } else { " " });
    }
}

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


Measured memory_bytes: 9596
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;

int main(){
    ll k, n;
    cin >> k >> n;
    vi a(n);
    int max_ = 0;
    ll sum = 0;
    rep(i, n){
        cin >> a.at(i);
    }
    sum += k-a.at(n-1)+a.at(0);
    max_ = k-a.at(n-1)+a.at(0);
    rep(i, n-1){
        sum += a.at(i+1)-a.at(i);
        max_ = max(a.at(i+1)-a.at(i), max_);
    }

    cout << sum-max_ << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int K = sc.nextInt();

		N -= K;

		out.println((int) Math.ceil((double) N / (K - 1)) + 1);
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


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

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, int> LP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e18;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    int h, w, k;
    cin >> h >> w >> k;
    int si, sj, ti, tj;
    cin >> si >> sj >> ti >> tj;
    --si; --sj; --ti; --tj;
    vector<string> g(h);
    rep(i,h) cin >> g[i];

    auto toId = [&](int i, int j, int v){
        return (i*w + j) * 4 + v;
    };
    auto modCeil = [&](ll x){
        return (x + k - 1) / k * k;
    };

    vector<ll> dist(h*w*4, INF);
    priority_queue<LP, vector<LP>, greater<LP>> q;
    auto push = [&](int i, int j, int v, ll x){
        int id = toId(i, j, v);
        if(dist[id] <= x) return;
        dist[id] = x;
        q.emplace(x, id);
    };
    rep(v,4) push(si, sj, v, 0);
    while(!q.empty()){
        ll d = q.top().first;
        int id = q.top().second;
        q.pop();
        if(dist[id] != d) continue;
        int i = id / w / 4;
        int j = id / 4 % w;
        int v = id % 4;
        rep(nv, 4) push(i, j, nv, modCeil(d));
        {
            int ni = i + di[v], nj = j + dj[v];
            if(0 <= ni && ni < h && 0 <= nj && nj < w){
                if(g[ni][nj] == '.'){
                    push(ni, nj, v, d+1);
                }
            }
        }
    }
    ll ans = INF;
    rep(v,4) chmin(ans, dist[toId(ti,tj,v)]);
    if(ans == INF){
        cout << -1 << endl;
        return 0;
    }
    ans = modCeil(ans) / k;
    cout << ans << endl;
	return 0;
}

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

int main() {

    int m, f, r;

    for ( ;; ) {

        std::cin >> m >> f >> r;

        if ( m == -1 && f == -1 && r == -1 ) break;

        char grade;

        if ( m == -1 || f == -1 ) grade = 'F';

        else if ( m + f >= 80 ) grade = 'A';
        else if ( m + f >= 65 ) grade = 'B';
        else if ( m + f >= 50 ) grade = 'C';
        else if ( m + f >= 30 ) grade = r >= 50 ? 'C' : 'D';
        else                    grade = 'F';

        std::cout << grade << std::endl;
    }

    return 0;
}



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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	vector <int> a(n+1), cur(n+1), ans;
	for (int i=1; i<=n; i++) {
		cin >> a[i];
	}
	for (int i=n; i>=1; i--) {
		int have = 0;
		for (int j=2; j*i<=n; j++) {
			have ^= cur[j*i];
		}
		if (have != a[i]) {
			cur[i] = 1;
			ans.push_back(i);
		}
	}
	cout << ans.size() << "\n";
	for (int i:ans) {
		cout << i << " ";
	}
	return 0;
}


Measured memory_bytes: 3192
import sys
readline = sys.stdin.readline

N = int(readline())
G = [[] for i in range(N)]

for i in range(N - 1):
  u,v,w = map(int,readline().split())
  G[u - 1].append((v - 1, w))
  G[v - 1].append((u - 1, w))
  
color = [-1] * N
stack = []
stack.append([0, -1, 0])
while stack:
  v,parent,cost = stack.pop()
  color[v] = cost
  for child in G[v]:
    if child[0] == parent:
      continue
    stack.append([child[0], v, (cost + child[1]) % 2])

for c in color:
  print(c)

Measured memory_bytes: 42684
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    string s;cin>>s;
    vector<int>num(26,0);
    rep(i,s.size()){
        num[int(s[i]-'a')]++;
    }
    rep(i, 26){
        if(num[i]==0){co(char(i+'a'));return 0;}
    }
    co("None");
}

Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> a(N, 0), s(N, 0);
    REP(i, N) {
        cin >> a[i];
        if (i > 0) {
            s[i] = s[i - 1] + a[i];
        } else {
            s[i] = a[i];
        }
    }
    ll res = 1e15;
    REP(i, N - 1) {
        ll x = s[i];
        ll y = s[N - 1] - s[i];
        amin(res, abs(x - y));
    }
    cout << res << "\n";
    return 0;
}


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

using namespace std;

long long axor(long long a){
  if(a % 4 == 0) return a;
  if(a % 4 == 1) return 1;
  if(a % 4 == 2) return a + 1;
  if(a % 4 == 3) return 0;

  // g++ -Wall warning
  return 0;
}

int main()
{
  long long A, B;
  cin >> A >> B;

  cout << (axor(B) ^ axor(A-1)) << endl;

	return 0;
}


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

#define MAX_N 18

using namespace std;

int n;
int a[1 << MAX_N];

struct mxs
{
    int mx1, p1;
    int mx2, p2;
};

mxs v[1 << MAX_N];

struct elem
{
    int nr, p;
};

struct cmp
{
    bool operator () (const elem &a, const elem &b) const
    {
        if(a.nr == b.nr)
            return (a.p < b.p);

        return (a.nr < b.nr);
    }
};

elem c[5];

void readFile()
{
    cin >> n;

    int i;
    for(i = 0; i < (1 << n); i ++)
    {
        cin >> a[i];
        v[i].mx1 = a[i];
        v[i].p1 = i;
    }
}

void comb(int a, int b)
{
    c[1] = {v[a].mx1, v[a].p1};
    c[2] = {v[a].mx2, v[a].p2};
    c[3] = {v[b].mx1, v[b].p1};
    c[4] = {v[b].mx2, v[b].p2};

    sort(c + 1, c + 4 + 1, cmp());

    v[b].mx1 = c[4].nr;
    v[b].p1 = c[4].p;

    int i = 3;
    while(i >= 1 && c[i].p == c[4].p)
        i --;

    v[b].mx2 = c[i].nr;
    v[b].p2 = c[i].p;
}

void solve()
{
    int i, j;
    for(i = 0; i < (1 << n); i ++)
    {
        for(j = 0; j < n; j ++)
            comb(i, i | (1 << j));
    }
}

void ansQues()
{
    int i, j;
    for(i = 1; i < (1 << n); i ++)
    {
      //  cout << i << " AVEM " << mx[i] << " " << mx2[i] << "\n";
        int rez = v[i].mx1 + v[i].mx2;
        int cr = 0;
        for(j = n - 1; j >= 0; j --)
        {
            if(((1 << j) & i) != 0)
            {
                int loc = cr + (1 << j) - 1;
           //     cout << loc << "+++++++\n";
                rez = max(rez, v[loc].mx1 + v[loc].mx2);
                cr = cr | (1 << j);
            }
        }

        cout << rez << "\n";
    }
}

int main()
{
    readFile();

    solve();

    ansQues();

    return 0;
}


Measured memory_bytes: 8192
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        _n: usize,
        s: String,
    };

    let s: Vec<char> = s.chars().collect();
    let mut ans = 0;

    for i in 0..s.len()-2 {
        if s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C' {
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2116
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>

using namespace std;
#define ll long long
#define pb push_back

int main()
{
    // g++ -std=c++11 -o b.o b.cpp
    int n, d;
    cin >> n >> d;
    int a[n][d];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < d; j++)
        {
            cin >> a[i][j];
        }
    }
    int cnt = 0;
    double flag = 0;

    for (int i = 0; i < n; i++)
    {

        for (int j = i + 1; j < n; j++)
        {
            int sum = 0;

            for (int k = 0; k < d; k++)
            {
                sum += pow(a[i][k] - a[j][k], 2);
            }
            flag = sqrt(sum);
            // cout << flag << " " << sum << endl;
            if(flag-(int)flag != 0){
                continue;
            }
            if (sum % (int)flag == 0)
            {
                cnt++;
            }
        }
    }

    cout << cnt << endl;
}


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

#define INF 1000000

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

  for(int i=0; i<(int)(s.size()); i+=2) {
    cout << s[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 512
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int upper = (int) Math.sqrt(X)+1;
        PriorityQueue<Integer> pq = new PriorityQueue<>();
        pq.add(1);
        int base = 2;
        while(base<=upper){
            int cur = base*base;
            while(cur<=X){
                pq.add(cur);
                cur = cur*base;
            }
            base++;
        }
        int ans = 0;
        while(pq.size()>1) ans = pq.poll();
        ans = pq.poll();

        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main(void){
    double x1,y1,x2,y2,d;
    cin>>x1>>y1>>x2>>y2;
    d=sqrt(pow(x1-x2,2)+pow(y1-y2,2));
    printf("%lf\n",d);
    return 0;
}

Measured memory_bytes: 3208
#include <stdio.h>

int main(void) 
{
	double height, max = 0, min = 0;

	while (scanf("%lf", &height) != EOF) {
		if (!max) 
			max = height;

		if (!min)
			min = height;

		max = (height > max) ? height : max;
		min = (height < min) ? height : min;
	}

	printf("%.1f\n", max - min);

	return 0;
}

Measured memory_bytes: 652
local mfl, mce = math.floor, math.ceil
local mmi, mma = math.min, math.max
local bls, brs = bit.lshift, bit.rshift
local SegTree = {}
SegTree.updateAll = function(self)
  for i = self.stagenum - 1, 1, -1 do
    local cnt = bls(1, i - 1)
    for j = 1, cnt do
      self.stage[i][j] = self.func(self.stage[i + 1][j * 2 - 1], self.stage[i + 1][j * 2])
    end
  end
end
SegTree.create = function(self, n, func, emptyvalue)
  self.func, self.emptyvalue = func, emptyvalue
  local stagenum, mul = 1, 1
  self.stage = {{}}
  while mul < n do
    mul, stagenum = mul * 2, stagenum + 1
    self.stage[stagenum] = {}
  end
  self.stagenum = stagenum
  self.left_stage = {}
  for i = 1, n do
    local sp, sz = 1, bls(1, stagenum - 1)
    while(i - 1) % sz ~= 0 do
      sp, sz = sp + 1, brs(sz, 1)
    end
    self.left_stage[i] = sp
  end
  self.sz_stage = {}
  local tmp, sp = 1, stagenum
  for i = 1, n do
    if tmp * 2 == i then tmp, sp = tmp * 2, sp - 1 end
    self.sz_stage[i] = sp
  end
  for i = 1, mul do self.stage[stagenum][i] = emptyvalue end
  self:updateAll()
end
SegTree.getRange = function(self, left, right)
  if left == right then return self.stage[self.stagenum][left] end
  local stagenum = self.stagenum
  local ret = self.emptyvalue
  while left <= right do
    local stage = mma(self.left_stage[left], self.sz_stage[right - left + 1])
    local sz = bls(1, stagenum - stage)
    ret = self.func(ret, self.stage[stage][1 + brs(left - 1, stagenum - stage)])
    left = left + sz
  end
  return ret
end
SegTree.setValue = function(self, idx, value, silent)
  self.stage[self.stagenum][idx] = value
  if not silent then
    for i = self.stagenum - 1, 1, -1 do
      local dst = brs(idx + 1, 1)
      local rem = dst * 4 - 1 - idx
      self.stage[i][dst] = self.func(self.stage[i + 1][idx], self.stage[i + 1][rem])
      idx = dst
    end
  end
end
SegTree.new = function(n, func, emptyvalue)
  local obj = {}
  setmetatable(obj, {__index = SegTree})
  obj:create(n, func, emptyvalue)
  return obj
end

local function merge(x, y)
  return (x + y) % 3
end

local s = io.read()
local t = io.read()
local sts = SegTree.new(#s, merge, 0)
for i = 1, #s do
  sts:setValue(i, s:sub(i, i):byte() - 64, true)
end
sts:updateAll()
local stt = SegTree.new(#t, merge, 0)
for i = 1, #t do
  stt:setValue(i, t:sub(i, i):byte() - 64, true)
end
stt:updateAll()
local q = io.read("*n")
for iq = 1, q do
  local a, b, c, d = io.read("*n", "*n", "*n", "*n")
  print(sts:getRange(a, b) == stt:getRange(c, d) and "YES" or "NO")
end


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

int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec[i];
  }
  sort(vec.begin(), vec.end());
  double ans = 0, tmp;
  for (int i = 0; i < N; i++){
    tmp = vec[i];
    if(i == 0){
      tmp /= pow(2, N - 1);
      ans += tmp;
    }
    else{
      tmp /= pow(2, N - i);
      ans += tmp;
    }
  }
  cout << ans;
}

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

int main()
{
    int x;
    cin >> x;
    if(x < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    
	public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  int n = sc.nextInt();
	  int[] mountain = new int[n];
	  int prev = 0;
	  int res = 0;
	  
	  for (int i = 0; i < n; i++) {
		  mountain[i] = sc.nextInt();
	  }
	  
	  prev = mountain[0];
	  
	  for (int i = 0; i < n; i++) {
		  if (mountain[i] >= prev) {
			  prev = mountain[i];
			  res++;
		  }
	  }
	  
	  System.out.println(res);
	  
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 22356
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		String s= new String();
		if((x+r)<=W &&(x-r)>=0 && (y+r)<=H && (y-r)>=0){
			s="Yes";
		} else {
			s="No";
		}
		System.out.println(s);
	}
}

Measured memory_bytes: 26392
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>

#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 REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

const int MAX = 500010;
const int MOD = (ll)1e9 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;

typedef pair<int, int>P;

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





signed main() {
	int X; cin >> X;
	REP(i, 3) {
		if (X - i * 2 == 3) {
			print("YES"); return 0;
		}
	}
	print("NO")
}	


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
using namespace std;
typedef long long int ll;
ll cnt=0;
bool is_prime(int n) {
    if(n == 1) return false; // 1 は素数ではない。
    for(int i = 2; i*i <= n; ++i) { // 2 <= i <= sqrt(n) に約数があれば、
        if(n % i == 0) return false; // n は素数ではない
    }
    return true;
}
std::pair<std::vector<ll>, std::vector<ll>> prime_factor_decomp(ll n) {
    std::vector<ll> p, e;
    ll m = n;
    for (ll i = 2; i * i <= n; i++) {
        if (m % i != 0) continue;
        int c = 0;
        while (m % i == 0) c++, m /= i;
        p.push_back(i);
        e.push_back(c);
        cnt++;
    }
    if (m > 1) {
        p.push_back(m);
        e.push_back(1);
        cnt++;
    }
    return std::make_pair(p, e);
}
int main(){
  ll n,p;
  cin >>n>>p;
  if(n==1) cout<<p<<endl;
  //else if(is_prime(p)) cout <<1<<endl;
  else{
    pair <vector<ll>,vector<ll>> v=prime_factor_decomp(p);
    ll ans=1;
    for(ll i=0;i<cnt;i++){
      if(v.second[i]>=n){
        ll k=v.second[i]/n,p=1;
        for(ll j=0;j<k;j++) p*=v.first[i];
        ans*=p;
      }
    }
    cout <<ans<<endl;
  }

}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.Remoting.Messaging;
using System.Security.Principal;
using System.Text;
class Simple {
    private long N, A, B;
    private long[] h;
    void Solve() {
        //input
        N = io.Int;
        A = io.Int;
        B = io.Int;
        h = new long[N];
        for(int i = 0; i < N; ++i) h[i] = io.Int;
        //cal
        var diff = A - B;
        Func <long, bool> isOK = (num) => {
            var damaged = B * num;
            var addNum = 0L;
            for(int i = 0; i < N; ++i) {
                var left = h[i] - damaged;
                if(left > 0) addNum += left / diff + (left % diff == 0 ? 0 : 1);
            }
            return addNum <= num;
        };
        var ans = binarySearch(h, -1, (long)1e9 + 5, isOK);
        //ret
        Console.WriteLine(ans);
    }
    long binarySearch(long[] a, long ng, long ok, Func <long, bool> check) {
        while(Math.Abs(ok - ng) > 1){
            long mid = (ok + ng) / 2;
            if(check(mid)) ok = mid;
            else ng = mid;
        }
        return ok;
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] {' '};
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if(BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while(st == "") st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}

Measured memory_bytes: 15828
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
using namespace std;

//const int64_t INF = 1LL << 60;

int main(void){
  int N;
  cin >> N;
  vector<int> a,b,c;
  map<int,map<int,int64_t>> dp;
  
  const int A = 0;
  const int B = 1;
  const int C = 2;
  
  /// 6 patterns such that a->b,a->c,b->a,b->c,c->a,c->b . 

  
  for(int i=0;i<N;i++){
    int _a,_b,_c;
    cin >> _a >> _b >> _c;
    a.push_back(_a);
    b.push_back(_b);
    c.push_back(_c);
  }
  
  dp[0][A] = a[0];
  dp[0][B] = b[0];
  dp[0][C] = c[0];
  //cout << "A:" << dp[0][A] << ", B:" << dp[0][B] << ", C:" << dp[0][C] << endl;
  for(int i=1;i<N;i++){
    dp[i][A] = max(dp[i-1][B]+a[i],dp[i-1][C]+a[i]);
    dp[i][B] = max(dp[i-1][C]+b[i],dp[i-1][A]+b[i]);
    dp[i][C] = max(dp[i-1][A]+c[i],dp[i-1][B]+c[i]);
    
    //cout << "A:" << dp[i][A] << ", B:" << dp[i][B] << ", C:" << dp[i][C] << endl; 
  }
  
  cout << max(max(dp[N-1][A],dp[N-1][B]),dp[N-1][C]) << endl;
}


Measured memory_bytes: 29548
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
//!Recursion 
ll knapsack(ll wghts[],ll prfts[],ll n,ll w){
    if(n<=0 || w<=0) return 0;
    else {
        ll inc=0;
        if(w>=wghts[n]){
            inc=prfts[n]+knapsack(wghts,prfts,n-1,w-wghts[n]);
        }
        ll exc=knapsack(wghts,prfts,n-1,w);
        return max(inc,exc);
    }
}
//!Bottom up approach
ll bottomup(ll wghts[],ll prfts[],ll n,ll w){
    ll dp[n+1][w+1]={0};
    for(int i=0;i<=n;i++){
        for(int j=0;j<=w;j++){
            if(i==0 || j==0) {
                dp[i][j]=0;
            }
            else{
                ll inc=0;
                if(j>=wghts[i-1]){
                    inc=prfts[i-1]+dp[i-1][j-wghts[i-1]];
                }
                ll exc=dp[i-1][j];
                dp[i][j]=max(inc,exc);
            }
        }
    }
   
    return dp[n][w];

}
int main(){
    ll n,w;
    cin>>n>>w;
    ll wghts[n],prfts[n];
    for(int i=0;i<n;i++){
        cin>>wghts[i]>>prfts[i];
        // =wghts[i];
    }
    // ll wghts[4]={2,5,6,8};
    // ll prfts[4]={2,5,6,8};
    // cout<<knapsack(wghts,prfts,n-1,w)<<endl;
    cout<<bottomup(wghts,prfts,n,w)<<endl;
    return 0;
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int X;
    cin>>X;
    

    cout << (2199-X)/200 << endl;

    



}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,mod=1000000007,l[22][22],z,dp[4000000],dp2[4000000],mx,r,zz,w;
void rec(long long q){
	if(q>a){
		if(w!=b) return;
		zz=1;
		for(int h=1; h<=a; h++){
			if((r&zz)!=0&&l[b][h]==1){
				dp2[r]+=dp[r-zz];
				dp2[r]%=mod;
			}
			zz*=2;
		}
		return;
	}
	z*=2;
	rec(q+1);
	r=r+z/2;
	w++;
	rec(q+1);
	z/=2;
	r-=z;
	w--;
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	for(b=1; b<=a; b++){
		for(c=1; c<=a; c++){
			cin>>l[b][c];
		}
	}
	z=1;
	for(b=1; b<=a; b++){
		mx+=z;
		if(l[1][b]==1) dp[z]=1;
		z*=2;
	}
	for(b=2; b<=a; b++){
		z=1;
		rec(1);
		for(c=0; c<=mx; c++){
			dp[c]=dp2[c];
			dp2[c]=0;
		}
	}
	cout<<dp[mx];
	return 0;
}

Measured memory_bytes: 37120
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long N;
    cin>>N;
    
    vector<long long> A(N),B(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
        B[i]=A[i]-(i+1);
    }
    
    sort(B.begin(),B.end());
    double b;  
    if(N%2!=0)b=B[(N-1)/2];
    else b=round((B[N/2-1]+B[N/2])/2.0);

    long long sum=0;
    for(int i=0;i<N;i++){
        sum+=abs(B[i]-b);
    }
    
    cout<<sum<<endl;
}


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

int main()
{
    double radius;
    double area, circumference;
    double pi = 3.141592653589;
    scanf("%lf", &radius);
    area = pi * radius * radius;
    circumference = 2 * pi * radius;
    printf("%f %f", area, circumference);
}


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

int main() {
  string s;
  cin >> s;
  int a = stoi(s.substr(0, 1));
  int b = stoi(s.substr(1, 1));
  int c = stoi(s.substr(2, 1));
  int d = stoi(s.substr(3, 1));

  int i;
  for (i = 0; i < 1 << 4; ++i) {
    int num = a;
    num = (i & 1) ? num + b : num - b;
    num = ((i >> 1) & 1) ? num + c : num - c;
    num = ((i >> 2) & 1) ? num + d : num - d;
    if (num == 7) {
      break;
    }
  }
  char op1 = (i & 1) ? '+' : '-';
  char op2 = ((i >> 1) & 1) ? '+' : '-';
  char op3 = ((i >> 2) & 1) ? '+' : '-';

  cout << a << op1 << b << op2 << c << op3 << d
    << "=7" << endl;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    map<string, bool> d;

    int x;
    for (int i = 0; i < k; i++){
        cin >> x;
        d[to_string(x)] = true;
    }

    string s;
    bool check = true;
    string z;
    while (1){
        s = to_string(n);
        check = true;
        for (int i = 0; i < s.size(); i++){
            z = s[i];
            if (d[z]) check = false;
        }

        if (check) break;
        n++;
    }

    cout << n << endl;
    return 0;
}

Measured memory_bytes: 256
//AUTHOR:BlackBox Inc.//
#include<bits/stdc++.h>
#include<unordered_map>
#include<tr1/unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace std::tr1;

int main()
{
#ifdef RAHUL
    freopen("input.txt","r",stdin);
#endif
ll n,k;
cin>>n>>k;

int answer=0;

while(n>0){
	n/=k;
	answer++;
}

cout<<answer<<endl;


return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 200005
int n, m, k, i, j, ans, in, in2; long long a[M], b[M];
int main ()
{
    cin >> n >> m >> k;
    for(i = 1; i <= n; i++)
    {
        cin >> in;
        a[i] += a[i-1] + in;
    }
    for(i = 1; i <= m; i++)
    {
        cin >> in;
        b[i] += b[i-1] + in;
    }
    for(i = 0; i <= n; i++)
    {
        in = a[i]; if(in > k) break;
        in2 = lower_bound(b, b + m + 1, k-in) - b;
        if(b[in2] > k-in or in2 > m) in2--;
        ans = max(ans, i + in2);
    }
    for(i = 0; i <= m; i++)
    {
        in = b[i]; if(in > k) break;
        in2 = lower_bound(a, a + n + 1, k-in) - a;
        if(a[in2] > k-in or in2 > n) in2--;
        ans = max(ans, i + in2);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6736
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (200000)
#define MOD (998244353)


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

    int c = 0;
    int cmax = 0;
    int old = 0;
    for(int i=0;i<n;i++)
    {
        int h;
        scanf("%d",&h);
        if(h <= old)
        {
            c++;
            cmax = max(c,cmax);
        }else
        {
            c = 0;
        }
        old = h;
    }
    printf("%d\n",cmax);

    return 0;
}







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

typedef long long ll;
typedef long double ld;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
const ll N=210;

bool func(ll arr[3][3] , ll a1)
{
    ll b1 = arr[0][0] - a1;
    ll b2 = arr[0][1] - a1;
    ll b3 = arr[0][2] - a1;

    ll a2 = arr[1][0] - b1;
    ll a3 = arr[2][0] - b1;

    if(a2+b2!=arr[1][1])
        return false;
    if(a2+b3!=arr[1][2])
        return false;
    if(a3+b2!=arr[2][1])
        return false;
    if(a3+b3!=arr[2][2])
        return false;
    return true;
}

int main()
{
    fast();
    ll arr[3][3];
    for(ll i=0;i<3;i++)
        for(ll j=0;j<3;j++)
            cin>>arr[i][j];


    for(ll a1=-100;a1<=200;a1++)
    {
        if(func(arr,a1))
        {
            cout<<"Yes";
            return 0;
        }
    }

    cout<<"No";
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int count = d * 2 + 1;
		System.out.println((n + count - 1) / count);
	}
}


Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
 
#define N 8
#define ON 1
#define OFF 0
#define TRUE 1
#define FALSE -1
 
int Search(int);
void Print();
 
int X[N], Y[N], sir[N][N], L[2*N-1], R[2*N-1];
 
int main(){
  int i, j, k, r, c;
 
  for(i = 0; i < N; i++){
    X[i] = OFF;
    Y[i] = OFF;
  }
 
  for(i = 0; i < 2*N-1; i++){
    L[i] = OFF;
    R[i] = OFF;
  }
 
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      sir[i][j] = FALSE;
    }
  }
 
  scanf("%d", &k);
  for(i = 0; i < k; i++){
    scanf("%d %d", &r, &c);
    sir[r][c] = TRUE;
  }
  Search(0);
  return 0;
}
 
int Search(int p){
  int q;
 
  if(p == N){
    Print();
    return 0;
  }
 
  for(q = 0; q < N; q++){ 
    if(Y[q]==ON || L[p+q]==ON || R[p-q+N-1]==ON){
      continue;
    }
 
    X[p] = q;
    Y[q] = ON;
    L[p+q] = ON;
    R[p-q+N-1] = ON;
 
    Search(p+1);
 
    X[p] = OFF;
    Y[q] = OFF;
    L[p+q] = OFF;
    R[p-q+N-1] = OFF;
  }
   return 0;
}
 
void Print(){
  int i, j;
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      if(sir[i][j] == TRUE){
        if(X[i] != j){
          return;
        }
      }
    }
  }
 
  for(i = 0; i < N; i++) {
    for(j = 0; j < N; j++) {
      if(X[i] == j) {
        printf("Q");
      }else{
        printf(".");
      }
    }
    printf("\n");
  }
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define     PI                       acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void GO(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
const int N=200000+5,M=1000000+5;
string s[N];
int ans=0;
int vis[M][100],tree[M][30],cnt[M][30];
int rng(int f,int t,int ch){
  if(t<f) return 0;
 return vis[t][ch]-(f?vis[f-1][ch]:0);
}
int id=1;
void insertt(string word,int chh){

   int node=1;

   for(int i=0;i<sz(word);i++){
    int ch=word[i]-'a';
    if(tree[node][ch]==0){
        tree[node][ch]=++id;
    }
    node = tree[node][ch];
   }
   cnt[node][chh]++;
}
void query(string word,int cid,int ex){

   int node=1;
   for(int i=0;i<sz(word);i++){
    int ch=word[i]-'a';

    for(int j=0;j<26;j++){
        if(rng(0,cid,j)==0||(cid==0&&j==ex)) continue;
        ans+= cnt[node][j];
    }
    node= tree[node][ch];
    cid--;
   }
   for(int j=0;j<26;j++){
        if(rng(0,cid,j)==0||(cid==0&&j==ex)) continue;
        ans+= cnt[node][j];
    }
}

int main(){
    GO();
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i];
        string ss="";
        int siz=sz(s[i]);
        for(int j=siz-1;j>=1;j--) ss+=s[i][j];
        insertt(ss,s[i][0]-'a');
    }

    for(int i=0;i<n;i++){

        int siz=sz(s[i]);
        string ss="";
        for(int j=0;j<siz;j++){
            for(int k=0;k<26;k++) vis[j][k]=(j-1>=0?vis[j-1][k]:0);
            vis[j][s[i][j]-'a']++;
        }
        for(int j=siz-1;j>=1;j--) ss+=s[i][j];
        query(ss,siz-1,s[i][0]-'a');
    }

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
























































































































































































































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

using namespace std;

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

    double x, h;
    while(1){
        cin >> x >> h;
        if(x == 0 && h == 0){
            break;
        }
        cout << fixed << (x * sqrt(x * x / 4 + h * h) / 2) * 4 + x * x << endl;
    }

    return 0;
}

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

using namespace std;

int main(void)
{
	int a,b,x;

	cin >> a >> b >> x;

	x-=a;

	if(x>b || x<0)
	{
		cout << "NO" << '\n';
	}
	else
	{
		cout << "YES" << '\n';
	}

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  ll n;
  map<string, ll> m;
  cin >> n;
  rep(i, n) {
    string s;
    cin >> s;
    sort(ALL(s));
    if (m.find(s) == m.end()) {
      m[s] = 1;
    } else {
      m[s]++;
    }
  }
  ll ans = 0;
  for (auto& x : m) {
    if (x.second > 1) {
      ans += (x.second) * (x.second - 1) / 2;
    }
  }
  cout << ans << endl;
  return 0;
}


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

// const int MAX_M = 1e5;
// const int MAX_V = 1e9;
// int N, M;
// int a[MAX_N], b[MAX_N];

int main(){
    int a;
    cin >> a;
    a %= 10;
    if(a == 2 || a == 4 || a == 5 || a == 7 || a == 9){
        cout << "hon" << endl;
    }else if(a == 0 || a == 1 || a == 6 || a == 8){
        cout << "pon" << endl;
    }else if(a == 3){
        cout << "bon" << endl;
    }

    // cout << a << endl;
}

Measured memory_bytes: 3636
def max(a,b);       a > b ? a : b                              end
def min(a,b);       a < b ?  a : b                             end
def swap(a,b);      a, b = b, a                                end

n = gets.to_s.to_i
# n,m = gets.to_s.split.map{|e|e.to_i}
a = gets.to_s.split.map{|e|e.to_i-1}
# m = Array.new(n){ gets.to_s.split.map{|e|e.to_i} }
# s = gets.to_s.chomp

s = a.tally

(0...n).each do |t|
  puts s[t] || 0
end

#puts s

Measured memory_bytes: 39688
fun main(args : Array<String>) {
    val (a, b) = readLine()!!.split(" ").map { it.toInt() }

    if (a <= 0 && b >= 0) {
        println("Zero")
        return
    }

    if (a > 0) {
        println("Positive")
        return
    }

    if (a == b || (b - a + 1) % 2 == 0) {
        println("Positive")
    } else {
        println("Negative")
    }
}

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

int n;
vector<int> s(1000000);

int binarySearch(int key){
  int left = 0;
  int right = n;

  while(left < right){
    int mid = (left + right) / 2;

    if(key == s[mid]) return 1;

    else if(key < s[mid]) right = mid;

    else left = mid + 1;

  }

    return 0;

}

int main()
{
  int q, k, sum = 0;

  cin >> n;
  for(int i = 0; i < n; i++) cin >> s[i];

  cin >> q;
  for(int i = 0; i < q; i++){
    cin >> k;
    if(binarySearch(k)) sum++;
  }

  cout << sum << endl;

  return 0;

}



Measured memory_bytes: 6620
n=int(input())
l=list(map(int,input().split()))

m=[0]*n
a=99999999
for i in range(n):
    if l[i]<a:
        m[i]=l[i]
        a=l[i]
    else:
        m[i]=a
ans=0
for j in range(n):
    if l[j]<=m[j]:
        ans+=1

print(ans)

Measured memory_bytes: 75600
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
#define yn(x) puts((x ? "Yes" : "No"))
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  cin>>S;
  cout<<(S=="ABC" ? "ARC" : "ABC")<<endl;
  ;
}
void solve() {
  ;
  ;
}
signed main() {
  cout << setprecision(12);
  input();
  solve();
  return 0;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int[] num = new int[4];
		
		boolean go = true;

		while(sc.hasNext()){
			int[] n = new int[3];
			for(int i=0;i<3;i++){
				n[i] = sc.nextInt();
			}
			Arrays.sort(n);
			if(n[0]+n[1]<=n[2])go=false;
			if(go==true){
				if(n[0]*n[0] + n[1]*n[1] == n[2]*n[2]){
					num[1]++;
				}else if(n[0]*n[0] + n[1]*n[1] > n[2]*n[2]){
					num[2]++;
				}else if(n[0]*n[0] + n[1]*n[1] < n[2]*n[2]){
					num[3]++;
				}
				num[0]++;
			}
		}
		System.out.println(num[0] + " " + num[1] + " " + num[2] + " " + num[3]);
	}
}

Measured memory_bytes: 23284
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> S(n+1,0);
  ll maxi = 0;
  for (int i = 1; i <= n; ++i) {
    S[i] += a[i-1];
    S[i] += S[i-1];
    chmax(maxi, S[i]);
  }
  unordered_map<ll,ll> cnt;
  ll ans = 0;
  for (int i = n; i >= 0; --i) {
    if (cnt.count(S[i]) == 0) cnt[S[i]] = 0;
    cnt[S[i]]++;
  }
  for (auto p : cnt) { //s_l == s_r
    if (p.second >= 2) {
      ans += (p.second)*(p.second-1)/2;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 11592
#include <bits/stdc++.h> 
using namespace std ; 
#define ll long long int 
#define pb push_back
#define ff first 
#define dobara(i,a,b) for(int (i) = (a); (i) < (b); (i)++)
#define ss second 
#define S(x) scanf("%d",&x) 
#define SL(x) scanf("%lld",&x)
#define M 1000000007
#define sz(x) (int)x.size()
#define all(a) (a).begin(),(a).end()
#define N 100005 
ll dp[N][20] ;
string s  ; 
int n ; 

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;  
  
    x = x % p;  
    while (y > 0) 
    { 
         
        if (y & 1) 
            res = (res*x) % p; 
  
        y = y>>1;  
        x = (x*x) % p;   
    } 
    return res; 
} 
  

ll f(int idx , int rem){
	
	if(idx == n){
		//cout<<rem<<endl; 
		if(rem == 5){
			return 1LL ; 
		}
		return 0 ; 
	}
    
    if(dp[idx][rem] != -1){
    	return dp[idx][rem] ; 
    } 

    ll res = 0 ; 

    if(s[idx] == '?'){
    	for(ll i=0;i<=9;i++){
    		ll p = power(10LL , n - idx - 1,13	) ;  
    		p = (p*i)%13 ;  
    		p = (rem + p)%13 ; 
    		//cout<<p<<endl;
    		res = (res + f(idx + 1 , p))%M ; 
    	}
    }
    else{
    	ll x = (s[idx] - '0') ; 
    	//cout<<x<<endl;
    	ll p = power(10LL , n - idx - 1 , 13) ; 
    	//cout<<p<<endl;
    	p = (p*x)%13  ;  
    	p = (p + rem)%13 ; 
    	res = (res + f(idx + 1 , p))%M ; 
    }
    //cout<<res<<endl ; 
    return dp[idx][rem] = res ; 
}

int main(){
	cin>>s ; 
	n = s.size() ; 
    memset(dp , -1 , sizeof(dp)) ; 
	ll ans = f(0 , 0) ;
	cout<<ans<<"\n" ; 
}

Measured memory_bytes: 24064
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 105
#define MAXK 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,k,a[MAXN];
int dp[MAXN][MAXK],sum[MAXK];
void add(int &a,int b) {a+=b; if(a>=MOD) a-=MOD;}
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    dp[n+1][0]=1;
    for(int i=n;i>=1;i--)
    {
        memset(sum,0,sizeof(sum));
        sum[0]=dp[i+1][0];
        for(int j=1;j<=k;j++) {sum[j]=sum[j-1]; add(sum[j],dp[i+1][j]);}
        for(int j=0;j<=k;j++)
        {
            int l=max(0,j-a[i]),r=j;
            if(l==0) dp[i][j]=sum[r]; else dp[i][j]=(sum[r]-sum[l-1]+MOD)%MOD;
        }
    }
    printf("%d\n",dp[1][k]);
    return 0;
}



Measured memory_bytes: 40832
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  char C;
  cin>>C;
  
  int a=0;
  a=C;
  ++a;
  char ans=char(a);
  
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int x;
    cin >> x;
    cout << 1 - x << endl;
}




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

int main(){
  string s,t,u;
  int n,i,j;
  cin>>s>>t;
  n=s.length();
  
  for(i=0;i<n;i++){
    u="";
    for(j=0;j<n;j++) u+=s.at((n-i+j)%n);
    if(t==u) break;
  }
  
  if(i<n) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 3624