akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int A, B, C, X, Y;
  std::cin >> A >> B >> C >> X >> Y;
  int Z = std::max(X, Y);
  int ans = std::pow(10,9);
  for(int i=0; i <= Z; i++){
     ans = std::min(ans, i*2*C
                            + std::max(0,X-i)*A
                            + std::max(0,Y-i)*B);
  }

  std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

using namespace std;

#define BUF_SIZE 22

struct Node{
	Node(){
		left_child = right_child = 0;
		data = 0;
	}
	Node *left_child,*right_child;
	long long data;
};

class Tree{
public:
	Tree(){
		root = new Node();
		num_of_node = 0;
	}
	void insert(long long insert_data){
		if(num_of_node == 0){
			root->data = insert_data;
			num_of_node++;
		}else{
			Node* tmp = root;
			while(true){
				if(tmp->data < insert_data){
					if(tmp->right_child == 0){
						tmp->right_child = new Node();
						tmp->right_child->data = insert_data;
						break;
					}else{
						tmp = tmp->right_child;
					}
				}else{
					if(tmp->left_child == 0){
						tmp->left_child = new Node();
						tmp->left_child->data = insert_data;
						break;
					}else{
						tmp = tmp->left_child;
					}
				}
			}
		}
	}

	void print(){
		inORDER(root);
		printf("\n");
		preORDER(root);
		printf("\n");
	}

private:
	Node* root;
	int num_of_node;

private:
	void preORDER(Node* node){
		printf(" %lld",node->data);
		if(node->left_child != 0) preORDER(node->left_child);
		if(node->right_child != 0) preORDER(node->right_child);
	}

	void inORDER(Node* node){
		if(node->left_child != 0) inORDER(node->left_child);
		printf(" %lld",node->data);
		if(node->right_child != 0) inORDER(node->right_child);
	}
};


int main(){
	int m;
	long long insert_data;
	char buf[BUF_SIZE];
	Tree tree;

	scanf("%d",&m);
	getchar();

	for(int i = 0; i < m; i++){
		fgets(buf,BUF_SIZE,stdin);
		if(buf[0] == 'i'){
			insert_data = 0;
			for(int k = 0; buf[k] != '\0';k++){
				if(buf[k] >= '0' && buf[k] <= '9'){
					insert_data = 10*insert_data + (buf[k] - '0');
				}
			}
			tree.insert(insert_data);
		}else{
			tree.print();
		}
	}
}

Measured memory_bytes: 16824
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007


int floormod(int a, int mod) {
  if (a > 0) return (a % mod);
  else if (a % mod == 0 ) return 0;
  else return (a % mod) + mod;
}

int modpow(int a, int n, int mod) {
  int res = 1;
  while (n > 0) {
    if (n & 1) res = floormod(res * a , mod);
    a = floormod(a * a , mod);
    n >>= 1;
  }
  return res;
}

int modinv(int a, int mod) {
  return modpow(a, mod - 2, mod);
}

const int MAX = 3100;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit(int mod) {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
    finv[i] = finv[i - 1] * inv[i] % mod;
  }
}
int COM(int n, int k, int mod) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}


int main() {
  int p;
  cin >> p;
  COMinit(p);
  vi a(3005, 0);
  rep(i, p) cin >> a[i];

  vi b(3005, 0);
  b[0] = a[0];
  b[p - 1] = (p - 1) * a[0];

  for (int i = 1; i < p; i++) {
    if (a[i] == 0) continue;
    for (int j = 1; j < p; j++) {
      int c = floormod(COM(p - 1, j, p) * modpow(-i, p - 1 - j, p), p);
      b[j] = floormod(b[j] - c, p);
    }
  }

  rep(i, p) cout << b[i] << " ";
  cout << endl;


}





Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<algorithm>
#include<deque>
#include<string>
static const double pi = 3.141592653589793;
using namespace std;

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)
#define N 110

int main(void){
  int x1,x2,y1,y2;
  cin>>x1>>y1>>x2>>y2;

  cout<<x2-y2+y1<<" "<<y2+x2-x1<<" "<<x1-y2+y1<<" "<<y1+x2-x1<<endl;

return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
//see answer
const int Mod = 1000000007;
class mll {
public:
	long long x;
	mll(long long x = 0) : x((x% Mod + Mod) % Mod) {};
	void operator += (const mll& a) {
		if ((x += a.x) >= Mod) x -= Mod;
	}
};
int main() {
	string S;
	cin >> S;
	int N = S.length();
	vector<vector<mll>> Mods(N, vector<mll>(13));
	if (S[0] == '?') for (int i = 0; i <=9; i++) Mods[0][i] = 1;
	else Mods[0][S[0] - '0'] = 1;
	for (int i = 1; i < N; i++) {
		if (S[i] == '?') for (int t = 0; t <= 9; t++) for (int j = 0; j < 13; j++) Mods[i][(j * 10 + t) % 13] += Mods[i - 1][j];
		else {
			int t = S[i] - '0';
			for (int j = 0; j < 13; j++) Mods[i][(j * 10 + t) % 13] += Mods[i - 1][j];
		}
	}
	cout << Mods[N - 1][5].x << endl;
}

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

int f(int n) {
	int ret = 0;
	for (int i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			if (i * i == n) ret++;
			else ret += 2;
		}
	}
	return ret;
}

int main() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i += 2) {
		if (f(i) == 8) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
ll uni[100005];
ll root(ll u){
    if(uni[u]<0)return u;
    return uni[u]=root(uni[u]);
}

void connect(int a,int b){
    a=root(a);
    b=root(b);
    if(a==b)return;
    if(uni[a]<uni[b]){
        a^=b;
        b^=a;
        a^=b;
    }
    uni[a]+=uni[b];
    uni[b]=a;
    return;
}
ll size(ll u){
    return -uni[root(u)];
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    memset(uni,-1,sizeof(uni));
    int n,m,q,a,b;
    cin>>n>>m;
    for(int i=0;i<m;i++){
    	cin>>a>>b;
    	connect(a,b);
    }
    vector<string> v;
    cin>>q;
    for(int i=0;i<q;i++){
    	cin>>a>>b;
    	if(root(a)==root(b))v.pb("yes");
    	else v.pb("no");
    }
    for(int i=0;i<q;i++){
    	cout << v[i] <<endl;
    }
    return 0;
}



Measured memory_bytes: 5040
import java.util.Scanner;
public class Main {
  void run() {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    char c = s.charAt(0);
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
      System.out.println("vowel");
    }else {
      System.out.println("consonant");
    }
  }
  public static void main(String[] args) {
    new Main().run();
  }
}


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

#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int a, b, c, k;
int main()
{
    ios_base::sync_with_stdio(false);

    cin >> a >> b >> c >> k;
    int res = 0;
    res += min(a, k);
    k -= min(k, a);
    /// res += min(b, k);
    k -= min(b, k);
    res -= min(c, k);
    cout << res << "\n";
}



Measured memory_bytes: 3656
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const ll MOD = 1e9+7;
//}}}

int a[100000];
ll ab[100000];
int b[100000];
ll bc[100000];
int c[100000];
int main(){
  int N;
  cin >> N;
  rep(i, N) cin >> a[i];
  rep(i, N) cin >> b[i];
  rep(i, N) cin >> c[i];
  sort(a, a + N);
  sort(b, b + N);
  sort(c, c + N);

  {
    int ai = 0;
    int bi = 0;
    while(1){
      if(a[ai] < b[bi]){
        ai++;
        if(ai == N){
          rep(i, bi, N){
            ab[i] = ai;
          }
          break;
        }
      }else{
        ab[bi] = ai;
        bi++;
        if(bi == N){
          break;
        }
      }
    }
  }
  {
    int bi = 0;
    int ci = 0;
    while(1){
      if(b[bi] < c[ci]){
        bc[bi] = N - ci;
        bi++;
        if(bi == N){
          break;
        }
      }else{
        ci++;
        if(ci == N){
          rep(i, bi, N){
            bc[i] = N - ci;
          }
          break;
        }
      }
    }
  }
  ll ans = 0;
  rep(i, N){
    ans += ab[i] * bc[i];
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;

signed main(){
	string s, t;
	cin>>s>>t;
	
	int x=s.length();
	int y=t.length();
	
	int dp[x+1][y+1];
	
	for(int i=0; i<=x; i++){
		for(int j=0; j<=y; j++){
			if(i==0 or j==0) dp[i][j]=0;
			
			else if(s[i-1]==t[j-1]) dp[i][j]=dp[i-1][j-1]+1;
			else dp[i][j]= max(dp[i-1][j], dp[i][j-1]);
		}
	}
	
	int l=dp[x][y];
	int tem=l;
	char ans[l];
	
	while(x>0 and y>0){
		if(s[x-1]==t[y-1]){
			ans[l-1]=s[x-1];
			l--;
			x--;
			y--;
		}
		
		else if(dp[x-1][y]> dp[x][y-1]) x--;
		else y--;
	}
	
	for(int i=0; i<tem; i++) cout<<ans[i];
	
    return 0;
}

Measured memory_bytes: 70656
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

const double eps = 1e-6;
const ll MOD = 1000000007;
const ll INF = 1e15;
vector<ll> imos;

ll f(ll left, ll cut, ll right, ll N) {
	return max({ imos[left], imos[cut] - imos[left], imos[right] - imos[cut], imos[N] - imos[right] }) -
		min({ imos[left], imos[cut] - imos[left], imos[right] - imos[cut], imos[N] - imos[right] });
}

int main() {
	ll N;
	cin >> N;
	vector<ll> A(N+1);
	for (int i = 1;i <= N;i++)
		cin >> A[i];
	imos = vector<ll>(N + 1);
	for (int i = 1;i <= N;i++) {
		imos[i] = A[i] + imos[i - 1];
	}
	ll left = 1;
	ll right = 3;
	ll ans = INF;
	for (ll cut = 2; cut <= N - 2;cut++) {
		while (left + 1 < cut && imos[left + 1] < imos[cut] - imos[left + 1])
			left++;
		while (right + 1 < N && imos[right + 1] - imos[cut] < imos[N] - imos[right + 1])
			right++;
		ans = min(ans, f(left, cut, right, N));
		if (left + 1 < cut)
			ans = min(ans, f(left + 1, cut, right, N));
		if(right + 1 < N)
			ans = min(ans, f(left, cut, right + 1, N));
		if (right + 1 < N && left+1 < cut)
			ans = min(ans, f(left + 1, cut, right + 1, N));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3328
use std::io;

fn main() {
  let mut line = String::new();
  io::stdin().read_line(&mut line)
    .expect("failed to read line");
  let mut ss: Vec<i32> = line.trim().split_whitespace()
    .map(|e| e.parse().unwrap()).collect();

  ss.sort();
  let ret: Vec<String> = ss.iter().map(|e| e.to_string()).collect();
  let ttt = ret.join(" ");
  println!("{}", ttt)
}



Measured memory_bytes: 5036
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int max = 1;

    for(int b=1;b<32;b++){
      for(int p=2;p<10;p++){
        double exp = Math.pow(b,p);
        if(exp>X){
          break;
        }
        if(max < exp){
          max = (int)exp;
        }
      }
    }
    System.out.println(max);
  }
}


Measured memory_bytes: 21972
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif


int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string s, t;
	cin >> s >> t;
	t.pop_back();

	if (s == t) cout << "Yes" << "\n";
	else cout << "No" << "\n";

	return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
int main(){

  int n,k,u,v,i,j,d[101][101];
  scanf("%d",&n);
  for(i=0;i<n;i++)
    for(j=0;j<n;j++)
      d[i][j]=0;
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      d[i][v-1]=1;
    }
  }
    for(i=0;i<n;i++){
      if(i!=0)printf("\n");
      for(j=0;j<n;j++){
       	printf("%d",d[i][j]);
	if(j!=n-1)printf(" ");
      }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main{
	static Scanner sc=new Scanner(System.in);
	List<String> input=new ArrayList<String>();
	static String temp="A";
	
	
	
	void FT(String tmp){
		String []ans=tmp.split(",");
		if(temp.equals(ans[0])){
			temp=ans[1];
		}else if(temp.equals(ans[1])){
			temp=ans[0];
		}
		
	}
	public static void main(String[] args) {
		Main app=new Main();
		while(sc.hasNext())app.FT(sc.next());
		System.out.println(temp);
		
	}

}

Measured memory_bytes: 17132
import heapq

def solve():
    N = int(input())
    A = list(sorted(map(int, input().split()), reverse=True))
    C = [-A[0]]

    ans = 0
    for a in A[1:]:
        K = heapq.heappop(C)
        ans += -K
        heapq.heappush(C, -a)
        heapq.heappush(C, -a)

    print(ans)



solve()

Measured memory_bytes: 105480
#include <stdio.h>

int main(void) {
	int a, b;
	if (scanf("%d%d", &a, &b) != 2) return 1;
	if (a <= 0 && 0 <= b) puts("Zero");
	else if (a > 0 || ((-a) - (-b) + 1) % 2 == 0) puts("Positive");
	else puts("Negative");
	return 0;
}


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

using namespace std;

int main(){
    while(true){
        int n,m;
        cin >> n >> m;
        if(n==0 && m==0)break;
        vector<int> h(n+1,0);
        vector<int> w(m+1,0);
        for(int i=1;i<=n;i++){
            cin >> h[i];
            h[i]+=h[i-1];
//            cout << h[i] << " ";
        }
//        cout << endl;
        for(int i=1;i<=m;i++){
            cin >> w[i];
            w[i]+=w[i-1];
//            cout << w[i] << " ";
        }
//        cout << endl;
        int ans=0;
        map<int,int> hlen,wlen;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<=n;j++){
                int t=h[j]-h[i];
                hlen[t]++;
            }
        }
        for(int i=0;i<m;i++){
            for(int j=i+1;j<=m;j++){
                int t=w[j]-w[i];
                wlen[t]++;
            }
        }
        map<int,int>::iterator hitr,witr;
        for(hitr=hlen.begin();hitr!=hlen.end();++hitr){
            int len=hitr->first,hval=hitr->second;
            witr=wlen.find(len);
            if(witr!=wlen.end()){
                int wval=witr->second;
                ans+=hval*wval;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 29860
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

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

signed main(){
    int k;
    cin >> k;
    vector<ll> cand;
    for(int i = 0; i < 10000; i++){
        string t;
        for(int j = 0; to_string(i).size() + j <= 15; j++){
            cand.emplace_back(stoll(to_string(i) + t));
            t.push_back('9');
        }
    }
    sort(ALL(cand));
    reverse(ALL(cand));
    cand.erase(unique(ALL(cand)), cand.end());
    vector<ll> ans;
    double mn = LINF;
    for(ll n : cand){
        double t = (double)n / (double)SOD(n);
        if(t <= mn) ans.emplace_back(n);
        mn = min(mn, t);
    }
    sort(ALL(ans));
    rep(i,k){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 1524
import heapq
t = 1
def max(a,b):
	if a > b:
		return a
	return b
while t > 0:
	t -= 1
	n,k = map(int,input().split())
	# k = int(input())
	v = list(map(int,input().strip().split()))[0:n]
	for i in range(k,n):
		if v[i] > v[i-k]:
			print("Yes")
		else:
			print("No")
	# for i in range(q):
	# 	p = int(input().strip())
	# 	v.append(p)
	# for i in range(n):
	# 	l.append(0)
	# for i in v:
	# 	l[i-1] += 1
	# for i in range(n):
	# 	if(l[i] <= q-k):
	# 		print("No")
	# 	else:
	# 		print("Yes")


Measured memory_bytes: 94200
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <cassert>

#define rep(i,x) for(int i = 0; i < x; i++)
#define rrep(i,x) for(int i = 1; i <= x; i++)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using ll = long long;
using namespace std;
const int INF = 1001001001;
const ll LINF = 1002003004005006007;

int main(){
    int n, k, c;
    cin >> n >> k >> c;
    string s; cin >> s;
    vector<int> dl(n, 0), dr(n, 0);
    int cntl = 1;
    rep(i, n){
        if (s[i] == 'o'){
            dl[i] = cntl;
            ++cntl;
            i += c;
        }
    }
    int cntr = cntl - 1;
    for (int i = n - 1; i >= 0; --i){
        if (s[i] == 'o'){
            dr[i] = cntr;
            --cntr;
            i -= c;
        }
    }
    if (cntl - 1 > k) return 0;
    rep(i, n){
        if (dl[i] != 0 and dl[i] == dr[i]) cout << i + 1 << endl;
    }
}



Measured memory_bytes: 3332
#include<stdio.h>
int main()
{
   int K,A,B,d=0;
   scanf("%d %d %d",&K,&A,&B);
   for(A;A<=B;A++)
   {
       if(A%K==0)
       d++;
   }
   if(d>0)
    printf("OK\n");
   else
    printf("NG\n");
}


Measured memory_bytes: 1620
#include<cstdio>
#include<queue>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<iostream>
using namespace std;
char s[1100],t[1100];
int  main()
{
	double l;
	scanf("%lf",&l);
	printf("%.10lf\n",l*l*l/27);
}


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


void a(){
    int N,K; cin >> N >> K;

    cout << N - K + 1;

}

void b(){
    int R,G,B,N; cin >> R >> G >> B >> N;

    int count = 0;
    for(int r = 0; r*R <= N; r++)
        for(int g = 0; r*R + g*G <= N; g++){
            int rg = r*R + g*G;
            if ((N - rg) % B == 0){
                count++;
            }
        }

    cout << count;

}


void c(){
    int N; cin >> N;
    int pure_AB_count = 0;
    int _A_count = 0;
    int B_count = 0;
    int B_A_count = 0;
    for(int i = 0; i < N; i++){
        string s; cin >> s;
        for(int i = 0; i < s.size() - 1; i++){
            if(s[i] == 'A' && s[i+1] == 'B') pure_AB_count++;
        }

        int l = s.size() - 1;
        if(s[0] == 'B' && s[l] == 'A') {
            B_A_count++;
        }else if(s[0] == 'B'){
            B_count++;
        }else if(s[l] == 'A'){
            _A_count++;
        }
    }

    int gen_AB = 0;
    if (B_A_count > 0) {
        gen_AB += B_A_count - 1;
        if (_A_count > 0) {
            _A_count--;
            gen_AB++;
        }
        if (B_count > 0) {
            B_count--;
            gen_AB++;
        }
    }
    gen_AB += min(_A_count,B_count);

    cout << pure_AB_count + gen_AB;

}
int main(){

    c();
    return 0;


}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    long long n;
    scanf("%lld",&n);

    int i;
    long long ans = 0;
    for(i=1;i<=n;i++){
        if(i % 3 != 0 && i % 5 != 0)ans += i;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1732
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        long n = sc.nextLong();
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            map.put(num, i);
        }
        if (n == 1) {
            System.out.println(0);
            return;
        }
        long ans = 0;
        long cnt = 1;
        for (Integer key = 2; key <= n; key++) {
            if (map.get(key - 1).intValue() <= map.get(key).intValue()) {
                cnt++;
            } else {
                cnt = 1;
            }
            ans = Math.max(cnt, ans);
        }
        System.out.println(n - ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 55480
//
// Created by GGG1235 on 2019/11/24.
//

#include <bits/stdc++.h>

#define MAX 1050
#pragma GCC optimize(3)

using namespace std;

typedef long long LL;

int g_pnHelper[MAX];
int g_pnDi[MAX];

int g_nLength=0;
bool bCheck() 
{
    for (int i = 1; i <= g_nLength; i++) 
    {
        if (g_pnDi[g_pnHelper[i]] > 0) 
        {
            return true;
        }
    }
    return false;
}

int main(int argc,const char **argv,const char **envp)
{
    ios::sync_with_stdio(false);
    cin.tie();

    int nDi;
    LL lN;
    LL lK;
    
    LL lTmp = 0;
    int nTmp = 0;
    cin >> lN >> lK;
    for (int i = 1; i <= lK; i++)
    {
        cin >> nDi;
        g_pnDi[nDi]++;
    }
    lTmp = lN;
    while (lTmp > 0)
    {
        g_pnHelper[++g_nLength] = lTmp % 10;
        lTmp /= 10;
    }
    while (bCheck())
    {
        nTmp = bCheck();
        g_pnHelper[nTmp]++;
        lN++;
        while (g_pnHelper[nTmp] >= 10)
        {
            g_pnHelper[nTmp] = 0;
            nTmp++;
            g_pnHelper[nTmp]++;
        }
        g_nLength = max(g_nLength, nTmp);
    }
    cout << lN << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stdio.h>
long long h[200001],n,k,i,a=0;
using namespace std;
int main(){
	scanf("%lld%lld",&n,&k);
	for(i=0;i<n;i++){
		scanf("%lld",&h[i]);
	}
	sort(h,h+n);
	for(i=0;i<n-k;i++){
		a+=h[i];
	}
	printf("%lld\n",a);
	return 0;
}

Measured memory_bytes: 1792
N = int(input())
H = [int(x) for x in input().split()]

flg=True
prev = H[0]
for i in range(1, N):
    if H[i-1] < H[i]:
        H[i] -= 1
    elif H[i-1] > H[i]:
        flg=False
        break
ans = 'Yes' if flg else 'No'
print(ans)

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


ll N;

int main(){
  cin >> N;
  ll sN = 2 * N, tN = 3 * N;
  vector<ll> a(tN);
  vector<ll> res(N+1, 0);
  priority_queue<ll, vector<ll>, greater<ll> > fir;
  priority_queue<ll> sec;
  
  for(int i = 0; i < tN; i++){
    cin >> a[i];
  }
  
  for(int i = 0; i < N; i++){
    fir.push(a[i]);
    res[0] += a[i];
  }

  for(int i = 0; i < N; i++){
    int mi = fir.top();
    int nex = a[N + i];
    res[i + 1] = res[i];
    if(mi < nex) {
      fir.pop();
      fir.push(nex);
      res[i+1] += nex - mi;
    }
   //cout << i+1 << ' ' << sub[i+1] << endl;
  }
  
  ll sub = 0;
  for(int i = sN; i < tN; i++){
    sec.push(a[i]);
    sub += a[i];
  }
  res[N] -= sub;
  
  for(int i = 0; i < N; i++){
    int ma = sec.top();
    int nex = a[sN - 1 - i];
    
    if(ma > nex) {
      sec.pop();
      sec.push(nex);
      sub += nex - ma;
    }
    res[N - 1 - i] -= sub;
  }
  
  ll ans = (ll)-1e18;
  for(int i = 0; i <= N; i++){
   ans = max(ans, res[i]);
  }
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 5748
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<functional>
#include<vector>
#include<queue>
using namespace std;
#define f(i,n) for(int i=0;i<(int)n;i++)
#define MOD 1000000009

int main(void){
	int n;
	vector<long long>x;
	vector<long long>d;
	long long k, l, r, m, c;

	scanf("%d %lld", &n,&k);
	m = 2000000000000000001;
	f(i, n){
		scanf("%lld %lld", &l, &r);
		m = min((r*k) + l, m);
		x.push_back(l);
		d.push_back(r);
	}
	l = 1;
	r = m;
	while (l != r){
		m= (l + r) / 2;
		c = 0;
		f(i, n){
			if (x[i] <= m){
				c += (m - x[i]) / d[i];
				c++;
			}
		}
		if (c < k)l = m + 1;
		else r = m;
	}
	printf("%lld\n", l);
	return 0;
}

Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const double pi=acos(-1.0);
const double inf = 1e100;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    string s;
	cin>>s;
	cout<<s.substr(0,3); 
    return 0;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(shoki,i,n) for(int i=shoki; i<n; i++)
#define _GLIBCXX_DEBUG
int main(){
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int res = 0;
    rep(0,i,a+1){
        rep(0,j,b+1){
            rep(0,k,c+1){
                int total = i*500 + j*100 + k*50;
                if(x==total) res++;
            }
        }
    }

    cout << res << endl;
}

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

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

int main() {
	ll X;
	cin >> X;

	ll yokin = 100;
	int ans = 0;
	while (X > yokin) {
		yokin += yokin / 100;
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3604
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            String tmpLArr[] = br.readLine().split(" ");
            int lArr[] = new int[2 * n];
            for (int i = 0; i < 2 * n; i++) {
                lArr[i] = Integer.parseInt(tmpLArr[i]);
            }
            Arrays.sort(lArr);
            int ans = 0;
            for (int i = 0; i < 2 * n - 1; i = i + 2) {
                ans = ans + lArr[i];
            }
            System.out.println(ans);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
namespace rng { using namespace boost; using namespace boost::range; }
namespace adp { using namespace boost::adaptors; }

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
constexpr auto color_s_ = "\033[2m\033[33m", color_e_ = "\033[0m";
template<class T> void trace_(const T& v) { cerr << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cerr << "\n"; for (const auto& v : m) { trace_(v); cerr << "\n"; } }
template<class T> void trace_(const char* s, const T& v) { cerr << color_s_ << s << "="; trace_(v); cerr << color_e_ << "\n"; cerr.flush(); }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { cerr << color_s_; for (; *s != ','; ++s) { cerr << *s; } cerr << "="; trace_(v); cerr << ","; trace_(++s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    vector<int> d(n);
    ll ans = 0;
    for (int i : irange(n)) {
        if (i + a[i] < n) {
            d[i + a[i]]++;
        }
        if (i - a[i] >= 0) {
            ans += d[i-a[i]];
        }
    }
    cout << ans << nl;
}


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

#define MAX_V 100000

vector<pair<int, int>> g[MAX_V];

pair<int, int> dfs(int u, int p) {
	pair<int, int> ret = make_pair(0, u);
	for (auto t : g[u]) {
		const int v = t.first;
		const int w = t.second;
		if (v == p) continue;
		auto child = dfs(v, u);
		ret = max(ret, make_pair(child.first + w, child.second));
	}
	return ret;
}

int main(int argc, char const *argv[])
{
	int n; cin >> n;
	for (int i = 0; i < n - 1; ++i) {
		int s, t, w; cin >> s >> t >> w;
		g[s].push_back(make_pair(t, w));
		g[t].push_back(make_pair(s, w));
	}
	int p = dfs(0, -1).second;
	cout << dfs(p, -1).first << endl;
	return 0;
}



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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
void chmax(T1 &a, const T2 &b) {
  if(a < b) a = b;
}

template <typename T1, typename T2>
void chmin(T1 &a, const T2 &b) {
  if(a > b) a = b;
}

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i != (int)(s.size())-1) cout << " ";
  }
  cout << "\n";
}

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

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

  int n; cin >> n;
  vll a(n);
  REP(i, n) {
    cin >> a[i];
  }

  map<int, int> mp;
  REP(i, n) {
    mp[a[i]-1]++;
    mp[a[i]]++;
    mp[a[i]+1]++;
  }

  ll ans = 0;
  for(auto &e: mp) {
    chmax(ans, e.second);
  }
  cout << ans << endl;

}


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

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

const int N = 2e5+10 , mod = 1e9+7;

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n;
   cin >> n;
   vector <pii> v;
   for(int i = 0 ; i < n ; i++){
      string s;
      cin >> s;
      int m = s.length();
      int nw = 0 , mn = 1;
      for(int j = 0 ; j < m ; j++){
         if(s[j] == '(')
            nw++;
         else
            nw--;
         mn = min(mn , nw);
      }
      v.push_back({mn , nw});
   }
   sort(v.begin() , v.end());
   int sum = 0;
   vector <pii> vv;
   while(v.size()){
      bool done = false;
      while(v.size() && v.back().first + sum >= 0){
         if(v.back().second >= 0)
            sum += v.back().second;
         else
            vv.push_back(v.back());
         done = true;
         v.pop_back();
      }
      if(!done)
         return cout << "No" , 0;
   }
   vector <pii> vvv;
   for(int i = 0 ; i < vv.size() ; i++)
      vvv.push_back({vv[i].first - vv[i].second , i});
   sort(vvv.begin() , vvv.end());
   for(pii x : vvv){
      if(sum + vv[x.second].first < 0)
         return cout << "No" , 0;
      sum += vv[x.second].second;
   }
   if(sum == 0)
      cout << "Yes";
   else
      cout << "No";
   return 0;
}


Measured memory_bytes: 22912
import java.util.LinkedList;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		while(true){
			int n = in.nextInt();
			int m = in.nextInt();
			int s = in.nextInt()-1;
			int g1 = in.nextInt()-1;
			int g2 = in.nextInt()-1;
			if(n == 0) break;
			int[][] edge = new int[n][n];
//			int[][] root = new int[n][n];
			for(int i=0; i<n; i++){
				for(int j=0; j<n; j++){
//					root[i][j] = i;
					if(i==j) continue;
					edge[i][j] = Integer.MAX_VALUE/4;
				}
			}
			for(int i=0; i<m; i++){
				int b1 = in.nextInt()-1;
				int b2 = in.nextInt()-1;
				int c = in.nextInt();
				edge[b1][b2] = c;
			}
			for(int i=0; i<n; i++){
				for(int j=0; j<n; j++){
					for(int k=0; k<n; k++){
						if(edge[j][k] > edge[j][i]+edge[i][k]){
							edge[j][k] = edge[j][i] + edge[i][k];
//							root[j][k] = i;
						}
					}
				}
			}
			int res = edge[s][g1] + edge[s][g2];
			for(int i=0; i<n; i++){
				res = Math.min(res, edge[s][i]+edge[i][g1]+edge[i][g2]);
			}
//			LinkedList<Integer> list = rooting(root, s, g1);
//			for(int i: list){
//				res = Math.min(res, edge[s][g1] + edge[i][g2]);
//			}
			
//			list = rooting(root, s, g2);
//			for(int i: list){
//				res = Math.min(res, edge[s][g2] + edge[i][g1]);
//			}
			
			System.out.println(res);
		}
	}
	
	public static LinkedList<Integer> rooting(
			int[][] root, int s, int t){
		LinkedList<Integer> res = new LinkedList<Integer>();
		refound(root, s, t, res);
		return res;
	}
	
	public static void refound(
			int[][] root, int s, int t
			, LinkedList<Integer> res){
		int center = root[s][t];
		if(s == center){
			res.add(t);
			return;
		}
		refound(root, s, center, res);
		refound(root, center, t, res);
	}
}

Measured memory_bytes: 62988
#include<bits/stdc++.h>
using namespace std;
int main(){
	
	int a,b;
	cin>>a>>b;
	if(a<=8&&b<=8){
		cout<<"Yay!"<<endl;
		return 0;
	}
	else{
		cout<<":("<<endl;
		return 0;
	}
	
	return 0;
}

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
import bisect
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#############
# Main Code #
#############

N,K,C = inputIL()
S = inputS()

L = []

i = 0
c = 0
while i<N and c<K:
  if S[i]=="o":
    L.append(i)
    c += 1
    i += C+1
  else:
    i += 1

R = []

i = N-1
c = 0
while i>=0:
  if c == K:
    break
  if S[i]=="o":
    R.append(i)
    c += 1
    i -= C+1
  else:
    i -= 1

R = R[::-1]
for i in range(K):
  if L[i] == R[i]:
    print(L[i]+1)


Measured memory_bytes: 102284
//テンプレート
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

//int型配列の最大値を返す関数
int maxOfArray(int *n){
    int i, ans, len = sizeof(n) / 4;;
    ans = n[0];
    for (i = 0; i < len; i++) {
        if (ans < n[i])
            ans = n[i];
    }
    return ans;
}

int main(){
    int n,max=0,count=0,sum=0;
    scanf("%d",&n);
    int l[n];
    for (int i=0; i<n; i++) {
        scanf("%d",&l[i]);
        count++;
    }
    for (int i=0; i<count; i++) {
        if (max < l[i]) {
            max=l[i];
        }
        sum+=l[i];
    } //最大値もとめた
    sum-=max;
    if (sum > max) {
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    
    return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, K;
    cin >> N >> K;
    vec x(N);
    REP(i,0,N) cin >> x[i];

    ll sum = 0;
    REP(i,0,N) sum += (x[i] < K - x[i] ? x[i] : K - x[i]) * 2;        
    PR(sum);

    return 0;
}

/*



*/

Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<math.h>
#include<vector> 
#include<cstdio> 
#include<set>
#include<string.h>
#include<stdio.h>
#include<queue>
#include<cstring>
using namespace std;
int a[105000],ans;
int main()
{int n;
 cin>>n;
 for(int i=0;i<n;i++)
 cin>>a[i];
 for(int i=0;i<n;i++)
 {
  {for(long long j=1;j<=29;j++)
   {if(a[i]%2==0){
    a[i]/=2;
    ans++;
   }}
   if(a[i]%2!=0)
   {continue;
   }
  }
 }
 cout<<ans<<endl; 
 system("pause");
 return 0;
}

Measured memory_bytes: 504
N, K = map(int,input().split())
MOD = 10**9+7
count = [0]*(K+1)
for i in range(K,0,-1):
    count[i] = pow(K//i,N,MOD)
    for j in range(i*2,K+1,i):
        count[i] -= count[j]
    count[i] %= MOD
ans = 0
for i in range(K+1):
    ans += i*count[i]
    ans %= MOD
print(ans)

Measured memory_bytes: 68772
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_148
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int a = ReadInt();
            int b = ReadInt();
            if (a != 1 && b != 1) WriteLine(1);
            if (a != 2 && b != 2) WriteLine(2);
            if (a != 3 && b != 3) WriteLine(3);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
#import<iostream>
main(){int n,a;std::cin>>n;a=0;int p[n];for(int i=0;i<n;i++)std::cin>>p[i];for(int i=1;i<n-1;i++)if((p[i-1]<p[i]&&p[i]<p[i+1])||(p[i-1]>p[i]&&p[i]>p[i+1]))a++;std::cout<<a;}


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

int main() {
    int a, b;
    std::cin >> a >> b;
    if(a > b) std::cout << "safe" << std::endl;
    else std::cout << "unsafe" << std::endl;
    
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const long long INF = 10000000000000;

int main() {
  int N;
  cin >> N;
  vector<dd> v(N);
  for(int i = 0;i<N;i++){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  dd a = (v[0]+v[1])/2;
  
  if(N>=3){
  for(int i = 2;i<N;i++){
    a = (a+v[i])/2;
   }
  }
  
  cout << fixed << setprecision(10);
  cout << a << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rev(a,b){return a>b}
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
using namespace std;
int arr[25];




int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    string str;
    cin>>str;
    string str2 = str;
    int n = str.length();
    int one=0;
    for(int i=1;i<n;i++)
    {
        if(str[i]==str[i-1])
        {
            if(str[i]=='0')str[i]='1';
            else str[i]='0';
            one++;
        }
    }
    int two=0;
    str = str2;
    for(int i=n-2;i>=0;i--)
    {
        if(str[i]==str[i+1])
        {
            if(str[i]=='0')str[i]='1';
            else str[i]='0';
            two++;
        }
    }
    cout<<min(one,two)<<endl;

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007
#define iP pair<int,int>
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define inf 1e15
#define mod1 998244353
#define pi 3.141592653589793238
int32_t main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);cout<<fixed;cerr.tie(NULL);cout.precision(20);
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes\n";
    else cout<<"No\n";
}

Measured memory_bytes: 256
#include<stdio.h>

//選択ソート(０オリジン)
int selectionSort(int A[], int N){
    int i,j,t,sw=0, minj;
    for (i = 0; i<N-1; i++){
        minj = i;
        for (j=i;j<N;j++){
            if(A[j]<A[minj]) minj=j;
        }
        t = A[i]; A[i]=A[minj]; A[minj]=t;
        if(i != minj) sw++;   
    }
    return sw;
}

int main(){
    int A[100], N , i, sw;
    scanf("%d", &N);
    for(i=0; i<N; i++) scanf("%d", &A[i]);
    sw=selectionSort(A, N);
    for (i=0;i<N;i++){
        if(i>0) printf(" ");
        printf("%d", A[i]);
        }
        printf("\n");
        printf("%d\n", sw);
        return 0;
    
}


Measured memory_bytes: 2696
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
int a[100100],b[100100];
bool cmp(int a,int b)
{
 return a>b;
}
int main()
{
  int n;
  cin>>n;
  int k=0,c=0;
  memset(b,0,sizeof(b));
  for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]!=i)
            k++;
    }


        for(int i=1;i<=n;i++)
        {
           if(a[i]==i)
           {
               int t;
               t=a[i];
               a[i]=a[i+1];
               a[i+1]=t;
               c++;
           }
        }
          if(k==n)
       {
            cout<<'0'<<endl;
       }
    else
        cout<<c<<endl;

}


Measured memory_bytes: 1024