akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int R[2]={1,1};
int C[2]={1,1};
int H[2][400010],N[2][400010];
long long h0=0,h1=0;
//評価関数（いまはMIN）
int hyouka(int a,int b,int n){
  if(C[n]<b)return 1;
  if(C[n]<a||b==0)return 0;
  if(n==0)return N[n][H[n][a]]>N[n][H[n][b]]?1:0;
  if(n==1)return N[n][H[n][a]]<N[n][H[n][b]]?1:0;
}
//挿入関数
void hin(int a,int n){
  int i=C[n]++;
  if(n==0)h0+=2e9-a;
  else    h1+=2e9+a;
  for(N[n][H[n][0]=R[n]]=a;hyouka(0,i/2,n);i/=2)H[n][i]=H[n][i/2];
  H[n][i]=R[n]++;
}
//取り出す関数
int hout(int n){
  int rt=H[n][1],i,j=2,k=H[n][--C[n]];
  if(n==0)h0-=2e9-N[n][rt];
  else    h1-=2e9+N[n][rt];
  for(i=1;hyouka(i,C[n],n);i=j)H[n][i]=H[n][j=i*2+1-hyouka(i*2,i*2+1,n)];
  H[n][j/2]=k;
  return rt;
}
int main(){
  int n,q,a,b;
  long long s=0,x,y;
  scanf("%d",&n);
  while(n--){
    scanf("%d",&q);
    if(q==1){
      scanf("%d %d",&a,&b);
      hin(a,0);
      //h=h+a+2e9;//printf("h %lld %d %d\n",h,C[0],C[1]);
      s+=b;
      if(C[0]>C[1]+1)hin(N[0][hout(0)],1);
      while(N[0][H[0][1]]>N[1][H[1][1]]){
	hin(N[0][hout(0)],1);
	hin(N[1][hout(1)],0);
      }//printf("%d %d %d\n",C[0]-1,C[1]-1,N[0][H[0][1]]);
    }
    else {
      x=N[0][H[0][1]];
      y=h0-(2e9-x)*(C[0]-1)+h1-(2e9+x)*(C[1]-1);
      //printf("h0:%lld h1:%lld %d %d\n",h0,h1,C[0]-1,C[1]-1);
      printf("%lld %lld\n",x,y+s);
    }
  }
  return 0;
}


Measured memory_bytes: 7424
def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    s = 0

    bc = [list(map(int, input().split())) for _ in range(m)]
    bc.sort(key=lambda x: x[1], reverse=True)

    arr = []
    sum_b = 0
    for b, c in bc:
        arr += [c] * b
        sum_b += b
        if sum_b >= n:
            break

    arr += a
    arr.sort(reverse=True)
    print(sum(arr[:n]))


main()

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

#define all(x) (x).begin(), (x).end()
#define dbl(k, x) fixed << setprecision(k) << (x)

template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}

#define _upgrade                \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)

// ********************** CODE ********************** //

const int N = 1e6 + 7;

const long long P = 1e9 + 7;

long long dp[N][4];

int main() {
  _upgrade;
  int n;
  cin >> n;
  dp[0][0] = 8;
  dp[0][1] = 1;
  dp[0][2] = 1;
  dp[0][3] = 0;

  for (int i = 1; i < n; i++) {
    dp[i][0] = (dp[i - 1][0] * 8) % P;
    dp[i][1] = (dp[i - 1][1] * 9 + dp[i - 1][0]) % P;
    dp[i][2] = (dp[i - 1][2] * 9 + dp[i - 1][0]) % P;
    dp[i][3] = (dp[i - 1][1] + dp[i - 1][2] + dp[i - 1][3] * 10) % P;
  }

  cout << dp[n - 1][3] << "\n";
  return 0;
}

Measured memory_bytes: 34780
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val (n, m) = readIntList()
    val h = listOf(0) + readIntList()
    val graph = List(n + 1) { mutableListOf<Int>() }
    for (i in 0 until m) {
        val edge = readIntList()
        graph[edge[0]].add(edge[1])
        graph[edge[1]].add(edge[0])
    }

    var count = 0
    graph.drop(1).forEachIndexed { index, edges ->
        if (edges.all { h[it] < h[index+1] }) {
            count += 1
        }
    }

    println(count)
}

Measured memory_bytes: 80088
import copy
N=int(input())



def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d


G=[]
for i in range(N):
    A=list(map(int, input().split()))
    G.append(A)

H=copy.deepcopy(G)

#print(H, G)
H=warshall_floyd(H)



for i in range(N):
    for j in range(N):
        if G[i][j]!=H[i][j]:
            print(-1)
            exit()
T=copy.deepcopy(H)
for k in range(N):
    for i in range(N):
        for j in range(N):
            if H[i][j]==H[i][k] + H[k][j] and i!=k and j!=k:
                T[i][j]=0
ans=0
for i in range(N):
    ans+=sum(T[i])
print(ans//2)





Measured memory_bytes: 77500
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define INF 0x3f3f3f3f

typedef long long ll;
typedef pair<ll,ll> pii;
typedef pair<double,double> pdd;
ll n,d;
ll g[50][50];
int main()
{
    while(cin>>n>>d)
    {
        ll sum=0;
        rep1(i,n) rep1(j,d) cin>>g[i][j];
        rep1(i,n)
        {
            for(int j=i+1;j<=n;j++)
            {
                ll ans=0;
                rep1(k,d)
                {
                    ans+=(g[i][k]-g[j][k])*(g[i][k]-g[j][k]);
                }
                for(int f=0;f<=ans;f++)
                {
                    if(f*f==ans) {sum++;break;}
                }
            }
        }
        cout<<sum<<"\n";
    }

    return 0;
}



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

#define fst first
#define snd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
}

const ld PI = 4*atan((ld)1);
const int INF = 998244353;
const ll _INF = 1e18+7;
const int mxn = 2e5+7;

vector<pair<ll, ll>>vi;
ll pf[mxn], dp[mxn];

int main(){
	setIO();
	ll n, k;
	cin >> n >> k;
	for (int i = 0; i < k; i++){
		int l, r;
		cin >> l >> r;
		vi.emp(l, r);
	}
	pf[1] = 1; dp[1] = 1;
	for (int i = 2; i <= n; i++){
		for (pair<ll, ll> x : vi) if (i-x.fst > 0) {
			dp[i] = (dp[i]+INF+pf[i-x.fst]-pf[max(i-x.snd-1, 0LL)])%INF;
		}
		pf[i] = (pf[i-1]+dp[i])%INF;
	}
	cout << dp[n] << endl;
}

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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(v) (v).begin(), (v).end()

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s,t;
  cin >> s;
  for(ll bit=0;bit<(1<<3);bit++){
    ll sum = s[0]-'0';
    t = "";
    for(ll i=0;i<3;i++){
      if(bit&(1<<i)){
        sum += s[i+1]-'0';
        t += "+";
      }
      else{
        sum -= s[i+1]-'0';
        t += "-";
      }
    }
    if(sum==7){
      rep(i,3){
        cout << s[i] << t[i];
      }
      cout << s[3] << '=' << 7 << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    fast_io
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];

    rep(i,n-1) a[i+1] += a[i];
    rep(i,m-1) b[i+1] += b[i];

    // aを０冊読むとき
    ll a_count = 0;
    ll time_tmp = 0;
    ll time_rest = k - time_tmp;
    ll b_count = upper_bound(b.begin(), b.end(), time_rest) - b.begin();
    ll count = a_count + b_count;

    // aをi+1札読むとき
    rep(i,n) {
        a_count = i+1;
        time_tmp = a[i];
        time_rest = k - time_tmp;
        if (time_rest < 0) break;
        b_count = upper_bound(b.begin(), b.end(), time_rest) - b.begin();
        ll count_tmp = a_count + b_count;
        count = max(count, count_tmp);
    }
    
    
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;


void solve(){
    string s;
    cin >> s;
    int t = 0;
    rep(i,4){
        if(s[i]=='+') t++;
        else t--;
    }
    cout << t << endl;
}

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


Measured memory_bytes: 256
use std::ascii::AsciiExt;
use std::collections::HashMap;

fn main() {
    let mut h: HashMap<char, i32> = HashMap::new();

    loop {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        if s.is_empty() {
            break;
        }

        for c in s.chars().map(|c| c.to_ascii_lowercase()) {
            let count = match h.get(&c) {
                Some(c) => c + 1,
                None => 1,
            };
            h.insert(c, count);
        }
    }

    for c in b'a'..b'z' + 1 {
        println!("{} : {}", c as char, h.get(&(c as char)).unwrap_or(&0));
    }
}



Measured memory_bytes: 5036
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C,D,AB,CD;
    cin >> A >> B >> C >> D;
    AB = A * B;
    CD = C * D;
    if (AB > CD) cout << AB << endl;
    else if(CD > AB) cout << CD << endl;
    else cout << AB << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	map<string, int> mp;
	string s;
	for (int i = 0; i < n; ++i) {
		cin >> s;
		++mp[s];
	}
	int max_i = 0;
	for (auto x : mp)
		if (x.second > max_i) max_i = x.second;
	for (auto x : mp) {
		if (x.second == max_i)
			cout << x.first << endl;
	}
	return 0;
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
using namespace std;
#define int long long int
const int mxN =150000;
int32_t main(){
  ios_base::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);

  string s,t; cin>>s>>t;
  int res=0;
  for(int i=0;i<s.size();i++)
  if(s[i]!=t[i])res++;
  cout<<res<<endl;


 return 0;}



Measured memory_bytes: 3796
#include<cstdio>
#define ll long long
const int NUM=2e5+5,N=4005,mo=1e9+7,inv2=mo+1>>1;
int num,nx,mx,n,m,i,j,f[N][N],ans;
struct arr{int x,y;}a[NUM];
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
int g[N][N];
void init(){
	for (i=0;i<=n;i++) g[i][0]=1;
	for (i=1;i<=m;i++) g[0][i]=1;
	for (i=1;i<=n;i++) for (j=1;j<=m;j++)
		g[i][j]=(g[i-1][j]+g[i][j-1])%mo;
}
int main(){
	for (num=read(),i=1;i<=num;i++){
		a[i]=(arr){read(),read()};
		if (a[i].x>nx) nx=a[i].x;
		if (a[i].y>mx) mx=a[i].y;
	}
	nx++;mx++;n=nx*2;m=mx*2;init();
	for (i=1;i<=num;i++)
		f[nx-a[i].x][mx-a[i].y]++;
	for (i=1;i<=n;i++) for (j=1;j<=m;j++)
		f[i][j]=((ll)f[i][j]+f[i-1][j]+f[i][j-1])%mo;
	for (i=1;i<=num;i++){
		ans=(ans+f[a[i].x+nx][a[i].y+mx])%mo;
		ans=(ans-g[a[i].x*2][a[i].y*2])%mo;
	}
	printf("%d",((ll)ans*inv2%mo+mo)%mo);
}

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

using namespace std;
typedef long long int ll;

ll A[81][81];
ll B[81][81];
ll D[81][81];
bool dp[81][81][6500];

int main() {

    ll H, W; cin >> H >> W;
 
    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            cin >> A[i][j];
        }
    }

    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            cin >> B[i][j];
            D[i][j] = abs(A[i][j] - B[i][j]);
        }
    }

    //初期化
    dp[0][0][abs(A[0][0] - B[0][0])] = true;

    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            for(ll k = 0; k < 6400; k++){
                if(dp[i][j][k]){
                    dp[i][j+1][abs(k - abs(A[i][j+1] - B[i][j+1]))] = true;
                    dp[i][j+1][abs(k + abs(A[i][j+1] - B[i][j+1]))] = true;
                    
                    dp[i+1][j][abs(k - abs(A[i+1][j] - B[i+1][j]))] = true; 
                    dp[i+1][j][abs(k + abs(A[i+1][j] - B[i+1][j]))] = true;
                     
                }
            }
        }
    }

    for(ll k = 0; k < 6400; k++){
        if(dp[H-1][W-1][k]){
            cout << k << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 41856
#define MYDEBUG
//
#include <bits/stdc++.h>
#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#define dbp4(w,x,y,z) cout<<#w<<","<<#x<<","<<#y<<","<<#z<<": "<<w<<","<<x<<","<<y<<","<<z<<endl
#define ifcin(x) std::ifstream cin(x)
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#define dbp4(w,x,y,z)
#define ifcin(x)
#endif
#define ll long long
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)
#define REP(i, from, to) for(int i=from; i<=to; ++i)
using namespace std;
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last) {
			out << ",";
		}
	}
	out << "]";
	return out;
}
template<typename T>
ostream& operator<<(ostream& out, const vector<vector<T> >& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i] << endl;
	}
	return out;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& p) {
	out << "{" << p.first << "," << p.second << "}";
	return out;
}

static const int MAX_N = 500000;
static const int INF = 1000000000 + 10000;
int a[MAX_N], l[MAX_N / 2 + 2], r[MAX_N / 2 + 2];
int cnt = 0;

//[left, right)
//[left, mid), [mid, right)
void merge(int arr[], int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	//[0, 5)
	//[0, 2), [2, 5)
	//0,1 : 2,3,4
	//n1 = 2 - 0 = 2
	//n2 = 4 - 2 = 2
	rep(i,0,n1)
	{
		l[i] = arr[left + i];
	}
	rep(i,0,n2)
	{
		r[i] = arr[mid + i];
	}
	l[n1] = INF;
	r[n2] = INF;
	int i = 0, j = 0;
	rep(k,left,right)	//n1+n2 == right - left
	{
		if (l[i] <= r[j]) {
			arr[k] = l[i++];
			cnt++;
		} else {
			arr[k] = r[j++];
			cnt++;
		}
	}
}

void mergeSort(int arr[], int left, int right) {
	if (left + 1 < right) {	//要素数2以上
		int mid = (left + right) / 2;
		mergeSort(arr, left, mid);
		mergeSort(arr, mid, right);
		merge(arr, left, mid, right);
	}
}

void solve() {
	int n;
	scanf("%d", &n);
	rep(i,0,n)
	{
		scanf("%d", &a[i]);
	}
	mergeSort(a, 0, n);
	int ins = 0;
	rep(i,0,n)
	{
		if (ins++ > 0) {
			printf(" ");
		}
		printf("%d", a[i]);
	}
	printf("\n%d\n", cnt);
}
int main() {
	solve();
	return 0;
}



Measured memory_bytes: 7116
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    string s, t, ans;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if(s >= t) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

signed main(void)
{
    string s;
    cin >> s;
    int n = s.length();
    vll a(n+1);
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '<') {
            a[i+1] = a[i] + 1;
        }
    }
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == '>') {
            if (a[i] <= a[i+1]) {
                a[i] = a[i+1] + 1;
            }
        }
    }
    rep(i, n+1) {
        ans += a[i];
    }
    mes(ans);
    
}

Measured memory_bytes: 7648
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		double x1=scan.nextDouble();
		double y1=scan.nextDouble();
		double x2=scan.nextDouble();
		double y2=scan.nextDouble();
		double a=x1-x2;
		double b=y1-y2;
		double c=0;
		if(Math.abs(a)==0 || Math.abs(b)==0) {
			c=Math.abs(a)+Math.abs(b);
		}else {
			c=Math.sqrt(Math.pow(a,2)+Math.pow(b, 2));
		}
		System.out.printf("%.8f\n",c);
		scan.close();
	}
}


Measured memory_bytes: 28288
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A_reverse = list(reversed(A))
    left = [0]
    right = [0]
    answer = []
    for n in range(N):
        left.append(gcd(left[n], A[n]))
        right.append(gcd(right[n], A_reverse[n]))
    del left[N]
    del right[N]
    right.reverse()
    for n in range(N):
        answer.append(gcd(left[n], right[n]))
    print(max(answer))


def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


if __name__ == "__main__":
    main()


Measured memory_bytes: 14400
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);

using ll = long long;
using namespace std;
using ld = long double;



int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    ll l,r;
    const int mod=2019;
    cin >> l >> r;
    int res=3000;
    if ((r/mod) != ((l-1)/mod) ) cout << 0; else
    {
        l%=mod;
        r%=mod;
        for(int i=l; i<r; ++i)
            for(int j= i+1; j<=r; ++j)
            res=min(res,(i*j)%mod);
        cout << res;
    }
    return 0;
}



Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var in string
	var i int
	fmt.Scan(&in)
	if in[0] == '1' {
		i++
	}
	if in[1] == '1' {
		i++
	}
	if in[2] == '1' {
		i++
	}
	fmt.Println(i)
}


Measured memory_bytes: 512
#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;

int n, m;
vector<vector<int>> dp;
int main() {
    cin >> n >> m;
    vector<int> c(m);
    REP(i,m){
        cin >> c[i];
    }
    dp.assign(m+1, vector<int>(n+1,n));

    REP(i,m+1) dp[i][0] = 0;
    
    FOR(i,0,m){
        FOR(j,0,n+1){
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);//選ばない

            if(j-c[i] >= 0){//選ぶ
                dp[i+1][j] = min(dp[i+1][j], dp[i][j-c[i]]+1);
                dp[i+1][j] = min(dp[i+1][j], dp[i+1][j-c[i]]+1);
            }
        }
    }

    cout << dp[m][n] << endl;

    return 0;
}



Measured memory_bytes: 7088
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vi A(N), B(N), from(N);
    ll re = 0;
    rep(a, N) {
        cin >> A[a];
        B[a] = a - A[a];
        if (B[a] < 0)re = -1;
    }
    rep(a, N - 1)if (B[a] > B[a + 1])re = -1;
    if (re != -1) {
        vector<int> used(N);
        for (int a = N - 1; a >= 0; --a)if (!used[B[a]]++) {
            re += a - B[a];
        }
    }

    cout << re << endl;
}

Measured memory_bytes: 3456
n = int(input())
rec = -1
for ai_str in input().split():
    ai = int(ai_str)
    if rec == -1:
        if ai == 1:
            rec = 1
    else:
        if rec + 1 == ai:
            rec = ai
if rec == -1:
    print('-1')
else:
    print(n - rec)

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

using namespace std;

int main() {
    string s;
    string t;
    cin>>s>>t;
    int lens = s.length(), lent = t.length();
    int cost = lent;
    for(int i = 0; i <= lens-lent; i++) {
        int same = 0;
        for(int j = 0; j < lent; j++) {
            if(s[i+j] == t[j]) {
                same++;
            }
        }
        cost = min(lent-same, cost);
    }
    cout<<cost<<endl;
    return 0;
}

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

int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char>>board(50,vector<char>(50));
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin>>board.at(i).at(j);
        }
    }
    const vector<int> dx = {0,0,1,-1};
    const vector<int> dy = {1,-1,0,0};
    bool check2=true;
    for(int i=0; i<h; i++){
        for(int j=0; j<w;j++){
            if(board.at(i).at(j)=='.')continue;
            bool check=false;
            for(int k=0; k<4; k++){
                int nx=i+dx.at(k);
                int ny=j+dy.at(k);
                if(nx<0 or h<=nx)continue;
                if(ny<0 or w<=ny)continue;
                if(board.at(nx).at(ny)=='#'){
                    check=true;
                    break;
                }
            }
            if(check==false){
                check2=false;
                break;
            }
        }
    if(check2==false)break;
    }
    if(check2)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    int ans = 0;
    int n; string s; cin >> n >> s;
    for (int k = 1; k < n; k++) {
        string a, b;
        int a_cnt[26] = {0, };
        int b_cnt[26] = {0, };
        for (int i = 0; i < k; i++) {
            a += s[i];
            a_cnt[s[i] - 97]++;
        }
        for (int i = k; i < n; i++) {
            b += s[i];
            b_cnt[s[i] - 97]++;
        }

        int res = 0;
        for (int i = 0; i < 26; i++) {
            if (a_cnt[i] && b_cnt[i]) res++;
        }

        ans = max(ans, res);
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1<<17;

int main(){
    LL N,x;
    cin >> N >> x;
    LL a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    LL m[N][N];
    for(int i=0;i<N;i++){
        LL t=LINF;
        for(int j=i+N;j>i;j--){
            t=min(a[j%N],t);
            m[i+N-j][i]=t;
        }
    }
    LL ans=LINF;
    for(LL i=0;i<N;i++){
        LL t=0;
        for(int j=0;j<N;j++){
            t+=m[i][j];
        }
        ans=min(ans,t+x*i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 31488
n=gets.to_i
a=(1..n).map{
  (1..gets.to_i).map{
    gets.split.map(&:to_i)
  }
}
p (0...2**n).select{|b|
  (0...n).all?{|i|
    b[i]==0 || a[i].all?{|x,y|b[x-1]==y}
  }
}.map{|b|b.to_s(2).count(?1)}.max


Measured memory_bytes: 2428
N, T = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

dp = [[0] * (T + 1) for _ in range(N + 1)]
for i, (a, b) in enumerate(sorted(X)):
    for j in range(T + 1):
        if j == T:
            dp[i + 1][j] = max(dp[i][j], dp[i][j - 1] + b)
        elif j < a:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = max(dp[i][j], dp[i][j - a] + b)
            
print(dp[-1][-1])


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

int main(){
    int k=42;
    int n=k*(k-1)+1;
    int p=k-1;

    vector<vector<int>> res(n);
    for(int i=0;i<k;i++) res[0].push_back(i+1);
    
    for(int x=0;x<k;x++){
        for(int y=0;y<p;y++){
            res[1+x*p+y].push_back(x+1);
        }
    }
    
    int flesh=k+1;
    for(int s=0;s<p;s++){
        for(int t=0;t<k-1;t++){
            res[1+s].push_back(flesh);
            for(int x=0;x<k-1;x++){
                res[1+(x+1)*p+(t+s*x)%p].push_back(flesh);
            }
            flesh++;
        }
    }
    cout<<n<<" "<<k<<endl;
    for(int i=0;i<n;i++){
        assert(res[i].size()==k);
        for(int j=0;j<k;j++){
            cout<<res[i][j]<<(j+1==k ? "\n" : " ");
        }
    }

    return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
 
int main(){
    int n, q;
    long int sum=0, count[1<<20]={0}, p;
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%ld", &p);
        count[p]++;
        sum = sum + p;
    }
    scanf("%d", &q);
    int b[1<<20], c[1<<20];
    for(int i=0; i<q; i++){
        scanf("%d%d", &b[i], &c[i]);
        sum = sum + (c[i]-b[i])*count[b[i]];
        printf("%ld\n", sum);
        count[c[i]] = count[c[i]] + count[b[i]];
        count[b[i]] = 0;
    }
}

Measured memory_bytes: 10676
def comb(n, k, fact, invfact, M):
    return fact[n] * invfact[k] * invfact[n-k] % M

def main():

    s = int(input())
    M = 10** 9 + 7
    fact = [0] * 4001
    invfact = [0] * 4001
    fact[0] = 1
    for i in range(1,4001):
        fact[i] = fact[i-1] * i % M

    invfact[-1] = pow(fact[-1], M - 2, M)
    for i in range(4001-1, 0, -1):
        invfact[i-1] = invfact[i] * i % M
    ans = 0
    # try:
    for n in range(1,s):
        if 3 * n > s:
            break
        ans += comb(s-3*n+n-1, n-1, fact, invfact, M)
        ans %= M
    # except :
    #     print(n)
    #     print(s-3*n+n-1)
    print(ans)
if __name__=='__main__':
    main()


Measured memory_bytes: 9196
#include <iostream>
using namespace std;
int main() {
    int d;cin >> d;
    if (d == 25) cout << "Christmas" << endl;
    else if (d == 24) cout << "Christmas Eve" << endl;
    else if (d == 23) cout << "Christmas Eve Eve" << endl;
    else cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;

using edge= struct{int to;ll cost;};


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

typedef priority_queue<ll> PQ_HIGH;
typedef priority_queue<ll,VL,greater<ll>> PQ_LOW;//昇順

//A 65
//a 97

int main(){
  int p,q,r;cin>>p>>q>>r;
  cout<<p+q+r-max({p,q,r})<<endl;
}

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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}

char grid[301][301];

int main(){

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n; cin >> n;

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

    long long tot = 0;

    for(int i = 0; i < n; ++i){
        bool f = true;
        char cop[301][301];

        for(int x = 0; x < n; ++x)
            for(int y = 0; y < n; ++y)
                cop[x][y] = grid[x][(y + i) % n];

        for(int x = 0; x < n && f; ++x)
            for(int y = 0; y < n && f; ++y)
                if(cop[x][y] != cop[y][x])
                    f = false;

        if(f)
            tot += n;

    }

    cout << tot << "\n";

    return 0;

}


Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll n,k;
    cin >>n>>k;
    ll a[n];
    ll ii=0;


    F0R(i,n) {
      cin >> a[i];
      if(a[i] == 1) ii = i;
    }
    if(n == k) {
      cout << 1<<endl;
      return 0;
    }
    ll minOp = INF;
    F0R(l,k){
      ll temp = (ii-l+k-2)/(k-1) + (n+l-ii-2)/(k-1) + 1;
      if(temp < minOp) minOp = temp;
    }
    cout << minOp<<endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
template<typename T> inline void add(T& a, T b) { a += b; if (a >= MOD) a -= MOD; }

int D1[100005];
int D2[100005];

void dfs1(vector<vector<int>>& g, int cur, int pre, int d) {
  D1[cur] = d;
  rep(i, g[cur].size()) {
    if(g[cur][i] != pre) {
      dfs1(g, g[cur][i], cur, d + 1);
    }
  }
}

void dfs2(vector<vector<int>>& g, int cur, int pre, int d) {
  D2[cur] = d;
  rep(i, g[cur].size()) {
    if(g[cur][i] != pre) {
      dfs2(g, g[cur][i], cur, d + 1);
    }
  }
}

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

  int N,U,V; cin >> N >> U >> V;
  --U;
  --V;
  vector<vector<int>> G(N);
  rep(i, N-1) {
    int a,b; cin >> a >> b;
    --a;
    --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  dfs1(G, U, U, 0);
  dfs2(G, V, V, 0);

  int ans = 0;
  rep(i, N) {
    if(D1[i] < D2[i]) {
      ans = max(ans, D2[i] - 1);
    }
  }

  cout << ans << endl;
}


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


int h,w;
char mas[50][51];
int memo[50][50];

int move_x[4] = {1,-1,0,0};
int move_y[4] = {0,0,1,-1};


int main(){
  cin >> h >> w;
  for(int i = 0;i < h;i++){
    cin >> mas[i];
  }

  int white = 0;
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      if(mas[i][j] == '.'){
        white++;
      }
      memo[i][j] = -1;
    }
  }

  queue<int> que;
  int x = 0;
  int y = 0;
  int cnt = 1;
  que.push(x);
  que.push(y);
  que.push(cnt);

  while(!que.empty()){
    x = que.front(); que.pop();
    y = que.front(); que.pop();
    cnt = que.front(); que.pop();

    if(x >= 0 && x < w && y >= 0 && y < h && mas[y][x] == '.' && memo[y][x] == -1){
      memo[y][x] = cnt;
      for(int i = 0;i < 4;i++){
        que.push(x+move_x[i]);
        que.push(y+move_y[i]);
        que.push(cnt+1);
      }
    }
  }

  if(memo[h-1][w-1] == -1){
    cout << -1 << endl;
  }else{
    cout << white - memo[h-1][w-1] << endl;
  }

  return 0;
}





Measured memory_bytes: 256
a, s = [0]*100003, [0]*100003
while True:
	n, k=map(int, input().split())
	if n==0 :
	    break
	s[0]=a[0]=int(input())
	for i in range(1, n):
		a[i]=int(input())
		s[i]=s[i-1] + a[i]
		if i>=k:
		    s[i] -= a[i-k]
	ans=0
	for i in range(k, n):
		if s[i] > ans:
		    ans = s[i]
	print(ans)


Measured memory_bytes: 13316
// --------------
// Tejas Pandey  |
// 21 - 06 - 19  |
// Atcoder #131  |    |
// --------------

#include <bits/stdc++.h>
using namespace std;

#define mod 1000000007
typedef long long int ll;

int main (void)
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int n,l;
	cin >> n >> l;
	ll sum = 0;
	int pie[n];
	for(int i = 1;i <= n;i++)
	{
		pie[i-1] = l + i - 1;
		sum += pie[i-1];
	}
	int ans = pie[0];
	for(int i = 1;i < n;i++)
	{
		if(abs(ans) > abs(pie[i]))
		ans = pie[i];
	}
	cout << sum - ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double r=sc.nextDouble();
        double pi=Math.PI;
        double area=pi*r*r;
        double length=2*pi*r;
        System.out.printf("%f %f",area,length);
        System.out.println();
        sc.close();
    }
}


Measured memory_bytes: 27964
#include <stdio.h>
#include <string.h>


int main(){
	long long N,A,B;
	int a=0,b=0,i;
	char s[110];
	
	long long K=0,amari,ans_amari;

	scanf("%lld%lld%lld",&N,&A,&B);
	
	if(A==0){
		printf("0\n");return 0;
	}
	
	K = N/(A+B);
	amari = N%(A+B);
	
	if(amari<A)ans_amari=amari;
	else ans_amari=A;
	
	printf("%lld\n", A*K+ans_amari);
	//printf("%ld %ld*(%ld - %ld)\n", cnt,edge,K,sa);
 return 0;
 }

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  if(abs(A-B) % 2 == 0) cout << "Alice" << endl;
  else cout << "Borys" << endl;
  
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <climits>
#include <cmath>
#include <queue>
#include <ctime>
using namespace std;


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

    long long n, k, x, y;
    cin >> n >> k >> x >> y;
    if (n <= k) {
        cout << n * x << endl; 
    } else {
        cout << k * x + (n - k) * y << endl;
    }
    
    
    return 0;
}   

Measured memory_bytes: 256
// <------------- Template -----------------------> //


#include<bits/stdc++.h>
using namespace std;

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(20);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	2 * 1e18;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

vll adj[MAX5];

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, y, q, m, k;
string s, t, d;
ll sum = 0;
ll cou = 0;


// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	char x,y;
	cin >> x >> y;
	if(x == y) cout<<"=";
	if(x < y) cout<<"<";
	if(x > y) cout<<">";
}

int main() {
	fastio; randomINT;
	//cin>>T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 5968
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int x[100010];
signed main(){
    int n,a,b;
    cin>>n>>a>>b;
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    ll ans=0;
    for (int i = 0; i < n-1; i++)
    {
        if(a*(x[i+1]-x[i])<b) ans+=a*(x[i+1]-x[i]);
        else ans+=b; 
    }
    cout<<ans<<endl;
    
   
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    int K,A,B;
    cin >> K >> A >> B;
    int c=A/K;
    int d=(c+1)*K;
    if(d<=B || A%K == 0) cout << "OK";
    else cout << "NG" << endl;
    
    return 0;
}

Measured memory_bytes: 3636
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '(L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

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

    if(a<=c&&c<=b){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}



Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    long H =sc.nextLong();
    if(H==1){System.out.println(1);}
    else{
    long M[]=new long[100000];
    long N[]=new long[100000];
    M[0]=H;N[0]=1;int k=0;
    for(int i=1;i<100;i++){
      M[i]=(M[i-1]-M[i-1]%2)/2;
      N[i]=2*N[i-1];
      k=k+1;
    if(M[i]==1){break;}}
    long x=0;
    for(int j=0;j<=k;j++){
      x=x+N[j];}
    System.out.println(x);
  }}
}

Measured memory_bytes: 25812
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

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

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr ll LNF = 1e15+7;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    int i = 0;
    int j = n-1;
    int ans = 0;
    while(i<j){
      if(s[i]==s[j]){
        i++;
        j--;
      }
      else if(s[i]=='x'){
        ans++;
        i++;
      }
      else if(s[j]=='x'){
        ans++;
        j--;
      }
      else{
        cout << -1 << endl;
        return 0;
      }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long int64;

const int MAX = 1e6 + 5;
bitset<MAX> prime;
vector<int> v;

void seive(int N) {
    prime.set();
    prime[0] = prime[1] = false;
    for (int i = 2; i * i <= N; ++i) {
        if (prime[i]) {
            for (int j = i * i; j <= N ; j += i) {
                prime[j] = false;
            }
        }
    }
    for (int i = 1; i < N; ++ i) {
        if (prime[i]) v.emplace_back(i);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    seive(1e6);
    int x;
    cin >> x;
    cout << *lower_bound(v.begin(), v.end(), x);
    
}

Measured memory_bytes: 1020
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long INT;
double PI = 3.14159265;

const long long INF = 1LL << 60;
//---//
INT dp[2010][2010], mx = 0;

int main() {
    string s;

    cin >> s;

    if(s[2]==s[3]&&s[4]==s[5])cout << "Yes" << endl;
    else cout << "No" << endl;

  return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

//long double f[105];

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

    /*f[0] = f[1] = 1;
    for (int i = 2; i <= 105; i++) {
        long double x = (long double)i;
        f[i] = x * f[i-2];
        cout << fixed << i << ":   " << f[i] << "\n";
    }*/

    ll n; cin >> n;
    ll ans = 0LL;

    if (n%2 == 1) {
        cout << 0;
        return 0;
    }

    ll powOf5 = 5LL;
    while (powOf5 <= n) {
        ll tmp = n / powOf5;
        tmp /= 2;
        ans += tmp;
        powOf5 *= 5;
    }

    cout << ans;



    return 0;
}


Measured memory_bytes: 256