akhauriyash/Code-Regression huggingface dataset:
#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 n;
ll sum[100010];
ll ans;
int a[100010];
int q;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n;
    rep(i,1,n+1){
    	cin>>a[i];
    	sum[a[i]]++;
    	ans+=a[i];
	}
	cin>>q;
	while(q--){
		int x,y;
		cin>>x>>y;
		ans-=1ll*x*sum[x];
		ans+=sum[x]*1ll*y;
		sum[y]+=sum[x];
		sum[x]=0;
		cout<<ans<<endl;
	}
    return 0;
}



Measured memory_bytes: 4696
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>

using namespace std;

int h,w;
int fie[501][501];
int sum[501][501];
int main(void){
	while(1){
		scanf("%d%d",&h,&w);
		if(h==0)break;
		memset(fie,0,sizeof(fie));
		memset(sum,0,sizeof(sum));
		for(int i=1;i<=h;i++){
			string s;
			cin >> s;
			for(int j=1;j<=w;j++){
				if(s[j-1]=='*')fie[j][i]=1;
			}
		}
		for(int i=0;i<=h;i++){
			for(int j=1;j<=w;j++)sum[j][i]=sum[j-1][i]+fie[j][i];
		}
		for(int i=0;i<=w;i++){
			for(int j=1;j<=h;j++)sum[i][j]+=sum[i][j-1];
		}
		int res=0;
		for(int i=0;i<w;i++){
			for(int j=i+1;j<=w;j++){
				int l=0,r=0;
				while(r<h){
					r++;
					while(sum[j][r]-sum[j][l]-sum[i][r]+sum[i][l]!=0)l++;
					res=max(res,(j-i)*(r-l));
				}
			}
		}
		printf("%d\n",res);
	}
	return 0;
}

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

template<class T, class U>
bool contain(const std::basic_string<T>& s, const U& v)
{
	return s.find(v) != std::basic_string<T>::npos;
}

int  main()
{
	int h, w;
	cin >> h >> w;
	string s[h];
	rep(i, h)
		cin >> s[i];
	
	vector<int> d;
	rep(i, h)
	{
		rep(j, w)
		{
			if(s[i][j] == '.')
				d.push_back(j);
		}
	}

	for (int i = 0; i < h; i++)
	{
		if(contain(s[i], "#"))
		{
			for(int j = 0; j < w; j++)
			{
				if (count(d.begin(), d.end(), j) != h)
					cout << s[i][j];
			}
			cout << endl ;
		}
	}
	return (0);
}


Measured memory_bytes: 384
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//234
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++) {
		if(i&1) {
			if(s[i]=='R'){
				cout<<"No";
				return;
			}
		} else {
			if(s[i]=='L') {
				cout<<"No";
				return;	
			}
		}
	}
	cout<<"Yes";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3632
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
/*---------------------------------------*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, y; cin >> n >> y;
  y /= 1000;

  REP(i, n+1) {
    REP(j, n+1-i) {
      if (y-i*10-j*5 == n-i-j){
        cout << i << " " << j << " " << n-i-j << "\n";
        return 0;
      }
    }
  }
  cout << "-1 -1 -1\n";
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<tuple<string, int, int>> p(N);
  string a;
  int b;
  for (int i=0; i<N; i++) {
    cin >> a >> b;
    p.at(i) = make_tuple(a,-1*b,i+1);
  }
  
  sort(p.begin(), p.end());
  
  int c;
  for (int i=0; i<N; i++) {
    tie(ignore, ignore ,c) = p.at(i);
    cout << c << endl;
  }
}


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

int main(){
	int n, k; cin>>n>>k;
	int arr[k];
	int fin = n;
	for(int i = 0; i < k; i++) cin>>arr[i];

	for(int i = n; ; i++){
		bool f = 1;
		int fun_no = i;
		while(fun_no){
			int numb = fun_no % 10;
			//cout<<numb<<' ';
				for (auto j : arr){
						if(j == numb){
							f = 0;
							break;
							}
					}

				//if(f) break;
				fun_no /= 10;
			}

		if(f){
			fin = i;
			break;
			};

		}
	cout<<fin;
	return 0;
	}


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


int main(void){
  int input;
  int a,b,c,d;
  std::cin >> input;
  a = input/1000;
  b = (input%1000)/100;
  c = (input%100)/10;
  d = (input%10);

  if(a+b+c+d == 7){
    std::cout << a << "+" << b << "+" << c << "+" << d << "=7" << std::endl;
  }else if(a+b+c-d == 7){
    std::cout << a << "+" << b << "+" << c << "-" << d << "=7" << std::endl;
  }else if(a+b-c+d == 7){
    std::cout << a << "+" << b << "-" << c << "+" << d << "=7" << std::endl;
  }else if(a-b+c+d == 7){
    std::cout << a << "-" << b << "+" << c << "+" << d << "=7" << std::endl;
  }else if(a+b-c-d == 7){
    std::cout << a << "+" << b << "-" << c << "-" << d << "=7" << std::endl;
  }else if(a-b+c-d == 7){
    std::cout << a << "-" << b << "+" << c << "-" << d << "=7" << std::endl;
  }else if(a-b-c+d == 7){
    std::cout << a << "-" << b << "-" << c << "+" << d << "=7" << std::endl;
  }else if(a-b-c-d == 7){
    std::cout << a << "-" << b << "-" << c << "-" << d << "=7" << std::endl;
  }
  return 0;
}




Measured memory_bytes: 256
open Scanf
open Printf

let s = sscanf (read_line ()) "%s" (fun x -> x);;
let ans = ref 0;;
String.iteri (fun i c ->
  if (i mod 2 = 0) then
    if (c = '0') then ans := !ans + 1 else ()
  else
    if (c = '1') then ans := !ans + 1 else ()
) s;;
printf "%d\n" (min !ans ((String.length s) - !ans))


Measured memory_bytes: 2816
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
#define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        2e18
 #define sm         -1e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
   
    #endif
}



int a[55],b[55],c[55],d[100001],n,m,q,an=-1;


void recur(int cur,int rm,vii vc)
{
  if(cur>m && rm!=0) return ;
  if(rm==0)
  {
    int cur=0;
    
    
    forf(j,0,q)
    {
      int f = a[j]-1 ,s = b[j]-1 ;
     if(vc[s]-vc[f]==c[j]) cur+=d[j];
    }

    an = max(an,cur);
    return ;
  }
  recur(cur+1,rm,vc);
  vc.pb(cur);
  recur(cur+1,rm-1,vc);
  recur(cur,rm-1,vc);
}

void solve()
{
  
  
  cin >> n >> m >> q;

  forf(i,0,q)
  {
    cin >> a[i] >> b[i] >> c[i] >> d[i];

  }
 vii emp;
 recur(1,n,emp);
 cout<<an<<endl;

}

int32_t main()
{
  pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    // cout << "Time taken by function: "
    //      << duration.count() << " microseconds" << endl; 

 }


Measured memory_bytes: 3648
//--------------------------------------------------
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,fma")
#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Ofast")
//--------------------------------------------------
#include <bits/stdc++.h>
#include <chrono>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
#include <iomanip>
#include <numeric>
#include <time.h>
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <stack>
#include <cstring>
//--------------------------------------------------
#define forn(i, n) for(int i = 0; i < n; i++)
#define forw(i, n) for(int i = n-1; i >= 0; --i)
#define forns(i, n, s) for(int i = s; i < n; i++)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
//----------------------------------------------------
using namespace std;
//----------------------------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef vector<ll> lnum;
typedef complex<ld> comp;
//----------------------------------------------------
const ll mod = 1e9 + 7, mod2 = 998244353;
const ld eps = 1e-6;
const ll inf = 1e18;
const int base = 1e9;
const ld PI = 3.1415926;
//----------------------------------------------------
#define endl '\n';
#ifdef MY_DEBUG
void deb(ld x) { cerr << x << endl; };
#else
void deb(ld x){};
#endif
//----------------------------------------------------
ll n, m, k;
ll fact[2*100*1000+1];
ll res = 0;
//----------------------------------------------------
unsigned int bitcount(ull val) { return __builtin_popcount(val) + __builtin_popcount(val >> 32); }

void local() {
    freopen("test.in", "r", stdin);
}

void remote() {
}

void read() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> m >> k;
}

ll binpow(ll val, ll deg){
    ll res = 1;
    while(deg > 0){
        if(deg & 1) res *= val, res %= mod2;
        val *= val, val %= mod2;
        deg >>= 1;
    }
    return res;
}

ll binomial(ll n, ll k){
    return k > n ? 0 : (((fact[n] * binpow(fact[k], mod2-2))% mod2) * binpow(fact[n-k], mod2-2)) % mod2;
}

int main() {
#ifdef MY_DEBUG
    local();
#else
    remote();
#endif
    read();

    fact[0] = 1;
    forns(i, n+1, 1) fact[i] = (fact[i-1] * i) % mod2;

    forn(kk, k+1){
        //Раскрашиваем n-kk блоков
        ll mul = (m * binpow((m-1), n-1-kk)) % mod2, ways = 1;
        if(kk > 0){
            //Пытаемся разбить на kk пар
            ways *= binomial(n-1, kk), ways %= mod2;
        }
        res += (mul * ways) % mod2, res %= mod2;
    }

    cout << res << endl;

}

Measured memory_bytes: 5168
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		long div = 1000000007;
		int n = s.length();
		int[] a = new int[n];
		boolean[] b = new boolean[n];
		int[] c = new int[n];
		int[] q = new int[n];
		char ch = s.charAt(0);
		if(ch=='A') a[0]++;
		else if(ch=='B') b[0] = true;
		else if(ch=='C') c[0]++;
		else q[0]++;
		for(int i=1;i<n;i++) {
			ch = s.charAt(i);
			a[i] = a[i-1];
			c[i] = c[i-1];
			q[i] = q[i-1];
			if(ch=='A') a[i]++;
			else if(ch=='B') b[i] = true;
			else if(ch=='C') c[i]++;
			else {
				b[i] = true;
				q[i]++;
			}
		}
		long[] threePow = new long[n];
		threePow[0] = 0;
		threePow[1] = 1;
		for(int i=2;i<n;i++) {
			threePow[i] = (threePow[i-1]*3)%div;
		}
		
		long ans = 0;
		for(int i=1;i<n-1;i++) {
			if(b[i]) {
				ans += (((threePow[q[i-1]+1]*a[i-1]%div+threePow[q[i-1]]*q[i-1]%div)%div) * (threePow[q[n-1]-q[i]+1]*(c[n-1]-c[i])%div+threePow[q[n-1]-q[i]]*(q[n-1]-q[i])%div)%div)%div;
			}
			if(ans>=div) ans %= div;
		}
		
		System.out.println(ans);
		in.close();
	}

}

Measured memory_bytes: 26128
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<double> a(n);
    double avg;
    rep(i,0,n) {
        cin>>a[i];
        avg+=a[i];
    }
    avg/=n;
    
    double now=10000;
    int ans=0;
    rep(i,0,n){
        if(abs(a[i]-avg)<now){
            now=abs(a[i]-avg);
            ans=i;
        }
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N, Q = [int(x) for x in input().split()]
S = input()

t = [0] * N
a = [0] * N

for i in range(N - 1):
    if S[i] == 'A' and S[i + 1] == 'C':
        t[i] = 1

a[0] = 0
for i in range(N - 1):
    a[i + 1] = a[i] + t[i]

for q in range(Q):
    l, r = [int(x) for x in input().split()]
    print(a[r - 1] - a[l - 1])



Measured memory_bytes: 10052
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;

ll a[123456];
signed main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	ll n; cin >> n;
	vector<ll> xs;
	rep(i, n) {
		cin >> a[i]; xs.push_back(a[i]);
	}
	sort(all(xs));
	xs.erase(unique(all(xs)), xs.end());
	ll x = xs.size();
	if (x >= 3) { cout << "No\n"; return 0; }
	if (x == 1) {
		if (xs[0] == n - 1) { cout << "Yes\n"; return 0; }
		if (xs[0] <= n / 2) { cout << "Yes\n"; return 0; }
		cout << "No\n";
	}
	if (x == 2) {
		if (xs[1] - xs[0] >= 2) { cout << "No\n"; return 0; }
		ll v = 0, w = 0;
		rep(i, n) {
			if (a[i] == xs[0]) { v++; }
			else { w++; }
		}
		if (xs[1] > v && (xs[1] - v) * 2 <= w) { cout << "Yes\n"; }
		else { cout << "No\n"; }
	}
	cin >> n;
	return 0;
}

Measured memory_bytes: 5032
#include <bits/stdc++.h>
using namespace std;
int sti(string s){
    stringstream rohit(s);
    int x=0; rohit>>x;
    return x;
}
int sti(char s){
    int x=(int)s-48;
    return x;
}
bool iseven(int t){
    if(t%2==0)
        return true;
    else
        return false;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s; cin>>s;
    if(s[2]==s[3] && s[4]==s[5])
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 998244353
#define MAX 400000
using namespace std;
ll N,A,B,K;
ll fact[MAX]={0};
ll powMod(ll x,ll n){
ll r=1;
while(n){
    if(n&1)r = (r*x)%MOD;
    x = (x*x)%MOD;
    n = (n>>1);
}
return r;
}

void init(){
ll i,j;
fact[0]=1;
for(i=1;i<MAX;++i){
    fact[i] = (i*fact[i-1])%MOD;
}
}
ll C(ll n, ll r){
if(n<0||r>n||r<0)
    return 0 ;
ll an = fact[n];
an = (an*powMod(fact[r],MOD-2))%MOD;
an = (an*powMod(fact[n-r],MOD-2))%MOD;
return an;
}

ll solve(ll n,ll m){
return (C(N,n)*C(N,m))%MOD;
}

int main()
{
    init();
    cin>>N>>A>>B>>K;
    ll t,i,j,k,x1,x2;
    ll ans=0;
    for(i=0;i<=N;++i){
        if((i*A)%B == K%B){
            x1=i;
            x2 = K-i*A;
            x2 = x2/B;
            if(x2>=0&&x2<=N){
                ans = (ans + solve(x1,x2))%MOD;
            }
        }
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	ll dp[100][3]={};
	ll N;
	cin>>N;
	dp[64][0]=1;
	dp[64][1]=0;
	dp[64][2]=0;
	for(int i=63;i>=0;i--){
		if((N>>i)&1){
			dp[i][0]=(dp[i+1][0])%MOD;
			dp[i][1]=(dp[i+1][0]+dp[i+1][1])%MOD;
			dp[i][2]=(3*dp[i+1][2]+2*dp[i+1][1])%MOD;

		}
		else{
			dp[i][0]=(dp[i+1][0]+dp[i+1][1])%MOD;
			dp[i][1]=(dp[i+1][1])%MOD;
			dp[i][2]=(3*dp[i+1][2]+dp[i+1][1])%MOD;
		}
	}
	cout<<(dp[0][0]+dp[0][1]+dp[0][2])%MOD<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 100000007

#define writeln(n) cout<<n<<endl

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

const int inf=100000000;

long long modpow(long long a, long long n, long long mod) //a^n
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

llong gcd(llong a, llong b) {
    return b != 0 ? gcd(b, a % b) : a;
}
//setprecision(10);



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<int> a(n,0);
    REP(i,n) cin>>a[i];
    double cnt=0;
    REP(i,n)
    {
        cnt+=(double)1/a[i];
    }

    cout<<(double)1/cnt<<endl;
    return  0;
}


Measured memory_bytes: 256
N = int(input())
ans = 0
for i in range(1,N+1):
    yakusu_count = 0
    if(i%2 == 1):
        for j in range(1,i+1):
            if(i%j == 0):
                yakusu_count += 1
        if(yakusu_count == 8):
            ans += 1
print(ans)

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;
 
public class Main{
	public static String toBin(long A) {
		String S = "";
		while(A != 0){
			long amari = A%2;
			S = String.valueOf(amari) + S;
			A = A/2;
		}
		for(int i = S.length(); i < 40; i++){
			S = "0" + S;
		} 
		return S;
	}
    
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		String[] A = new String[N];
		String xor = "0000000000000000000000000000000000000000";
		for(int i = 0; i < N; i++){
			long moto = s.nextLong();
			A[i] = toBin(moto);
			String exam = "";
			for(int j = 0; j < 40; j++){
				if(xor.charAt(j) == A[i].charAt(j)){
					exam = exam+"0";
				}else{
					exam = exam+"1";
				}
			}
			xor = exam;
		}

		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < N; i++){
			String result = "";
			for(int j = 0; j < 40; j++){
				if(xor.charAt(j) == A[i].charAt(j)){
					result = result+"0";
				}else{
					result = result+"1";
				}
			}
			sb.append(Long.parseLong(result, 2) + " ");
		}
		System.out.println(sb.toString());
	}
} 

Measured memory_bytes: 83144
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please

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

	int N;
	cin >> N;
	int x[100], y[100], h[100];
	rep(i, N) {
		cin >> x[i] >> y[i] >> h[i];
	}

	rep(i, 101) {
		rep(ii, 101) {
			int takasa = 0;
			int dame = 0;

			rep(iii, N) {
				if (h[iii] > 0) {
					if (takasa == 0) {
						takasa = abs(i - x[iii]) + abs(ii - y[iii]) + h[iii];
					}
					else if (takasa != abs(i - x[iii]) + abs(ii - y[iii]) + h[iii]) {
						dame = 1;
						break;
					}
				}
			}
			rep(iii, N) {
				if (h[iii] == 0) {
					if (takasa - abs(i - x[iii]) - abs(ii - y[iii]) > 0) {
						dame = 1;
						break;
					}
				}
			}

			if (dame == 0) {
				cosp(i);
				cosp(ii);
				co(takasa);
				return 0;
			}
		}
	}

	Would you please return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

long long ru(int a,int b){
		long long r=1;
		for(int i=0;i<b;i++)r=r*a;
		return r;
}

int main(){
		int n,i,a[100],m=0;
		long long ans;
		scanf("%d",&n);
		for(i=0;i<n;i++)scanf("%d",&a[i]);
		for(i=0;i<n;i++){
				if(a[i]%2==0)m++;
		}
		ans=ru(3,n)-ru(2,m);
		printf("%lld\n",ans);
		return 0;
}


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

int main() {
  int n;
  cin >> n;
  if(n%10==0 || n%10==1 || n%10==6 || n%10==8){
    cout << "pon" << endl;  
    return 0;
  }
  if(n%10==3){
    cout << "bon" << endl; 
    return 0;
  }
    cout << "hon" << endl;  
}

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

import sys
from math import sqrt

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()

# for i in range(N, 0, -1):
#     print(i, N//i, N%i)

# 0除算対策
if N==1:
    print(0)
    exit()

m=N
ans=set()
while m>=sqrt(N):
    i=N//m
    j=N%m
    if (i-j)%i==0 and N//m==N//(m-1):
        ans.add(m-1)
    m=N//(i+1)

for m in range(1, int(sqrt(N))+1):
    if N//m==N%m:
        ans.add(m)

print(sum(ans))


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

int main(){
    ll N;
    cin>>N;
    ll res=0;
    rep(i,N){
        int total=0;
        rep(x,i){
            if(i<x*x)break;
            rep(y,i){
                if(i<x*x+y*y+x*y)break;
                rep(z,i){
                    if(i<x*x+y*y+z*z+x*y+y*z+z*x)break;
                    if(i==x*x+y*y+z*z+x*y+y*z+z*x){
                        total++;
                    }
                }
            }
        }
        cout<<total<<endl;
    }
    return 0;
}

Measured memory_bytes: 3544
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);

str s,t;
int a,b;
vec<vec<int>> nxt, pos;

int main(){
    fast;
    cin>>s>>t;
    a = s.size();
    b = t.size();
    nxt = vec<vec<int>>(a, vec<int>(26, -1));
    pos = vec<vec<int>>(26, vec<int>());
    for(int q=0; q<a; q++) pos[s[q]-'a'].pb(q);
    for(int q=0; q<a; q++){
        for(int w=0; w<26; w++){
            if(pos[w].size()==0) continue;
            auto it = upper_bound(pos[w].begin(), pos[w].end(), q);
            if(it==pos[w].end()) it = pos[w].begin();
            int p = *it;
            nxt[q][w] = p;
        }
    }
    ll  o =0, ps = a-1, fl=1;
    for(int q=0; q<b; q++){
        char c  =t[q];
        if(nxt[ps][c-'a']==-1){
            fl = 0;
            break;
        }
        int u = nxt[ps][c-'a'];
        if(u==ps) o+=a;
        else if(u>ps) o+=u-ps;
        else o+=(u+1)+(a-ps-1);
        ps = u;
    }
    if(fl) cout<<o;
    else cout<<-1;
}

Measured memory_bytes: 14416
#include <stdio.h>
#include <string.h>
int main()
{
    int max,min;
    int i,j,k;
    unsigned long long int a,b;
    int tmp;
    scanf("%lu %lu",&a,&b);
    if(b > a) {
        int tmp = a; a = b; b = tmp;
    }
    while(1) {
        if (a % b == 0) break;
        tmp = a;
        a = b;
        b = tmp % b;
    }
    printf("%d\n",b);
    return 0;
}

Measured memory_bytes: 596
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] x = new int[3];
    for(int i = 0; i < 3; i++) {
      x[i] = sc.nextInt();
    }
    int count5 = 0;
    int count7 = 0;
    for(int i = 0; i < 3; i++) {
      if(x[i] == 5) {
        count5++;
      }
      if(x[i] == 7) {
        count7++;
      }
    }
    String ans = "NO";
    if((count5 == 2) && (count7 == 1)) ans = "YES";
    System.out.println(ans);
  }
}

Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	ll a, b, c;
	cin >> a >> b >> c;
	
	ll x = c - a - b;
	
	if( a + b < c && x * x > 4 * a * b ) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = INT64_MAX;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

void solve() {
    str S;
    ll N;
    cin >> N;
    cin >> S;
    set<char> s;
    REP(i, S.size()) {
        s.insert(S[i]);
    }
    ll ans = 1;
    for(auto &x:s) {
        ans *= (1 + count(WHOLE(S), x));
        ans %= MOD;
    }
    out(ans - 1);
}

int main() {
    fast_io;
    solve();
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct edge{ int from, to;};

int main(){
    int n, m;//ノードの個数
    cin >> n >> m;
    bool s[n]={}, t[n]={};
    for(int i=0;i<m;i++){
        int a, b;
        cin >> a >> b;
        if(a==1) s[b]=true;
        if(b==n) t[a]=true;

    }
    for(int i=0;i<n;i++){
        if(s[i]==true && t[i]==true){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,(n))


class CSameIntegers {
public:
	void solve(std::istream& in, std::ostream& out) {
    vector<int> abc(3);
    REP(i,3) in >> abc[i];
    int cnt = 0;
    while(abc[0] != abc[1] || abc[0] != abc[2] || abc[1] != abc[2]){
      sort(abc.begin(),abc.end());
      int tmp = abc[2] - abc[1];
      if(tmp > 0) {
        cnt += tmp;
        abc[1] += tmp;
        abc[0] += tmp;
      }
      else{
        cnt += ceil((abc[2] - abc[0]) / 2.0);
        abc[0] += ceil((abc[2] - abc[0]) / 2.0) * 2;
      }
    }
    out << cnt << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	CSameIntegers solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3648
// abc127_b
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(int argc, char *argv[])
{
  int r,d,x,ans;
  cin>>r>>d>>x;
  rep(i,10){
    ans=r*x-d;
    cout<<ans<<endl;
    x=ans;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <sstream>
#include <limits>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <cctype>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <map>
#include <set>
#define PI (acos(-1.0))
#define Abs(a) (((a)<0) ? (-(a)) :(a) )
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define Rep(i,n) for(int i=0;i<(n);i++)
#define Rrep(i,n) for(int i=((n)-1);i>=0;i--)
#define rrep(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define Pii pair<int,int>
#define PB push_back
#define Size(x) ((int)(x.size()))
using namespace std;
typedef long long mint;
typedef unsigned long long umint;
int main()
{
    //freopen("in.txt","r",stdin);
    int n, val;
    cin >> n;
    multiset<int, greater<int> >s;
    Rep(i, 3*n)
    {
        scanf("%d", &val);
        s.insert(val);
    }
    long long sm = 0;
    Rep(i,n)
    {
        s.erase(s.begin());
        s.erase(--s.end());
        sm += *s.begin();
        s.erase(s.begin());
    }
    cout << sm << endl;
    return 0;
}




Measured memory_bytes: 14336
#include  <iostream>
using namespace std;
int main() {
	int ans = 0;
	int flag = 1;
	int N;
	long long A[201];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (A[i] % 2 == 1) {
			cout << 0 << endl;
			flag = 0;
			return 0;
		}		
	}
	while (flag) {
		for (int j = 0; j < N; j++) {
			if (A[j] % 2 == 1) {
				flag = 0;
				break;
			}
			A[j] /= 2;
			if (j == N - 1)ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
using namespace std;
const int INF = 1 << 20;

int main()
{
	bool jud[128];
	int rail, stat, cost[128][128], time[128][128], start, goal, kind, route[128], exp[128], num;
	int wk, tk, kt, kr;
	while(cin >> rail >> stat)
	{
		if(!rail && !stat) break;
		for(int i = 0; i < stat; i++)
		{
			for(int j = 0; j < stat; j++)
			{
				cost[i][j] = INF;
				time[i][j] = INF;
			}
		}

		for(int i = 0; i < rail; i++)
		{
			cin >> wk >> tk >> kt >> kr;
			cost[wk-1][tk-1] = kt;
			cost[tk-1][wk-1] = kt;
			time[wk-1][tk-1] = kr;
			time[tk-1][wk-1] = kr;
		}

		cin >> num;

		for(int m = 0; m < num; m++)
		{
			for(int i = 0; i < stat; i++)
			{
				jud[i] = false;
				route[i] = INF;
				exp[i] = INF;
		
			}

			cin >> start >> goal >> kind;
			if(!kind)//min length
			{
				route[start - 1] = 0;
				while(1)
				{	
					int v = -1;
					for(int u = 0; u < stat; u++)
					{
						if(!jud[u] && (v == -1 || route[u] < route[v]) ) v = u;
					}

					if(v == -1) break;

					jud[v] = true;

					for(int u = 0; u < stat; u++)
					{
						route[u] = min(route[u], route[v] + cost[v][u]);
					}
				}

				cout << route[goal - 1] << endl;
			}
			else//min time
			{
				exp[start -1] = 0;
				while(1)
				{
					int v = -1;
					for(int u = 0; u < stat; u++)
					{
						if(!jud[u] && (v == -1 || exp[u] < exp[v]) ) v = u;
					}

					if(v == -1) break;

					jud[v] = true;

					for(int u = 0; u < stat; u++)
					{
						exp[u] = min(exp[u], exp[v] + time[v][u]);
					}
				}

				cout << exp[goal - 1] << endl;
			}
		}
	}
}

Measured memory_bytes: 1264
#include<bits/stdc++.h>
using namespace std;
int a[1000],b[1000],c[1000];
int main()
{
	int n;
	cin>>n;
	for (int i = 1; i <= n; ++i)
	{
		cin>>a[i];
	}
	for (int i = 1; i <= n; ++i)
	{
		cin>>b[i];
	}
	for (int i = 1; i <= n-1; ++i)
	{
		cin>>c[i];
	}
	int ans = b[a[1]];
	for(int j = 2; j <= n ;j++)
	{
		ans += b[a[j]];
		if(a[j] == a[j-1]+1)
		{
			ans+= c[a[j-1]];
		}
		
	}

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

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define pque(type) priority_queue<type,vector<type>,greater<type> >
 
int main(void){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	cout << (a.back() - a.front()) << endl;	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class A
{
	static void Main()
	{
		var ms = new int[int.Parse(Console.ReadLine())].Select(_ => Console.ReadLine().Split()).ToArray();
		var x = Console.ReadLine();

		Console.WriteLine(ms.SkipWhile(m => m[0] != x).Skip(1).Sum(m => int.Parse(m[1])));
	}
}


Measured memory_bytes: 13652
import bisect
n = int(input())
s = input()
rl = []
gl = []
bl = []
for i in range(n):
    if s[i] == "R": rl.append(i+1)
    elif s[i] == "G": gl.append(i+1)
    else: bl.append(i+1)

ans = len(rl)*len(gl)*len(bl)

for i in rl:
    for j in gl:
        lb = len(bl)
        if (i+j)%2==0:
            index = bisect.bisect_left(bl, (i+j)//2)
            if lb>index and bl[index] == ((i+j)//2):
                ans -= 1
        if i>j:
            index = bisect.bisect_left(bl, 2*i-j)
            if lb>index and bl[index] == (2*i-j):
                ans -= 1
            if 2*j-i>0:
                index = bisect.bisect_left(bl, 2*j-i)
                if lb>index and bl[index] == (2*j-i):
                    ans -= 1
        elif i<j:
            index = bisect.bisect_left(bl, 2*j-i)
            if lb>index and bl[index] == (2*j-i):
                ans -= 1
            if 2*i-j>0:
                index = bisect.bisect_left(bl, 2*i-j)
                if lb>index and bl[index] == (2*i-j):
                    ans -= 1

print(ans)

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

int main()
{
	string n;
	cin >> n;
	string ans;
	for (auto c : n) {
		if (c == '1') {
			c = '9';
		}
		else if (c == '9') {
			c = '1';
		}
		ans += c;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
#define INF             1000000000

//#define DEBUG

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;



int main()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, res = 0, num, mmax = 0;
	cin >> n;
	lp(i, n){
		cin >> num;
		res += num;
		mmax = max(mmax, num);
	}
	cout << ((res > 2*mmax) ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // ver1.8
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
#define PAI 3.14159265358979
using namespace std;

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

signed main() {
  cout << fixed << setprecision(14);
  int n,m;
  cin >> n >> m;
  int h=0,w=0;
  Vi hsa(n-1),wsa(m-1);
  int qw,er;
  
  cin >> qw;
  rep(i,0,n-1){
    er = qw;
    cin >> qw;
    hsa[i] = qw-er;
  }
  cin >> qw;
  rep(i,0,m-1){
    er = qw;
    cin >> qw;
    wsa[i] = qw-er;
  }
  
  repeq(i,1,n){
    h += (n-i)*(i*hsa[i-1]%MOD)%MOD;
    h %= MOD;
  }
  repeq(i,1,m){
    w += (m-i)*(i*wsa[i-1]%MOD)%MOD;
    w %= MOD;
  }
  
  cout << w*h%MOD << endl;
  
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


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

ll n;
queue<ll> q;
int main(){
    cin>>n;
    for(int i=1;i<=9;i++)q.push(i);
    ll t;
    for(int i=0;i<n;i++){
        t=q.front();
        q.pop();
        if(t%10!=0)q.push(10*t+(t%10)-1);
        q.push(10*t+(t%10));
        if(t%10!=9)q.push(10*t+(t%10)+1);
    }
    cout<<t<<endl;
    return 0;
}

Measured memory_bytes: 1792
# coding: utf-8

# https://atcoder.jp/contests/abc082/tasks/arc087_a
# 16:20-16:26 done


def main():
    N = int(input())
    a = list(map(int, input().split()))
    
    num_cnt = {}
    for num in a:
        if num in num_cnt:
            num_cnt[num] += 1
        else:
            num_cnt[num] = 1
    
    ans = 0
    for num, cnt in num_cnt.items():
        if cnt >= num:
            ans += cnt - num
        else:
            ans += cnt

    return ans


print(main())


Measured memory_bytes: 17784
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
const int maxn = 1e5 + 10;
typedef long long ll;
ll h[maxn];
ll maxh[maxn], sum[maxn];
ll n, t;
int main() {
    scanf("%lld%lld", &n, &t);
    for (int i = 1; i <= n; i++) scanf("%lld", &h[i]);
    maxh[0] = 0, sum[0] = 0;
    for (int i = 1; i <= n; i++) {
        maxh[i] = max(maxh[i-1], h[i]);
        sum[i] = sum[i-1] + h[i];
    }
    for (int i = 1; i <= n; i++) {
        if (t < sum[i]) printf("1\n");
        else printf("%lld\n", (ll)ceil((1.0*t+0.5-sum[i])/maxh[i])+1);
    }
    return 0;
}



Measured memory_bytes: 5572
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC100(void);
void ABC101(void);
void ABC102(void);
void ABC103(void);
void ABC104(void);
void ABC105(void);
void ABC106(void);
void ABC107(void);
void ABC108(void);
void ABC109(void);

int main(void){
    ABC100();
}

void ABC100(){
    int d,n;
    cin>>d>>n;
    if(n<100){
    if(d==0)cout<<n<<endl;
    if(d==1)cout<<n*100<<endl;
    if(d==2)cout<<n*10000<<endl;
    }
    if(n==100){
    if(d==0)cout<<101<<endl;
    if(d==1)cout<<101*100<<endl;
    if(d==2)cout<<101*10000<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using pci = pair<char, int>;
using vpci = vector<pci>;
#define out(S) cout<<(S)<<endl;
#define REP(i,b) for(size_t i=0;i<(b);i++)
#define rREP(i,b) for(int i=(b)-1;i>=0;i--)
#define FOR(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define Foreach(item,collection) for(auto item:collection)
#define mod(i) ((i) % (ll)(1e9 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9 + 5))))
#define Yes out("Yes")
#define No out("No")
#define NO out("NO")
#define YES out("YES")
#define INF 1e10;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define IfOut(condition,text) if((condition)){out(text);return 0;}
#define IfeOut(condition,itext,etext) if(condition){out(itext);return 0;}else{out(etext);return 0;}
#define Select(collection,condition,result) Foreach(i,collection){result+=condition;}
#define GetAuto(_N,vect) {cin>>_N;vect.resize(_N);REP(i,_N){cin>>vect[i];}}
#define beginend(vec) (vec).begin(),(vec).end()
#define pb(item) push_back(item)
#define removeAll(vec,deleg) auto itr=remove_if(beginend(vec),deleg);vec.erase(itr,vec.end());
void removeAt(string& s, int index) { s.erase(index, 1); }
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
ll manhattanDistance(ll x1, ll y1, ll x2, ll y2) { return (abs(x2 - x1) + abs(y2 - y1)); }
vector<ll> sieveOfEratosthenes(int max) {ll prime;double sqrtmax = sqrt(max);vector<ll> primeVec, searchVec;FOR(i, 2, max + 1) searchVec.push_back(i);do{prime = searchVec[0];primeVec.push_back(prime);auto itr = remove_if(beginend(searchVec), [=](ll x)->bool {return x%prime == 0; });searchVec.erase(itr, searchVec.end());} while (prime < sqrtmax);primeVec.reserve(primeVec.size() + searchVec.size());primeVec.insert(primeVec.end(), beginend(searchVec));return primeVec;}
bool isPrime(ll x) {if (x == 2) return true;if (x < 2 || x % 2 == 0) return false;ll i = 3;while (i <= sqrt(x)) {if (x%i == 0) return false;i += 2;}return true;}

ll convert(vi box) {
	ll rt = 0;
	Foreach(i, box) {
		rt = rt * 10 + i;
	}
	return rt;
}
string S;
int s, L;

void solve() {

	map<ll,int> calced;
	int cnt = 0;
	calced[stoll(S)] = 0;
	while (1) {
		vi box(L);
		REP(i, S.size()) box[i] = S[i] - '0';
		FOR(i, S.size(), L) box[i] = 0;
		sort(beginend(box));
		auto dmin = convert(box);
		reverse(beginend(box));
		auto dmax = convert(box);
		S = to_string(dmax - dmin);
		if (calced.count(dmax - dmin)) {
			cout << calced[dmax-dmin] << " " << dmax - dmin << " " <<cnt - calced[dmax - dmin] +1 << endl;
			break;
		}
		else {
			calced[dmax - dmin] = cnt+1;
		}
		cnt++;
	}
}

int main() {

	while (cin>>s>>L,(s||L))
	{
		S = to_string(s);
		solve();
	}
	return 0;
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int l, r, d;
    cin >> l >> r >> d;
    cout << (r/d-(l-1)/d) << endl;
    return 0;
}


Measured memory_bytes: 3560