akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	int N;
	ll X;
	ll lay_num(int n) {
		static ll memo[51];
		if (n == 0) return 1;
		if (memo[n]) return memo[n];
		return memo[n] = 2 * lay_num(n - 1) + 3;
	}
	ll p_num(int n, ll x) {
		if (x == 0) return 0;
		if (n == 0) return 1;
		if (x - 1 <= lay_num(n - 1)) return p_num(n - 1, x - 1);
		if (x == 2 * lay_num(n - 1) + 3) return 2 * p_num(n - 1, lay_num(n - 1)) + 1;
		return p_num(n - 1, lay_num(n - 1)) + 1 + p_num(n - 1, x - 2 - lay_num(n - 1));
	}
	vector<int> h;
	void ans() {
		cin >> N >> X;
		cout << p_num(N, X) << "\n";
	}
};

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

	question q;
	q.ans();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <memory.h>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define ll long long
using namespace std;

const int N = 2e5 + 7;
const ll MOD = 1e9 + 7;

void solve() {
    int n, k;
    cin >> n >> k;
    ll ans = 0;
    for (ll i = k; i <= n + 1; i++) {
        ll r = i * (2 * n - i + 1) / 2;
        ll l = i * (i - 1) / 2;
        ans += r - l + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}

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


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

/*
# BIT
## ??????
??°??? a1, a2, a3, ..., a4 ????????????,

- i ???????????????, a1 + a2 + ... + ai ????¨??????????
- i ??¨ x ???????????????, ai ?????x ????¶????

????????? O(lgN) ??§??§????????????????§????

## ??????????????? 1 ????????£??????????????????
x & -x
 x : 01000110
-x : 10111010
-------------
 & : 00000010

## ?????°?????´??°
?¬??????´??°???????????????????????????????????????????¶??????¨?±???????
```
x + (x & -x)
```

## ???????¨????
?¬?????¶???????????????????????????????????????????????????¨?±???????
```
x - (x & -x)
```
*/

// 1-indexed
// [1, i]
class BIT {
    int n;
    vector<int> dat;

public:
    BIT(int _n) : n(_n), dat(vector<int>(_n+1)) {}

    void add(int i, int x)
    {
        while (i <= n) {
            dat[i] += x;
            i += i & -i;
        }
    }

    int sum(int i)
    {
        int res = 0;
        while (i > 0) {
            res += dat[i];
            i -= i & -i;
        }
        return res;
    }

    // [l, r]
    int sum(int l, int r)
    {
        return sum(r) - sum(l-1);
    }
};

int main()
{
    ios::sync_with_stdio(false);

    int N, Q;
    cin >> N >> Q;
    BIT bit(N);
    rep(i, Q) {
        int C, X, Y;
        cin >> C >> X >> Y;

        if (C == 0) {
            bit.add(X, Y);
        } else {
            cout << bit.sum(X, Y) << endl;
        }
    }
}

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

int64_t zet(int64_t x){
    if (x >= 0){
        return x;
    }
    else{
        return (x * (-1));
    }
}
    
    
void hik(int64_t M, int64_t J, int64_t &ans){
    if (M <= zet(M - J)){
        ans = M;
    }
    else{
        hik(zet(M-J), J, ans);
    }
}

int main() {
    int64_t N, K;
    cin >> N >> K;
    int64_t ans = 0;
    N = N % K;
    hik(N, K, ans);
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;
ll dp[1001][1001];
int dx[]={-1,0,0,1};
int dy[]={0,1,-1,0};

int main(){
    int n,m;
    cin>>n>>m;
    vector<ll> a(0);
    for(int i=0;i<n;i++){
        ll now;
        cin>>now;
        a.push_back(now);
    }
    vector<P> cb(m);
    for(int i=0;i<m;i++){
        cin>>cb[i].second>>cb[i].first;
    }
    sort(cb.begin(),cb.end(),greater<P>());
    int f=n;
    int now=0;
    while(f && now<cb.size()){
        int c=cb[now].first;
        int b=cb[now].second;
        while(b>0 && f>0){
            a.push_back(c);
            b--; f--;
        }
        now++;
    }
    sort(a.begin(),a.end(),greater<ll>());
    ll ans=0;
    for(int i=0;i<n;i++){
        ans+=a[i];
    }
    cout<<ans<<endl;

    
}

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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; const ll MOD = 1000000007;
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; }

//---------------------------------------------------------------------------------------------------
void _main() {
    ll A, B, C, K; cin >> A >> B >> C >> K;
    ll res = 0;
    if (A >= K) res = K;
    else if (A+B >= K) res = A;
    else res = A - ( K - (A+B));
    cout << res << endl;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size


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

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int h,a;
	cin >> h >> a;
	cout << ((h-1)/a+1) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 998244353//1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   string ans="";
   while(n > 0)
   {
       n--;
       int rem=(n % 26);
       ans+=('a' + rem);
       n/=26;
   }
   reverse(all(ans));
   cout<<ans<<endl;

}


Measured memory_bytes: 3656
#include<iostream>
using namespace std;
int main(){
	int n;
	string s;
	cin >> n >> s;

	int west[300001],east[300001];

	if (s[0] == 'W')
		west[0] = 1;
	else 
		east[0] = 1;

	for (int i = 1; i < n; i++) {
		if (s[i] == 'W') {
			west[i] = west[i-1] + 1;
			east[i] = east[i-1];
		}
		else {
			west[i] = west[i-1];
			east[i] = east[i-1] + 1;
		}
	}
/*
	for (int i = 0; i < n ;i++) {
		cout << west[i] << " ";
	}
	cout << endl;

	for (int i = 0; i < n ;i++) {
		cout << east[i] << " ";
	}
	cout << endl;
*/
	int min = east[n-1]; //左边第0个做为leader，右边所有的east人数

	for (int i = 1; i < n; i++) {
		int left = west[i-1];
		int right = east[n-1] - east[i];
		if ( left + right < min) 
			min = left + right;
	}

	cout << min;

	return 0;
}

Measured memory_bytes: 2948
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld=long double;
 
int main(){
    int a,b;
    cin>>a>>b;
    if(a-b*2<0)
    cout<<0;
    else
    cout<<a-b*2;
    
    
    
    return 0;
}

Measured memory_bytes: 256
// (c) 2020, redotter

// Roses are red
// The Tardis is blue
// The Doctor once said
// Rose Tyler...

#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#pragma comment(linker, "/stack:500000000")
#endif

#define pb push_back
#define the(a) (a).begin(), (a).end()
#define ft first
#define sd second
#define endl "\n"
#define forn(i, n) for (int i = 0; i < (n); i++)
#define forr(i, s, n) for (int i = (s); i < (n); i++)

using i64 = long long;
using i32 = int;
using f64 = long double;

template <class T> using vec = vector<T>;
using str = string; using p64 = pair<i64, i64>;
using v64 = vec<i64>; using vv64 = vec<v64>;
using s64 = set<i64>; using m64 = map<i64, i64>;
template <size_t Size1> using a64 = array<i64, Size1>;
template <size_t Size1, size_t Size2> using aa64 = array<a64<Size2>, Size1>;
template <class T> using hash_set = unordered_set<T>;
template <class T, class U> using hash_map = unordered_map<T, U>;

mt19937 gen(998244353);
const i64 inf = numeric_limits<i64>::max() / 2;

template <class T> inline i64 len(const T& a) { return (i64)(a.size()); }
inline void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }
template <class T, class S>
inline bool check_min(T& a, S b) { if (a > b) return a = b, 1; return 0; }
template <class T, class S>
inline bool check_max(T& a, S b) { if (a < b) return a = b, 1; return 0; }

void read() {}
template<class T, class ...U>
void read(T& a, U& ...b) { cin >> a; read(b...); }
void print() {}
template<class T, class ...U>
void print(const T& a, const U& ...b) { cout << a << " "; print(b...); }
void println() { cout << "\n"; }
template<class T, class ...U>
void println(const T& a, const U& ...b) { cout << a << " "; println(b...); }

struct Problem {
	void files(str in, str out) {
#ifdef ONLINE_JUDGE
		freopen(in.c_str(), "r", stdin), freopen(out.c_str(), "w", stdout);
#endif
	}
	void solve(), input();
	void many() { i32 t; cin >> t; while (t--) input(), solve(); }
	void make(bool mt = 0) { if (mt) many(); else input(), solve(); }
} problem;

signed main() {
	fast();
	problem.make();
#ifdef _DEBUG
	println(); println("[finished]"); system("pause > nul");
#endif
	return 0;
}

i64 n;
v64 a;

void Problem::solve() {
	vv64 dp(n, v64(n, -inf));
	forn(i, n) {
		dp[i][i] = a[i];
	}
	forr(ln, 2, n + 1) {
		forn(i, n) {
			i64 j = i + ln - 1;
			if (j >= n) break;
			check_max(dp[i][j], a[i] - dp[i + 1][j]);
			check_max(dp[i][j], a[j] - dp[i][j - 1]);
		}
	}
	println(dp[0][n - 1]);
}

void Problem::input() {
	read(n);
	a.resize(n);
	forn(i, n) read(a[i]);
}


Measured memory_bytes: 73656
#include<bits/stdc++.h>
using namespace std;
const long long N=1e5+5;
string a[N];
bool cmp(string s1,string s2){
	int len1=s1.length(),len2=s2.length();
	if(len1>len2) return true;
	if(len1<len2) return false;
	if(s1>=s2) return true;
	return false;
}
int main(){
	int n;
	scanf("%d",&n);
	int ans=0,mx=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(i==0) continue;
		if(cmp(a[i-1],a[i])){
			ans++;
		}else{
			if(mx<ans) mx=ans;
			ans=0;
		}
	}
	if(mx<ans) mx=ans;
	printf("%d\n",mx);
	return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 5000
#define LL long long
using namespace std;
int n,A,B,a[N+5];LL f[N+5][N+5];
int main()
{
	RI i,j;for(scanf("%d%d%d",&n,&A,&B),i=1;i<=n;++i) scanf("%d",a+i);
	for(memset(f,63,sizeof(f)),f[0][0]=0,i=1;i<=n;++i)
	{
		for(j=0;j^a[i];++j) f[i][j]=min(f[i][j],f[i-1][j]+A),f[i][a[i]]=min(f[i][a[i]],f[i-1][j]);
		for(j=a[i]+1;j<=n;++j) f[i][j]=min(f[i][j],f[i-1][j]+B);
	}
	LL ans=f[0][1];for(i=0;i<=n;++i) ans=min(ans,f[n][i]);return printf("%lld\n",ans),0;
}

Measured memory_bytes: 199504
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <unordered_set>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

typedef long long ll;

using namespace std;

const int N = 1000000;
bool isNotPrime[N+1];

int main(void) {
  isNotPrime[0] = isNotPrime[1] = true;
  int x;
  cin >> x;
  REP(i, N+1) {
    if(!isNotPrime[i]) {
      if(i >= x) {
        cout << i << endl;
        break;
      }
      for(int j = i + i; j <= N; j += i) {
        isNotPrime[j] = true;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 1280
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


s = S()
t = S()
ans = 0
for c1, c2 in zip(s, t):
    if c1 != c2:
        ans += 1
print(ans)


Measured memory_bytes: 68364
import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	
	public class Main {
		public static void main(String[] args) {
			InputStreamReader is = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(is);
			String input = "2";
			try {
				input = br.readLine();
			} catch (IOException e) {
			}
	
			long K = Long.valueOf(input);
			if(K <= 5) {
				System.out.println(1);
				return;
				
			}
			long Km = K/11;
			long Kr = K%11;
			if(Kr == 0)
				System.out.println(Km * 2);
			else if (1 <= Kr && Kr <= 6)
				System.out.println(Km * 2 + 1);
			else
				System.out.println(Km * 2 + 2);
		}
	}


Measured memory_bytes: 7892
#include<iostream>
#include<vector>
#include<utility>
#include<map>
#include<deque>
#include<numeric>
#include<algorithm>
#include<unordered_map>
#include<cmath>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 29;
constexpr ll MOD = ll(1e9 + 7);



int main(void) {
	ll h, w;
	cin >> h >> w;
	ll ret = (h / 2) * w;
	ret += (h % 2) * (w / 2 + w % 2);
	if (min(h, w) == 1)
		ret = 1;
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    //const int MOD = 1000000007;
    static void Main(string[] args)
    {
        new Program().Solve();
    }

    void Solve()
    {
        int max = 101010;
        Scanner cin = new Scanner();
        int n = cin.NextInt();
        Dictionary<int, int> a = new Dictionary<int, int>();

        for (int i = 0; i < n; i++)
        {
            a.Add(i, cin.NextInt());
        }

        var sorted = a.OrderByDescending(e => e.Value);
        var candidate = sorted.ElementAt(0);

        for (int i = 0; i < n; i++)
        {
            if (candidate.Key == i)
            {
                Console.WriteLine(sorted.ElementAt(1).Value);
            }
            else
            {
                Console.WriteLine(candidate.Value);
            }
        }
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string Next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return Next();
        i = 0;
        return s[i++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public char[] ArrayChar()
    {
        return Next().ToCharArray();
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextInt() + add;
        }
        return Array;
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextLong() + add;
        }
        return Array;
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 32080
#include <iostream>
#include <bits/stdc++.h>
 
using namespace std;
int a[100005];
int cnt;
void init()
{
    for(int i=1; i<=100; i++)
        for(int j=2; j<=100 ;j++)
        {
            a[cnt++] = pow(i*1.0,j);
        }
    sort(a,a+cnt);
 
}
int main()
{   cnt = 0;
    init();
 
    int n;
    scanf("%d",&n);
    int pos = lower_bound(a,a+cnt,n)-a;
    while(a[pos] > n)
        pos--;
    cout<<a[pos]<<endl;
 
    return 0;
}


Measured memory_bytes: 640
using System;
namespace ABC148C
{
    public class MainClass
    {
        public static void Main(string[] args)
        {
            long[] inp = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);

            long x = inp[0] * inp[1];
            if (inp[1] > inp[0])
            {
                long tmp = inp[0];
                inp[0] = inp[1];
                inp[1] = tmp;
            }

            long r = inp[0] % inp[1];
            while (r!=0)
            {
                inp[0] = inp[1];
                inp[1] = r;
                r = inp[0] % inp[1];
            }
            Console.WriteLine(x / inp[1]);
        }
    }
}


Measured memory_bytes: 11092
#define y1 askjdkasldjlkasd
#include <bits/stdc++.h>
#undef y1

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while (0)
#endif

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

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

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

///////////////////////////////////////////////////

const int MAX = 5e3 + 41;
const ll INF = 1e18;

int n, A, B;
int a[MAX];
int cnt[MAX][MAX];
ll d[MAX][MAX];
int p[MAX];

int getq(int x, int l, int r) {
	int res = cnt[x][r];
	if (l > 0) res -= cnt[x][l - 1];
	return res;
}

void solve () {	
	fi(0, n - 1) p[a[i]] = i;
	fi(0, n - 1) {
		int cur = 0;
		fj(0, n - 1) {
			if (a[j] > i) {
				cur++;
			}
			cnt[i][j] = cur;
		}
	}
	fill_n(&d[0][0], MAX * MAX, INF);	
	d[0][0] = 0;
	fi(0, n - 1) {
		fj(0, n) {
			if (j > p[i]) {
				d[i + 1][j] = min(d[i + 1][j], d[i][j]);
			}	else {
				int q = getq(i, j, p[i] - 1);
				ll v1 = d[i][j] + (ll) q * A;
				ll v2 = d[i][j] + B;
				d[i + 1][j] = min(d[i + 1][j], v2);
				d[i + 1][p[i] + 1] = min(d[i + 1][p[i] + 1], v1);
//				dbg(v1);
//				dbg(v2);
			}
		}
	}
	/*
	fi(0, n - 1) {
		fj(0, n - 1) {
			err("%d %d %lld\n", i, j, d[i][j]);
		}
	}
	*/
	ll ans = INF;
	fi(0, n) ans = min(ans, d[n][i]);
	printf("%lld\n", ans);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif

	scanf("%d %d %d", &n, &A, &B);		
	fi(0, n - 1) {
		scanf("%d", &a[i]);
		a[i]--;
	}
	solve();

	exit();
	return 0;
}





Measured memory_bytes: 297216
def main() -> None:
    r = (str(input()) + " " + str(input()) + " " +  str(input())).split()
    pos = {
        1: 0,
        2: 0,
        3: 0,
        4: 0,
    }
    for i in r:
        pos[int(i)] += 1

    num = 0
    for i in pos.values():
        if i >= 2:
            num = num + 1

    print("%s" % "YES" if num >= 2 else "NO")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,n,m;
    int sum=0;
    scanf("%d",&n);
    m=n;
    while(n>0)
    {
        sum+=(n%10);
        n/=10;
    }
    if(m%sum==0)
        printf("Yes");
    else
        printf("No");
    return 0;
}

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

//定数
const long long MOD1=1000000007;
const long long MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};

//型名省略
#define ll long long
#define ull unsigned long long
#define ld long double
#define uld unsigned long double
#define pll pair<long long,long long>
#define tll(n) array<long long,(int)(n)>
#define pcc pair<char,char>
#define vl vector<long long>
#define vld vector<long double>
#define vvl vector<vector<long long>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define vt(n) vector<array<long long,(int)(n)>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define Fi first
#define Se second
#define mp make_pair
#define eb emplace_back

//マクロ
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s);i<(long long)(n);i++)
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define lin(s) getline(cin,(s))

//MAX,MIN
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}

//最大公約数,最小公倍数
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}

//累乗
template<typename t>
constexpr t mypow(t a,long long b){
    if(b==0)return 1;
    if(a==0)return 0;
    t x=1;
    while(b>0){
        if(b&1LL)x*=a;
        a*=a;
        b>>=1LL;
        }
    return x;
}
#define pow mypow

//chmin,chmax
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;}

//組み合わせ O(r)
template<typename t>
constexpr t nCr(t n,long long r){
    if(r==0)return 1;
    if(n==0)return 0;
    if(n<r)return 0;
    t x=1;
    for(long long i=1;i<=r;i++){
        x*=n-i+1;
        x/=i;
    }
    return x;
}

//main関数
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(10);
    ll n;
    cin>>n;
    vld v(n);
    rep(i,n)cin>>v[i];
    sort(rall(v));
    ld res=0;
    ld now=2;
    rep(i,n-1){
        res+=v[i]/now;
        now*=2;
    }
    res+=2.0*v[n-1]/now;
    cout<<res<<endl;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, i;
  cin >> n;
  int f[n];
  f[0] = 1, f[1] = 1;
  for (i = 2; i <= n; ++i) {
    f[i] = f[i - 1] + f[i - 2];
  }

  cout << f[n] << '\n';

  return 0;
}



Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int a[N];
int b[N];
int main()
{
	int n;cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+n+1);
	int p=a[n];
	int mid=(p+1)/2;
	int ans=a[1]>=mid?p-a[1]:a[1],pos=1;
	for(int i=1;i<n;i++){
		b[i]=a[i];
		if(a[i]>=mid) b[i]=p-a[i];
		if((mid-b[i])<=mid-ans)
			ans=b[i],pos=i;
	}
	printf("%d %d",p,a[pos]);
	return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {
        int n = 0, m = 0;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        if(n <= m){
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }
}

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

int main()
{
    int n;
    cin>>n;
    vector<ll> a;
    ll ans=1;
    bool flag=true;
    for(int i=0;i<n;i++){
        ll b;cin>>b;a.push_back(b);
        if(b==0){
          cout<<0<<endl;
          return 0;
        }
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++){
        if(a[i]>1000000000000000000/ans){
            flag=false;
            break;
        }
        ans*=a[i];
    }
    if(flag){
        cout<<ans<<endl;
    }else{
        cout<<-1<<endl;
    }
}

Measured memory_bytes: 4324
A = [[]*3]*3

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

N = int(input())

B = [int(input()) for i in range(N)]

result = "No"

if(A[0][0] in B and A[0][1] in B and A[0][2] in B):
  result = "Yes"
if(A[1][0] in B and A[1][1] in B and A[1][2] in B):
  result = "Yes"
if(A[2][0] in B and A[2][1] in B and A[2][2] in B):
  result = "Yes"
if(A[0][0] in B and A[1][0] in B and A[2][0] in B):
  result = "Yes"
if(A[0][1] in B and A[1][1] in B and A[2][1] in B):
  result = "Yes"
if(A[0][2] in B and A[1][2] in B and A[2][2] in B):
  result = "Yes"
if(A[0][0] in B and A[1][1] in B and A[2][2] in B):
  result = "Yes"
if(A[0][2] in B and A[1][1] in B and A[2][0] in B):
  result = "Yes"

print(result)

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] h = new int[N + 2];
        for (int i = 1; i < h.length - 1; i++) {
            h[i] = sc.nextInt();
        }
        int counter = 0;
        int[] check = new int[h.length];
        while (!Arrays.equals(h, check)) {
            int m = 0;
            for (int i = 1; i < h.length - 1; i++) {
                if (m == 0 && h[i] != 0) {
                    counter++;
                }
                m = h[i];
                if (h[i] != 0) {
                    h[i]--;
                }
            }
        }
        System.out.println(counter);
        sc.close();
    }
}

Measured memory_bytes: 25300
import sys
N, K = [int(x) for x in input().split()]
p = [ list(map( int, input().split()) ) for i in range(N)]
p.sort( key=lambda x:x[1])
area_min = sys.maxsize
for i in range(N):
    for j in range( i+1, N):
        xmin = min( p[i][0], p[j][0])
        xmax = max( p[i][0], p[j][0])
        tmp = [ p[x] for x in range(N) if xmin<=p[x][0]<=xmax]
        num = len(tmp)
        if num < K:
            continue
        area = sys.maxsize
        for k in range( num-K+1):
            area = min( area, abs( (xmax-xmin)*(tmp[k][1]-tmp[K-1+k][1]) ) )
            # print( tmp[k], tmp[K-1+k], p[i], p[j], "area =", area, tmp[k:k+K])
        area_min = min( area_min, area)

print( "{}".format(area_min))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int     long long
#define F       first
#define S       second
#define _READ   freopen("input.txt","r", stdin);
#define _FAST   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
void solve()
{
	int x;
	cin>>x;
	int ans=0;
	ans+=1000*(x/500);
	x=x%500;
	ans+=5*(x/5);
	cout<<ans;
}
int32_t main()
{
    
    int t;
    t=1;
    while(t--)
        solve();
    return 0;
}
/*
===FOR N-Dimensional Vector===
https://codeforces.com/blog/entry/76149
g++ -std=c++17 -Wshadow -Wall -g -fsanitize=address -fsanitize=undefined a.cpp -o a -D_GLIBCXX_DEBUG
*/

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(){
  char a[10];
  char b[5];
  char *c;
  int num;
  int d;
  scanf("%s",a);
  scanf("%s",b);
  c = strcat(a,b);
  num = atoi(c);

  d = (int)sqrt((double)num);
  if(d*d == num){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<sstream>
#include<fstream>
using namespace std;
string henkan(int);
int main(){
	string name;
	int time;
	string doll;
	while(cin>>time&&time!=0){
		cin>>name;
		int siz;
		char num;
		for(int i=0;i<time;++i){
			string dommy="";
			num='-';
			for(int k=0;k<name.size();++k){
				if(num=='-'){
					num=name[k];
					siz=1;
				}else if(num==name[k]){
					++siz;
				}else{
					dommy+=henkan(siz);
					dommy+=num;
					siz=1;
					num=name[k];
				}
			}
			dommy+=henkan(siz);
			dommy+=num;
			name=dommy;
		}
		cout<<name<<endl;
	}
	return 0;
}
string henkan(int siz){
	ostringstream ss;
	ss<<siz;
	return ss.str();
}

Measured memory_bytes: 3136
#標準入力
V, E = map(int, input().split())
dist = [[float("inf")] * (V + 1) for i in range(V + 1)]
for i in range(E):
  s, t, d = map(int, input().split())
  dist[s][t] = d
  
for i in range(V):  
  dist[i][i] = 0
  
#print(dist)
#2 ** 15 = 1024 * 16 = 16384
dp = [[-1] * (V + 1) for i in range(2 ** V + 1)]

def rec(bit, v):
  #すでに探索済みだったらリターン
  if dp[bit][v] != -1:
    return dp[bit][v]
  
  #初期値
  if bit == (1 << 0):
    dp[bit][0] = 0
    return 0
  
  res = float("inf")
  prev_bit = bit & ~(1 << v)
  
  for i in range(V):
    if not (prev_bit & (1 << i)):
      continue
    else:
      res = min(res, rec(prev_bit, i) + dist[i][v])
  
  dp[bit][v] = res
  return res

ans = float("inf")
for i in range(V):
  ans = min(ans, rec((1 << V) - 1, i) + dist[i][0])
  #print(dp)

if ans >= 1000000:
  print(-1)
else:
  print(ans)
#print(dp)


Measured memory_bytes: 19044
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d[] = new int[n];
		int ans = 0;
		for(int i = 0;i < n;i++) {
			d[i] = sc.nextInt();
			if(i != 0) {
				for(int k = 0;k < i;k++) {
					ans += d[i] * d[k];
				}
			}
		}
		System.out.println(ans);

	}

}

Measured memory_bytes: 25044
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int i;
    int k;
    int m;
    int cnt=0;
    cin >> i >> k >> m;
    
    for (int n = i; n <=k; n++) {
        if (m%n==0) {
            cnt++;
        }
    }
    cout << cnt << endl;
}



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

string s;

int k = (int)1e5;

int main(void){
    // Here your code !
    cin >> s;
    int length = s.size();

    bool all1 = true;
    for (int i = 0; i < s.size(); ++i) {
      all1 &= (s[i] == '1');
    }
    if (all1) {
      printf("%d\n", length);
      return 0;
    }

    bool all0 = true;
    for (int i = 0; i < s.size(); ++i) {
      all0 &= (s[i] == '0');
    }
    if (all0) {
      printf("%d\n", length);
      return 0;
    }

    for (int i = 0; i < s.size() - 1; ++i) {
      if (s[i] != s[i + 1]) {
        int size = max(i + 1, length - (i + 1));
        k = min(k, size);
      }
    }

    printf("%d\n", k);

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define SIZE 10
#define PI 3.141592653589793

using namespace std;
typedef long long ll;

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

	string N;
	int i,j;
	int tmp;
	int answer=0;
	int counter=0;
	vector<int> given;

	cin >> N;

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

	return 0;
}



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

int main() {
  int n,m,nodnk=0;
  cin>>n;
  vector<int> t(n);
  rep(i,n){
    cin>>t[i];
    nodnk+=t[i];
  }
  cin>>m;
  rep(i,m){
    int p,x;
    cin>>p>>x;
    p--;
    cout<<x-t[p]+nodnk<<endl;
  }
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;
const ll INF=-10000000000;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

//a,b x
int main(){
	string s,t; cin>>s>>t;
	vector<ll> S(26,0);
	vector<ll> T(26,0);
	rep(i,s.sz){
		ll tmp=s[i]-'a';
		S[tmp]++;
	}
	rep(i,t.sz){
		ll tmp=t[i]-'a';
		T[tmp]++;
	}
	ll SS,SN,TS,TN;
	for(int i=0;i<26;i++){
		if(S[i]!=0){
			SS=i;
			SN=S[i];
			break;
		}
	}
	for(int i=25;i>=0;i--){
		if(T[i]!=0){
			TS=i;
			TN=T[i];
			break;
		}
	}
	if(SS>TS) cout<<"No";
	else if(SS==TS){
		if(SN==s.sz && SN<=TN){
			if(SN==TN && TN==t.sz) cout<<"No";
			else cout<<"Yes";
		}
		else cout<<"No";
	}
	else cout<<"Yes";
}

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

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

  int n;
  cin >> n;
  vector<tuple<string, int, int>> vt(n);
  for (int i = 0; i < n; i++)
  {
    string s;
    int score;
    cin >> s >> score;
    vt.at(i) = make_tuple(s, score, i);
  }
  sort(vt.begin(), vt.end());
  vector<string> vs;
  for (auto tp : vt)
  {
    string tp_name;
    tie(tp_name, ignore, ignore) = tp;
    bool check = false;
    for (int j = 0; j < (int)vs.size(); j++)
    {
      if(tp_name == vs.at(j))
      {
        check = true;
        break;
      }
    }
    if(check) continue;
    vector<pair<int, int>> vtii;
    for (auto elem : vt)
    {
      string s;
      int score, index;
      tie(s, score, index) = elem;
      if(tp_name == s) vtii.push_back(make_pair(score, index));
    }
    sort(vtii.begin(), vtii.end());
    reverse(vtii.begin(), vtii.end());
    for(auto elem : vtii)
    {
      cout << elem.second + 1 << endl;
    }
    vs.push_back(tp_name);
  }
  return 0;
}

Measured memory_bytes: 256
# input
N = int(input())
H = list(map(int, input().split()))

dp = [None for _ in range(N)]
def jump(i):
    # initiate
    dp[0] = 0
    dp[1] = abs(H[1] - H[0])
    for i in range(2, N):
        dp[i] = min(dp[i-1] + abs(H[i]-H[i-1]), dp[i-2] + abs(H[i]-H[i-2]))
    # if i < 3 or H[i-2] < H[i-3]:
    #     cost += abs(H[i-2] - H[i-1]) + jump(i-1)
    # else:
    #     cost += abs(H[i-3] - H[i-1]) + jump(i-2)
    # dp[i] = cost
    # return cost
    return dp[N-1]

print(jump(N))
pass

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

vector<int> graph[101010];

int n;
int m;
int x;
int y;
vector<int> jarjestys;
int dp[1010101];
int z[1010101];
void haku(int s){
	if(z[s]) return;
	z[s] = 1;
	for(auto u : graph[s]){
		haku(u);
	}
	jarjestys.push_back(s);
}
int main(){
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		cin >> x >> y;
		graph[x].push_back(y);
	}

	for(int i = 1; i <= n; i++){
		haku(i);
	}
	reverse(jarjestys.begin(), jarjestys.end());
	for(int i = 0; i < jarjestys.size(); i++){
		for(auto u : graph[jarjestys[i]]){
			dp[u] = max(dp[jarjestys[i]]+1,dp[u]);
		}
	}
	int maxi = 0;
	for(auto u : jarjestys){
		maxi = max(dp[u], maxi);
	}
	cout << maxi << "\n";
}


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

#define int long long int
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define endl "\n"

int32_t main()
{
	IOS;
	float r;
	cin >> r;
	cout << 6.28 * r << endl;



	return 0;
}

Measured memory_bytes: 3796
import math
X = int(input())
if X == 2:
    print(2)
else:
    is_find = False
    while not is_find:
        for i in range(2, X//2):
            is_find = True
            if math.gcd(X, i) != 1:
                is_find = False
                X += 1
                break
        rst = X
    print(rst)

Measured memory_bytes: 9112
#include <bits/stdc++.h>
typedef long long ll;
#define endl "\n"
#define all(s) s.begin(),s.end()
#define pb push_back
#define uno unordered_map
#define pi 3.1415926536
#define dig(a) fixed<<setprecision(a)
#define test(zz) int zz; cin>>zz; while(zz--)
#define foreach(var,i) for(auto i = var.begin();i!=var.end();i++)
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
ll power(ll a, ll n) {ll res = 1; while (n) {if (n % 2) {res *= a;} n >>= 1; a *= a;} return res;}
ll powerm(ll a, ll n, ll m) {ll res = 1; while (n) {if (n % 2) {res = (res * a) % m;} n >>= 1; a = (a * a) % m;} return res;}
using namespace std;

const int M=1e9+7;
ll mod(ll x){
      return ((x%M + M)%M);
}
ll add(ll a, ll b){
      return mod(mod(a)+mod(b));
}
ll mul(ll a, ll b){
      return mod(mod(a)*mod(b));
}
const int N = 1000005;

int main(){
	fast();
	//test(t){}
	
	int n;
	cin>>n;
	vector<int> a(n),fact(N);
	for(int i=0;i<n;i++){
		cin>>a[i];
		fact[a[i]]++;
	}
	
	bool f = true;
	for(int i=2;i<N;i++){
		int c=0;
		for(int j = i;j<N;j+=i){
			c+=fact[j];
		}
		if(c>1){
			f = false;
			break;
		}
	}
	if(f){
		cout<<"pairwise coprime"<<endl;
		return 0;
	}
	int g = 0;
	for(int i=0;i<n;i++){
		g = __gcd(g,a[i]);
	}
	if(g==1){
		cout<<"setwise coprime"<<endl;
		return 0;
	}
	cout<<"not coprime"<<endl;
	
	return 0;
}


Measured memory_bytes: 11056
///~Hard work pays well..smart work pays more though.~ Fu'ad daoud 
#include <stdio.h>
#include <sstream>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <cctype>
#include <functional>	
#include <stack>
#include <map>
#include <algorithm>
#include <iomanip>
#include <utility>  
#include <queue>
#include <set>

#define input(a) scanf("%lld",&a);
#define fc for_each
#define all(k) k.begin(),k.end()
#define pb push_back
#define printall(k) fc(all(k),prints);
#define lastindex(a) a.size()-1
#define lastelement(a) a[lastindex(a)]
#define forf(a,x) for(int a=0;a<x;a++)
//#define ffor(h,v,hh,hhh) for(int h=v;h<hh;h+=hhh);
#define nextline printf("\n")
#define space printf(" ")
#define mb(a,b) make_pair(a,b)


using namespace std;



typedef long long int lld;
typedef vector<lld> vlld;
typedef vector<string> vs;
typedef vector<char> vc;

lld intsum;



void printint(lld k) { printf("%lld", k); }
void printchar(char k) { printf("%c ", k); }
void printstring(string k) { cout << k << endl; }
void printbool(bool k) { printf("%b", k); }
void printpairis(pair<lld, string> k) { cout << k.first << " " << k.second << endl; }
//void printchar(vector<char> k) { fc(all(k), printchar); cout << endl; }
void printvecint(vector<lld> k) { fc(all(k), printint); nextline; }
void printvecchar(vector<char> k) { fc(all(k), printchar); nextline; }
bool isodd(int k) { return (k % 2) ? true : false; }
bool iseven(int k) { return (k % 2) ? false : true; }
bool paircompare(pair<int, string> k, pair<int, string> f) { return k.first < f.first; }
void  intsumming(lld k) { intsum += k; }
void reverseall(vector<int> &k) { reverse(all(k)); }
//void  charsumming1(char k) { charsum1 +=k; }
//void  charsumming2(char k) { charsum2 +=k; }
bool pairCompare(const pair<lld, lld> firstElem, const pair<lld, lld> secondElem) { return firstElem.second < secondElem.second; }
void printpair(pair<lld, lld> p) { printf("%lld , %lld\t", p.first, p.second); }
void printallint(vlld a) { fc(all(a), printint); }

lld a, b;
lld ss;
int main()
{
	input(a);
	input(b);
	ss = b - a + 1;
	forf(k, ((a - 1) * 2) + 1)
		printf("%lld ", ss + k);
	
	return 0;
}	

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, k;
  cin >> n >> k;
  
  vector<int> v(n);
  for(int i = 0; i < n; i++) cin >> v.at(i);
  
  int ans = 0;
  for(int i = 0; i <= k; i++){
    for(int j = 0; j <= k - i; j++){
      if(i + j > n) continue;
      priority_queue<int, vector<int>, greater<int>> pq;
      for(int ii = 0; ii < i; ii++) pq.push(v.at(ii));
      for(int jj = 0; jj < j; jj++) pq.push(v.at(n - jj - 1));
      for(int x = 0; x < k - i - j; x++){
        if(pq.empty()) break;
        if(pq.top() < 0) pq.pop();
      }
      int keep = 0;
      while(!pq.empty()){
        keep += pq.top();
        pq.pop();
      }
      ans = max(ans, keep);
    }
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
import numpy as np
 
N = int(input())
A = np.array([int(x) for x in input().split()],dtype=np.int64)
 
"""
F_2 上の線形代数。基本変形で簡単な基底を得る。
"""
 
xor = np.bitwise_xor.reduce(A)
 
A = np.concatenate([np.array([1<<i for i in range(60) if xor&(1<<i)],np.int64),A])
 
for k in range(60,-1,-1):
    bit = 1<<k
    one = (A&bit != 0)
    i = np.where(one & (A < (1<<(k+1))))[0]
    if len(i) == 0:
        continue
    i = i[0]
    x = A[i]
    A[one] ^= x
    A[i] = x
 
A = A[A != 0]
A.sort()
A = A[::-1]
 
if len(A) > 0:
	red = np.bitwise_xor.reduce(A)
else:
    red = 0
blue = red^xor
answer = red + blue
print(answer)

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

int main() {
  int n;cin>>n;
  vector<int> a(n+1),b(n);
  rep(i,n+1)cin>>a[i];
  rep(i,n)cin>>b[i];
  ll ans=0;
  rep(i,n){
    if(a[i]>b[i])ans+=b[i];
    else{
      ans+=min(b[i],a[i]+a[i+1]);
      a[i+1]=max(0,a[i]+a[i+1]-b[i]);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3868
n, y = map(int, input().split())

for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
int bp(int pow, int n){
    int d = 1;
    while(n)
    {
        if(n%2==1)d=(d*pow)%mod;
        pow=(pow*pow)%mod;
        n/=2;
    }
    return d;
}
void solve(){
    int n;
    cin>>n;
    map<string, int>u;   
    for(int i = 0; i < n; i++){
        string s;
        cin>>s;
        u[s]++;
    }
    cout<<u.size();
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 19144
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def solve():
    L, R = list(map(int, input().split()))
    if R - L >= 2019:
        return 0
    L %= 2019
    R %= 2019
    if R < L:
        return 0
    ans = 2020
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            if ans > (i * j) % 2019:
                ans = (i * j) % 2019
    return ans


def main():
    print(solve())


if __name__ == "__main__":
    main()


Measured memory_bytes: 40048
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void){
    int a,b,c,k;
    scanf("%d%d%d%d",&a,&b,&c,&k);
    int ans=0;
    if(a>=k){
        ans=k;
    }else{
        ans=a;
        if(a+b<k){
            ans-=(k-a-b);
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

using namespace std;

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

    vector<double> a(n + 1);
    a[0] = 0;
    for (int i = 1; i <= n; ++i) {
        double p;
        cin >> p;
        a[i] = a[i - 1] + (p + 1.0) / 2.0;
    }

    double ans = 0.0;
    for (int i = 0; i + k <= n; ++i) {
        ans = max(ans, a[i + k] - a[i]);
    }

    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
//132 A.cpp
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
#define int long long

int32_t main()
{
    vector<char> S(4);
    for(int i=0;i<4;i++)
    {
        cin>>S[i];
    }
    sort(S.begin(),S.end());
    if(S[0]==S[1]&&S[2]==S[3])
    {
        if(S[1]!=S[2])
        cout<<"Yes";
        else cout<<"No";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}


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

int main () {

    int N;
    cin >> N;

    string s[N];
    for (int i = 0; i < N; i++) {
        cin >> s[i];
    }

    unordered_map<string, int> um;
    long long ans = 0LL;
    for (int i = 0; i < N; i++) {
        sort(s[i].begin(), s[i].end());
        ans += um[s[i]];
        um[s[i]]++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 17700