akhauriyash/Code-Regression huggingface dataset:
<?php
list($h, $w) = ints();
for ($i = 0; $i < $h; ++$i) list($s[]) = strs();
for ($i = 0; $i < $h; ++$i) {
    for ($j = 0; $j < $w; ++$j) {
        if ($s[$i][$j] === '#') {
            $d[$i][$j] = 0;
            continue;
        }
        if ($i > 0 && $s[$i - 1][$j] === '#') $d[$i - 1][$j] = 0;
        if ($j > 0 && $s[$i][$j - 1] === '#') $d[$i][$j - 1] = 0;
        $d[$i][$j] = min(INF, ($d[$i - 1][$j] ?? INF) + 1, ($d[$i][$j - 1] ?? INF) + 1);
    }
}
// var_dump($d);
for ($i = $h - 1; $i >= 0; --$i) {
    for ($j = $w - 1; $j >= 0; --$j) {
        if ($s[$i][$j] === '#') continue;
        $d[$i][$j] = min($d[$i][$j], ($d[$i + 1][$j] ?? INF) + 1, ($d[$i][$j + 1] ?? INF) + 1);
    }
}
// var_dump($d);
$max = 0;
for ($i = 0; $i < $h; ++$i) $max = max($max, max($d[$i]));
echo $max;
function strs(): array
{
    return explode(' ', trim(fgets(STDIN)));
}
function ints(): array
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 49488
max_n = 999999
?´???°s = Array.new(max_n + 1, true)
?´???°?????°list = Array.new(max_n + 1, 0)

max = Math.sqrt(max_n).to_i

?´???°s[0] = ?´???°s[1] = false

(2..max_n).each do |x|
  next unless ?´???°s[x]

  k = 2 * x
  while k <= max_n
    ?´???°s[k] = false
    k += x
  end
end

sum = 0
(2..max_n).each do |x|
  sum += 1 if ?´???°s[x]
  ?´???°?????°list[x] = sum
end

while line = STDIN.gets
  n = line.to_i
  puts ?´???°?????°list[n]
end

Measured memory_bytes: 24164
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
ll n,a,b;
int main()
{
	read(n),read(a),read(b);
	if(a>b) swap(a,b);
	if((b-a)%2==0) return print((b-a)/2,'\n'),0;
	print(min(a+(b-a-1)/2,n-b+1+(b-a-1)/2),'\n');
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

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 E = sc.nextInt();
        int INF = 1_500_000_000;
        int[][] e = new int[N][N];
        for (int i=0;i<N;i++) {
            for (int j=0;j<N;j++) {
                e[i][j] = INF;
            }
        }
        for (int i=0;i<E;i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            int d = sc.nextInt();
            e[s][t] = d;
        }

        long[][] dp = new long[(1<<N)][N];
        long ans = INF;
        for (int s=0;s<N;s++) {
            for (int i=0;i<(1<<N);i++) {
                for (int j=0;j<N;j++) {
                    dp[i][j] = INF;
                }
            }
            dp[(1<<s)][s] = 0;
            for (int i=0;i<(1<<N);i++) {
                for (int j=0;j<N;j++) {
                    for (int k=0;k<N;k++) {
                        if (e[j][k]==INF) continue;
                        if (((i>>k)&1)==1) continue;
                        dp[i+(1<<k)][k] = Math.min(dp[i+(1<<k)][k], dp[i][j]+e[j][k]);
                        if (i+(1<<k)==(1<<N)-1) ans = Math.min(ans, dp[i][j]+e[j][k]+e[k][s]);
                    }
                }
            }
        }
        System.out.println(ans==INF?-1:ans);
    }
}


Measured memory_bytes: 34276
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001001001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x - a) < abs(x - b))
    {
        cout << 'A' << endl;
    }
    else if (abs(x - a) > abs(x - b))
    {
        cout << 'B' << endl;
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
};

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

int main(){
  int d,n;
  cin >> d >> n;
  if(n==100){
    n=101;
  }
  if(d==0){
    cout << n << endl;
  }
  if(d==1){
    cout << 100*n << endl;
  }
  if(d==2){
    cout << 10000*n << endl;
  }
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let  s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

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

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

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

fn d2c(num: u32) -> char {
    std::char::from_digit(num, 10).unwrap()
}

fn bit_sum(bits: u32, nums: Vec<i32>) -> i32{
    let mut bits = bits;
    let mut count: usize = 0;
    let mut sum: i32 = 0;
    while bits != 0 {
        if bits & 1 == 1 {sum = sum + nums[count]}
        bits /= 2;
        count += 1;
    }
    sum
}

fn bit_last(bits: u32) -> Option<u32>{
    let mut count = 0;
    let mut bits = bits;
    if bits == 0 { return None; }
    else {
        while bits != 1{
            bits /= 2;
            count += 1;
        }
    }
    Some(count)
}

fn main() {
    abc104_c();
}

fn abc104_c(){
    input!{
        d: usize, g: u32,
        list: [(u32, u32); d]
    }
    let mut scores = Vec::new();
    let mut min = 100000;
    for (i, (p, c)) in list.into_iter().enumerate() {
        scores.push((p, ((i as u32) + 1) * 100 * p + c));
    }
    for i in 0..(1<<d) {
        let score = bit_sum(i, scores.iter().map(|x| x.1 as i32).collect()) as u32;
        let mut count = bit_sum(i, scores.iter().map(|x| x.0 as i32).collect());
        if score >= g && min > count {min = count;}
        if score < g {
            if let Some(max) = bit_last(i^((1<<d) - 1)){
                for j in 1..scores[max as usize].0{
                    let temp = (score as u32) + j * (max + 1) * 100;
                    if temp >= g {
                        count += j as i32;
                        if min > count {min = count;}
                        break;
                    }
                }
            }
        }
    }
    println!("{}", min);
}

Measured memory_bytes: 4352
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

string field[30];
int x,y,d;
int h,w;
int xxx[]={0,0,-1,1},yyy[]={-1,1,0.0};

void move(){
	int xx=x+xxx[d],yy=y+yyy[d];
	if(xx<0||w<=xx||yy<0||h<=yy)return;
	if(field[yy][xx]=='.'){x=xx;y=yy;}
	return;
}

void shoot(){
	int xx=x+xxx[d],yy=y+yyy[d];
	for(;;xx+=xxx[d],yy+=yyy[d]){
		if(xx<0||w<=xx||yy<0||h<=yy)break;
		if(field[yy][xx]=='*'){field[yy][xx]='.';break;}
		if(field[yy][xx]=='#')break;
	}
}

int main() {
	int t=in();
	int i;
	bool first=true;
	for(i=0;i<t;i++){
		if(!first)cout<<endl;
		first=false;
		cin>>h>>w;
		int j;
		for(j=0;j<h;j++){
			cin>>field[j];
		}
		int k;
		for(j=0;j<h;j++){
			for(k=0;k<w;k++){
				if(field[j][k]=='^'){x=k;y=j;d=0;}
				if(field[j][k]=='v'){x=k;y=j;d=1;}
				if(field[j][k]=='<'){x=k;y=j;d=2;}
				if(field[j][k]=='>'){x=k;y=j;d=3;}
			}
		}
		field[y][x]='.';
		int n;
		string ope;
		cin>>n>>ope;
		for(j=0;j<n;j++){
			if(ope[j]=='U'){d=0;move();}
			if(ope[j]=='D'){d=1;move();}
			if(ope[j]=='L'){d=2;move();}
			if(ope[j]=='R'){d=3;move();}
			if(ope[j]=='S'){
				shoot();
			}
		}
		string c="^v<>";
		field[y][x]=c[d];
		for(j=0;j<h;j++)cout<<field[j]<<endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	int N, A;
	cin >> N >> A;

	if (N % 500 - A <= 0)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())

bool solve() {
    ll n;
    cin >> n;
    
    ll sum = 0;
    vector<ll> a(n);
    for (auto& ai : a) { cin >> ai; sum += ai; }
    ll tmp = n * (n + 1) / 2;
    ll k = sum / tmp;
    if (sum % tmp != 0) return 0;
    
    vector<ll> b(n);
    rep(i, n) { b[i] = a[(i + 1) % n] - a[i]; b[i] -= k; }
    // outa(b, n);
    
    sum = 0;
    rep(i, n) {
        if (b[i] % n == 0 && b[i] < 0) sum += -b[i] / n;
        else if (b[i] != 0) return 0;
    }
    // outa(b, n);
    
    if (sum == k) return 1;
    return 0;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    if (solve()) out("YES");
    else out("NO");
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7+1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/


int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	ans = 100 * a + 10 * b + c;
	if(ans%4==0) {
		cout << "YES" << endl;
	}else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>


int main() {
	long long int a, b, k; std::cin >> a >> b >> k;
	auto et = std::min(a, k);
	auto at = std::min(b, k - et);
	std::cout << a - et << ' ' << b - at << std::endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

typedef vvi graph;

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

    int N, Q; cin >>N>>Q;
    graph g(N);
    vll cnt(N, 0);
    vll px(N, 0);
    rep(i, N-1) {
        int a, b; cin >> a >> b; a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i, Q) {
        int p, x; cin >> p >> x; p--;
        px[p] += x;
    }

    vector<bool> done(N, false);
    cnt[0] = px[0];
    done[0] = true;
    queue<pair<int, ll>> q;
    q.push(make_pair(0, px[0]));
    while (!q.empty()) {
        pair<int, ll> _p = q.front(); q.pop();
        int v = _p.first;
        ll add = _p.second;
        rep(i, g[v].size()) {
            if (done[g[v][i]]) continue;
            done[g[v][i]] = true;
            cnt[g[v][i]] = add + px[g[v][i]];
            q.push(make_pair(g[v][i], add + px[g[v][i]]));
        }
    }

    cout_h(cnt);
}


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

int main()
{
    ll n, d;
    cin >> n >> d;

    vector<ll> x(n), y(n);
    rep (i, n)
        cin >> x[i] >> y[i];

    int ans = 0;
    rep (i, n)
    {
        ll temp = x[i] * x[i] + y[i] * y[i];
        if (temp <= d * d)
            ans++;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6424
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#include <assert.h>
#define FOR(i,a,n) for(i=(a);i<(n);i++)
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define SIZE 100005
#define LOCAL
#ifdef LOCAL
    #define DEBUG(...) printf(" "__VA_ARGS__)
#else
    #define DEBUG(...)
#endif /* LOCAL */
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
int digitsum(int n){
	int res=0;
	while(n>0){
		res+=n%10;
		n/=10;
	}
	return res;
}
int main(void)
{
	int n,res=INF,t,i;
	scanf("%d",&n);
	FOR(i,1,n){
		t=digitsum(i)+digitsum(n-i);
		res=MIN(res,t);
	}
	printf("%d\n",res);
	return 0;
}
    
    
    


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1000000007;

const int M = pow(10, 6) + 2;

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  vector<int> ans(M);

  rep(i,n) {
    int x = a[i];
    if (ans[x] != 0) {
      ans[x] = 2;
      continue;
    }
    for (int j = x; j < M; j += x) {
      ans[j]++;
    }
  }
  int res = 0;
  rep(i,n) {
    int x = a[i];
    if (ans[x] == 1) res++;
  }
  cout << res << endl;
}

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

Measured memory_bytes: 8004
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
vector<ll> a;
ll n,k;

ll countltx(ll x){
    ll ans = 0;
    for(int i=0;i<n;i++){
        ll f = a.at(i);
        if(f<0){
            long double t = x/(long double)f;
            auto it = upper_bound(a.begin(),a.end(),t);
            ll num = it - a.begin();
            ans += n-num;
            if(num == 0) ans--;
            else if(*it<=f) ans--;
        }else if(f>0){
            long double t = x/(long double)f;  
            auto it = lower_bound(a.begin(),a.end(),t);
            ll num = it - a.begin();
            ans += num;
            if(num == n) ans--;
            else if(*it>f) ans--;
        }else{
            if(0<x) ans += n-1;            
        }
    }
    return ans/2;
}

int main(){
    cin >> n >> k;
    a.resize(n);
    rep(i,n) cin >> a.at(i);
    sort(a.begin(),a.end());
    
    ll left = -LINF, right = LINF;
    ll center = (left+right)/2;
    
    while(right-left>1){
        if(countltx(center)<k) left = center; else right = center;
        center = (left+right)/2;
    }
    cout << left << endl;    
}


Measured memory_bytes: 1792
open Scanf
open Printf

let flip f x y = f y x

let rec range a b = if a >= b then [] else a :: range (a+1) b

let read_int () = scanf " %d" (fun x -> x)
let rec read_ints n = if n = 0 then [] else let i = read_int () in i :: read_ints (n-1)

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f
let rec for_iter_ a b f = if a >= b then () else (f a; for_iter_ (a+1) b f)

let list_of_string str =
  let len = String.length str in
  let rec f i = if i >= len then [] else str.[i] :: f (i+1) in
  f 0

let lim_width = 16010
let cp = lim_width / 2

type axis = X | Y

let swt ax = match ax with X -> Y | Y -> X

let rec parse ax acc xs =
  match xs with
  | [] -> [(acc, ax)]
  | (x::xs') ->
      if x = 'T' then (acc, ax) :: parse (swt ax) 0 xs'
      else parse ax (acc+1) xs'

let () =
  let s0::_ as s = read_line () |> list_of_string in
  let [xp; yp] = read_ints 2 in
  let f_first = s0 = 'F' in
  let steps = parse X 0 s in
  let xs' = steps |> List.filter (fun z -> snd z = X) |> List.map fst in
  let (x0, xs) = match xs' with
  | (z::zs) when f_first -> (z, zs)
  | _                    -> (0, xs') in
  let ys = steps |> List.filter (fun z -> snd z = Y) |> List.map fst in

  let dp = Array.make lim_width false in
  let bak = Array.make lim_width false in

  let result = List.for_all (fun (ss, src, dst) ->
    Array.fill dp 0 lim_width false; dp.(src) <- true;
    List.iter (fun s ->
      Array.fill bak 0 lim_width false;
      for_iter_ 0 lim_width (fun i ->
        if dp.(i) then (
          if i-s >= 0        then bak.(i-s) <- true;
          if i+s < lim_width then bak.(i+s) <- true));
      for_iter_ 0 lim_width (fun i ->
        dp.(i) <- bak.(i));
    ) ss;
    dp.(dst)) [(xs, cp+x0, cp+xp); (ys, cp, cp+yp)] in

  print_endline @@ if result then "Yes" else "No"


Measured memory_bytes: 3840
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();

        int[] list = new int[N];
        int min = (int)1e5;
        int mid = 0;
        for(int i=0; i<N; i++) {
            int score = i+L;
            list[i] = score;
            if(score*score < min*min) {
                mid = i;
                min = score;
            }
        }
        System.out.println(IntStream.of(list).sum()-min);
        
    }
}

Measured memory_bytes: 28628
#include <iostream>
using namespace std;
typedef long long ll;
ll n,dp[300][300],ans,bns,ch[300][300];
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>dp[i][j];
            ans+=dp[i][j];
        }
    }
    ans/=2;
    for(int k=0;k<n;k++){
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if(i==j||j==k||k==i)continue;
                if(dp[i][j]>dp[i][k]+dp[k][j]){cout<<-1<<endl;return 0;}
                if(dp[i][j]==dp[i][k]+dp[k][j]){
                    //bns+=dp[i][j];
                    ch[i][j]=1;
                    //cout<<dp[i][j]<<endl;
                }
                //dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(ch[i][j])bns+=dp[i][j];
            //cout<<dp[i][j]<<" ";
        }
        //cout<<endl;
    }
    bns/=2;
    cout<<ans-bns<<endl;
}


Measured memory_bytes: 1664
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
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;}

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i,n) cin >> a[i];
	sort(a.begin(), a.end());
	
	ll res=0;
	{
		vector<int> ans(n,-1);
		int index=0;
		FOR(i,1,n){
			if(i%2==1){
				ans[i] = a[index];
				index++; 
			}
		}
		ans[0] = a[index];
		index++;
		for(int i=n-1; i>0; i--){
			if(i%2==0){
				ans[i] = a[index];
				index++; 
			}
		}
		REP(i,n-1) res += abs(ans[i]-ans[i+1]);
	}
	{
		vector<int> ans(n,-1);
		int index=n-1;
		FOR(i,1,n){
			if(i%2==1){
				ans[i] = a[index];
				index--; 
			}
		}
		ans[0] = a[index];
		index--;
		for(int i=n-1; i>0; i--){
			if(i%2==0){
				ans[i] = a[index];
				index--; 
			}
		}
		ll r = 0;
		REP(i,n-1) r += abs(ans[i]-ans[i+1]);
		chmax(res, r);
	}
	
	cout << res << endl;
	
	
	return 0;
}

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

int main()
{
    int N, M = 0; 
    cin >> N >> M;
    
    vector<int> X{};
    vector<int> distance{};

    for(int i = 0; i < M; i++)
    {
        int a;
        cin >> a;
        X.emplace_back(a);
    }

    if(M <= N)
    {
        cout << 0 << endl;
        return 0;
    }

    sort(X.begin(), X.end());
    
    for(int i = 0; i < M - 1; i++)
    {
        distance.emplace_back(X[i + 1] - X[i]);
    }

    sort(distance.begin(), distance.end());

    int len = X[M - 1] - X[0];

    for(int i = 0; i < N - 1; i++)
    {
        len -= distance[M - 2 - i];
    }
    cout << len << endl;
    return 0;
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int w = Integer.parseInt(input.next());
		int h = Integer.parseInt(input.next());
		int x = Integer.parseInt(input.next());
		int y = Integer.parseInt(input.next());
		int r = Integer.parseInt(input.next());
		
		if (x-r >= 0 && x+r <= w) {
			if (y-r >= 0 && y+r <= h) {
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
		}else{
			System.out.println("No");
			
		}
	}
}

Measured memory_bytes: 26320
#include <stdio.h>
int main(){
  char s[5];
  scanf("%s",s);
  if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2]||
     s[0]==s[2]&&s[1]==s[3]&&s[2]!=s[3]||
     s[0]==s[3]&&s[1]==s[2]&&s[0]!=s[1])printf("Yes");
  else printf("No");
     
}

Measured memory_bytes: 128
def memoize(f):  
    cache = {}  
    def helper(x):  
        if x not in cache:              
            cache[x] = f(x)  
        return cache[x]  
    return helper 
         
@memoize
def fib(n):
    if n in (0, 1):
        return 1
    else:
        return fib(n - 1) + fib(n - 2)
 
print(fib(int(input())))

Measured memory_bytes: 6728
#include<bits/stdc++.h>
 
using namespace std;
 
#define  fastio                ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  f                     first                 
#define  s                     second
#define  endl                  "\n"
#define  pb                    push_back  
#define  mset(a,x)             memset(a,x,sizeof(a))             
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  unordered_map<ll,pll>  um;
typedef  vector<pll>           vpll;
 
const ll   N     =  2e5+5;
const ll   mod   =  1e9;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;

ll test=1,n,x;
vpll a;
ll dp[2005][2005];

ll mem(ll i,ll l,ll r){
	if(l > r)
		return 0;
	if(dp[l][r] != -1)
		return dp[l][r];
	ll ans1 = a[i].f*abs(a[i].s-l)+mem(i+1,l+1,r);
	ll ans2 = a[i].f*abs(r-a[i].s)+mem(i+1,l,r-1);
	dp[l][r] = max(ans1,ans2);
	return dp[l][r];
}

void solve(){
	mset(dp,-1);
	cin>>n;
	for(int i = 0; i < n; i++){
	    cin>>x;
	    a.pb({x,i});
	}
	sort(a.begin(),a.end());
	reverse(a.begin(), a.end());
	cout<<mem(0,0,n-1)<<endl;
}

int main(){
    fastio;
    //cin>>test;
    for(int i = 1; i <= test; i++){
        //cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 35216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a,b;
    string s,t,u;
    cin>>s>>t>>a>>b>>u;
    if(s==u)
        cout<<a-1<<' '<<b<<endl;
    else
        cout<<a<<' '<<b-1<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n=0;
  double num1=0,num2=0;
  cin >> n;
  double x[n] = {0};
  string u[n];
  for(int i=0;i < n;i++){
    cin >> x[i] >> u[i]; 
  }
  for(int i=0;i<n;i++){
    if(u[i] == "JPY"){
      num1+=x[i];
    }else{
      num2+=x[i];
    }
  }
  cout << num1+num2*380000.0 << "\n";

}


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

int main()
{
  // int��v�f�Ɏ��D�揇�ʕt���L���[�B
  // �~���ɏ�������
  std::priority_queue<int64_t> que;
  int N,M;
	int64_t A;
  cin >> N >> M;
	for(int i=0;i<N;i++){
		cin >> A;
		que.push(A);
		
	}
  
	while(M>0){
		que.push(que.top()/2);
		que.pop();
		
		M--;
	}


  // �������ɏo�͂���
	int64_t sum=0;
  while (!que.empty()) {
    //std::cout << que.top() << std::endl;
  	sum += que.top();
  	que.pop();
  }
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000000000000



int main(){
	
	int N;
	cin>>N;
	
	if(N==0){
		cout<<0<<endl;
		return 0;
	}
	
	string S = "";
	
	while(N!=0){
		if(N%2!=0){
			S += '1';
			N--;
		}
		else{
			S += '0';
		}
		N/=-2;
	}
	
	reverse(S.begin(),S.end());
	
	for(int i=0;i<S.size();i++){
		if(S[i]=='1'){
			cout<<S.substr(i)<<endl;
			return 0;
		}
	}
	
    return 0;
}


Measured memory_bytes: 256
length, weight = map(int, input().split(" "))
dp = [0 for n in range(weight + 1)]

for i in range(length):
    v, w = map(int, input().split(" "))

    dp[w] = max(v, dp[w])
    for j in range(weight):
        if dp[j] and j + w <= weight:
            dp[j + w] = max(dp[j] + v, dp[j + w])

print(max(dp))



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

int main()
{
  int K;
  int n[3];
  cin>>n[0]>>n[1]>>n[2];
  cin>>K;
  sort(n,n+3);
  for(int i=0;i<K;++i){
    n[2]*=2;
  }
  cout<< (n[0]+n[1]+n[2]) <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SORTR(x) sort(ALLR(x));
#define SORT(x) sort(ALL(x));
#define SUM(x) accumulate(ALL(A), 0);
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef vector<char> VC;
typedef vector<VC> VVC;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}


void Main()
{
	ll R,G,B,N;
	ll result=0;
	cin>>R>>G>>B>>N;
	REP(r,N+1){
		REP(g,N+1){
			ll mod=N-(R*r+G*g);
			if(mod%B==0&&mod>=0)result++;
		}
	}

	cout << result << "\n";
	return;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
using namespace std;

typedef long long ll;
typedef pair<int, int> p;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9


int leastStep(int x) {
	int step = 1;
	while (step*(step + 1) / 2 < x) step++;
	return step;
}

int main() {
	int x;
	cin >> x;
	cout << leastStep(x) << endl;
	return 0;
}

Measured memory_bytes: 256
N = gets.to_i
H = gets.split.map(&:to_i)

max = 0
cnt = 0
(N-1).times do |i|
  if H[i] < H[i+1]
    max = [cnt, max].max
    cnt = 0
  else
    cnt += 1
  end
end
puts [cnt, max].max


Measured memory_bytes: 11012
n,y=map(int,input().split())
y //= 1000
a = False
for i in range(n+1):
    for j in range(n-i+1):
        if i*10 + j*5 + (n-i-j) == y and i+j <= n:
            print(i, j, (n-i-j))
            a = True
            break
    if a:
        break
if not a:
    print(-1,-1,-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define fi first
#define ii pair<int,int>
#define iil pair<ll,ll>
#define se second
#define ld long double
#define mod 1000000007
#define popcount __builtin_popcountll
#define x0 zxcxzcsacasd
#define x1 ghfghujfgfg
#define y0 olkjhdnncvcv
#define y1 bhvgrewm345345435
#define debug(x) std::cerr<<#x<<": "<<(x)<<'\n'
#define all(x) x.begin(), x.end()
using namespace std;

int main(){
	int n;
	cin>>n;
	vector<int>a(n), b(n), amid(n);
	vector<int>cnt(n + 1, 0);
	for(auto &x:a)scanf("%d", &x), cnt[x]++;
	for(auto &x:b)scanf("%d", &x), cnt[x]++;
	for(int i = 1;i<=n;i++){
		if(cnt[i]>n){
			cout<<"No"<<endl;
			return 0;
		}
	}
	reverse(all(b));
	int l = 0, r = n-1;
	for(int i=0;i<n;i++){
		if(a[i]==b[i]){
			if(b[l]!=a[i] && a[l]!=a[i]){
				swap(b[l], b[i]);
				l++;
			}else{
				swap(b[r], b[i]);
				r--;
			}
		}
	}
	cout<<"Yes"<<endl;
	for(int i=0;i<n;i++){
		//assert(a[i]!=b[i]);
		cout<<b[i]<<" ";
	}
}

Measured memory_bytes: 6408
def mergesort(A):
	N = len(A)
	if N==1:
		return A
	A1 = mergesort(A[:int(N/2)])
	A2 = mergesort(A[int(N/2):])
	p = 0
	p1, p2 = 0, 0
	A_result = []
	while True:
		if p1>=len(A1):
			A_result = A_result+A2[p2:]
			break
		if p2>=len(A2):
			A_result = A_result+A1[p1:]
			break
		if A1[p1]<A2[p2]:
			A_result.append(A1[p1])
			p = p+1
			p1 = p1+1
		else:
			A_result.append(A2[p2])
			p = p+1
			p2 = p2+1
		if p==N:
			break
	return A_result

N = int(input())
A = list(map(int, input().split()))
A = mergesort(A)

count = 0
for i in range(N-1):
	if A[i]==A[i+1]:
		count = count+1
ans = N-count
if ans%2==0:
	ans = ans-1
print(ans)


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

int main() {
	long long A; cin >> A;
	string B; cin >> B;
	int C = (B[0] - '0') * 100 + (B[2] - '0') * 10 + (B[3] - '0');
	cout << A*C/100 << endl;
}

Measured memory_bytes: 3624
import java.io.*;
// import java.math.*;
// import java.util.*;
// import java.util.Map.*;
// import java.util.stream.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        int A, B;
        A = Integer.parseInt (arr[0]);
        B = Integer.parseInt (arr[1]);
        int ans = 0;
        int cur = 1;
        while (cur < B) {
            ans++;
            cur += A - 1;
        }
        System.out.println (ans);
        return;
    }
}

Measured memory_bytes: 32696
//Volume0-0054
import java.util.Scanner;
 
public class Main {

    public static void main(String[] args) {
    	
    	//declare    	
    	int      a,b,n,div,mod,s;
    	String[] str;
    	
    	//input
    	Scanner sc = new Scanner(System.in);
    	while(sc.hasNext()){
    		str = sc.nextLine().split("\\s");
    		a   = Integer.parseInt(str[0]);
    		b   = Integer.parseInt(str[1]);
    		n   = Integer.parseInt(str[2]);
    		
    		//calculate
    		s = 0;
    		mod = a % b;
    		while(n-- > 0){
    			mod *= 10;
    			div  = mod / b;
    			mod %= b;
    			s   += div;
    		}
    		//output
    		System.out.println(s);
    	}
    }
}

Measured memory_bytes: 17256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sync ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD  1000000007 
int powm(int base,int exp,int mod=MOD) {int ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
int32_t main()
{
  	sync
	int a,b;
	cin>>a>>b;
	int ans = a*b/__gcd(a,b);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
N=int(input())
sum_all=N*(N+1)//2
sum_Fizz=3*(N//3)*(N//3+1)//2
sum_Buzz=5*(N//5)*(N//5+1)//2
sum_FizzBuzz=15*(N//15)*(N//15+1)//2
print(sum_all-sum_Fizz-sum_Buzz+sum_FizzBuzz)

Measured memory_bytes: 9120
x, k, d = map(int, input().split(" "))

def y(l): return abs(x + l * d - (k - l) * d)

lf = min(max(0, (k - x / d) / 2), k)
l = int(lf)
if lf - l > 0 and l + 1 <= k:
    print(min(y(l), y(l + 1)))
else:
    print(y(l))


Measured memory_bytes: 9176
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


i64 n, a[2020], k;

i64 sum(i64 x){
	return (x + 1) * x / 2;
}

int main(){
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	i64 ans = 0;
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(a[i] > a[j]){
				if(i < j){
					ans += sum(k);
				}
				else{
					ans += sum(k-1);
				}
				ans %= INF;
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division, print_function
import sys


def main():
    n = int(sys.stdin.readline().strip())
    a = []
    for _ in range(n):
        a.append(int(sys.stdin.readline().strip()))

    visited = set()

    i = 0
    counter = 0
    while True:
        if i in visited:
            print(-1)
            break
        visited.add(i)
        i = a[i] - 1
        counter += 1
        if i == 1:
            print(counter)
            break
    #     pass
    # a[0]
    # if 2 not in a:
    #     print(-1)
    #     return
    # print(n, a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14960
#include<iostream> 
#include<cstdio>
using namespace std;
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	if(a==1||b==1){
		if(a==1&b!=1){
			printf("Alice");
		}
		else if(a!=1&b==1){
			printf("Bob");
		}
		else{
			printf("Draw");
		}
	}
	else{
		if(a>b){
			printf("Alice");
		}
		else if(a<b){
			printf("Bob");
		}
		else{
			printf("Draw");
		}
	}
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
for _ in range(K):
    count_list = [0] * N
    for i, v in enumerate(A_list):
        count_list[i - v if i - v > 0 else 0] += 1
        if i + v + 1 < N:
            count_list[i + v + 1] -= 1
    temp = 0
    flag = True
    for i in range(len(A_list)):
        temp += count_list[i]
        if temp != N:
            flag = False
        A_list[i] = temp
    if flag:
        break

print(*A_list)

Measured memory_bytes: 155732
#include<bits/stdc++.h>
using namespace std;
const int INF = 100100000001;

int n, m;
int s[15];
int d[101];
int dp[1 << 15][101];

int calc(int bit){

    //cout << bit << endl;
    //探索済みなら値return
    if(dp[bit][m] != INF) return dp[bit][m];

    //全部使った時のぬくもり
    int warm = 0;
    for(int i = 0; i < n; i++){
        if(bit & (1 << i)) warm += s[i];
    }

    //bitを1本折るときと、現在のbitを組み合わせる
    for(int i = 0; i < n; i++){
        if(bit & (1 << i)){
            //もしbitが立っていたら
            //bitを折る
            int next_bit = bit & (~(1 << i));
            //dpが最新バージョンに更新
            int dummy = calc(next_bit);

            //これはいい感じですか？
            int temp_sum = 0;
            vector<int> temp_dp(m + 1);
            for(int j = 0; j < m; j++){
                temp_dp[j] = min(dp[next_bit][j], abs(warm - d[j]));
                temp_sum += temp_dp[j];
            }
            temp_dp[m] = temp_sum;

            if(temp_sum < dp[bit][m]){
                //もしいいなら入れ替える
                for(int j = 0; j <= m; j++) dp[bit][j] = temp_dp[j];
            }
        }
    }

    //cout << bit << " " << dp[bit][m] << endl;
    return dp[bit][m];
}

int main(){

    while(1){
        cin >> n >> m;
        if(!n) break;
        for(int i = 0; i < (1 << n); i++){
            for(int j = 0; j <= m; j++){
                dp[i][j] = INF;
            }
        }

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


        //dp初期化
        int sum = 0;
        for(int i = 0; i < m; i++){
            dp[0][i] = d[i];
            sum += d[i];
        }
        dp[0][m] = sum;

        cout << calc((1 << n) - 1) << endl;

        /*for(int i = 0; i < (1 << n); i++){
            for(int j = 0; j <= m; j++){
                cout << dp[i][j] << " ";
            }
            cout << endl;
        }*/


    }
    return 0;
}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = (ll)998244353;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

//functions
   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

//与えられたF2上の行列をAとして、(1 << (M * N - rank(A) - 1)) * ((1 << rank(A)) - 1 )が答え.
const ll MAX_M = 300, MAX_N = 300;
ll N, M;
ll a[MAX_N][MAX_M];

ll rnk(){
   ll r = 0;
   ll i = 0, j = 0;
   while(i < N && j < M){
      //a[i][j] = 0のときは、k = i + 1, ..., N - 1 からa[k][j] != 0なるkを探してきて, i行目とk行目を入れ替える
      if(!a[i][j]){
         FOR(k, i + 1, N){
            if(a[k][j]){
               REP(l, M){
                  swap(a[i][l], a[k][l]);
               }
               break;
            }
         }
      }
      //入れ替えを行ってもa[i][j] = 0のとき（つまりj列目はすべて0のとき)はj列目をスキップ j+1列目にトライ
      if(!a[i][j]){j++; continue;}
      r++;
      //k = i+1,...,N-1行目についてi行目を引く
      FOR(k, i + 1, N){
         ll c = a[k][j];
         REP(l, M){
            a[k][l] += c * a[i][l];
            a[k][l] %= 2;
         }
      }
      i++; j++;
   }
   return r;
}

int main(){
   cin >> N >> M;
   REP(i, N) REP(j, M) cin >> a[i][j];
   ll r = rnk();
/*
   cout << endl;
   REP(i, N){
      REP(j, M){
         if(j) {cout << " ";}
         cout << a[i][j];
      }
      cout << endl;
   }
   cout << "rnk = " << r << endl;
*/
   cout << residue(pow(2ll, N + M - 1, MOD) - pow(2ll, N + M - 1 - r, MOD), MOD) << endl;

}


Measured memory_bytes: 896
a, b= map(int, input().split())
if ((a<0)and(b<0))and((abs(a)+abs(b))%2==0):
    print('Negative')
elif (a>0)and(b>0):
    print('Positive')
elif ((a<0)and(b<0))and((abs(a)+abs(b))%2==1):
    print('Positive')
elif (a==0)or(b==0):
    print('Zero')
else:
    print('Zero')

Measured memory_bytes: 3064
MOD = 10**9+7
n = int(input())
la = list(map(int,input().split()))
L = [-1]*(n+1)
l = 0
for i in range(n+1):
  a = la[i]
  if L[a] == -1:
    L[a] = i
  else:
    l = i - L[a] - 1
    break
 
MAX = n
factorial = [1, 1]
inverse = [0, 1]
inverse_factorial = [1, 1]
for i in range(2,MAX+1):
  factorial.append( (factorial[-1]*i)%MOD )
  inverse.append( (-inverse[MOD%i]*(MOD//i))%MOD )
  inverse_factorial.append( (inverse_factorial[-1]*inverse[-1])%MOD )
 
def C_MOD(n, k):
  if k < 0 or k > n:
    return 0
  k = min(k,n-k)
  return factorial[n] * inverse_factorial[k] * inverse_factorial[n-k] % MOD
 
print(n)
#print((2*C_MOD(n-1,1)-C_MOD(n-1-l,1)+C_MOD(n-1,2)+1)%MOD)
for i in range(2,n+1):
  if n > l+1:
    print((2*C_MOD(n-1,i-1)-C_MOD(n-1-l,i-1)+C_MOD(n-1,i)+C_MOD(n-1,i-2))%MOD)
  else:
    print((2*C_MOD(n-1,i-1)+C_MOD(n-1,i)+C_MOD(n-1,i-2))%MOD)
print(1)

Measured memory_bytes: 26020
def binary_search(nums, key, length):
    left = 0
    right = length - 1
    while left <= right:
        mid = left + (right - left) //2
        if nums[mid] == key:
            return True
        elif nums[mid] < key:
            left = mid + 1
        else:
            right = mid - 1
    return False


n1 = int(input())
nums1 = list(map(int, input().split(' ')))
n2 = int(input())
nums2 = list(map(int, input().split(' ')))
sum = 0 
for i in range(n2):
    flag = binary_search(nums1,nums2[i],n1)
    if flag:
        sum += 1
print(sum)



Measured memory_bytes: 16708
#include<bits/stdc++.h>
#define inf 1000000000000
#define int long long int
#define hell (int)(1e9+7)

using namespace std;

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

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3604
case=0
while True:
    case+=1
    W=input()
    if W==0:break
    print "Case {}:".format(case)
    dp=[0]*1001
    w=[0]*1001
    v=[0]*1001
    n=input()
    for i in xrange(n):
        v[i],w[i]=map(int,raw_input().strip().split(","))
    for i in xrange(n):
        for j in xrange(W,-1,-1):
            if j+w[i]<=W:
                dp[j+w[i]]=max(dp[j+w[i]],dp[j]+v[i])
    print max(dp)
    print dp.index(max(dp))

Measured memory_bytes: 4308
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin>>N;
  vll H(N);
  REP(i,N)cin>>H[i];
  ll height=H[0],ans=1;
  REP2(i,1,N){
    if(H[i]>=height)ans++;
    height = max(height,H[i]);
  }
  cout<<ans;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int count = 0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)!=s.at(s.size()-1-i)){
      count++;
    }
  }
  cout<<count/2<<endl;
  return 0;
}
  

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    deque<int> q;
    REP(i, 0, n) {
        int a; cin >> a;
        if (i % 2 == 0) q.push_back(a);
        else q.push_front(a);
    }

    if (n % 2 == 0) {
        for (auto itr = q.begin(); itr != q.end(); itr++) {
            cout << *itr;
            if (itr == q.end() - 1) cout << endl;
            else cout << " ";
        }
    } else {
        for (auto itr = q.rbegin(); itr != q.rend(); itr++) {
            cout << *itr;
            if (itr == q.rend() - 1) cout << endl;
            else cout << " ";
        }
    }
    return 0;
}


Measured memory_bytes: 2944
#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 a, b, h, m;
    cin >> a >> b >> h >> m;
    double angle = h * 30 + m / 2.0 - m * 6;
    angle = abs(angle);
    while (angle >= 360) angle -= 360;
    if (angle > 180) angle = 360 - angle;
    cout << setprecision(15) << powl((long double)a * a + b * b - cosl(angle * (long double)3.14159265358979 / 180) * 2 * a * b, (long double)0.5) << endl;
    // cout << a * a + b * b << endl;
    // cout << cosl(angle * (long double)3.14159265358979 / 180) << endl;

}


Measured memory_bytes: 4116
N = int(input())
citys = []
SP = []
for i in range(0,N,1):
    S,P = input().split()
    citys.append(S)
    SP.append([S,int(P)])
citys = list(set(citys))
citys.sort()
for i in citys:
    tmp = []
    for j in range(0,N,1):
        if i == SP[j][0]:
            tmp.append([SP[j][1],j])
    tmp.sort(reverse=True)
    for j in tmp:
        print(j[1]+1)


Measured memory_bytes: 38512
N = int(input())
A = list(map(int, input().split()))
'''
1 bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A
2   flag = 1 // 逆の隣接要素が存在する
3   while flag
4     flag = 0
5     for j が N-1 から 1 まで
6       if A[j] < A[j-1]
7         A[j] と A[j-1] を交換
8         flag = 1
'''


def bubbleSort(A, N):
    flag = 1
    count = 0
    while flag:
        flag = 0
        for i in range(N - 1):
            if A[i] > A[i + 1]:
                tmp = A[i]
                A[i] = A[i + 1]
                A[i + 1] = tmp
                flag = 1
                count += 1
    print(' '.join(list(map(str, A))))
    print(count)


bubbleSort(A, N)



Measured memory_bytes: 5612