akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define int ll
#define mp make_pair
#define pii pair<int,int>
#define pb push_back
#define r1 rt<<1
#define r2 rt<<1|1
#define fi first
#define se second
#define db double
#define ld long db
#define ri register int
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define rep2(i,a,b,c) for(ri i=(a);i<=(b);i+=(c))
#define REP(i,a,b) for(ri i=(a);i>=(b);--i)
#define REP2(i,a,b,c) for(ri i=(a);i>=(b);i-=(c))
using namespace std;

inline int read(){
	ri x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^'0'),c=getchar();
	return x*f;
}

const int N=2e5+5;
int a[N],s[N],n,ans,m;
inline int f(ri x){
	ri t=0,j=1;
	REP(i,n,1){
		while(j<=n&&a[i]+a[j]<x)++j;
		t+=n-j+1;
	}
	return t;
}
inline void calc(ri x){
	ri j=1;
	REP(i,n,1){
		while(j<=n&&a[i]+a[j]<x)++j;
		ans+=s[j]+a[i]*(n-j+1);
	}
}

signed main()
{
	n=read();m=read();
	rep(i,1,n)a[i]=read();
	sort(a+1,a+n+1);
	REP(i,n,1)s[i]=s[i+1]+a[i];
	ri l=0,r=2e5,res=0;
	while(l<=r){
		ri mid=(l+r)>>1;
		if(f(mid)>=m)res=mid,l=mid+1;
		else r=mid-1;
	}
	calc(res);
	ans-=(f(res)-m)*res;
	cout<<ans;
	return 0; 
}

Measured memory_bytes: 1792
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		int c = 0;
		// 文字列の入力
		int[] d = new int[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
		} 
		for(int i = b; i < a; i++){
			if(d[i] > d[i - b]){
				System.out.println("Yes");
			}
			else{
				System.out.println("No");
			}
		}
		
	}
}

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

int main(){
long long A,B,C;
cin >> A >> B >> C;
if(C<=A){
    cout <<A-C << ' ' << B << endl;
}else if(C<=A+B){
    cout << 0 << ' '<< B-(C-A) << endl;
}else{
    cout << 0 << ' '<< 0 << endl;
}
}

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


Measured memory_bytes: 2060
#include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
#define INF 2000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M;
  cin >> N >> M;
  vector<ll> factor;
  for (ll i = 1; i * i <= M; ++i) {
    if (M % i == 0) {
      factor.push_back(i);
      factor.push_back(M / i);
    }
  }
  ll ans = 1;
  for (ll i = 0; i < factor.size(); ++i) {
    if (M / factor.at(i) >= N) {
      ans = max(ans, factor.at(i));
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 3632
package main

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

const (
	BUFSIZE   = 10000000
	MOD       = 1000000007
	INF_INT   = math.MaxInt32
	INF_INT64 = math.MaxInt64
)

var rdr = bufio.NewReaderSize(os.Stdin, BUFSIZE)

func main() {
	solve()
}

func solve() {
	X := ReadInt()
	for i := X; ; i++ {
		if isPrime(i) {
			fmt.Println(i)
			return
		}
	}
}

func isPrime(num int) bool {
	if num%2 == 0 && num != 2 {
		return false
	}
	for i := 3; i*i < num; i += 2 {
		if num%i == 0 {
			return false
		}
	}
	return true
}

func ReadLineInt64() []int64 {
	buf := make([]byte, 0, BUFSIZE)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			fmt.Println(e.Error())
			panic(e)
		}

		buf = append(buf, l...)

		if !p {
			break
		}
	}
	str := strings.Split(string(buf), " ")
	l := len(str)

	ret := make([]int64, l)

	for i, s := range str {
		ret[i] = s2i64(s)
	}
	return ret
}

func ReadLineInt() []int {
	values := ReadLineInt64()
	ret := make([]int, len(values))
	for i, v := range values {
		ret[i] = int(v)
	}
	return ret
}

func ReadInt() int {
	v := ReadLineInt()
	return v[0]
}
func ReadInt2() (int, int) {
	v := ReadLineInt()
	return v[0], v[1]
}
func ReadInt3() (int, int, int) {
	v := ReadLineInt()
	return v[0], v[1], v[2]
}
func ReadInt4() (int, int, int, int) {
	v := ReadLineInt()
	return v[0], v[1], v[2], v[3]
}

func ReadInt64() int64 {
	v := ReadLineInt64()
	return v[0]
}
func ReadInt64_2() (int64, int64) {
	v := ReadLineInt64()
	return v[0], v[1]
}
func ReadInt64_3() (int64, int64, int64) {
	v := ReadLineInt64()
	return v[0], v[1], v[2]
}
func ReadInt64_4() (int64, int64, int64, int64) {
	v := ReadLineInt64()
	return v[0], v[1], v[2], v[3]
}

func s2i64(s string) int64 {
	v, ok := strconv.ParseInt(s, 10, 64)
	if ok != nil {
		panic("Faild : " + s + " can't convert to int64")
	}
	return v
}

// For int64
func Bool2Int64(b bool) int64 {
	if b {
		return 1
	} else {
		return 0
	}
}

func Abs64(v int64) int64 {
	if v < 0 {
		return -v
	}
	return v
}

func Min64(a, b int64) int64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func Max64(a, b int64) int64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func Distance64(a, b int64) int64 {
	return Abs64(a - b)
}

// For int
func Bool2Int(b bool) int {
	if b {
		return 1
	} else {
		return 0
	}
}

func Abs(v int) int {
	if v < 0 {
		return -v
	}
	return v
}

func Min(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func Max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func Distance(a, b int) int {
	return Abs(a - b)
}


Measured memory_bytes: 3328
A, B, K = map(int, raw_input().split())

#print A, B, K

array = []

for i in range(K):
    if i <= (B - A):
        array.append(A + i)
        array.append(B - i)

array_uniq = list(set(array))
array_uniq.sort()

for i in array_uniq:
    print i


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

int main()
{
  while(true){
    int n;
    cin>>n;

    if(n==0)
    break;

    int len[40];
    for(int i=0;i<n;i++){
      string w;
      cin>>w;
      len[i]=w.size();
    }
    for(int i=0;i<n;i++){
      bool flg =false;
      int sta =0;
      int sum =0;

      for(int j=i;j<n;j++){
        sum+=len[j];
        if(sum==5||sum==12||sum==17||sum==24||sum==31){
          sta++;
        }
        if(sta==5){
          flg=true;
          break;
        }
        else if(sum>=31){
          break;
        }
      }
      if(flg){
        cout<<i+1<<endl;
        break;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3216
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

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

	LL s,c;
	cin >> s >> c;
	if(s * 2 >= c) cout << c/2 << endl;
	else{
		c -= s*2;
		cout << s + c/4 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("bug bug");
#define nl puts("");
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef pair<int,int> pii;
typedef pair<int,pii > tii;
#define mp make_pair
#define pb push_back
#define mx 200005

int main(){
    int k,x; cin>>k>>x;
    for(int i=x-k+1;i<x;i++){
        cout<<i<<" ";
    }
    cout<<x;
    for(int i=x+1;i<x+k;i++){
        cout<<" "<<i;
    }


  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

int main(void) {
	string A, B;
	cin >> A >> B;

	if (A.size() > B.size()) {
		cout << "GREATER" << endl;
		return 0;
	}
	else if (A.size() < B.size()) {
		cout << "LESS" << endl;
		return 0;
	}

	for (int i = 0; i < A.size(); i++)
	{
		if (A[i] > B[i]) {
			cout << "GREATER" << endl;
			return 0;
		}
		else if (A[i] < B[i]) {
			cout << "LESS" << endl;
			return 0;
		}
	}

	cout << "EQUAL" << endl;
	return 0;
}

Measured memory_bytes: 256
import datetime

h1, m1, h2, m2, k = map(int, input().split())

dt1 = datetime.datetime.strptime(str(h1) + ':' + str(m1) + ':00', '%H:%M:%S')
dt2 = datetime.datetime.strptime(str(h2) + ':' + str(m2) + ':00', '%H:%M:%S')

se = (dt2 - dt1).seconds
mi = se / 60 - k
print(str(int(mi)))


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

long n,q;
long mn[300010];
long k=0,v=1;

void add(long i, long x){
  i += v;
  //cout<<"v:"<<v<<endl;
  mn[i] += x;
//  cout<<"mn["<<i<<"]:"<<mn[i]<<endl;
  i /= 2;
  while(i>0){
    int l=mn[i*2];
    int r=mn[i*2+1];
    mn[i]=l+r;
  //  cout<<"mn["<<i<<"]:"<<mn[i]<<endl;
    i /= 2;
  }
}

long getSum(long x,long y,long bottom=0,long top= v,long node=1){
//  cout<<"x:"<<x<<" y:"<<y<<" bottom:"<<bottom<<" top"<<top<<" node:"<<node<<endl;
  if(x<=bottom && top<=y) return mn[node];
  if(top<=x || y<=bottom) return 0;

  long mid = (bottom+top)/2;
  long lmx=getSum(x,y,bottom,mid,node*2);
  long rmx=getSum(x,y,mid,top,node*2+1);
  return lmx+rmx;
}


int main(){
  cin>>n>>q;
  while(n>=v){
    v *=2;
    k+=1;
  }
  for(int i=0;i<300010;i++){
   mn[i]=0;
  }
  long com,x,y;
  for(int i=0;i<q;i++){
    cin>>com>>x>>y;
    if(com==0){
      add(x,y);
    }else if(com==1){
      cout<<getSum(x,y+1)<<endl;
    }
  }
  return 0;
}

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

int main(){ 
    Int N, K, ans;
    cin >> N >> K;

    vector<Int> A(N);
    rep(i,N) {
        cin >> A[i];
        A[i]--;
    }

    vector<Int> trace(200010);
    trace[0] = 0;

    set<Int> S;
    set<Int>::iterator ite;;
    S.insert(0);

    Int junkan, fst = -1, scnd = -1, period, res;

    rep(i,200010) {
        trace[i+1] = A[trace[i]];
        ite = S.find(trace[i+1]);
        if (!(ite == S.end())) {
            junkan = trace[i+1];
            scnd = i+1;
            break;
        }
        S.insert(trace[i+1]);
    }

    rep(i,scnd) {
        if (trace[i] == junkan) {
            fst = i;
            break;
        }
    }

    if (fst == -1 || scnd == -1) ans = -1;

    if (K <= fst) ans = trace[K] + 1;
    else {
        period = scnd - fst;
        res = (K - fst) % period;

        ans = trace[res + fst] + 1;
    }

    cout << ans << endl;
}

Measured memory_bytes: 15508
import numpy as np

n = int(input())
ppp = list(map(float, input().split()))
dp = np.array([0.0] * (n + 1), dtype=np.float64)
dp[0] = 1
for p in ppp:
    ndp = dp * (1 - p)
    ndp[1:] += dp[:-1] * p
    dp = ndp
print(sum(dp[n // 2 + 1:]))


Measured memory_bytes: 14540
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


const long long INF = 1e12;

void solve() {
    int A, B, Q; cin >> A >> B >> Q;
    vector<long long> s(A);
    vector<long long> t(B);

    for (int i = 0; i < A; i++) cin >> s[i];
    for (int i = 0; i < B; i++) cin >> t[i];

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());

    for (int q = 0; q < Q; q++) {
        long long x; cin >> x;

        long long s_right, s_left, t_right, t_left;

        if (lower_bound(s.begin(), s.end(), x) == s.end()) {
            s_left = *(lower_bound(s.begin(), s.end(), x) - 1);
            s_right = INF;
        }
        else if (lower_bound(s.begin(), s.end(), x) == s.begin()) {
            s_left = -INF;
            s_right = *lower_bound(s.begin(), s.end(), x);
        } else {
            s_left = *(lower_bound(s.begin(), s.end(), x) - 1);
            s_right = *lower_bound(s.begin(), s.end(), x);
        }

        if (lower_bound(t.begin(), t.end(), x) == t.end()) {
            t_left = *(lower_bound(t.begin(), t.end(), x) - 1);
            t_right = INF;
        }
        else if (lower_bound(t.begin(), t.end(), x) == t.begin()) {
            t_left = -INF;
            t_right = *lower_bound(t.begin(), t.end(), x);
        } else {
            t_left = *(lower_bound(t.begin(), t.end(), x) - 1);
            t_right = *lower_bound(t.begin(), t.end(), x);
        }

        long long ans = min(x - t_left, x - s_left) + abs(t_left - s_left);
        ans = min(ans, min(t_right- x, s_right - x) + abs(t_right - s_right));
        ans = min(ans, min(t_right- x, x - s_left) + abs(t_right - s_left));
        ans = min(ans, min(x - t_left, s_right - x) + abs(t_left - s_right));

        cout << ans << endl;
    }
}


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

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

int main()
{
  int N,ans,j;
  int max=0,max2=0;
  cin >> N;

  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if(max<A[i]) {
      j=i;
      max=A[i];
    }
  }
  sort(A.begin(), A.end());  //昇順ソート
  //max=A[N-1];
  max2=A[N-2];
  for (int i = 0; i < N; i++) {
    if(i==j)
      cout << max2 << endl;
    else
      cout << max << endl;
  }
  return 0;
}


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

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair
#define int long long

using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)2e5 + 7;

int n;
int a[N],b[N],mn = inf;
int ind,ans;
int sum;

 main () {
      cin >> n;

      for (int i = 1; i <= n; i ++) {
            cin >> a[i] >> b[i];
            sum += a[i];
            if (a[i] > b[i]) {
                  if (a[i] - b[i] < mn)
                        mn = a[i] - b[i],ind = i;

            }
      }
      if (mn == inf) {
            cout << 0 << endl;
      }
      else {
            for (int i = 1; i <= n; i ++) {
                  if (a[i] > b[i]) {
                        ans = max(ans,sum - a[i] + (a[i] - b[i]));
                  }
            }
            cout << ans << endl;
      }
}


Measured memory_bytes: 512
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let s = read::<i64>();
    let mut ai = s;
    let mut v = vec![s];
    for i in 2.. {
        ai = if ai % 2 == 0 {
            ai/2 
        } else {
            3*ai+1
        };
        if v.contains(&ai) {
            println!("{}",i);
            return;
        }
        v.push(ai);
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

ll MAX = 1e18;

int main(){
    int n;
    cin >> n;
    vector<ll> A(n);
    rep(i,n){
        ll ai;
        cin >> ai;
        if (ai == 0){
            cout << 0 << endl;
            return 0;
        }
        A[i] = ai;
    }
    ll ans = 1;
    rep(i,n){
        if (ans > MAX / A[i]){
            cout << -1 << endl;
            return 0;
        }
        ans *= A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4016
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;
const int inf=0x3f3f3f3f;
const int maxa=200005;
int su[maxa];
bool cmp(int a,int b)
{
    return a>b;
}
int main(){
    int n,m,x;
    int sum=0;
    cin>>n>>m;
    memset(su,0,sizeof(su));
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        if(su[x]==0)
        {
            sum++;
            su[x]++;
        }
        else
            su[x]++;
    }
    sort(su,su+maxa,cmp);
   if(sum<=m) cout<<0<<endl;
    else
    {
        int flag=0,k=n;
        for(int i=0;i<maxa;i++)
        {
            flag++;
            k-=su[i];
            if(flag==m) break;
        }
       cout<<k<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  cin >> N;
  vector<vector<char> > S(N, vector<char>(N));
  REP(i, N){
    REP(j, N){
      cin >> S[i][j];
    }
  }

  ll count = 0;
  REP(A, N){
    bool flag = true;
    REP(i, N){
      FOR(j, i+1, N){
        if(S[(i+A)%N][j] != S[(j+A)%N][i]){
          flag = false;
          break;
        }
      }
      if(!flag) break;
    }
    if(flag) count++;
  }
  
  cout << count*N << "\n";

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int D,G;
const int max_n = 1000;
int main(){
  cin >> D >> G;
  pair<int, int> p[D];
  for(int i=0 ; i<D ; i++){
    cin >> p[i].first >> p[i].second;
  }
  ll countmi = 1e9;
  for(int bit=0 ; bit<(1<<D) ; bit++){
    ll sum = 0, count = 0;
    for(int i=0 ; i<D ; i++){
      if(bit & (1<<i)){
        bool ok = true;
        for(int j=0 ; j<p[i].first ; j++){
          if(sum<G){
            sum += 100 * (i+1);
            count++;
          }else{
            ok = false;
            break;
          }
        }
        if(ok) sum += p[i].second;
      }
    }
    if(sum<G){
      for(int i=D-1 ; i>=0 ; i--){
        if(!(bit & (1<<i))){
          bool ok = true;
          for(int j=0 ; j<p[i].first ; j++){
            if(sum<G){
              sum += 100 * (i+1);
              count++;
            }else{
              ok = false;
              break;
            }
          }
          if(ok) sum += p[i].second;
        }
      }
    }
    if(sum>=G) countmi = min(countmi, count);
  }

  cout << countmi << endl;
  return 0;
}


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


class CompareDist
{
public:
    bool operator()(pair<int,int> n1,pair<int,int> n2) {
        return n1.second>n2.second;
    }
};

int V;
vector<vector<edge>> G;
vector<int> d;

void dijkstra(int s){
    priority_queue<P,vector<P>,CompareDist> q;
    //fill(d,d+V,INT_MAX);
    d=vector<int>(V,INT_MAX);
    d[s]=0;
    q.push(P(0,s));
    
    while(!q.empty()){
        P p=q.top();q.pop();
        int v=p.first;
        if(d[v]<p.second)continue;
        for(int i=0;i<G[v].size();i++){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                q.push(P(e.to,d[e.to]));
            }
        }
    }
}
int main(void){
    int n,in,t,c;
    cin>>n;
    V=n;
    G.resize(n);
    d.resize(n);
    for(int i=0;i<n;i++){
        cin>>in;
        int node=in;
        cin>>in;
        for(int j=0;j<in;j++){
            cin>>t>>c;
            G[node].emplace_back((edge){t,c});
        }
        
    }
    dijkstra(0);
    for(int i=0;i<d.size();i++){
        cout<<i<<" "<<d[i]<<endl;
    }
}



Measured memory_bytes: 7872
#coding:utf-8
n=[int(i) for i in input().split()]
if(n[1]-n[0]+1<=2*n[2]):
  for i in range(n[0],n[1]+1):
    print(i)
else:
  for j in range(n[0],n[0]+n[2]):
    print(j)
  for k in range(n[1]-n[2]+1,n[1]+1):
    print(k)


Measured memory_bytes: 3060
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int hitpoint = 0;
    int number_skills = 0;
    int total_damage = 0;
    int i = 0;

    scanf("%d %d", &hitpoint, &number_skills);

    int skill[number_skills];

    for (i = 0; i < number_skills; i++)
    {
        skill[i] = 0;
        scanf("%d", &skill[i]);
        total_damage += skill[i];
    }

    if (total_damage >= hitpoint)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();
	int n;
	cin >> n;
	VI a(n, 0);
	FOR(i, 0, n) cin >> a[i];
	int ans = 0;
	FOR(i, 0, n) {
		if ((i + 1) % 2 == 1 && a[i] % 2 == 1) ans++;
	}
	cout << ans << endl;
    return 0;
}

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

int main(void) {
  string d[10] = {
                  "pon",
                  "pon",
                  "hon",
                  "bon",
                  "hon",
                  "hon",
                  "pon",
                  "hon",
                  "pon",
                  "hon"
  };
  int n;
  cin >> n;
  cout << d[n % 10] << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

#define access(i) a[i/3][i%3]
int gcd(int x, int y)
{
    if(y==0)
        return x;
    return gcd(y, x%y);
}

 long long numbers[500005];


 int main(){

  long long n;
  cin>>n;

  --n;
   long long c = 26;
   int j = 1;

   while(n>=c){
     n -= c;
     c *= 26;
     j++;
   }

   vector<int>a;

   while(j--){
     a.push_back(n%26);
     n /= 26;
   }

   reverse(a.begin(),a.end());

   for(vector<int>::iterator it = a.begin();it!=a.end();it++)
    cout<<(char)('a'+*it);

   cout<<endl;


 return 0;
 }

Measured memory_bytes: 3524
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
const int maxn = 1e5 + 10;
int a[maxn];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  double h;
  int n, i = 0;
  cin >> h >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  reverse(a, a + n);
  while(i < n && h > 0) {
    h -= a[i++];
  }
  if (h <= 0){ cout << "Yes" << endl; return 0; }
  else cout << "No" << endl; 
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(){
	int N,i,A1,A2,temp;
	long long A[100],B[100]={},sum=0;
	scanf("%d",&N);
	for(i=0;i<N-1;i++){
		scanf("%lld",B+i);
		}
	A1=B[0];
	for(i=0;i<N-1;i++){
		if(A1>=B[i]){
			sum +=B[i];
			A1 =B[i];
			}
		else{
			sum += A1;
			A1 = B[i];
			}
	}
	sum += A1;
	printf("%lld",sum);
	return 0;
	}
	


Measured memory_bytes: 128
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
INIT_VAL = 0
def DD2(d1,d2): return [[INIT_VAL]*d2 for _ in range(d1)]
def DD3(d1,d2,d3): return [DD2(d2,d3) for _ in range(d1)]
## math ##
MOD=10**9+7
def divc(x,y): return -(-x//y)
def divf(x,y): return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers"""
    is_prime = [True] * MAX_NUM
    is_prime[0] = False
    is_prime[1] = False
    primes = []
    for i in range(MAX_NUM):
        if is_prime[i]:
            primes.append(i)
            for j in range(2*i, MAX_NUM, i):
                is_prime[j] = False
    return primes
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

#======================================================#

def main():
    n, a, b = MII()
    total = 0
    for i in range(1,n+1):
        if a <= sum(map(int,list(str(i)))) <= b:
            total += i
    print(total)

if __name__ == '__main__':
    main()

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

#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

int main() {
	int n = nxt();
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; ++i) {
		a[i].first = nxt();
		a[i].second = nxt();
	}

	cout << setprecision(10) << fixed;
	for (int i = 0; i < n; ++i) {
		vector<double> angles;
		for (int j = 0; j < n; ++j) {
			if (j == i) {
				continue;
			}
			int x = a[j].first - a[i].first;
			int y = a[j].second - a[i].second;
			angles.push_back(atan2(x, y));
		}
		sort(all(angles));
		// for (auto x : angles) {
		// 	cerr << x / 2 / acosl(-1) << " ";
		// }
		// cerr << "\n";
		double phi = 0;
		for (int i = 0; i < (int)angles.size(); ++i) {
			double psi = angles[(i + 1) % angles.size()] - angles[i];
			if (psi < -1e-9) {
				psi += 2 * acosl(-1);
			}
			if (psi > 2 * acosl(-1) + 1e-9) {
				psi -= 2 * acosl(-1);
			}
			if (psi > acosl(-1)) {
				phi = psi - acosl(-1);
			}
			// cerr << psi / 2 / acosl(-1) << " ";
		}
		bool zalypa = true;
		for (int i = 0; i < (int)angles.size(); ++i) {
			double dt = abs(angles[i] - angles[(i + 1) % angles.size()]);
			if (dt > acosl(-1)) {
				dt = 2 * acosl(-1) - dt;
			}
			if (dt > 1e-9) {
				zalypa = false;
			}
		}
		// cerr << "\n";
		if (zalypa) {
			phi = acosl(-1);
		}
		cout << phi / 2 / acosl(-1) << "\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe


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

int a,b,ans = 1;

cin >> a >> b;

if (b == 1)
{
    cout << '0' << endl;
}else if (a >= b)
{
    cout << '1' << endl;
}else
{   int sum = a;
    rep(i,20){
    sum += a-1;
    ans++;
    if(sum >= b){
        cout << ans << endl;
        break;       
    }
}
}





//////////////////////////////////////////////////////
return 0;}

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

int main()
{
    string str;
    cin>>str;
    int one=0,two=0,ans=0;
    for(int i=0;i<str.size();i++)
    {
        if(i%2==0&&str[i]=='1')
        {
            one++;
        }
        if(i%2==1&&str[i]=='0')
        {
            one++;
        }
    }
    for(int i=0;i<str.size();i++)
    {
        if(i%2==0&&str[i]=='0')
        {
            two++;
        }
        if(i%2==1&&str[i]=='1')
        {
            two++;
        }
    }
    //cout<<"one="<<one<<endl;
    //cout<<"two="<<two<<endl;
    ans=min(str.size()-one,str.size()-two);
    cout<<ans;
    return 0;
}


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

int main()
{
	ll n,w;
	cin>>n>>w;

	ll knap[n+1][2];
	knap[0][0]=knap[0][1]=0;
	for(ll i=1;i<=n;i++)
		for(ll j=0;j<2;j++)
			cin>>knap[i][j];

	ll dp[n+1][w+1];

	for(ll k=0;k<=n;k++)
		dp[k][0]=0;

	for(ll h=0;h<=w;h++)
		dp[0][h]=0;
		
	for(ll y=1;y<=n;y++)
	{
		for(ll z=1;z<=w;z++)
		{
			if(z<knap[y][0])
				dp[y][z]=dp[y-1][z];
			else
			{
				dp[y][z]=max(knap[y][1]+dp[y-1][z-knap[y][0]],dp[y-1][z]);
			}
		}
	}

	cout<<dp[n][w];
	return 0;
}

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

int main(){
	int n;
	scanf("%d", &n);
	string cmd, str;
	set<string> s;
	for(int i = 0; i < n; i++) {
		cin >> cmd >> str;
		if(cmd == "insert")
			s.insert(str);
		else if(cmd == "find")
			printf("%s\n", (s.find(str) != s.end()) ? "yes" : "no");
	}
}



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

#define fast ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define fl(i,a,n) for(int i=a; i<n; i++)
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define test()  int tt;  cin>>tt;  while(tt--)
#define nl  cout<<"\n"
#define pii pair<int,int>
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)    {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}
const int mod=1e9+7;
void solve()    {
        int n,m;        cin>>n>>m;
        int arr[n];
        int sum=0;
        fl(i,0,n)       {
                cin>>arr[i];
                sum+=arr[i];
        }
        int temp=ceil((1.0*sum)/(4*m));
        sort(arr,arr+n);
        if(arr[n-m]>=temp)      cout<<"Yes";
        else    cout<<"No";
}
/*  Integer Overflow  */
int main()  {
    fast;
    //test()
        solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
int bsr(int x) { return 31 - __builtin_clz(x); }
int bsr(ll x) { return 63 - __builtin_clzll(x); }
int bsf(int x) { return __builtin_ctz(x); }
int bsf(ll x) { return __builtin_ctzll(x); }

const int MN = 3100;
int n;
ll a[MN];
V<int> g[MN];

bool solve(int p) {
    bool f = false;
    for (int d: g[p]) {
        f |= !solve(d);
    }
    return f;
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n-1; i++) {
        int x, y;
        cin >> x >> y; x--; y--;
        if (a[x] > a[y]) {
            // x -> y
            g[x].push_back(y);
        }
        if (a[x] < a[y]) {
            // x <- y
            g[y].push_back(x);
        }
    }

    for (int i = 0; i < n; i++) {
        if (solve(i)) {
            cout << i+1 << " ";
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 512
# def gcd(a_gcd, b_gcd):
#     while b_gcd != 0:
#         a_gcd, b_gcd = b_gcd, a_gcd % b_gcd
#     return a_gcd
#
#
# def lcm(a_lcm, b_lcm):
#     return a_lcm * b // gcd(a_lcm, b_lcm)
#
#
# def max_sum(N_max_sum, a_max_sum):
#     dp = [0] * (N_max_sum + 1)
#     for i in range(N_max_sum):
#         dp[i + 1] = max(dp[i], dp[i] + a_max_sum[i])
#     return dp[N]
#
#
# def knapsack(N_knapsack, W, weight, value):
#     inf = float("inf")
#     dp = [[-inf for _ in range(W+1)] for j in range(N_knapsack + 1)]
#     for i in range(W+1):
#         dp[0][i] = 0
#
#     for i in range(N_knapsack):
#         for w in range(W+1):
#             if weight[i] <= w:
#                 dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w])
#             else:
#                 dp[i+1][w] = dp[i][w]
#     return dp[N_knapsack][W]

# n = int(input())
N, K = map(int, input().split())
S = input()

S = S[:K-1] + S[K-1].lower() + S[K:]

print(S)






















Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <float.h>
#include <stdio.h>
#include <math.h>
#define REP(i,n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
    int N, K, R[50], res = 0;

    cin >> N >> K;
    REP(i, N) cin >> R[i]; 
    sort(R, R+N);
    REP(i, K) res = res + R[N-i-1];
    cout << res << endl;
       
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int main() {
	int a;
	while (cin >> a&&a != 0) {
		long long sum = 0, b;
		for (int i = 0; i < a*(a - 1) / 2; i++) {
			cin >> b;
			sum += b;
		}
		cout << sum / (a - 1) << endl;
	}
}

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

using namespace std;

int main(){
    char a[3];
    cin>>a[0]>>a[1]>>a[2];

    if(a[0]!=a[1] || a[0]!=a[2] || a[1]!=a[2])
      cout<<"Yes";
    else
      cout<<"No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    string s;
    cin>>n>>s;
    int ans=0;
    rep(i,n){
        int cnt=0;
        for(char c='a';c<='z';c++){
            bool left=false,right=false;
            rep(j,i)
                if(s[j]==c) left=true;
            repi(j,i,n)
                if(s[j]==c) right=true;
            if(left&&right) cnt++;
        }
        ans=max(ans,cnt);
    }
    cout<<ans;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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 ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	double n,m;cin>>n>>m;
	vd a(n);
	double sum=0;
	rep(i,n){
		cin>>a[i];
		sum+=a[i];
	}
	int cnt=0;
	rep(i,n){
		if(a[i]/sum>=1/(4*m))cnt++;
	}
	if(cnt>=m)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B, C, D = MAP()
print(max(A*B, C*D))


Measured memory_bytes: 3884
#include<bits/stdc++.h>
#define fori(j,n) for(ll i=j;i<n;i++)
#define forb(n,j) for(ll i=n-1;i>=0;i--)
#define endl "\n"
#define pb push_back
#define ll long long
#define mp make_pair
#define ff first
#define ss second
#define vec vector<ll>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

void wldd()
{
	double d, t, s;
	cin >> d >> t >> s;
	double ans = d / s;
	if (ans <= t)
		cout << "Yes" << endl;
	else
	{
		cout << "No" << endl;
	}
}
int32_t main()
{
	IOS;
	/*ll t;
	cin >> t;
	while (t--)*/ wldd();
	return 0;
}

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

int main() {
    int x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2;
    x3 = x2 + y1- y2;
    y3 = y2 + x2 - x1;
    x4 = x1 + y1 - y2;
    y4 = y1 + x2 - x1;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}


Measured memory_bytes: 256
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())
minW = min(w)
for i in range(N):
    w[i] -= minW
MAX_W = 3 * 100
MAX_V = int(1e9)
INF = MAX_V + 2
dp = [[-INF] * (MAX_W + 10) for i in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in range(MAX_W, -1, -1):
        for k in range(N-1, -1, -1):
            dp[k+1][j+w[i]] = max((dp[k+1][j+w[i]], dp[k][j] + v[i]))

ans = 0
for i in range(N+1):
    for j in range(MAX_W + 1):
        if i * minW + j <= W:
            # print('i * minW: %d, j: %d, dp: %d' % (i*minW, j, dp[i][j]))
            ans = max((ans, dp[i][j]))

print(ans)



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


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String cubes = sc.next();
        int N = cubes.length();

        int red = 0, blue = 0;
        for(int n=0; n<N; n++){
            if(cubes.charAt(n)=='0') red++;
            else blue++;
        }
        System.out.println(2*Math.min(red,blue));
    }
}

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

#define rep(i,n) for(int i = 0;i < n;++i)
#define rep2(i,n,m) for(int i = n;i < m;++i)
#define all(v) v.begin(),v.end()

using namespace std;
using ll = long long;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    double l;
    const double PI=3.14159265358979323846;
    cin >> n;
    l = 2*n*PI;
    cout << fixed << setprecision(8);
    cout << l << endl;


}

Measured memory_bytes: 3796
// Dont hack this or I hack ur mama
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#define ll long long 
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define EPS (1e-9)
using namespace std;

////////////// END OF TEMPLATE
const int nmax = 100100;
vector < pair< int , pair < int , int > > > vec;
pair < int , int > pivot;
int N, R , C;
stack < int > S;
bool isImportant[nmax];
int getAngle( pair < int , int > pt)
{
	if(pt.first == 0)
		return pt.second;
	else if(pt.second == C)
		return C + pt.first;
	else if(pt.first == R)
		return R + C + (C - pt.second);
	else if(pt.second  == 0)
		return 2*C + R + (R - pt.first);
}
void read()
{
	 cin >> R >> C >> N;
	 for(int i = 0 ; i < N; ++i)
	 {
	 	int x,y;
		
		cin >> x >> y;
		isImportant[i+1] = ((x== 0 || x == R) || ( y == 0  || y== C));
		vec.push_back(make_pair(i+1,make_pair(x,y)));

		cin >> x >> y;
		isImportant[i+1] &=((x== 0 || x == R) || ( y == 0  || y== C));
		vec.push_back(make_pair(i+1,make_pair(x,y)));
	 }
	pivot = vec[0].second;

	sort(vec.begin(), vec.end(), [](pair< int , pair< int , int > > a, pair< int , pair< int , int > > b)
			{
				return getAngle(a.second) < getAngle(b.second);				
			});	

	
	for(int i = 0 ; i < vec.size(); ++i)
	{
		if(!isImportant[vec[i].first])
			continue;
		//cout << vec[i].first << endl;
		if(!S.empty() && S.top() == vec[i].first)
				S.pop();
			else
				S.push(vec[i].first);	
	}
	cout << (S.empty() ? "YES\n" : "NO\n") << endl;
}
void solve()
{

}
int main()
{
	std::ios::sync_with_stdio(false);
	read();
	solve();
	return 0;
}


Measured memory_bytes: 4980
#include <stdio.h>

void	ft_half(int *a, int N)
{
	int i = 0;
	while (i < N)
		a[i++] /= 2;
}

int main()
{
	int N;
	scanf("%d", &N);
	int a[N];
	int i;
	for (int i = 0; i < N; i++)
		scanf("%d", &a[i]);
	i = 0;
	int sign = 1;
	int count = 0;
	while (i < N)
	{
		if (a[i] % 2)
			break ;
		if (i == N - 1)
		{
			count++;
			ft_half(a, N);
			i = - 1;
		}
		i++;
	}
	printf("%d", count);
	return (0);
}

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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int K,S;
    cin >> K >> S;
    int ans = 0;
    for (int x=0;x<=K;x++){
        for (int y=0;y<=K;y++){
            int z = S - x - y;
            if (z >=0 && z <= K) ans++;
        }
    }
    cout << ans << "\n";
}

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    if(k<=a) cout << k << endl;
    else if(a+b>=k) cout << a << endl;
    else cout << a - (k-a-b) << endl;
    return 0;
}


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

int main() {
  int H,W;
  cin >> H >> W;
  vector<char> row(H);
  vector<char> column(W);
  
  cout << '#';
  for (int h = 0; h < W; h++) {
    cout << '#';
  }
  cout << '#' << endl;
  
  for (int i = 0; i < H; i++) {
    cout << '#';
    for(int j = 0; j < W; j++) {
      cin >> column.at(j);
      cout << column.at(j);
    }
    cout << '#' << endl;;
  }

  cout << '#';
  for (int k = 0; k < W; k++) {
    cout << '#';
  }
  cout << '#';
}


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

int main(){
  string a,b;
  cin >> a >> b;
  int x=a.size();
  int y=b.size();
  for(int i=0;i<y;i++){
    cout << a.at(i);
    cout << b.at(i);
  }
  if(x-y==1)
    cout << a.at(x-1);
}

Measured memory_bytes: 256