akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
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;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    cout<<SUM(a)-n<<endl;
    // int m=1;
    // rep(i,n){
    //     cin >> a[i];
    //     m=lcm(m,a[i]);
    // }
    // int res=0;
    // rep(i,n){
    //     res+=(m-1)%a[i];
    // }
    // cout<<res<<endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<deque>
#include<iomanip>
#include <numeric>
#include<tuple>
#include <functional>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define fi first
#define se second
const double pi = acos(-1.0);
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
using Edge = pair<int, ll>;
using Graph = vector<vector<Edge> >;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };
template <typename T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
};
template <typename T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
};
void Pvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void Pvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Ps(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void Pvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

void Yay(bool x) {
	if (x) cout << "Yay!\n";
	else cout << ":(\n";
}

ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}



ll  d, n, m, r, l, k, h, w, ans = 0, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s,t;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x, a;
	cin >> x >> a;
	if (x < a) cout << 0 << endl;
	else cout << 10 << endl;
	return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	x := make([]int, len(s)+1)
	y := make([]int, len(s)+1)
	for i := 0; i < len(s); i++ {
		if string(s[i]) == "<" {
			x[i+1] = x[i] + 1
		}
	}
	for i := len(s) - 1; i >= 0; i-- {
		if string(s[i]) == ">" {
			y[i] = y[i+1] + 1
		}
	}
	ans := 0
	for i := 0; i < len(x); i++ {
		ans += larger(x[i], y[i])
	}
	fmt.Println(ans)
}


Measured memory_bytes: 11480
# -*- coding: utf-8 -*-

def partition(A, p, r):
	x = A[r]
	i = p - 1

	for j in range(p, r):
		# A[j] > xの時は，何もせず，jを増加させるのみ
		if A[j] <= x:
			# A[j] <= x(A[j]がx以下の時)
			i += 1
			tmp = A[i]
			A[i] = A[j]
			A[j] = tmp
	tmp = A[i + 1]
	A[i + 1] = A[r]
	A[r] = tmp

	return i + 1

if __name__ == '__main__':
	#MAX = 100000
	#A = [0] * MAX

	n = int(input())
	A = list(map(int, input().split()))

	q = partition(A, 0, n - 1)

	for i in range(n):
		if i:
			print(" ", end="")
		if i == q:
			print("[", end="")
		if i == n - 1:
			print(A[i])
		else:
			print(A[i], end="")
		if i == q:
			print("]", end="")


Measured memory_bytes: 16396
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>

using namespace std;
using LL = long long;

map<LL, LL> v;

int main()
{
	LL x;
	scanf("%lld", &x);

	int x1 = 0, x2 = 0;
	for (int i = -500; i <= 500; ++i)
	{
		for (int j = -500; j <= 500; ++j)
		{
			if ((LL)pow(i, 5) - (LL)pow(j, 5) == x)
			{
				x1 = i, x2 = j;
				goto here;
			}
		}
	}
here:;
	cout << x1 << " " << x2 << endl;

	return 0;
}

Measured memory_bytes: 4088
#print(1//-2)

n = int(input())
if n==0:
  print(0)
else:
  result = ''
  while n!=0:
    #print(n)
    if n%-2==0:
      result+='0'
      n = n//-2
      #n+=1
    else:
      result+='1'
      if n<0:
        n = n//-2
        n+=1
      else:
        n = n//-2
        n+=1
  result = result[::-1]
  print(result)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 0, 1 },{ -1 ,1 },{ -1, 0 },
	{ -1 ,-1 },{ 0,-1 },{ 1 ,-1 },
	{ 1,0 },{ 1 ,1 }
};
double getRadian(double x, double y, double x2, double y2) {
	double radian = atan2(y2 - y, x2 - x);
	return radian;
}
signed main() {
	int sx, sy, tx, ty;
	scanf("%d %d %d %d", &sx, &sy, &tx, &ty);

	REP(i, tx - sx) {
		printf("R");
	}
	REP(i, ty - sy) {
		printf("U");
	}
	REP(i, tx - sx) {
		printf("L");
	}
	REP(i, ty - sy) {
		printf("D");
	}
	printf("D"); 
	REP(i, tx - sx+1) {
		printf("R");
	}
	REP(i, ty - sy+1) {
		printf("U");
	}
	printf("L");
	printf("U");
	REP(i, tx - sx + 1) {
		printf("L");
	}
	REP(i, ty - sy + 1) {
		printf("D");
	}
	printf("R");
	return 0;
}


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

using namespace std;

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

//===

int bs(Vi& vec, int x) {
	int left = -1, right = static_cast<int>(vec.size());
	while (right - left > 1) {
		int mid = (right + left) / 2;
		if (x < vec[mid]) {
			right = mid;
		}
		else {
			left = mid;
		}

	}
	return right;
}

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

	int ans = 1;
	Vi c_min;
	c_min.push_back(a[N - 1]);

	for (int i = N - 2; i >= 0; --i) {
		int pos = bs(c_min, a[i]);
		if (pos == ans) {
			c_min.push_back(a[i]);
			++ans;
		}
		else {
			c_min[pos] = a[i];
		}
	}

	cout << ans << endl;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  string S,T;
  cin >> S >> T;
  int cnt = 0;

  for (int i = 0; i < S.size(); ++i) {
    if (S[i] != T[i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3768
#include <iostream>
using namespace std;
int main(void){
    int N, i;
    int a, b, c;
    cin >> N;
    for(i = 1; i <= N; i++){
        cin >> a >> b >> c;
        if((a * a + b * b == c * c) || (b * b + c * c == a * a) || (c * c + a * a == b * b))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}



Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())

using namespace std;

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

//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
//cout << fixed << setprecision(10) << ans << defaultfloat << endl;
typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<double> Vd;
typedef vector<string> Vs;

int main() {
    int H,W;
    string tmp;
    cin >> H >> W;
    Vs g;
    g.push_back(string(W+2,'#'));
    FOR(i,0,H) {
        cin >> tmp;
        tmp = "#" + tmp + "#";
        g.push_back(tmp);
    }
    g.push_back(string(W+2,'#'));
    vector<Vi> ans(H+2, Vi(W+2,0));
    int submit = 0;

    FOR(i,1,H+2) {
        auto t = g.at(i);
        int n = 0;
        FOR(j,1,W+2) {
            if (t.at(j) == '#') {
                if (j - n ==1) 1+1;
                else {
                    FOR(k,n+1,j){
                        ans[i][k] = j-n-1;
                    }
                }
                n = j;
            }
        }
    }

    FOR(i,1,W+2) {
        int n = 0,m=0;
        FOR (j,1,H+2) {
            if (g[j][i] == '#') {
                if (j - n ==1) 1+1;
                else {
                    submit = max({submit,m+j-n-1});
                }
                n = j;
                m=0;
            }
            else{
                m = max({m,ans.at(j).at(i)});
            }
        }
    }
    cout << submit-1 << endl;

}

Measured memory_bytes: 23936
#include<stdio.h>
int main()
{
    int a,b,c,temp;
    
    scanf("%d %d %d",&a,&b,&c);
    if(b < a){
        temp = a;
        a = b;
        b = temp;
    }
    if(c < b){
        temp = b;
        b = c;
        c = temp;
    }
    if(b < a){
        temp = a;
        a = b;
        b = temp;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}


Measured memory_bytes: 2104
/*
    Author - Param Kothari
    Ah shit, here we go again
*/
 
/* Ordered Set Implementaton:

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;

typedef tree<
    int,
    null_type,
    less<int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
ordered_set;
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair 
 
typedef long long ll;
typedef long double ld;

void solve(){
    char c;
    cin >> c;
    cout << (char)(c + 1) << "\n";
    return;
}
 
int main(){
    IOS;
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  Vl H(N);
  ll tmp = 0, ans = 0;
  REP(i, N) cin >> H.at(i);
  for (ll j = 0; j < N - 1; j++) {
    if (H.at(j) >= H.at(j + 1))
      tmp++;
    else if (ans < tmp) {
      ans = tmp;
      tmp = 0;
    } else
      tmp = 0;
  }
  if (ans < tmp) ans = tmp;
  cout << ans << endl;
}

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll k, a, b;
  cin >> k >> a >> b;

  bool can = false;
  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      can = true;
    }
  }

  cout << (can ? "OK" : "NG") << "\n";
}

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

using namespace std;

int mod(int a, int b)
{
	if(a - b > 0)
		return a - b;
	return b - a;
}

int main()
{
	int n, k;
	cin >> n >> k;
	int arr[n];

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

	int dp[n] = {};
	dp[1] = mod(arr[1], arr[0]);

	for(int i = 2; i < n; i++)
	{
		// vector<int>select;
		int select, j, mini = INT_MAX;
		for(j = 1; j <= i && j <= k; j++)
		{		
			// select.push_back(dp[i - j] + mod(arr[i], arr[i - j]));
			select = dp[i - j] + mod(arr[i], arr[i - j]);
			if(mini >= select)
				mini = select;	
			// cout << "dp[" << i << "-" << j << "]" << " = " << dp[i - j] << " and select[" << i << "-" << j << " = " << select[j - 1] <<"\n";
			// cout << "Select"<< select[j - 1] << "\n";
		}	

		// dp[i] = min(select, j + 1);
		dp[i] = mini;
		// cout << "dp[" << i << "] = " << dp[i] << "\n";
	}

	cout << dp[n - 1] << "\n";


	return 0;
}

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

main(){
  int N,K,Q;
  cin >> N >> K >> Q;
  int A[Q];
  for(int ii=0;ii<Q;ii++){
    cin >> A[ii];
  }
  int point[N];
  for(int ii=0;ii<N;ii++){
    point[ii]=K-Q;
  }
  for(int ii=0;ii<Q;ii++){
    point[A[ii]-1]++;
  }
  for(int ii=0;ii<N;ii++){
    if(point[ii]>0)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

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

int main(){
    ll n;
    cin >> n;
    cout << (1+n-1)*(n-1)/2 << endl;
    
    
    return 0;
}











Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<map>
#include<set>
using namespace std;
#define LL long long 
int main()
{
	int a,b;
	while(cin>>a>>b)
	{
		if((a*b)&1)
		{
			cout<<"Odd"<<endl;
		}
		else cout<<"Even"<<endl;
	}
	return 0;
}


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

int main()
{
    ll N, M;
    cin >> N >> M;
    multiset<ll> A;
    ll a;
    rep(i, N)
    {
        cin >> a;
        A.insert(a);
    }
    auto mxi = A.end();
    ll mx;
    rep(i, M)
    {
        // mxi = A.crbegin();
        mxi = --A.end();
        mx = *mxi;
        A.erase(mxi);
        A.insert(mx / 2);
    }

    ll ans = 0;
    for (ll v : A)
    {
        ans += v;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4992
//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
const bool DEBUG = false;
#define cerr if(DEBUG)cerr
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const long long maxn = 2e5 + 5;
const long long INF = 2e18 ;
const long long M = 1e9 + 7;
const int lg = 21;

ll n, m, x[maxn];
vector<pll> r[maxn], l[maxn];
bool mark[maxn], flag;

void dfs(int v){
	if(flag)
		return;
	mark[v] = 1;
	for(auto u : r[v]){
		int L = v, R = u.X, d = u.Y;
		int z = x[L] + d;
		if(x[R] != -INF){
			if(x[R] != z)
				flag = 1;			
		}
		else{
			x[R] = z;
			dfs(R);
		}
	}
	for(auto u : l[v]){
		int L = u.X, R = v, d = u.Y;
		int z = x[R] - d;
		if(x[L] != -INF){
			if(x[L] != z)
				flag = 1;
		}
		else{
			x[L] = z;
			dfs(L);
		}
	}       	
}

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> m;
	fill(x, x + maxn, -INF);
	for(int i = 0; i < m; i++){
		int L, R, d;
		cin >> L >> R >> d, L--, R--;
		r[L].pb({R, d});
		l[R].pb({L, d});		
	}
	for(int i = 0; i < n; i++){
		if(mark[i])
			continue;
		x[i] = 0;
		dfs(i);		
	}
	if(flag)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;	
	return 0;
}


Measured memory_bytes: 24576
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();

		long a[] = new long[n];


		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();

		}
		Arrays.sort(a);
		long ans = 1;
		int cd = 0;
		for (long i = a[1]; i >=0; i=i-1) {
			for (int j = 0; j < n; j++) {
				if (a[j] % i != 0) {
					cd++;
					//System.out.println("cd" + i + " " + cd);
				}
				if(cd>=2){
					break;
				}
			}
			//System.out.println("sd#"+cd);


				if (cd <=1) {
					ans = i ;
					break;
				}
			cd = 0;
		}
		System.out.println(ans);
	}
}


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

void trace(int A[], int n) {
  for(int i = 0; i < n ; i++) {
    if (0 < i) { cout << " "; }
    cout << A[i];
  }
  cout << endl;
}

void insertionSort(int A[], int n) {
  for(int i = 1; i < n ; i++) {
    int v, j;
    v = A[i];
    j = i - 1;
    while ( j>= 0 && A[j]>v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    trace(A,n);
  }
}

int main() {
  int n;
  int A[1000];

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

  trace(A, n);
  insertionSort(A, n);

  return 0;
}


Measured memory_bytes: 3096
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner s=new Scanner(System.in);
		long n=s.nextLong();
		long m=s.nextLong();
		if(m>=n)
		System.out.println("Yes");
		else
		System.out.println("No");}}

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

 
int main() {
    string s;
    cin>>s;
    vector<int> as(123);
    rep(i,s.length()){
        as[(int)s[i]]++;
    }

    for(int i=97;i<=122;i++){
        if(as[i]==0){
            char c=i;
            cout<<c<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
}

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

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

      Arrays.sort(arr);
      HashMap<String, Long> memo = new HashMap<>();
      long res = dfs(arr, a, memo, 0, 0, 0);
      
      System.out.println(res);
  }

  private static long dfs(int[] arr, int a, HashMap<String, Long> memo, int idx, int n, long curSum) {
     
     if(memo.containsKey(curSum + "-" + idx + "-" + n)) 
        return memo.get(curSum + "-" + idx + "-" + n);
    
     if(n * a < curSum)
        return 0;

     long res = 0;
     if(n != 0 && n * a == curSum) {
        res = 1;
     }

     for(int i = idx; i < arr.length; i++) {
        res += dfs(arr, a, memo, i + 1, n + 1, curSum + arr[i]);
     }
     memo.put(curSum + "-" + idx + "-" + n, res);
     return res;
  }
}

Measured memory_bytes: 234628
#include<bits/stdc++.h>
using namespace std;
int n,m,x;
int c[20],a[20][20];
int ans=0x3f3f3f3f;
int tmp[20];
void dfs(int idx,int cost){
    if(idx==n){
        for(int i=0;i<m;i++){
            if(tmp[i]<x)return;
        }
        ans=min(ans,cost);
        return;
    }
    dfs(idx+1,cost);
    for(int i=0;i<m;i++){
        tmp[i]+=a[idx][i];
    }
    dfs(idx+1,cost+c[idx]);
    for(int i=0;i<m;i++){
        tmp[i]-=a[idx][i];
    }
}
int main(){
    cin>>n>>m>>x;
    for(int i=0;i<n;i++){
        cin>>c[i];
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    dfs(0,0);
    if(ans==0x3f3f3f3f)cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long

using namespace std;

struct face{
	int a,b,c,d,orien;
	face(){}
	face(int aa, int bb, int cc, int dd){
		a=aa, b=bb, c=cc, d=dd;
		orien = 1;
		if(a==c and b==d) orien = 2;
		if(a==b and b==c and c==d and d==a) orien = 4;
	}
	void rotate(){
		int t=a;
		a=b,b=c,c=d,d=t;
	}
	bool operator<(face f) const{
		return make_tuple(a,b,c,d) < make_tuple(f.a,f.b,f.c,f.d);
	}
	bool operator==(face f) const{
		return make_tuple(a,b,c,d) == make_tuple(f.a,f.b,f.c,f.d);
	}
	face arrange(){
		face best = face(a,b,c,d);
		face cur = face(a,b,c,d);
		for(int i=0; i<4; ++i){
			cur.rotate();
			if(cur < best) best = cur;
		}
		return best;
	}
	void print(){
//		printf("(%d %d %d %d)\n",a,b,c,d);
	}
};
int n;
face A[500];
map<face, int> cnt;
int32_t main(){
	cin >> n;
	for(int i=0; i<n; ++i){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		A[i] = face(a,b,c,d).arrange();
		if(cnt.find(A[i]) == cnt.end()) cnt[A[i]]=1;
		else cnt[A[i]]++;
	}
	sort(A, A+n);
	for(int i=0; i<n; ++i){
		A[i].print();
	}
	int ans = 0;
	for(int i=0; i<n; ++i){
		for(int j=i+1; j<n; ++j){
			face t=A[i], b=A[j];
			for(int k=0; k<4; ++k){
				face q = face(t.b,b.a,b.d,t.c).arrange();
				face w = face(t.a,b.b,b.a,t.b).arrange();
				face e = face(b.b,t.a,t.d,b.c).arrange();
				face r = face(t.c,b.d,b.c,t.d).arrange();
				vector<face> four; 
				four.push_back(q);
				four.push_back(w);
				four.push_back(e);
				four.push_back(r);

				typedef pair<face,int> pf;
				vector<pf> v;
				for(auto l : four){
					bool newone = true;
					for(auto it = v.begin(); it!=v.end(); ++it){
						if(it->first == l){ it->second++; newone = false; break; }
					}
					if(newone) v.push_back(pf(l,1));
				}
				int add = 1;
				for(auto m : v){
					int c = cnt[m.first];
					if(m.first == t) c--;
					if(m.first == b.arrange()) c--;
//					m.first.print(); printf("x%d, %d\n", c, m.second);
					assert(c>=0);
					while(m.second--){
						add *= c--; 
						add *= m.first.orien;
					}
				}
				ans += add;
//				printf(" === %d %d: +%d\n", i, j, add);
				b.rotate();
			}
		}
	}
	cout << ans/3;
}


Measured memory_bytes: 124928
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean r = false;
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				if((i*j)==n) {
					r = true;
					break;
				}
			}
		}
		System.out.println(r?"Yes":"No");
		sc.close();
	}
}

Measured memory_bytes: 24020
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

int main() {
  int r;
  cin >> r;
  printf("%.15f\n", r * 2 * M_PI);
  return 0;
}

Measured memory_bytes: 3772
N, M = [int(i) for i in input().split()]
A = sorted([s for s in input().split()], reverse=True)
numDict = {"1":2, "2":5, "3":5, "4":4, "5":5, "6":6, "7":3, "8":7, "9":6}
dp = ["" for _ in range(N + 1)]

for i in range(N + 1):
    for strNum in A:
        if i - numDict[strNum] < 0:
            continue
        if i - numDict[strNum] == 0 and dp[i] == "":
            dp[i] = strNum
        preStrNum = dp[i - numDict[strNum]]
        if preStrNum != "":
            if len(preStrNum) + 1 > len(dp[i]):
                dp[i] = preStrNum + strNum

print("".join(sorted(dp[N], reverse=True)))


Measured memory_bytes: 29684
#include<stdio.h>
int main(void){
    int a[100][100],x,y,ink,i,j,noc,max;
    for(i=0;i<10;i++)for(j=0;j<10;j++)a[i][j]=0;
    while(scanf("%d",&x)!=EOF){
        scanf(",%d,%d",&y,&ink);
        a[x][y]++;
        a[x+1][y]++;
        a[x][y+1]++;
        if(x!=0)a[x-1][y]++;
        if(y!=0)a[x][y-1]++;
        if(ink==1)continue;
        a[x+1][y+1]++;
        if(x!=0)a[x-1][y+1]++;
        if(y!=0)a[x+1][y-1]++;
        if(x!=0 && y!=0)a[x-1][y-1]++;
        if(ink==2)continue;
        a[x][y+2]++;
        a[x+2][y]++;
        if(x>1)a[x-2][y]++;
        if(y>1)a[x][y-2]++;
    }
    noc=max=0;
    for(i=0;i<10;i++){
        for(j=0;j<10;j++){
            if(a[i][j]==0)noc++;
            else if(max<a[i][j])max=a[i][j];

        }

    }
    printf("%d\n%d\n",noc,max);
    return 0;
}

Measured memory_bytes: 612
N,M,R=map(int, input().split())
r=map(lambda x:int(x)-1, input().split())
dp=[[10**9]*N for _ in range(N)]
for _ in range(M):
    A,B,C=map(int, input().split())
    A-=1
    B-=1
    dp[A][B]=C
    dp[B][A]=C
for z in range(N):
    for x in range(N):
        for y in range(N):
            dp[x][y]=min(dp[x][y], dp[x][z]+dp[z][y])

import itertools
ans=10**9
for rp in itertools.permutations(r):
    t=0
    for i in range(R-1):
        t+=dp[rp[i]][rp[i+1]]
    ans=min(ans,t)
print(ans)

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, a[3000], dp[3001][3001];
bool mf[3001][3001];

LL f(int l, int r) {
	if(mf[l][r]) { return dp[l][r]; }
	mf[l][r] = true;
	if(r - l == 1) { return (dp[l][r] = a[l]); }
	
	return (dp[l][r] = max(a[l] - f(l + 1, r), a[r - 1] - f(l, r - 1)));
}

int main() {
	cin >> n;
	inc(i, n) { cin >> a[i]; }
	
	cout << f(0, n) << endl;
	
	return 0;
}


Measured memory_bytes: 78464
//In the name of God:)
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define ll long long int
#define fast  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int MAXN = 2e5 + 10;
vector <int> adj[MAXN];


int main(){
    int n , x;
    scanf("%d" , &n);
    for(int i = 0 ; i < n-1 ; i++){
        scanf("%d" , &x);
        x--;
        adj[x].pb(i);
    }
    for(int i = 0 ; i < n ;i++){
        printf("%ld\n" , adj[i].size());
    }
}


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

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

  int n;
  cin >> n;

  if (n % 2 == 0) {
    cout << (n / 2 - 1) << endl;
  } else {
    cout << (n - 1) / 2 << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

vector<int> a;
int partition() {
  int s = a.size() - 1;
  int x = a[s];
  int p, q;
  p = 0;
  for (int i = 0; i < s; ++i) {
    if (x >= a[i]) {
      swap(a[i], a[p]);
      ++p;
    }
  }
  swap(a[p], a[s]);
  return p;
}

int main(int argc, char const *argv[]) {
  int n;  cin >> n;
  int p;
  for (int i = 0; i < n; ++i) {
    int t;  cin >> t;
    a.push_back(t);
  }
  p = partition();
  for (int i = 0; i < a.size(); ++i) {
    if (i == p) cout << "[";
    cout << a[i];
    if (i == p) cout << "]";
    if (i != a.size() - 1) cout << " ";
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 3464
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,i,j,k,x,y,l,z;
  cin>>n>>m;
  vector<pair<int,int>> a(n),c(m);
  for(i=0;i<n;i++){
    cin>>x>>y;
    a.at(i)=make_pair(x,y);
  }
  for(i=0;i<m;i++){
    cin>>x>>y;
    c.at(i)=make_pair(x,y);
  }
  for(i=0;i<n;i++){
    l=4e8;
    for(j=0;j<m;j++){
      z=abs(a.at(i).first-c.at(j).first)+abs(a.at(i).second-c.at(j).second);
      if(z<l){
        k=j+1;
        l=z;
      }
    }
    cout<<k<<endl;
  }
}

Measured memory_bytes: 3560
from collections import Counter
N = int(input())

LIM = int(N ** .5) + 10
P = [True] * LIM
P[0] = P[1] = False
for i in range(4, LIM, 2): P[i] = False
i = 3
while i * i < LIM:
	if P[i]:
		j = i * i
		while j < LIM:
			P[j] = False
			j += 2 * i
	i += 2

pr = []
for i in range(2, LIM):
	if P[i]:
		pr.append(i)


if N == 1:
	print(0)
else:
	factors = Counter()
	for p in pr:
		if p > N: break
		while N % p == 0:
			factors[p] += 1
			N //= p

	if N > 1:
		factors[N] += 1

	r = 0
	for k, v in factors.items():

		i = 1
		while v >= i:
			r += 1
			v -= i
			i += 1
	print(r)


Measured memory_bytes: 80888
using System;
using System.Linq;
using static System.Console;

static class Extensions {
   public static int ToInt(this string str) {
      return int.Parse(str);
   }
}

class Program {
   public static void Main(string[] args) {
      var n = ReadLine().ToInt();
      var a = ReadLine().Split(' ').Select(x => x.ToInt()).ToArray();

      var sortedA = a.OrderByDescending(x => x).ToArray();
      int alice = 0;
      int bob = 0;
      for (int i = 0; i < n; i++) {
         if (i % 2 == 0) {
            alice += sortedA[i];
         } else {
            bob += sortedA[i];
         }
      }
      WriteLine(alice - bob);
   }
}


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll>   pairl;
typedef vector<ll>     vl;
typedef vector<ll>     vll;
typedef vector<vector<ll> > vvl;
const   int            infi = numeric_limits<int>::max();
const   ll             infl = numeric_limits<ll>::max();
const   double         eps = 0;
const   int            ms  = 0;



int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    int A, B;
    cin >> A >> B;
    int c = A - B*2;
    cout << max(c, 0) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem( f, x ) memset( f, x, sizeof(f) )
#define pii pair<int,int>
#define fi first
#define se second
#define mk(x,y) make_pair(x,y)
#define pk push_back
typedef long long ll;
using namespace std;
const int M = 215;
const int N = 55;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 2505;
ll m, n, s;
int head[N], cnt;
ll dis[N][MAXN];
ll c[N], d[N];

struct eg{
    int to, pre;
    ll a, b;
    eg( ):to(0), pre(0), a(0), b(0){ }
    eg( int tt, int pp, int aa, int bb ){
        to = tt, pre = pp, a = aa, b = bb;
    }
}e[M];

struct node{
    int x, c, d;
    node():x(0), c(0), d(0){ }
    node( int xx, int cc, int dd ):x(xx), c(cc), d(dd){}
    friend bool operator<( node p1, node p2 ){
        if( p1.d == p2.d )
            return p1.c < p2.c;
        return p1.d > p2.d;
    }
};

void add( int x, int y, int a, int b ){
    e[++cnt] = eg( y, head[x], a, b );
    head[x] = cnt;
}

void Bfs( ){
    dis[1][s] = 0;
    queue<pii> pq;
    pii cur, nxt;
    cur = mk( 1, s );
    pq.push( cur );
    while( !pq.empty() ){
        cur = pq.front();
        pq.pop();
        int x = cur.fi;
        int w = cur.se;
        //cout << "cur_x: " << x << endl;
        for( int i = head[x]; i; i = e[i].pre ){
            int to = e[i].to;
            ll a = e[i].a, b = e[i].b;
            if( w >= a && dis[to][w-a] > dis[x][w]+b ){
                dis[to][w-a] = dis[x][w]+b;
                pq.push( mk(to, w-a) );
            }
        }
        ll mi = min( ll(2500), w+c[x] );
        if( dis[x][mi] > dis[x][w]+d[x] ){
            dis[x][mi] = dis[x][w]+d[x];
            pq.push( mk( x,mi ));
        }

    }
}

void init( ){
    for( int i = 0; i <= n; i++ ){
        head[i] = 0;
        for( int j = 0; j < MAXN; j++ )
            dis[i][j] = INF;
    }
    s = min( s, ll(2500) );
    cnt = 0;
}

int main( ){
    while( scanf( "%lld %lld %lld", &n, &m, &s ) != EOF ){
        init( );
        int x, y;
        ll a, b;
        for( int i = 0; i < m; i++ ){
            scanf( "%d %d %lld %lld", &x, &y, &a, &b );
            add( x, y, a, b );
            add( y, x, a, b );
        }
        for( int i = 1; i <= n; i++ )
            scanf( "%lld %lld", c+i, d+i );
        Bfs( );
        for( int i = 2; i <= n; i++ ){
            ll ans = INF;
            for( int j = 0; j < MAXN; j++ )
                ans = min( ans, dis[i][j] );
            printf( "%lld\n", ans );
        }
    }
    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
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 end



int main(){
    int n,a,b; scanf("%d%d%d",&n,&a,&b);
    printf((a+b)&1?"Borys\n":"Alice\n");
    return 0;
}

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

constexpr Int mod = 1e9+7;
Int n, x, y, z;
vector<vector<Int>> dp;

bool ok(Int w){
	Int c = 0;
	for(Int j=0; (w>>j)>0; ++j)
		if((w>>j) & 1){
			if(j+1 == z) c += 4;
			if(j+1 == z+y) c += 2;
			if(j+1 == z+y+x) c += 1;
		}
	return c != 7;
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> x >> y >> z;
	dp.resize(n, vector<Int>(1<<(x+y+z)));
	for(Int i=1; i<=10; ++i){
		Int t = (1<<(i-1));
		t &= (1<<(x+y+z))-1;
		++dp[0][t];
	}
	for(Int i=0; i<n-1; ++i)
		for(Int j=0; j<(1<<(x+y+z)); ++j)
			for(Int k=1; k<=10; ++k){
//				cout << i << " " << j << " " << k << "\n";
				Int t = j;
				t <<= k;
				t |= (1<<(k-1));
				t &= (1<<(x+y+z))-1;
				if(ok(t)){
					dp[i+1][t] += dp[i][j];
					dp[i+1][t] %= mod;
				}
			}
	Int ans = 1;
	for(Int i=0; i<n; ++i){
		ans *= 10;
		ans %= mod;
	}
	for(Int i=0; i<(1<<(x+y+z)); ++i){
		ans -= dp[n-1][i];
		if(ans < 0) ans += mod;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 42368
'use strict'

function main(input) {
    input = input.split("\n");
    const N = parseInt(input[0]);
    const S = input[1];
    let w = 0;
    let e = 0;
    for (let i = 0; i < N; i++) {
        if (S[i] === 'W')
            w++;
        else
            e++;
    }

    let num = e - ((S[0] === 'E') ? 1 : 0);
    let min = num;
    for (let i = 1; i < N; i++) {
        let left = S[i-1];
        let newleader = S[i];
        if (left === 'W')
            num++;
        if (newleader === 'E')
            num--;
        if (min > num)
            min = num;
    }
    console.log(min);
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'));


Measured memory_bytes: 7628
#include <iostream>
using namespace std;
int main(){
  int a,b;
  string c,d,ans;
  cin>>c>>d;
  cin>>a>>b;
  cin>>ans;
  if(ans==c){
    cout<<a-1<<" "<<b<<endl;
  }
  else{
    cout<<a<<" "<<b-1<<endl;
  }
  return 0;
}

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

def main():
  n, m = map(int, input().strip().split())
  ls, rs = [], []
  for _ in range(m):
    l, r = map(int, input().strip().split())
    ls.append(l)
    rs.append(r)
  l = max(ls)
  r = min(rs)
  print(max(r - l + 1, 0))

if __name__=='__main__':
  main()



Measured memory_bytes: 10992
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

LL w(LL e){
    if(e%4 == 0)return e;
    if(e%4 == 1)return 1;
    if(e%4 == 2)return e+1;
    if(e%4 == 3)return 0;
}
int main(){
    LL A,B;cin >> A>> B;
    cout<<(w(B)^w(A-1))<<endl;
}



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

const int N = 2e6 + 12;

#define mkp make_pair
#define sz(s) (int)(s.size())
#define eb emplace_back

#define ll long long

int main () {
	clog << "Ready\n";
	
	int a, b;
	cin >> a >> b;

	cout << max(a * b, max(a + b, a - b));

	cerr << '\n';
	return 0;
}



Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;

using namespace std;


int main() {
	ios::sync_with_stdio(false);
	cin >> N >> M >> H >> W;
	long long int num[200001] = {};
	num[0] = 1;
	num[1] = 1;
	for (int i = 2; i <= N + M; i++) {
		num[i] = num[i - 1] * i;
		num[i] %= MOD;
	}
	for (int i = W + 1; i <= M; i++) {
		long long int box = num[N - H + i - 2];
		box *= num[H + M - i - 1];
		box %= MOD;
		box *= power(num[N - H - 1], MOD - 2, MOD);
		box %= MOD;
		box *= power(num[i - 1], MOD - 2, MOD);
		box %= MOD;
		box *= power(num[H - 1], MOD - 2, MOD);
		box %= MOD;
		box *= power(num[M - i], MOD - 2, MOD);
		box %= MOD;
		ans += box;
		ans %= MOD;
		//cout << box << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1920
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=55,M=6000,Z=2501;
typedef long long ll;
int a[N];
ll f1[M],f2[M];
int n,k;
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        a[i]-=k;
    }
    ll ans=0;
    f1[0]=f2[0]=1;
    for(int i=1;i<=n;i++)
        if(a[i]>=0)
            for(int j=M-1;j>=0;j--)
                if(a[i]+j>=0&&a[i]+j<M&&f1[j])
                    f1[a[i]+j]+=f1[j];
    for(int i=1;i<=n;i++){
        if(a[i]<0){
            a[i]=-a[i];
            for(int j=M-1;j>=0;j--)
                if(a[i]+j>=0&&a[i]+j<M&&f2[j])
                    f2[a[i]+j]+=f2[j];
        }
    }
    for(int j=1;j<M;j++){
        ans+=f1[j]*f2[j];
    }
    ans+=f1[0]-1;
    printf("%lld\n",ans);
}


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

int main(){
  string s;
  cin >> s;

  int a_cnt = 0;
  long long ans = 0;
  for(int i = 0; i < s.length(); i++){
    if(s[i] == 'A'){
      if(i > 0 && s[i - 1] == 'B'){
	a_cnt = 1;
      }else{
	a_cnt++;
      }
    }else if(s[i] == 'B'){
      if(i > 0 && s[i - 1] == 'B'){
	a_cnt = 0;
      }
    }else{
      if(i > 0 && s[i - 1] == 'B'){
	ans += a_cnt;
      }else{
	a_cnt = 0;
      }
    }
    //cout << a_cnt << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 832
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	string S;
	cin >> S;
	int count=0;
	for(int i=0; i<S.length()/2; i++){
		if(S[i]!=S[S.length()-1-i]){
			count++;
		}
	}

	cout << count << endl;
	return 0;
}

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

int main() {
  int X, A;
  cin >> X >> A;
  if (X < A) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main(){
	i64 n, x; cin >> n >> x; std::vector<i64> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(begin(a), end(a));
	
	i64 s = 0, c = 0;
	for(int i = 0; i < n; i++) {
		s += a[i];
		if(s <= x) c++;
	}
	
	cout << c - (s < x) << endl;
	return 0;
}


Measured memory_bytes: 256
function main()
  
  X = parse(Int,readline())
  
  ans = 0
  
  check500 = div(X,500)
  X -= check500 * 500
  check5 = div(X,5)
  
  ans = check500 * 1000 + check5 * 5
  
  println(ans)
  
end

main()

Measured memory_bytes: 166868
#include<stdio.h>
int main()
{
double a,b,c,d,e,f,x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF)
{
 y=(c*d-f*a)/(b*d-e*a);
 x=(c-b*y)/a;
 printf("%.03lf %.03lf\n",x,y);
 }
return 0;}

Measured memory_bytes: 652
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int a, b;
    cin >> a >> b;
    int c = (b+b+a-1)*a/2;
    if(b <= 0 && b+a-1 >= 0) cout << c << endl;
    else if (a+b-1 < 0) cout << c-(a+b-1) << endl;
    else cout << c-b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}

int main(){
  int a,b,c;
  lp(i,3){
    cin>>a>>b>>c;
    long x=a*3600+b*60+c;
    int d,e,f;
    cin>>d>>e>>f;
    long y=d*3600+e*60+f;
    y-=x;
    a=y/3600;
    b=y%3600/60;
    c=y%60;
    cout<<a<<" "<<b<<" "<<c<<endl;
  }
    
  return 0;
}



Measured memory_bytes: 3088
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(1000000)
from collections import deque

# スペース区切りの整数の入力
N, K = map(int, input().split())
#配列の入力
data = list(map(int, input().split()))

data.sort()

ans = 0
for i in range(K):
    ans += data[i]

print(ans)


Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
int INF = 1e9+7;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    int count = 0;
    int bmin = 1e9+1;
    ll sum = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i];
        sum += a[i];
        if(a[i] > b[i])
        {
            count++;
            bmin = min(bmin, b[i]);
        }
    }
    if(count == 0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << sum - bmin << endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int arr[301];
double dp[301][301][301];

int n;
double solve(int x, int y, int z) {

	//cout<<"#x "<<x<<" #y "<<y<<" #z "<<z<<endl;
	if(x<0 || y<0 || z<0)
		return 0;
	if (x == 0 && y == 0 && z == 0)
		return 0;

	if (dp[x][y][z] > -0.9)
		return dp[x][y][z];

	dp[x][y][z] = ((n + x * solve(x - 1, y, z) + y * solve(x+1, y-1 , z) + z * solve(x, y+1 , z - 1)));
	//Finally x=0 y=0 z=0
	dp[x][y][z]/=(x+y+z);

	return dp[x][y][z];
}



int main() {

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> n;
	int x=0, y=0, z=0;




	for (int i = 0; i < n; i++)
	{	cin >> arr[i];
		if (arr[i] == 1)
			x++;
		else if (arr[i] == 2)
			y++;
		else if (arr[i] == 3)
			z++;
	}


	memset(dp,-1.0,sizeof(dp));
	//cout<<x<<" "<<y<<" "<<z<<endl;
	cout<<fixed<<setprecision(10)<<solve(x,y,z)<<endl;



}

Measured memory_bytes: 216896
#include <iostream>
#include <stdio.h>
static int MAX = 100;

void bubbleSort(int *A,int N){
	int flag=1;
	int buf;
	int count=0;
	while(flag){
		flag = 0;
		for(int i = N-1;i >= 1;i--){
			if(A[i] < A[i-1]){
				buf = A[i];
				A[i] = A[i-1];
				A[i-1] = buf;
				flag = 1;
				count++;
			}
		}
	}
	printf("%d",A[0]);
	for(int i = 1;i < N;i++){
		printf(" %d",A[i]);
	}
	printf("\n");
	std::cout << count << std::endl;
}
int main(){
	int A[MAX];
	int n;
	std::cin >> n;
	for(int i = 0;i < n;i++) std::cin >> A[i];

	bubbleSort(A,n);


	return 0;
}

Measured memory_bytes: 3200