akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Tag solver = new Tag();
        solver.solve(1, in, out);
        out.close();
    }

    static class Tag {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int A = in.nextInt();
            long V = in.nextInt();
            int B = in.nextInt();
            long W = in.nextInt();
            long T = in.nextInt();
            if (W >= V) {
                out.println("NO");
            } else if ((Math.abs(A - B) <= T * (V - W))) {
                out.println("YES");
            } else {
                out.println("NO");
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for(int i = 0; i < n; ++i)
  {
    int num;
    cin >> num;
    a[i] = num;
    b[i] = num;
  }

  sort(a.begin(), a.end());
  int max = a[n-1];
  int next;
  bool dup = false;
  for(int i = n-2; i >=0; --i)
  {
    if(a[i] == max)
    {
      dup = true;
    }
    else
    {
      next = a[i];
      break;
    }
  }
  
  for(int i = 0; i < n; ++i)
  {
    if(b[i] != max)
    {
      cout << max << endl;
    }
    else
    {
      if(dup) cout << max << endl;
      else cout << next << endl;
    }
  }
}

Measured memory_bytes: 4756
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
ll mod=998244353;
signed main(){
    int n,ans=1,r=0,g=0,b=0;
    string s;
    cin>>n>>s;
    rep(i,3*n){
        if(s[i]=='R'){
            if(g&&b){
                ans*=min(g,b);
                ans%=mod;
                g--,b--;
            }
            else{
                ans*=max(max(g,b)-r,1ll);
                ans%=mod;
                r++;
            }
        }
        if(s[i]=='G'){
            if(r&&b){
                ans*=min(r,b);
                ans%=mod;
                r--,b--;
            }
            else{
                ans*=max(max(r,b)-g,1ll);
                ans%=mod;
                g++;
            }
        }
        if(s[i]=='B'){
            if(r&&g){
                ans*=min(r,g);
                ans%=mod;
                r--,g--;
            }
            else{
                ans*=max(max(r,g)-b,1ll);
                ans%=mod;
                b++;
            }
        }
      //cout<<ans<<endl;
    }
    rep(i,n){
        ans*=(i+1);
      //cout<<ans<<endl;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 900
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std ;
using ll = long long ;
using vll = vector<ll> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;

void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll n ; cin >> n ;
	vector<pll> u,d,l,r ;
	for(int i=0;i<n;i++){
		ll x,y ;
		cin >> x >> y ;
		char c ; cin >> c ;
		if(c=='U') u.emplace_back(x,y) ;
		if(c=='D') d.emplace_back(x,y) ;
		if(c=='L') l.emplace_back(x,y) ;
		if(c=='R') r.emplace_back(x,y) ;
	}
	vector<pair<pll,char>> ud,lr,ur,ul,dr,dl ;
	for(int i=0;i<u.size();i++){
		ud.emplace_back(make_pair(u.at(i).first,u.at(i).second),'U') ;
		ur.emplace_back(make_pair(u.at(i).first+u.at(i).second,u.at(i).first),'U') ;
		ul.emplace_back(make_pair(u.at(i).first-u.at(i).second,u.at(i).first),'U') ;
	}
	for(int i=0;i<d.size();i++){
		ud.emplace_back(make_pair(d.at(i).first,d.at(i).second),'D') ;
		dr.emplace_back(make_pair(d.at(i).first-d.at(i).second,d.at(i).first),'D') ;
		dl.emplace_back(make_pair(d.at(i).first+d.at(i).second,d.at(i).first),'D') ;
	}
	for(int i=0;i<l.size();i++){
		lr.emplace_back(make_pair(l.at(i).second,l.at(i).first),'L') ;
		ul.emplace_back(make_pair(l.at(i).first-l.at(i).second,l.at(i).first),'L') ;
		dl.emplace_back(make_pair(l.at(i).first+l.at(i).second,l.at(i).first),'L') ;
	}
	for(int i=0;i<r.size();i++){
		lr.emplace_back(make_pair(r.at(i).second,r.at(i).first),'R') ;
		ur.emplace_back(make_pair(r.at(i).first+r.at(i).second,r.at(i).first),'R') ;
		dr.emplace_back(make_pair(r.at(i).first-r.at(i).second,r.at(i).first),'R') ;
	}
	sort(all(ud)) ;
	sort(all(lr)) ;
	sort(all(ur)) ;
	sort(all(ul)) ;
	sort(all(dr)) ;
	sort(all(dl)) ;
	ll ans = INF ;
	for(int i=0;i+1<(int)ud.size();i++) if(ud.at(i).first.first==ud.at(i+1).first.first&&ud.at(i).second=='U'&&ud.at(i+1).second=='D') chmin(ans,(ud.at(i+1).first.second-ud.at(i).first.second)*5) ;
	for(int i=0;i+1<(int)lr.size();i++) if(lr.at(i).first.first==lr.at(i+1).first.first&&lr.at(i).second=='R'&&lr.at(i+1).second=='L') chmin(ans,(lr.at(i+1).first.second-lr.at(i).first.second)*5) ;
	for(int i=0;i+1<(int)ur.size();i++) if(ur.at(i).first.first==ur.at(i+1).first.first&&ur.at(i).second=='R'&&ur.at(i+1).second=='U') chmin(ans,(ur.at(i+1).first.second-ur.at(i).first.second)*10) ;
	for(int i=0;i+1<(int)ul.size();i++) if(ul.at(i).first.first==ul.at(i+1).first.first&&ul.at(i).second=='U'&&ul.at(i+1).second=='L') chmin(ans,(ul.at(i+1).first.second-ul.at(i).first.second)*10) ;
	for(int i=0;i+1<(int)dr.size();i++) if(dr.at(i).first.first==dr.at(i+1).first.first&&dr.at(i).second=='R'&&dr.at(i+1).second=='D') chmin(ans,(dr.at(i+1).first.second-dr.at(i).first.second)*10) ;
	for(int i=0;i+1<(int)dl.size();i++) if(dl.at(i).first.first==dl.at(i+1).first.first&&dl.at(i).second=='D'&&dl.at(i+1).second=='L') chmin(ans,(dl.at(i+1).first.second-dl.at(i).first.second)*10) ; 
	if(ans==INF) cout << "SAFE" << endl ;
	else cout << ans << endl ;
}

Measured memory_bytes: 25832
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>

#define PI 3.14159265358979
#define MOD 1000000007

//fixed << setprecision(15) <<

using namespace std;

int N;
vector<long long> a;

void solve() {
    map<long long, long long> ma;
    for (int i = 0; i < N; ++i) ma[a[i]]++;
    long long res = 0;
    for (auto it : ma) res += it.second * (it.second - 1) / 2;
    for (int i = 0; i < N; ++i) {
        long long val = ma[a[i]];
        long long before = val * (val - 1) / 2;
        long long after = (val - 1) * (val - 2) / 2;
        cout << res + after - before << endl;
    }
}

int main() {
    cin >> N;
    a.resize(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    solve();
}

Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
string s;
bool isP(string st) {
    //cout << st << endl;
    int l = 0;
    int r = st.size() - 1;
    while(l < r) {
        if(st[l] == st[r]) {
            l ++;
            r --;
        }
        else {
            return false;
        }
    }
    return true;
}
int main() {
    cin >> s;
    if(s.size() % 2 == 0) {
        cout << "No" << endl;
        return 0;
    } else {
        int len = s.size() / 2;
        if(isP(s) && isP(s.substr(0, len)) && isP(s.substr(len+1, len))) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


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

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

ll ans = 1;
ll K,A,B;

void solve(){
    if(B - A <= 2) ans += K;
    else {
        ans = min(K+1, A);
        K -= ans - 1;

        int tmp = K / 2;
        
        ans += tmp*(B - A);

        if(K % 2 == 1) ans++;

    }

    cout << ans << endl;
}

int main(){
    cin >> K >> A >> B;

    solve();
}


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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif

const int N = 200005;
LL n , ara[N] , k;

int main()
{
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int x;

    cin >> x;

    cout << (x >= 30 ? "Yes" : "No") << "\n";
    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while (a > 0 && c > 0) {
        c -= b;
        if(c <= 0) {
            cout << "Yes\n";
            break;
        }
        a -= d;
        if(a <= 0) {
            cout << "No\n";
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=0;i<n;i++){
        int h;
        cin>>h;
        if(h>=k)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int mod=1e9+7;
// Not for Rating """"""""""I'm in Love with Experience :)""""""""""""""""""
void solve()
{
    ll N,D;cin>>N>>D;
    ll x,y;
    ll a=0;
    while(N--)
    {
        cin>>x>>y;
        if(sqrt(pow(x,2)+pow(y,2))<=D)a++;
    }
    cout<<a<<'\n';
}
int main(void)
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int T=1;while(T--){solve();}return 0;
}/*Solved By:- RITIK AGARWAL*/

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int n;
    cin >> n;
    if (n == 1) {
        cout << "1\n";
        return 0;
    }
    vector<string> s(n*2);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        s[i] += s[i];
        s[i+n] = s[i];
    }
    vector<vector<int>> dp(n*2, vector<int>(n*2, 1));
    ll ans = 0;
    for (int i = 1; i < 2*n-1; i++) {
        for (int j = 1; j < 2*n-1; j++) {
            int cnt = 0;
            for (int k = 1; k <= min(i, j) && s[i][j-k] == s[i-k][j]; k++) {
                cnt++;
            }
            dp[i][j] = 1 + min(dp[i-1][j-1], cnt);
            if (dp[i][j] >= n) ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 2176
import itertools
n, c = map(int, input().split())
cs = [[0]*(10**5+10) for _ in range(c+1)]
#cs = [[0]*(15) for _ in range(c+1)]
for i in range(n):
    s, t, ch = map(int, input().split())
    s += 1
    t += 1
    cs[ch][t] = s

for i in range(1,c+1):
    for j in range(1,10**5+10):
    #for j in range(15):
        if cs[i][cs[i][j]] != 0:
            start = cs[i][j]
            cs[i][j] = cs[i][start]
            cs[i][start] = 0

#print(cs)
rsw = [0]*(10**5+10)
#rsw = [0]*(15)
for i in range(1,c+1):
    for j in range(1,10**5+10):
    #for j in range(15):
        if cs[i][j] != 0:
            cs[i][j] -= 1
            rsw[cs[i][j]] += 1
            rsw[j] -= 1

print(max(itertools.accumulate(rsw)))

Measured memory_bytes: 99624
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

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)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

const MAX: usize = 20000;
const MOD: usize = 1000000007;

struct Com {
    fac: Vec<usize>,
    finv: Vec<usize>,
    inv: Vec<usize>,
}

impl Com {
    fn new() -> Com {
        let fac = vec![0; MAX];
        let finv = vec![0; MAX];
        let inv = vec![0; MAX];
        let mut res = Com { fac: fac, finv: finv, inv: inv };
        res.com_init();
        res
    }
    fn com_init(&mut self) {
        self.fac[0] = 1;
        self.fac[1] = 1;
        self.finv[0] = 1;
        self.finv[1] = 1;
        self.inv[1] = 1;
        for i in 2..MAX {
            self.fac[i] = self.fac[i-1] * i % MOD;
            self.inv[i] = MOD - self.inv[MOD%i] * (MOD / i) % MOD;
            self.finv[i] = self.finv[i-1] * self.inv[i] % MOD;
        }
    }
    fn com(&self, n: usize, k: usize) -> usize {
        if n < k {
            return 0;
        }
        self.fac[n] * (self.finv[k] * self.finv[n - k] % MOD) % MOD
    }
}

fn f(com: &Com, x: usize, y: usize) -> usize {
    com.com(x-1, y-1)
}

fn main() {
    input!{
        N: usize,
        K: usize,
    }
    let com = Com::new();
    for i in 1..(K+1) {
        let mut ans = 0;
        ans += com.com(N-K+1, i);
        ans *= com.com(K-1, i-1);
        ans %= MOD;
        println!("{}", ans);
    }
}


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

const int MAX = 210000;
int Q;
long long type[MAX],a[MAX],b[MAX];
int main() {
    
    cin >> Q;
    
    long long sum = 0;
    priority_queue<long long> zen;
    priority_queue<long long, vector<long long>, greater<long long>> kou;
    long long zensum = 0;
    long long kousum = 0;
    
    for(int i = 0; i < Q;i++){
        cin >> type[i];
        if(type[i]==1){
            cin >> a[i] >> b[i];
            sum += b[i];
            
            if(zen.size() > kou.size()){
                
                int t = zen.top();
                if(a[i] >= t){
                    kou.push(a[i]); kousum += a[i];
                }else{
                    zen.pop();zensum -= t;
                    zen.push(a[i]); zensum += a[i];
                    kou.push(t); kousum += t;
                }
            }else{
                
                if(zen.empty())zen.push(a[i]),zensum += a[i];
                else{
                    
                    int t = kou.top();
                    if(a[i]<=t){
                        zen.push(a[i]);zensum += a[i];
                    }else{
                        kou.pop();kousum -= t;
                        kou.push(a[i]); kousum += a[i];
                        zen.push(t); zensum += t;
                    }
                }
            }
        }else{
            long long x = zen.top();
            long long res = (x * (int)zen.size() - zensum) + (kousum - x*(int)kou.size()) + sum;
            cout << x << " "<<res <<endl;
        }
            
        
        
        
        
        
        
    }
    
}


Measured memory_bytes: 8564
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if((a==5 && b==5 && c==7) || (a==5 && b==7 && c==5) || (a==7 && b==5 && c==5)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

const ll mod=1e9+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a%=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}

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

  ll h,w,a,b;
  cin >> h >> w >> a >> b;

  ll fact[h+w+1];
  ll inv[h+w+1];
  fact[0]=1;
  rep1(i,h+w) fact[i] = mu(fact[i-1],i);
  rep(i,h+w+1) inv[i] = dv(1,fact[i]);

  ll ans = 0;
  rep(i,h-a){    
    ans = ad(ans,mu(mu(mu(fact[b+i-1],inv[i]),inv[b-1]) , mu(mu(fact[h+w-b-i-2],inv[h-i-1]),inv[w-b-1])));
    //    cout << mu(mu(fact[b+i-1],inv[i]),inv[b-1])<< " " << mu(mu(fact[h+w-b-i-2],inv[h-i-1]),inv[w-b-1]) << endl;
  }
  
  cout << ans  << endl;
  


  
  return 0;
    

}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int maxn=1005;
int dp[maxn][maxn];
int main()
{
    int h,w;
    cin>>h>>w;
    char grid[h][w];
    for(int i=0;i<h;i++)
    {
        scanf("%s",grid[i]);
    }
    dp[0][0]=1;
    for(int r=0;r<h;r++)
    {
        for(int c=0;c<w;c++)
    {
        for(int row:{r,r+1})
            {
                int col=c;
                if(row==r)
                    col=c+1;
                if(row<h && col<w && grid[row][col]=='.')
                {
                    dp[row][col]+=dp[r][c];
                    if(dp[row][col]>=mod)
                        dp[row][col]-=mod;
                }
            }
    }
    }
    cout<<dp[h-1][w-1]<<endl;
}



Measured memory_bytes: 5120
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
char s[1000001];
int a[1000001];
int main()
{
    scanf("%s",&s);
	int len=strlen(s);
    for(int i=0;i<len/2+1;i++)
    {
    	if(s[i]=='p'&&s[len-i-1]=='q'||s[i]=='b'&&s[len-i-1]=='d'||s[i]=='q'&&s[len-i-1]=='p'||s[i]=='d'&&s[len-i-1]=='b');
    	else
    	{
    		printf("No");
    		return 0;
		}
	}
    printf("Yes");
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,p;
  cin >> n >> p;
  vector<ll> x(1000000);
  if(n==1){
    cout << p << endl;
  }
  else{
  for(int i=2;i<=1000000;i++){
    while(p%i==0){
      x[i]++;
      p/=i;
    }
  }
  ll ans=1;
  for(int i=2;i<=1000000;i++){
    for(int j=1;j<=x[i]/n;j++){
      ans*=i;
    }
  }
  cout << ans << endl;
  }
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int  n,m,a[105],sum,i;
	while(~scanf("%d%d",&n,&m))
	{
		memset(a,0,sizeof(a));
		sum=0;
		for(i=1;i<=n;i++)
		{
			cin>>a[i];
			sum+=a[i];
		}
		sort(a+1,a+n+1,cmp);
		int t=0,f=0;
		if(sum%(4*m)==0)f=1;
		for(i=1;i<=n;i++)
		{
			if(a[i]>=sum/(4*m)&&f==1)
			{
				t++;
				if(t==m)break;
			}
			if(a[i]>sum/(4*m)&&f==0)
			{
				t++;
				if(t==m)break;
			}
		}
		if(i<=n)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 2e5 + 10 , M = 1e6 + 10;
int n , m , a[N] , f[M + M] , _;

int main(){
  scanf("%d",&n);
  rep(i,1,n) scanf("%d",a+i);
  int sum = 0;
  rep(i,3,n) sum += a[i];
  per(i,0,M) f[_++] = i;
  rep(i,3,n) {
    int last = _ - 1;
    rep(j,1,a[i]+1)
      f[_++] = f[last - j];
  }
  scanf("%d",&m);
  rep(i,0,m) {
    int x;
    scanf("%d",&x);
    if(x >= sum) {
      printf("%d\n",x - sum + a[1] - a[2]);
    } else {
      printf("%d\n",f[_ - 1 - x] + a[1] - a[2]);
    }
  }
  return 0;
}


Measured memory_bytes: 10752
#include<bits/stdc++.h>
using namespace std;
const int maxn=100100,mod=998244353;
inline void Add(int &a,int b){a=a+b>=mod?a+b-mod:a+b;}
inline int ksm(int a,int b)
{
	int res=1;
	for(;b;b>>=1,a=1ll*a*a%mod) if(b&1) res=1ll*res*a%mod;
	return res;
}
int fac[maxn],invfac[maxn];
inline int C(int n,int m){return (n<0||n<m)?0:(1ll*fac[n]*invfac[m]%mod*invfac[n-m]%mod);}
int n,x,ans=0;
int main()
{
	for(int i=fac[0]=1;i<maxn;i++) fac[i]=1ll*fac[i-1]*i%mod;
	invfac[maxn-1]=ksm(fac[maxn-1],mod-2);
	for(int i=maxn-2;i>=0;i--) invfac[i]=1ll*invfac[i+1]*(i+1)%mod;
	cin>>n>>x;
	for(int cnt0=0;cnt0<=n;cnt0++)
	{
		int sum=0,N=n-cnt0;
		if(2*N<x||x%2==1) sum=1;
		for(int i=N;i<2*N;i++)
		{
			if(i<x) {Add(sum,C(N,i-N));continue;}
			if((i-x)%2==0) continue;int cnt=(i-x+1)/2;
			if(2*cnt>=N) continue;int va=N-2*cnt,vb=i-4*cnt;
			if(vb<va||vb>2*va) continue;Add(sum,C(va,vb-va));
		}
		Add(ans,1ll*sum*C(n,cnt0)%mod);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4500
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
////////////////////////////



#define N 4000004

ll kai[N];
ll kai2[N];
ll po(ll i,ll p){
    if(p==0)return 1;
    else{
        i=mod(i);
        if(p==1)return i;
        if(p%2==0)return po(mod(i*i),p/2);
        return mod(i*po(i,p-1));
    }
}
void calc(){
    kai[0]=1;
    kai2[0]=1;
    rep(i,1,N-1){
        kai[i]=mod(kai[i-1]*i);
    }
    kai2[N-1]=po(kai[N-1],i_5);
    for(ll i=N-2;i>=0;i--){
        kai2[i]=mod(kai2[i+1]*(i+1));
    }
}
ll comb(ll n,ll k){
    if(n<k)return 0;
    if(n==0)return 1;
    return mod(mod(kai[n]*kai2[n-k])*kai2[k]);
}
ll bunbo(ll n){
    return po(n,i_5);
}

int main(){fastio
    calc();
    
    ll r1,c1,r2,c2;cin>>r1>>c1>>r2>>c2;
    ll ans=0;
    ll a=comb(r2+c2+2,r2+1);
    Add(ans,a);
    Add(ans,-comb(r1+c2+1,r1));
    Add(ans,-comb(r2+c1+1,r2+1));
    Add(ans,comb(r1+c1,r1));
    cout<<mod(ans)<<endl;
    
    return 0;
}


Measured memory_bytes: 62720
#include <stdio.h>

int main(void) {
    int a, b;
    scanf("%d %d", &a, &b);
    int sum = a + b;
    if(sum % 2 != 0){
        printf("%d\n", sum / 2 + 1);
    }else{
        printf("%d\n", sum / 2);
    }
}


Measured memory_bytes: 128
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]

scr = [k - q for _ in range(n)]
for ai in a:
    scr[ai - 1] += 1
ans = list(map(lambda x: "Yes" if 0 < x else "No", scr))
print('\n'.join(ans))

Measured memory_bytes: 59992
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;


#define N 200050

int main(void){
    // Your code here!
    long long index;
    long long ans=0;
    char a[N];
    int n=0;
    char d;
    
    
    scanf("%s",a);
   // printf("%lld\n",n);
   //printf("%s\n",a); 
   
   index=strlen(a)-1;
   //printf("index:%d\n",index);
   
   while( index>=0 ){
      //if( a[0]=='\0' ) break; 
      d=a[ index ];
      n=d-'0'; 
      //printf("%d\n",n);
      ans+=n; 
      a[ index-- ] ='\0'; 
   }
    
    //printf("%d\n",ans);
    if( ans%9==0 ) puts("Yes");
    else puts("No");
    //printf("%d\n",ans);
    
}


Measured memory_bytes: 3820
package main

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

//input
var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

//solve
type Node struct {
	id int
	p  int
	l  int
	r  int
}

const MAX = 10000
const NIL = -1

var T [10000]Node
var n int

func preParse(u int) {
	if u == NIL {
		return
	}
	fmt.Printf(" %d", u)
	preParse(T[u].l)
	preParse(T[u].r)
}

func inParse(u int) {
	if u == NIL {
		return
	}
	inParse(T[u].l)
	fmt.Printf(" %d", u)
	inParse(T[u].r)
}

func postParse(u int) {
	if u == NIL {
		return
	}
	postParse(T[u].l)
	postParse(T[u].r)
	fmt.Printf(" %d", u)

}

func main() {
	sc.Split(bufio.ScanWords)
	n = nextInt()

	for i := 0; i < n; i++ {
		T[i].p = NIL
	}
	for i := 0; i < n; i++ {
		id, l, r := nextInt(), nextInt(), nextInt()
		T[id].l = l
		T[id].r = r
		if l != NIL {
			T[l].p = id
		}
		if r != NIL {
			T[r].p = id
		}
	}

	root := -1
	for i := 0; i < n; i++ {
		if T[i].p == NIL {
			root = i
		}
	}

	//fmt.Println(root, T[:n])

	fmt.Println("Preorder")
	preParse(root)
	fmt.Println("\nInorder")
	inParse(root)
	fmt.Println("\nPostorder")
	postParse(root)
	fmt.Println("")
}



Measured memory_bytes: 1128
#include<bits/stdc++.h>
using namespace std;
const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
    COMinit();
    int x,y;
    cin >> x >> y;
    if((x+y)%3!=0) cout << 0 << endl;
    else{
        int a = (x+y)/3;
        cout << COM(a,2*a-y) << endl;
    }
}

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

int n, q;
vector<bool> isE(2001);

int main()
{
	cin>>n;
	int num;
	for( int i=0; i<n; i++ ) {
		cin>>num;
		for( int j=2000-num; 0<j; j-- ) {
			if( isE.at( j ) ) {
				isE.at( j+num ) = true;
			}
		}
		isE.at( num ) = true;
	}
	cin>>q;
	for( int i=0; i<q; i++ ) {
		cin>>num;
		if( isE.at( num ) ) {
			cout<<"yes"<<'\n';          
		} else {
			cout<<"no"<<'\n';
		}
	}
	return 0;
}

Measured memory_bytes: 1156
using System;
public class Hello{
    public static void Main(){
        // Your code here!
         var stArrayData = System.Console.ReadLine().Split(' ');
         var a =double.Parse(stArrayData[0]);
         var b = double.Parse(stArrayData[1]);
         var v = double.Parse(stArrayData[2]);
         var V = a*a*b;
         if(v>=V/2)
         {
            double x =  (V-v)/(a*a)*2;
            var theta = Math.Atan(x/a)/Math.PI*180.0;
            System.Console.WriteLine(theta);
         }else{
            var x =  (v)/(a*b)*2;
            var theta = Math.Atan(b/x)/Math.PI*180.0;
            System.Console.WriteLine(theta);
         }
         
        } 
}

Measured memory_bytes: 13140
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;

const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 1, 0,-1};
const int dy4[6] = {-1, 0, 1,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};
void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}

ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 3e3 + 5;
const double PI = acos(-1.0);
const ll mod = 1000000007;
/*************************************************************************/

string s;
void solve() {
    cin>>s;
    int cnt = 0;
    REP(i,0,s.length()) {
        if(s[i]=='A') {
            cnt |= 1;
        } else {
            cnt |= 2;
        }
    }
    if(cnt == 3) {
        puts("Yes");
    } else {
        puts("No");
    }
}

int main()
{

  solve();
  return 0;
}





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

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

typedef long long ll;

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}

int main() {
    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll lcm_cd = lcm(c, d);
    ll num_a = a-1 - (a-1)/c - (a-1)/d + (a-1)/lcm_cd;
    ll num_b = b - b/c - b/d + b/lcm_cd;
    cout << num_b - num_a << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()

r = list()
g = list()
b = list()
for idx, si in enumerate(s):
    if si == 'R':
        r.append(idx)
    elif si == 'G':
        g.append(idx)
    else:
        b.append(idx)

ret = 0
bi_cnt = len(b)
for ri in r:
    for gi in g:
        cnt = 0
        try:
            dan1 = 2*ri - gi
            if (dan1 > 0) & (s[dan1] == 'B'):
                cnt += 1
        except:
            pass

        try:
            dan3 = 2*gi - ri
            if (dan3 > 0) & (s[dan3] == 'B'):
                cnt += 1
        except:
            pass

        try:
            dan2, mod = divmod(ri+gi, 2)
            if (mod == 0) & (s[dan2] == 'B'):
                cnt += 1
        except:
            pass

        ret += (bi_cnt - cnt)

print(ret)

Measured memory_bytes: 9252
import math

N = int(input())
m = int(math.log10(N))+1
a = N//(pow(10,m))

ans = 0
for i in range(1,m,2):
    ans += 9*pow(10,i-1)

if m%2 == 1:
    ans += N-pow(10,m-1)+1
print(ans)


Measured memory_bytes: 9244
#include <bits/stdc++.h>
using namespace std;
#define maxx 3010
#define mp make_pair
typedef pair<int,int> ii;
ii rt[maxx][maxx];
int dp[maxx][maxx];
int m,n;
string s,t,ans = "";
void bfs(int i,int j){
	queue <ii> q;
	q.push(mp(i,j));
	while(!q.empty()){
		ii k = q.front();
		q.pop();
		int y = k.first;
		int x = k.second;
		if(dp[y][x] == 0) break;
		
		if(rt[y][x].first == y-1 && rt[y][x].second == x-1)  ans += s[y-1];
		
		q.push(mp(rt[y][x].first,rt[y][x].second));
	}
}

int main() {
	cin >> s;
	cin >> t;
	if(s.size() > t.size()) swap(s,t);
	
	for(int i = 1; i <= (int)s.size(); i++){
		for(int j = 1; j <= (int)t.size(); j++){
			if(s[i-1] == t[j-1]){
				if(dp[i-1][j-1] + 1 >= dp[i-1][j]){
					dp[i][j] = dp[i-1][j-1]+1;
					rt[i][j] = mp(i-1,j-1);
				}
				else{
					dp[i][j] = dp[i-1][j];
					rt[i][j] = mp(i-1,j);
				}
			}
			else{
				if(dp[i][j-1] > dp[i-1][j]){
					dp[i][j] = dp[i][j-1];
					rt[i][j] = mp(i,j-1);
				}
				else{
					dp[i][j]  = dp[i-1][j];
					rt[i][j] = mp(i-1,j);
				}
			}
		}
	}

	bfs(s.size(),t.size());
/*	
	for(int i = 1; i <= s.size(); i++){
		for(int j = 1; j <= t.size(); j++){
			cout << dp[i][j] << " ";
		}
		cout << s[i-1]; 
		cout << endl;
	}
	for(int i = 1; i <= s.size(); i++){
		for(int j = 1; j <= t.size(); j++){
			cout << rt[i][j].first << "," << rt[i][j].second << " ";
		}
		cout << s[i-1]; 
		cout << endl;
	}
*/
	
	for(int i = (int)ans.size()-1; i >= 0; i--){
		cout << ans[i];
	}
	cout << "\n";
  	
	return 0;
}

Measured memory_bytes: 109448
n,a,b=map(int,input().split())
m=[str(i+1) for i in range(n)]
o=[0 for i in range(n)]
tmp=0
def ad(t):
  tmp=0
  for i in t:
    tmp+=int(i)
  return tmp

for i in range(n):
  o[i]=ad(m[i])
for i in range(n):
  if o[i]>=a and o[i]<=b:
    tmp+=int(m[i])

print(tmp)

Measured memory_bytes: 3700
# include <bits/stdc++.h>
using namespace std ;
char s[10] ;

int main(void) 
{
	int flag = 0 ;
	scanf("%s",s) ;
	if(s[2] == s[3]) 
	{
		if(s[4] == s[5]) 
		 {
		 	printf("Yes\n")  ;
		 	flag = 1 ;
		 }
	}
	
	if(flag == 0)
	{
		printf("No\n") ;
	}
	return 0 ;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
tmp = [0]
for a in A:
  tmp.append(tmp[-1]+a)
tmp.sort()
ans = 0
k = 0
for i in range(N):
  if(tmp[i] == tmp[i+1]):
    k += 1
  else:
    ans += (k*(k+1))//2
    k = 0
ans += (k*(k+1))//2
print(ans)

Measured memory_bytes: 26720
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
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) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

//絶対無理そう

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int A = getint(), B = getint(), M = getint();

	int a[100001], b[100001];
	int ma = 100000, mb = 100000;
	rep1(i, A) {
		a[i] = getint();
		chmin(ma, a[i]);
	}
	rep1(i, B) {
		b[i] = getint();
		chmin(mb, b[i]);
	}

	int kotae = ma + mb;

	rep(i, M) {
		int x = getint(), y = getint(), c = getint();
		chmin(kotae, a[x] + b[y] - c);
	}

	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
public class Main {
  public static void main(String[] args) throws Exception {
    String line = null;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    line = br.readLine();
    String data[] = line.split(" ");
    int size = Integer.parseInt(data[0]);
    long total = Long.parseLong(data[1]);
    long sum = 0;
    long count = 0;
    long min = 1000;
    for (int i = 0; i < size; i ++) {
      line = br.readLine();
      long num = Long.parseLong(line);
      sum = sum + num;
      //System.out.println(num);
      count = count + 1;
      if (num < min) min = num;
    }
    //System.out.println(sum + "," + min);
    if (total != sum) {
      long rest = total - sum;
      count = count + (rest/min);
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 21460
N,A,B=[int(x) for x in input().rstrip().split()]
l=[int(x) for x in input().rstrip().split()]
ans=0

for i in range(N-1):
    if((abs(l[i]-l[i+1]))*A)<=B:
        ans+=(abs(l[i]-l[i+1]))*A
    
    else:
        ans+=B
print(ans)


Measured memory_bytes: 14252
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

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

    vector<int> as(n);
    for(int i = 0; i < n; i++){
        char c; cin >> c;
        as[i] = c - '0';
    }
    for(int i = 0; i < n - 1; i++){
        as[i] = abs(as[i] - as[i + 1]);
    }
    as.pop_back();
    n--;

    if(n < 50){
        while(n > 1){
            for(int i = 0; i < n - 1; i++){
                as[i] = abs(as[i] - as[i + 1]);
            }
            as.pop_back();
            n--;
        }
        cout << as[0] << '\n';
        return 0;
    }

    bool one = false;
    for(auto& a : as){
        one |= a == 1;
    }
    if(one){
        for(auto& a : as){
            a = a == 1 ? 1 : 0;
        }
    }else{
        for(auto& a : as){
            a /= 2;
        }
    }
    printde(as);

    int a = 0;
    auto cntBit = [&](int num){ 
        int bit = 1;
        for(int i = 0; ; i++){
            if(bit & num){
                return i;
            }
            bit <<= 1;
        }
    };
    int twos = 0;
    for(int i = 0; i < n; i++){
        if(i){
            twos -= cntBit(i);
            twos += cntBit(n - i);
        }
        a += as[i] * (twos == 0);
        // a += as[i] * (i & 1 ? n - 1 : 1);
    }
    a &= 1;
    cout << (one ? a : a * 2) << '\n';
}


Measured memory_bytes: 4224
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	ll k,a,b,ans;
	cin >> k >> a >> b; ++k;
	if(k<a || b<a+2){
		cout << k << endl;
		return 0;
	}
	ans = a+((k-a)/2)*(b-a)+(k-a)%2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x, long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var s = Console.ReadLine().ToCharArray();
            var n = s.Length;
            
           
            long ans = 0;
            long count = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'W')
                {
                    ans += i - count;
                    count++;
                }
            }
            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }
}



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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
typedef pair< int, int > pii;

template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int N, dst[100010];
vector< vector< int > > adj;

pii dfs(int v, int p, int dep) {
	pii res(dep, v);
	for (int u : adj[v]) if (u != p) maxUpdate(res, dfs(u, v, dep + 1));
	return res;
}

void rec(int v, int p, int dep) {
	maxUpdate(dst[v], dep);
	for (int u : adj[v]) if (u != p) rec(u, v, dep + 1);
}

void solve() {
	memset(dst, 0, sizeof(dst));
	
	pii p1 = dfs(0, -1, 0);
	pii p2 = dfs(p1.second, -1, 0);
		
	rec(p1.second, -1, 0);
	rec(p2.second, -1, 0);
	
	for_(v,0,N) cout << 2 * (N - 1) - dst[v] << endl;
}

int main() {
	cin >> N;
	adj.assign(N, vector< int >());
	for_(i,0,N-1) {
		int u, v;
		cin >> u >> v;
		--u; --v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	solve();
}

Measured memory_bytes: 16436
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define REP(i, n) for (LL i = 0; i < (LL)(n); i++)
#define REP2(i, n) for (LL i = 1; i <= (LL)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0)
#define vLL(v,n) vector<LL> v(n); REP(i,n)cin>>v[i];
#define vstr(v,n) vector<string> v(n); REP(i,n)REP(i,n)cin>>v[i];
LL INF = 1e9 + 1;
LL MOD = 1e9+7;
  LL a,b,c,d,e,n,m,l,k,r,x,y,z,ans=0,ans2=0;
string s,S,t;
int gcd(int p, int q){
if(p % q == 0)return q;
return gcd(q, p % q);
}
int main() {
ios_base::sync_with_stdio(false);
  cin >> k;
  REP2(i,k)REP2(j,k)REP2(o,k){
    ans+=gcd(gcd(i,j),o);
  }
  cout <<ans;
}

Measured memory_bytes: 3552
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
    
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){

    vector<bool> colors(4) ;

    int n;
    cin >> n;

    string s;
    for(int i = 0; i < n; i++){
        cin >> s;
        if(s[0] == 'P') colors[0] = true;
        if(s[0] == 'W') colors[1] = true;
        if(s[0] == 'G') colors[2] = true;
        if(s[0] == 'Y') colors[3] = true;
    }

    n = accumulate(all(colors),0);
    if(n == 3) cout << "Three" << endl;
    if(n == 4) cout << "Four" << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include<math.h>
#include<stdio.h>
using namespace std;

int main()
{

   double a,b,c;
   double x;
   cin>>a>>b>>c;
   if(c<=(a*a*b)/2)
   {
       double l=(c/a)*2/b;
       x=atan(b/l*(1.0));
   }
   else
   {
       double l=((c/a)*2)/a-b;

       x=atan((b-l)*1.0/a);

   }


   //double a=atan(1);
   printf("%.10f",(x*360)/(2.0*M_PI));
}


Measured memory_bytes: 384
n,k = map(int, input().split())

ans = 0
abl = []
for _ in range(n):
    a,b = map(int, input().split())
    abl.append((a,b))

max_bit = 0
for i in range(31):
    if k < pow(2,i):
        max_bit = i
        break

k_bits = [-1]*(max_bit)
for i in range(max_bit-1,-1,-1):
    if k&(1<<i) > 0:
        k_bits[i] = 1
    else:
        k_bits[i] = 0

# print(k_bits)

k_bits = k_bits[::-1]
bits_cands = []
bits_cands.append(k_bits[::-1])
for i in range(max_bit):
    curr_row = []
    for j in range(0,i):
        curr_row.append(k_bits[j])
    if k_bits[i] == 1:
        curr_row.append(0)
        curr_row = curr_row + [1]*(max_bit-1-i)
    else:
        for j in range(i,max_bit):
            curr_row.append(k_bits[j])
    bits_cands.append(curr_row[::-1])

# print(bits_cands)
ans = 0
for bits in bits_cands:
    val = 0
    for a,b in abl:
        if a > k: continue
        for i in range(max_bit):
            if a&(1<<i) > 0 and bits[i] == 0:
                break
        else:
            val += b
    ans = max(ans,val)
print(ans)

# bits_cands = []
# print(max_bit)
# curr = [1]
# for i in range(max_bit-1,-1,-1):
#     if k%(1<<i) == 0:
#         curr.append(0)
#         row = curr + []

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

using namespace std;

#define intt long long

const int MAXN = 1003;
const int INF = 2000000003;

map <char, int> mp;

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i ++) {
        mp[s[i]] ++;
    }
    for (char i = 'a'; i <= 'z'; i ++) {
        if (mp[i] % 2) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256