akhauriyash/Code-Regression huggingface dataset:
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint a[200100];
int main(){
	int n;lint x=0;cin>>n;
	rep(i,n){
		cin>>a[i];x^=a[i];
	}
	rep(i,n){
		cout<<(x^a[i]);
		if(i<n-1) cout<<' ';else cout<<endl;
	}
}


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

using namespace std;

const int N = 55;

int n, t;

int a[N];
long long dp[N][N][N * N];

long long add(long long a, long long b) {
  return a + b;
}

int main() {
  scanf("%d %d", &n, &t);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      for (int k = 0; k < N * N; k++) {
        if (k + a[i] < N * N) dp[i + 1][j + 1][k + a[i]] = add(dp[i + 1][j + 1][k + a[i]], dp[i][j][k]);
        dp[i + 1][j][k] = add(dp[i + 1][j][k], dp[i][j][k]);
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = add(ans, dp[n][i][t * i]);
  printf("%lld\n", ans);
  return 0;
}       

Measured memory_bytes: 65792
//https://atcoder.jp/contests/dp/tasks/dp_d
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};


int main(){
    int N,W;
    cin>>N>>W;
    using V=vector<LL>;
    V dp(W+1);
    for(int i:range(N)){
        V nxt=dp;
        int w,v;
        cin>>w>>v;
        for(int j:range(w,W+1)){
            chmax(nxt[j],dp[j-w]+v);
        }
        swap(dp,nxt);
    }
    cout<<dp.back()<<endl;
    return 0;
}

Measured memory_bytes: 1888
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(int)(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) ((flag)?1:0)
#define YN(flag) cout<<(flag?"YES":"NO")<<endl;
#define Yn(flag) cout<<(flag?"Yes":"No")<<endl;
#define yn(flag) cout<<(flag?"yes":"no")<<endl;
#define Cout(v) cout<<(v)
#define COUT(v) cout<<(v)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<p.first<<" "<<p.second;
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ===================
// Template End =========================

constexpr int MOD=1e9+7;
locale LOCATE=locale::classic();

int main(void){
  string s; cin>>s;
  queue<int> q; q.push(0);
  bool able=false;
  while(!q.empty()){
    int now=q.front(); q.pop();
    if(now==s.size()){
      able=true;
      continue;
    }
    if(now+4<s.size()&&s.substr(now,5)=="dream") q.push(now+5);
    if(now+6<s.size()&&s.substr(now,7)=="dreamer") q.push(now+7);
    if(now+4<s.size()&&s.substr(now,5)=="erase") q.push(now+5);
    if(now+5<s.size()&&s.substr(now,6)=="eraser") q.push(now+6);
  }
  YN(able);
}











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

int main()
{
  string s;
  cin >> s;
  long bs = 0, count = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == 'B') {
      bs++;
    } else {
      count += bs;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String[] input = sc.next().split("");
		long numR = 0;
		long numL = 0;
		long res = 0;
		for (int i = 0; i < input.length - 1; i++) {
			if (input[i].equals("<")) {
				res += numL;
				numL++;
			} else {
				res += numR;
				numR++;
				if (input[i + 1].equals("<")) {
					res += Math.max(numL, numR);
					numL = 0;
					numR = 0;
				}
			}
		}
		if (input[input.length - 1].equals("<")) {
			res += numL;
			numL++;
			res += numL;
		} else {
			res += numR;
			numR++;
			res += Math.max(numL, numR);
		}
		System.out.println(res);
	}
}


Measured memory_bytes: 82116
fn main(){
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let n = s.trim().parse::<usize>().ok().unwrap();

	for i in 1..n + 1 {
		if i % 3 == 0 || i.to_string().contains("3") {
			print!(" {}", i);
		}
	}
	println!("");
}


Measured memory_bytes: 5044
#include <iostream>
#include <vector>
#include <map>
#include <math.h>
#include <algorithm>
#include <sstream>

using namespace std;

#define MAX	-10000

int main()
{
	long i, j, k, l;

	int a, b;
	cin >> a >> b >> k;

	j = 1;
	
	vector<int> r;
	r.clear();

	while (j<=a && j <= b)
	{
		if (a%j == 0 && b%j == 0)
			r.push_back(j);
		j++;
	}

	printf("%ld", r[r.size() - k]);

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int m, n, s = 0;
	scanf("%d%d", &m, &n);
	if (m > 1)	s += (m * (m - 1)) / 2;
	if (n > 1)	s += (n * (n - 1)) / 2;
  	printf("%d", s);
	return 0;
}

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

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


Measured memory_bytes: 79656
def main():
    N, A, B = (int(i) for i in input().split())
    S = input()
    b_cnt = 0
    cnt = 0
    for s in S:
        if s == 'a' and cnt < A + B:
            print("Yes")
            cnt += 1
        elif s == 'b' and cnt < A + B and b_cnt < B:
            print("Yes")
            cnt += 1
            b_cnt += 1
        else:
            print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 51928
#include<bits/stdc++.h>
using namespace std;
long long read()
{
	char ch=getchar();long long x=0,ff=1;
	while(ch<'0'||ch>'9') {if(ch=='-') ff=-ff;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*ff;
}
void write(long long aa)
{
	if(aa<0) putchar('-'),aa=-aa;
	if(aa>9) write(aa/10);
	putchar(aa%10+'0');
	return;
}
const long long mod=924844033;
long long n,m;
long long tot,head[200005],nx[400005],to[400005];
long long fac[200005],ny[200005];
long long jl[200005],sz[200005];
long long bh[1400005],A[1400005],B[1400005];
void jia(long long aa,long long bb)
{
	tot++;
	nx[tot]=head[aa];
	to[tot]=bb;
	head[aa]=tot;
	return;
}
long long ksm(long long aa,long long bb)
{
	long long now=1;
	while(bb)
	{
		if(bb&1) now=now*aa%mod;
		bb>>=1;aa=aa*aa%mod;
	}
	return now;
}
void dfs(long long rt,long long fa)
{
	sz[rt]=1;
	for(long long i=head[rt];i;i=nx[i])
	{
		long long yy=to[i];
		if(yy==fa) continue;
		dfs(yy,rt);sz[rt]+=sz[yy];
	}
	if(fa) jl[sz[rt]]++,jl[n-sz[rt]]++;
	return;
}
void ntt(long long* a,long long ff)
{
	for(long long i=0;i<m;++i) if(bh[i]>i) swap(a[i],a[bh[i]]);
	for(long long i=1;i<m;i<<=1)
	{
		long long yuan=ksm(5,(mod-1)/(i*2));
		if(ff==-1) yuan=ksm(yuan,mod-2);
		for(long long j=0;j<m;j+=(i<<1))
		for(long long l=0,now=1;l<i;++l,now=now*yuan%mod)
		{
			long long aa=a[j+l],bb=now*a[j+i+l]%mod;
			a[j+l]=(aa+bb)%mod;a[j+i+l]=(aa-bb+mod)%mod;
		}
	}
	return;
}
long long C(long long aa,long long bb) 
{
	if(bb<aa) return 0;
	return fac[bb]*ny[aa]%mod*ny[bb-aa]%mod;
}
int main()
{
	n=read();
	for(long long i=1;i<n;++i)
	{
		long long x=read(),y=read();
		jia(x,y);jia(y,x);
	}
	dfs(1,0);fac[0]=1;
	for(long long i=1;i<=n;++i) fac[i]=fac[i-1]*i%mod;
	ny[n]=ksm(fac[n],mod-2);
	for(long long i=n;i;i--) ny[i-1]=ny[i]*i%mod;
	m=1;while(m<=n*2) m<<=1;
	for(long long i=1;i<m;++i) bh[i]=(bh[i>>1]>>1)|(i&1?(m>>1):0);
	for(long long i=0;i<=n;++i) A[i]=jl[i]*fac[i]%mod;
	for(long long i=0;i<=n;++i) B[i]=ny[n-i];
	ntt(A,1);ntt(B,1);
	for(long long i=0;i<m;++i) A[i]=A[i]*B[i]%mod;
	ntt(A,-1);long long NY=ksm(m,mod-2);
	for(long long i=1;i<=n;++i) write((n*C(i,n)%mod-A[i+n]*NY%mod*ny[i]%mod+mod)%mod),puts("");
	return 0;
}

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

#define LL long long

struct Node {
  int to;
  LL w;
  Node() {}
  Node(int _to, LL _w) {
    to = _to;
    w = _w;
  }
};

void dfs(int v, LL now, vector<LL> &dist, const vector<vector<Node>> &tree) {
  dist[v] = now;
  // cout << v+1 << " " << now << " " << endl;
  for (auto &e : tree[v]) {
    if (dist[e.to] != -1) continue;
    dfs(e.to, now+e.w, dist, tree);
  }
}

int main() {
  int N;
  cin >> N;
  vector<vector<Node>> tree(N, vector<Node>());
  for (int i=0; i < N-1; i++) {
    int u, v;
    LL w;
    cin >> u >> v >> w;
    u--;v--;
    tree[u].push_back(Node(v, w));
    tree[v].push_back(Node(u, w));
  }
  vector<LL> dist(N, -1);
  dfs(0, 0, dist, tree);
  for (int i=0; i < N; i++) {
    cout << dist[i] % 2LL << endl;
  }
}


Measured memory_bytes: 9984
using System;
    using System.Linq;
    using System.Collections.Generic;
     
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int[] A = new int[N];
            for(int i=0; i<N; i++){
                A[i] = int.Parse(input[i]);
            }

            int max = A[0];
            int min = A[0];

            for(int i=1; i<N; i++){
                if(A[i]>max) max = A[i];
                if(A[i]<min) min = A[i];
            }

            Console.WriteLine(max-min);
        }
    }

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

int main()
{
    ll n; cin >> n;
    if(n==2) {pr(1); return 0;}
    ll ans = 2;
    for(ll k=2; k*k <= n; k++){
        ll kt = k;
        ll nt = n;
        if((nt-1)%kt == 0){
            if((nt-1)/kt==kt) ans++;
            else ans += 2;
            // pr(kt);
            // pr((nt-1)/kt);
        }else{
            while(nt%kt==0 && nt!=1) {
                nt /= kt;
            }
            if(nt%kt==1) {
                ans++;
                // pr(kt);
            }
        }
    }

    pr(ans);
    return 0;}

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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define pb push_back
#define f first
#define s second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MAXN = 520;
const ll MOD = 1e9+7;

int n;
ll k;
ll a[MAXN];
ll sum = 0;

bool check(ll d) {
    ll s = 0;
    ll cnt = 0;
    vector<ll> mods;
    FOR(i, 1, n) {
        mods.pb(a[i]%d);
        s += a[i]%d;
    }
    sort(mods.begin(), mods.end());
    cnt = s;
    for (int i = n-1; s>0, i>=0; i--) {
        if (s <= 0) continue;
        s-=d;
        cnt -= mods[i];
        cnt += (d-mods[i]);
    }
    //cout << " d=" << d << " s=" << s << " cnt=" << cnt << endl;
    return (cnt<=2*k);
}

int main()
{
    FAST_IO;

    cin >> n >> k;
    FOR(i, 1, n) {
        cin >> a[i];
        sum += a[i];
    }

    ll ans = 1;
    for (ll i = 1; i*i <= sum; i++) {
        if (sum%i) continue;
        if (check(i)) ans = max(ans, i);
        if (check(sum/i)) ans = max(ans, sum/i);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
# ABC108B

x1, y1, x2, y2 = map(int, input().split())
if x1 <= x2 and y1 <= y2:
    d4 = x2-x1
    d3 = y2-y1
    print(x2-d3, y2+d4, x1-d3, y1+d4)
elif x1 > x2 and y1 <= y2:
    d4 = y2-y1
    d3 = x1-x2
    print(x2-d4, y2-d3, x1-d4, y1-d3)
elif x1 > x2 and y1 > y2:
    d4 = x1-x2
    d3 = y1-y2
    print(x2+d3, y2-d4, x1+d3, y1-d4)
elif x1 <= x2 and y1  > y2:
    d4 = y1-y2
    d3 = x2-x1
    print(x2+d4, y2+d3, x1+d4, y1+d3)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fill fill_n
#define pf push_front
#define pb push_back
#define FOR(i,l,r) for(int i=l;i<r;i++)
#define ROF(i,r,l) for(int i=r;i>=l;i--)
#define comp(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define infile freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
typedef vector<int> vi;
typedef vector<ll> vli;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvli;
const int M = 1e9+7;
const int N = 2e5;
ll po(int,int);


void solve(){
    int n;cin>>n;
    ll a[n];
    FOR(i,0,n) cin>>a[i];
    ll dp[n+1];
    dp[0]=1000;
    FOR(i,1,n){
        dp[i]=dp[i-1];
        FOR(j,0,i){
            ll x = dp[j]/a[j];
            ll c = dp[j] + (a[i]-a[j])*x;
            dp[i]=max(dp[i],c);
        }
    }
    cout<<dp[n-1]<<"\n";
    
}





int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int t=1;
    //cin>>t;
    FOR(i,1,t+1){
        //cout<<"Case #"<<i<<": "; 
        solve();
    }
    
	return 0;
	
	
}


ll po(int a,int b){
    if(b==0) return 1;
    ll ans=1;
    if(b%2==0){
        ans = po(a,b/2)%M;
        ans=(ans%M * ans%M)%M;
    }
    else{
        ans = po(a,(b-1)/2)%M;
        ans = (ans%M * ans%M * a)%M;
    }
    return ans%M;
}


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

long gcd(long a, long b)
{
    if (b == 0)
    {
        return a;
    }
    else
    {
        return gcd(b, a % b);
    }
}

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;

    long A[N];
    for (int n = 0; n < N; n++)
    {
        cin >> A[n];
    }

    long right_half_gcd[N];
    long left_half_gcd[N];
    for (int n = 0; n < N; n++)
    {
        if (n == 0)
        {
            left_half_gcd[n] = A[1];
            right_half_gcd[n] = A[1];
        }
        else if (n == N - 1)
        {
            left_half_gcd[n] = A[0];
            right_half_gcd[n] = A[N - 2];
        }
        else if (n == N - 2)
        {
            left_half_gcd[n] = A[0];
            right_half_gcd[n] = A[N - 1];
        }
        else
        {
            left_half_gcd[n] = A[0];
            right_half_gcd[n] = A[n - 1];
        }
    }

    for (int n = 2; n < N; n++)
    {
        left_half_gcd[n] = gcd(left_half_gcd[n - 1], A[n - 1]);
    }

    for (int n = N - 3; n >= 0; n--)
    {
        right_half_gcd[n] = gcd(right_half_gcd[n + 1], A[n + 1]);
    }

    long max_gcd = 1;
    for (int n = 0; n < N; n++)
    {
        //cout << left_half_gcd[n] << " " << right_half_gcd[n] << endl;
        max_gcd = max(max_gcd, gcd(left_half_gcd[n], right_half_gcd[n]));
    }

    cout << max_gcd;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi =vector<vi>;

int main(){
  cout << fixed << setprecision(8);
  double L;
  cin >> L;
  double R = L/3;
  double X = pow(L/3,3);
  cout <<X<< endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;

int main()
{	

	int sx,sy,tx,ty;
	cin>>sx>>sy>>tx>>ty;
	int dx=tx-sx;int dy=ty-sy;
	cout<<string(dx,'R')<<string(dy,'U')<<string(dx,'L')<<string(dy,'D');
	cout<<"D"<<string(dx+1,'R')<<string(dy+1,'U')<<"L";
	cout<<"U"<<string(dx+1,'L')<<string(dy+1,'D')<<"R";
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int h = scan.nextInt();
		int w = scan.nextInt();
		String c = scan.next();
		String[][] flag = new String[w][h];
		flag[w/2][h/2] = c;
		
		
		for(int i = 0 ; i < w ; i++) {
			for(int j = 0 ; j < h ;j++) {
				if(flag[i][j] != null){
				}else if(i == 0 || i == w-1){
					flag[i][j] = "-";
				}else if(j == h-1 || j == 0) {
					flag[i][j] = "|";
				}else {
					flag[i][j] = ".";
				}
				if((i == 0  && j == 0)||(i == w-1 && j == 0)||(i == 0 && j == h-1)||(i == w-1 && j == h-1)) {
					flag[i][j] = "+";
				}
				System.out.print(flag[i][j]);
			}
			System.out.println();
		}
	}

}



Measured memory_bytes: 26316
import java.util.*
import kotlin.math.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

fun main() {
    val (n, m) = readInts()

    val g = Array(n) { mutableListOf<Int>() }
    val dist = Array(n) { -1 }
    val dir = Array(n) { -1 }
    val q = ArrayDeque<Int>()

    (0 until m).forEach {
        val (aa, bb) = readInts()
        g[aa - 1].add(bb - 1)
        g[bb - 1].add(aa  - 1)
    }

    //g.forEach { println(it) }

    dist[0] = 0
    q.push(0)

    while (!q.isEmpty()) {
        val v = q.removeFirst()

        for (nv in g[v]) {
            if (dist[nv] != -1) continue

            dist[nv] = dist[v] + 1
            dir[nv] = v + 1
            q.addLast(nv)
        }
    }

    println("Yes")
    (1 until n).forEach {
        println(dir[it])
    }
}


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

int main(void) {
    int n, num, e, o;
    cin >> n;
    e = o = 0;
    for(int i = 0; i < n; i++){
        cin >> num;
        if(num % 2 == 0) e++;
        else o++;
    }
    if(o >= 2 && o % 2 == 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;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false


int main(void){
    ll K;
    cin >> K;
    bool AL[1114514]={};
    
    ll k=7%K;
    ll i=1;
    while(1){
        if(k==0){
            cout << i << endl;
            return 0;
        }
        if(AL[k]==true){
            cout << -1 << endl;
            return 0;
        }
        AL[k]=true;
        
        k = (7+k*10)%K;
        
        i++;
    }
    
    return 0;
}



Measured memory_bytes: 4720
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>

using namespace std;

int main() {
  string s;
  cin >> s;
  s[3] = '8';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;

int main(){
	int n, m, t;
	cin >> n >> m >> t;

	int a, a1;
	int count = 0;
	for(int i = 0; i < n; i++){
		cin >> a;
		if(i == 0)count += a - m;
		else{
			if(a - a1 > 2 * m)count += a - a1 - 2 * m;
		}
		a1 = a;
	}
	if(t > a + m)count += t - a - m;
	cout << count << endl;
		



}

Measured memory_bytes: 3108
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;

/*
struct point
{
long long dist; long long name;
bool operator<(const point& rhs) const {
return dist > rhs.dist;
}
};
*/

ll const MAX = 1000006;
ll k;
ll a[MAX];
ll b[MAX];

int main() {

	ll n,v; cin >> n >> v;
	REP(i, 1, n) {
		cin >> a[i];
	}
	k = 1;
	REP(i, 1, n) {
		ll cur = 0;
		REP(j, i, n) {
			cur += a[j];
			b[k] = cur;
			k++;
		}
	}
	k--;
	REP(i, 1, k) {
		//cout << b[i] << endl;
	}
	sort(b + 1, b + 1 + k);
	ll ans = 0;
	ll bit = 50;
	while (bit >= 0) {
		//cout << bit << endl;
		ll q = BIT(bit);
		ll t = 0;
		REP(i, 1, k) {
			if ((q&b[i]) != 0) {
				t++;
			}
		}
		//cout << bit << " " << p << " " << t << endl;
		if (t >= v) {
			ans += q;
			REP(i, 1, k) {
				if ((b[i] & q) == 0) {
					b[i] = 0;
				}
				else {
					b[i] %= q;
				}
			}
			sort(b + 1, b + 1 + k);
			
		}
		bit--;
	}
	cout << ans << endl;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;

struct UnionFind{
    vector<int> data;
    //data[i] = -x ... iが根であり、サイズがx
    //data[i] = x ... iの親がx

    //最初は全員根
    UnionFind(int size): data(size,-1){}

    bool union_set(int x, int y){//サイズがx>yになるようにしてから、xにyをつなげる
        x=root(x);
        y=root(y);
        if(x != y){
            if(data[y] < data[x]) swap(x,y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool find_set(int x, int y){//ルートが一致するかどうかを返す
        return root(x) == root(y);
    }
    int root(int x){//根を見つける。ついでに深さ2にしちゃう
        return data[x]<0 ? x : data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};

int main() {
    ll N,M; cin >> N >> M;
    vector<int> A(M);
    vector<int> B(M);
    REP(i,M){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }
    vector<ll> ans(M+1,0);
    UnionFind uf(N);
    ans[M] = N*(N-1)/2;

    REPR(i,M-1){
        if (uf.find_set(A[i],B[i])){
            ans[i] = ans[i+1];
        }else{
            ll A_size = uf.size(A[i]);
            ll B_size = uf.size(B[i]);
            ans[i] = ans[i+1] - A_size*B_size;
        }
        uf.union_set(A[i], B[i]);
    }

    FOR(i,1,M+1){
        cout << ans[i] << endl;
    }
    

    return 0;
}

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

int SumOfDigits(int n) {
	int sum = 0;

	while(n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

int main () {
  int N, A, B;
  cin >> N >> A >> B;
  int res = 0;

  for (int i = 1; i <= N; ++i) {
		
    int sum = SumOfDigits(i);
    if (A <= sum && sum <= B) res += i;
  }

  cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,c,d;
ll gcd(ll m,ll n){
  return n ? gcd(n,m%n) : m;
}
ll lcm(ll m,ll n){
  return m/gcd(m,n)*n;
}
ll f(ll x){
  ll res = x;
  res -= x/c;
  res -= x/d;
  res += x/lcm(c,d);
  return res;
}
int main(){
  cin >> a >> b >> c >> d;
  ll ans = f(b) - f(a-1);
  printf("%lld\n",ans);
}


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

typedef long long ll;
const int INF = 1e9 + 5;
int main() {
	ios_base::sync_with_stdio(false);

	int n, w;
	cin >> n >> w;
	vector<ll> weights(n + 1), values(n + 1);
	int v_sum = 0;
	for (int i = 1; i <= n; i++) {
		cin >> weights[i] >> values[i];
		v_sum += values[i];
	}

	vector<ll> dp(v_sum + 1, INF);
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = v_sum; j >= values[i]; j--) {
			dp[j] = min(dp[j], dp[j - values[i]] + weights[i]);
		}
	}

	for (int j = v_sum; j >= 0; j--) {
		if (dp[j] <= w) {
			cout << j << endl;
			break;
		}
	}

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> list(5);
  int t,j=0,mw=0;
  for(int i=0; i<5; i++) {
    cin >> list.at(i);
    t = 10-(list.at(i)%10);
    if(j < t && t != 10) {
      j = t;
      mw = i;
    }
  }
  int ans=0,x;
  for(int i=0; i<5; i++) {
    if(i != mw) {
      x = list.at(i);
      if(x%10 != 0) {
        x = (x+10)/10*10;
      }
      ans += x;
    }
  }
  ans += list.at(mw);
  cout << ans << endl;
}

Measured memory_bytes: 3628
n,m=map(int,raw_input().split())

mod=10**9+7

def kaijo(n):
    result=1
    for i in range(2,n+1):
        result*=i
        if result>mod:
            result=result%mod
    return result
    
def count(n,m):
    return kaijo(n)*kaijo(m)

if n-m==-1 or n-m==1:
    result=count(n,m)
    amari=result%mod
    print amari
elif n-m==0:
    result=count(n,m)
    result*=2
    amari=result%mod
    print amari
else:
    print 0

Measured memory_bytes: 5764
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)


def main():
    N, M, *A = map(int, read().split())
    B = A[::]

    while not any(b % 2 for b in B):
        B = [b // 2 for b in B]

    if not all(b % 2 for b in B):
        print(0)
        return

    semi_lcm = 1
    for a in A:
        semi_lcm = lcm(semi_lcm, a // 2)

    print((M // semi_lcm + 1) // 2)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 15372
#include<bits/stdc++.h>
using namespace std;
int main()
{

	int n, count = 0;
	cin >> n;
	int a[n];
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++)
	{
		if ((i & 1 ) && (a[i] & 1)) count++;

	}
	cout << count << endl;

	return 0;

}

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

struct Passenger{
    int n, t;
    bool operator<(const Passenger& obj)const{
        return t > obj.t;
    }
};

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

    priority_queue<Passenger> arr, ang;
    for(int i=0;i<n;++i){
        int t;
        cin >> t;
        arr.push((Passenger){i, t});
        ang.push((Passenger){i, t+k});
    }

    int ans = 0;
    while(!ang.empty()){
        Passenger p = ang.top(); ang.pop();
        arr.pop();
        int cnt = 1;
        while(!arr.empty() && arr.top().t <= p.t && cnt < c){
            arr.pop();
            ang.pop();
            cnt++;
        }
        ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2036
/*********************************************************************| 
|---------|    /\  ....                  ....                         |         
     |        /  \   \                    /  /------| ----- |-------| |
     |       /    \   \                  /  /           |   |         |
     |      /      \   \       /\       /  |            |   |         |
     |     /        \   \     /  \     /   |---|        |   |----|    |
     |    /__________\   \   /    \   /        |---|    |   |         |
     |   /            \   \ /      \ /              |   |   |         |
     |  /              \   |        |               /   |   |         |
     _ __              __ ...      ...      |------/  ----- _         |
                                                                      |  
        Md Tawsif Rahman                                              |
        Institute Of Information Technology                           |
        Jahangirnagar University                                      |                                                                         
                                                                      |
**********************************************************************/                 
#include<bits/stdc++.h>

using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define pii pair <int, int>
#define xx first
#define yy second
#define vi vector < int >
#define vl vector < ll >
#define vp vector < pii > 
#define inf  100000000 
#define f(i, c, n) for(i = c; i < n; i++)
#define fe(i, c, n) for(i = c; i <= n; i++)
#define fr(i, n, c) for(i = n - 1; i >= c; i--) 
#define vbe(a) a.begin(), a.end()
#define vsort(a) sort(a.begin(), a.end())
#define mem(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define srti(a, n) sort(a, a + n)
#define srtd(a, n) sort(a, a + n, greater<int>())
#define LB(a, x) (lower_bound(vbe(a), x) - a.begin())
#define UB(a, x) (upper_bound(vbe(a), x) - a.begin())

#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

#define fast ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
int i, j, temp;
// int convert_str_to_int(string s) {
//     stringstream str(s);
//     int x = 0;
//     str >> x;
//     return x;
// }


/********************|
                     |
   START HERE        |
                     |
*********************/



void solve() {
    int n, k;
    cin >> n >> k;
    int cnt[n + 10] = {0};
    int d, p;
    f(i, 0, k) {
        cin >> d;
        f(j, 0, d) {
            cin >> p;
            cnt[p]++;
        }
    }
    int count = 0;
    f(i, 1, n + 1) {
        if(!cnt[i]) count++;
    }
    cout << count << endl;
} 

int main() {
    fast;
    // int t; cin >> t; while(t--)
    solve(); 

}

Measured memory_bytes: 3620
//https://atcoder.jp/contests/agc015/tasks/agc015_a
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll N,A,B; cin>>N>>A>>B;
    ll min=A*(N-1)+B;
    ll max=B*(N-1)+A;
    ll ans=max-min+1;
    cout<<std::max<ll>(ans,0)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        for (int i = 0; i < 3; i++) {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a);

        System.out.println(a[2]*10 + a[1] + a[0]);
    }
}

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

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

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

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

  for (int i = 0; i < n; i++) {
    cout << vs.at(i);
  }

  return 0;
}

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

map <int, int> mmap;

int main()
{
	for (int i = 0; i < 3; i++)
	{
		int x;
		scanf("%d", &x);
		mmap[x]++;
	}
	for (auto y : mmap)
		if (y.second == 1)
			printf("%d\n", y.first);
	return 0;
}

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

int main(){
  long long N;
  cin>>N;
  long long ans=0;
  long long temp;
  for(long long i=1;i*i<=N;i++){
    if(N%i == 0 ){
      temp=i-1;
      if(i !=1 && N/(i-1)==N%(i-1)){
        ans+=temp;
      }
      temp=(N/i-1);
      if(N/i != 1 && N/(N/i-1)==N%(N/i-1)){
        ans+=temp;
      }
    }
  }

  cout<<setprecision(12)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3616
def main():
    A, B, C = map( int, input().split())
    K = int( input())
    for _ in range(K):
        if B <= A:
            B *= 2
            continue
        if C <= B:
            C *= 2
    if C > B and B > A:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()


Measured memory_bytes: 9172
from itertools import product
H, W = map(int, input().split())
S = [['.'] * (W + 2)] + [list('.' + input() + '.') for _ in range(H)] + [['.'] * (W + 2)]
dis = [1, 1, 1, 0, 0, -1, -1, -1]
djs = [-1, 0, 1, -1, 1, -1, 0, 1]
for i, j in product(range(1, H + 1), range(1, W + 1)):
    if S[i][j] == '.':
        around = [S[i + di][j + dj] for di, dj in zip(dis, djs)]
        S[i][j] = str(around.count('#'))

for li in S[1: H + 1]:
    print(''.join(li[1: W + 1]))

Measured memory_bytes: 3188
import sys
sys.setrecursionlimit(10 ** 6)

S = input()

def func(i):
    if i >= len(S):
        return True
    if S[i:i+5] == 'dream':
        if func(i + 5): return True
        if S[i+5:i+7] == 'er':
            if func(i + 7): return True
        return False
    if S[i:i+5] == 'erase':
        if func(i + 5): return True
        if S[i+5] == 'r':
            if func(i + 6): return True
        return False

print('YES' if func(0) else 'NO')


Measured memory_bytes: 17096
#include <stdio.h>
using namespace std;
int n, m, i, j, k, ans, l, hi[100005], w[100005]={0};
struct ROAD{
	int a, b;
}d[100005];
int main(){
	scanf("%d%d", &n, &m);
	for(i=1; i<=n; i++){
		scanf("%d", &hi[i]);
	}
	for(i=1; i<=m; i++){
		scanf("%d%d", &d[i].a, &d[i].b);
		if(hi[d[i].a] > hi[d[i].b]){
			w[d[i].a]++;
			w[d[i].b] = -1e9; 
		}
		else if(hi[d[i].a] < hi[d[i].b]){
			w[d[i].a] = -1e9;
			w[d[i].b]++;
		}
		else if(hi[d[i].a] == hi[d[i].b]){
			w[d[i].a] = -1e9;
			w[d[i].b] = -1e9;
		}
	}
	for(i=1; i<=n; i++){
		if(w[i] >= 0) ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3288
#include<bits/stdc++.h>
#define int long long
#define mod 1e18+10
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
int32_t main() {
	string a,b;
	int i;
	cin>>a>>b;
	a+=b;
	int k=stoi(a);
	for(i=1;i<=317;i++)
	if(i*i==k)
	{cout<<"Yes\n";
	return 0;
	}
	cout<<"No\n";
}	


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

#define mod 1000000007
#define LOCAL 0
#define pb push_back
#define ll long long

ll po(ll a,ll b){
	ll x = 1,y=a;
	while(b>0){
		if(b%2){
			x = x*y;
			x %= mod;
		}
		y=y*y;
		y%=mod;
		b/=2;
	}
	return x;
}

static char str[1005][1005];

int main(){
	if(LOCAL){
    	freopen("C:/Users/gold/Desktop/sublime IO/input.txt","r",stdin);
    	freopen("C:/Users/gold/Desktop/sublime IO/output.txt","w",stdout);
	}
	int T = 1;
	//scanf("%d",&T);
	while(T--){
		int n,m;
		scanf("%d %d",&n,&m);
		for(int i=0;i<n;i++){
			scanf("%s",str[i]);
		}	
		static int dx[] = {0, 0,1,1,1,-1,-1,-1}; 
		static int dy[] = {1,-1,0,-1,1,0,-1,1};
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(str[i][j] == '.'){
					int cnt =0 ;
					for(int k=0;k<8;k++){
						int r = i + dx[k];
						int c = j + dy[k];
						if(r >= 0 && r < n && c >= 0 && c < m && str[r][c] == '#'){
							cnt++;
						}
					}
					str[i][j] = cnt + '0';
				}
			}
		}	
		for(int i=0;i<n;i++){
			printf("%s\n",str[i]);
		}
	}
	return 0;	
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define MOD ((int)(1e9) + 7)
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
const int N = ((int)1e5) + 5;
const int M = ((int)1e3) + 5;

int n,a,b;

int main ()
{
	fast;
	cin >> n >> a >> b;
	cout << min(n * a, b);
}

Measured memory_bytes: 256
import sys
from math import sqrt

def dist(I, J, D):
    d = 0
    for k in range(D):
        d += pow(I[k] - J[k], 2)
    if int(sqrt(d)) ** 2 == d: return 1
    else: return 0

def solve():
    input = sys.stdin.readline
    N, D = map(int, input().split())
    X = [[int(i) for i in input().split()] for n in range(N)]
    count = 0
    for i in range(N-1):
        for j in range(i + 1, N):
            count += dist(X[i], X[j], D)
    print(count)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define int long long
using P = pair<int,int>;

signed main(){
  int n,a,b;
  cin >> n >> a >> b;
  vint A(n);
  rep(i,n) cin >> A[i];
  int ans = 0;
  rep(i,n-1){
    if((A[i+1] - A[i])*a < b){
      ans += (A[i+1] - A[i])*a;
    }
    else ans += b;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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;
}

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

int a[1000001], n;
int main() {
    cin >> n;
    a[0] = n;
    rep(i, 100000){
        if(a[i]%2){
            a[i+1] = a[i]*3+1;
        }else{
            a[i+1] = a[i]/2;
        }
    }

    map<int, int> mp;
    rep(i, 100001) {
        if(mp[a[i]]){
            cout << i + 1 << endl;
            return 0;
        }else{
           mp[a[i]]++;
        }
    }


}



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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    ll N, M, V, P;
    cin >> N >> M >> V >> P;
    Vl A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    sort(A.begin(), A.end(), greater<ll>());

    Vl csum(N + 1);
    for (int i = 0; i < N; i++) {
        csum[i + 1] = csum[i] + A[i];
    }

    int left = -1, right = N;
    while (right - left > 1) {
        int mid = (left + right) / 2;
        ll a = A[mid] + M;
        ll b = M * max(V - (N - mid) - (P - 1), 0LL);
        ll c = a * (mid - P + 1) - (csum[mid] - csum[P - 1]);
        if (mid < P) {
            left = mid;
        }
        else if (A[P - 1] > a) {
            right = mid;
        }
        else if (c < b) {
            right = mid;
        }
        else {
            left = mid;
        }
    }

    cout << left + 1 << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main() {
	ll a; string b; cin>>a>>b;
	ll c=0LL;
	c+=(ll)(b[0]-'0')*100;
	c+=(ll)(b[2]-'0')*10;
	c+=(ll)(b[3]-'0');
	cerr<<c<<endl;
	ll ans=a*c/100;
	cout<<ans<<endl;
	// ll ans=0LL;
	// ans += a*(ll)(b[0]-'0');
	// // cerr << ans<< endl;
	// // cerr<<a/10*(ll)(b[2]-'0')<<endl;
	// ans += a/10*(ll)(b[2]-'0');
	// // cerr << ans<< endl;
	// ans += a/100*(ll)(b[3]-'0');
	// // cerr<<(ll)(b[4]-'0')<<endl;
	// cout << ans<< endl;
	return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
int main(){
    int n,k;
    scanf("%d %d",&n,&k);
    char s[n];
    scanf("%s",s);
    if((65<=s[k-1])&&(s[k-1]<=90)){
        s[k-1]+=32;
    }
    printf("%s\n",s);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n=5,c;
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        v.push_back(x);
        if(v[i]==0)
            c=i+1;
    }
    cout<<c<<endl;

}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<string> s(N);
  vector<int> t(N);
  for (int i = 0; i < N; i++) {
    cin >> s.at(i) >> t.at(i);
  }
  string X;
  cin >> X;
  
  int sum = 0;
  int start = 0;
  for (int i = 0; i < N; i++) {
    if (start == 1) {
      sum += t.at(i);
    }
    if (X == s.at(i)) {
      start = 1;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e,sum=0;
	cin>>a>>b>>c>>d>>e;
	if(a<0){
		sum+=c*(a*-1)+d;
		a=0;
	}
	cout<<sum+((b-a)*e)<<endl;
}

Measured memory_bytes: 3084
s = input()

target = "ACGT"
max_len = 0
tmp_len = 0

for i in range(len(s)):
    if s[i] in target:
        tmp_len += 1
    else:
        max_len = max(tmp_len, max_len)
        tmp_len = 0
max_len = max(tmp_len, max_len)
print(max_len)


Measured memory_bytes: 2940
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define int long long

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここにグローバル変数宣言

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数宣言


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 int N;

 #define M 1000000000000000000

 cin>>N; 
 int A[N];
 REP(i,N){cin>>A[i];}
 double log_sum=0;




 REP(i,N){

 	if (A[i]==0){
	 cout<<0<<endl;
	 return 0;
 }
}

 REP(i,N){
 	log_sum+=log10(A[i]);
 }
 if (log_sum>18)
 	{
 		cout<<-1<<endl;
 		return 0;
 	}
 
 int seki=1;
 

 if (log_sum <19)
 {
 	REP(i,N){
 	seki*=A[i];
	}

	if (seki > M)
	{
		cout<<-1<<endl;
 		return 0;
	}
	if (seki==M)
	{
		cout<<M<<endl;
		return 0;
	}
 }

 seki=1;

 REP(i,N){
 	seki*=A[i];
 	//cout<<4294967296*4294967296<<endl;
	}
 
cout<<seki<<endl;

 
return 0;





}

Measured memory_bytes: 4640