akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  VI sum(1001, 0);
  for(int i=1;i<=1000;++i) sum[i] = sum[i-1] + i;
  while(true){
	int N; cin >> N; if(!N) break;
	int cnt = 0;
	for(int a=1;a<=1000;++a)
	  for(int b=a+1;b<=1000;++b)
		if(sum[b] - sum[a-1] == N)
		  ++cnt;
	cout << cnt << endl;
  }
  return 0;
}

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

ll gcd(ll x ,ll y){
    ll r = x%y;
    if(r==0)return y;
    else return gcd(y ,r);
}

int main(){
    string s,t;
    cin >> s >> t;
    vector<char> chs(s.size());
    vector<char> cht(t.size());
    for(int i=0;i<s.size();i++) chs[i] = s[i];
    for(int i=0;i<t.size();i++) cht[i] = t[i];
    sort(chs.begin() ,chs.end());
    sort(cht.begin() ,cht.end());
    reverse(cht.begin() ,cht.end());
    for(int i=0;i<s.size();i++) s[i] = chs[i];
    for(int i=0;i<t.size();i++) t[i] = cht[i];
    if(s<t)cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main (void)
{
	double s[1000],ave,sum,bunsan,hensa;
	int n,i;
	
	while(1)
	{
		sum = 0;
		ave = 0;
		bunsan = 0;
		hensa = 0;
		for(i = 0 ;i < 1000 ; i++)
		{
			s[i] = 0;
		}
		
		scanf("%d",&n);
		
		if(n == 0)
		{
			break;
		}
		
		for(i = 0 ;i < n ; i++)
		{
			scanf("%lf",&s[i]);
			sum += s[i];
		}
		
		ave = sum / n;
		
		for(i = 0 ; i < n ; i++)
		{
			bunsan += pow(s[i] - ave,2);
		}
		
		bunsan = bunsan / n;
		hensa = sqrt(bunsan);
		
		printf("%lf\n",hensa);
		
	}
	return 0;
}


Measured memory_bytes: 2084
program main
  implicit none
  integer(8) :: n, m, i, dig, res
  integer(8), allocatable :: d(:), cnt(:)
  character(200000) :: s
  read *, n, m
  read *, s
  allocate (d(n), cnt(0:m - 1))

  if (m == 2 .or. m == 5) then
    res = 0
    do i = 1, n
      read (s(i:i), *) dig
      if (modulo(dig, m) == 0) res = res + i
    end do
  else
    read (s(n:n), *) dig
    cnt = 0
    cnt(0) = 1
    d(n) = modulo(dig, m)
    cnt(d(n)) = cnt(d(n)) + 1
    do i = n - 1, 1, -1
      read (s(i:i), *) dig
      d(i) = d(i + 1) + pow(10_8, n - i) * dig
      d(i) = modulo(d(i), m)
      cnt(d(i)) = cnt(d(i)) + 1
    end do

    res = 0
    do i = 0, m - 1
      res = res + cnt(i) * (cnt(i) - 1) / 2
    end do
  end if
  print "(i0)", res
  contains

  recursive function pow(n, p) result(res)
    integer(8), intent(in) :: n, p
    integer(8) :: res
    if (p == 0) then
      res = 1
    else if (modulo(p, 2_8) == 0) then
      res = modulo(pow(n, p / 2) ** 2, m)
    else
      res = modulo(pow(n, p - 1) * n, m)
    end if
  end function pow
end program main


Measured memory_bytes: 2316
import sys
sys.setrecursionlimit(10**7)

class CombByFermat:
    def __init__(self, size, mod):
        self.size = size
        self.mod = mod
        self.factrial = [1]
        self.inverse = [1]
        pre_f = 1
        for i in range(1, self.size+1):
            pre_f = (pre_f * i) % self.mod
            self.factrial.append(pre_f)
            self.inverse.append(pow(pre_f, self.mod-2, self.mod))
    def comb(self, n, k):
        if n < k:
            return 0
        return (self.factrial[n] * self.inverse[k] * self.inverse[n-k]) % self.mod

size = 1000
mod = 10**9 + 7

CBF = CombByFermat(size, mod)
n, k = map(int, input().split())
print(CBF.comb(k, n))


Measured memory_bytes: 5620
N,T=[int(s) for s in input().split()]
food=[[int(s) for s in input().split()] for i in range(N)]
food.sort()

#i番目までの料理でt秒以内に食べきるときのDP
DP=[[0 for t in range(T)] for i in range(N)]
for i in range(N):
  time,point=food[i]
  for t in range(min([T,time])):
    DP[i][t]=DP[i-1][t]
  for t in range(time,T):
    DP[i][t]=max([DP[i-1][t] , DP[i-1][t-time]+point])

#i番目の料理を最後に注文することを考える
ls=[DP[i-1][T-1]+food[i][1] for i in range(1,N)]
ls.append(food[0][1])
print(max(ls))  

Measured memory_bytes: 149800
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 998244353
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define inf 1000000000000000000
#define vll vector<ll>
using namespace std;
const int N=200005;


void solve()
{
	ll n,m,a[N],x,y,s=0,ans=0,i;
	priority_queue<ll,vector<ll>,greater<ll> >pq;
	vector<pair<ll,ll> >v;
	cin>>n>>m;
	for(i=1;i<=n;i++)
		cin>>a[i];
	for(i=1;i<=m;i++)
	{
		cin>>x>>y;
		v.pb(MP(y,x));
	}
	sort(all(v));
	reverse(all(v));
	x=m-1;
	for(i=0;i<(ll)v.size();i++){
		s+=v[i].S;
		if(s>=n)
		{
			x=i;
			break;
		}
	}
	for(i=1;i<=n;i++)
		pq.push(a[i]);
	for(i=x;i>=0;i--)
	{
		while(v[i].S--)
		{
			if(pq.top()<v[i].F)
			{
				pq.pop();
				pq.push(v[i].F);
			}
			else
				break;
		}
	}
	while(!pq.empty())
	{
		ans+=pq.top();
		pq.pop();

	}
	cout<<ans;


	
}
 
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 4464
#include <stdio.h>
#define N 500

static const int INFTY = (1<<21);

int main(){
  int n,i,j,m;
  int min,l,x,sum;
  int G[N][N];
  int a[N];
  int b[N];
  int c[N];

  scanf("%d",&n);

  for(i=0 ; i<n ; i++){
    for(j=0 ; j<n ; j++){
      scanf("%d",&m);
      G[i][j] = (m == -1) ? INFTY:m;
    }
  }

  for(i=0 ; i<n ; i++){
    a[i] = INFTY;
    b[i] = -1;
    c[i] = 0;
  }

  a[0] = 0;

  while(1){
    min = INFTY;
    l = -1;
    for(i=0 ; i<n ; i++){
      if(min>a[i] && !c[i]){
        l = i;
        min = a[i];
      }
    }
    if(l == -1){
      break;
    }
    c[l] = 1;
    for(x=0 ; x<n ; x++){
      if(!c[x] && G[l][x]!=INFTY){
        if(a[x] > G[l][x]){
          a[x] =  G[l][x];
          b[x] = l;
        }
      }
    }
  }

  sum = 0;

  for(i=0 ; i<n ; i++ ){
    if (b[i] != -1){
      sum += G[i][b[i]];
    }
  }

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

  return 0;
}



Measured memory_bytes: 2112
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	long a = sc.nextLong();
	long b = sc.nextLong();
	long c = sc.nextLong();
	long d =  c - a - b;
	if((d>0) && (d*d > 4*a*b))
	    System.out.print("Yes");
	else
	    System.out.print("No");
    }
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n,p;
unordered_map<ll,ll> m;
ll ans = 1;

ll powl(ll x,ll r,ll mod = INF){
  ll ret = 1;
  for(;r != 0;r >>= 1){
    if(r&1 != 0) ret *= x,ret %= mod;
    x *= x,x %= mod;
  }
  return ret;
}

int main(){
  cin >> n >> p;
  for(ll i = 2;i*i <= p;i++){
    while(p%i == 0){
      m[i]++;
      p /= i;
    }
  }
  cerr << p << endl;
  if(p != 1){
    m[p]++;
  }
  for(auto x : m){
    ans *= powl(x.first,x.second/n);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
a = input()
for i in range(len(l)):
    if l[i] == a:
        print(l[i+1])

Measured memory_bytes: 3060
let [|N;K|] =
    stdin.ReadLine().Split()
    |> Array.map int

let rec f x (v:double) =
    if x>=K then v
    else f (2*x) (v+1.0)

[|1..N|]
|> Array.sumBy (fun x -> double(1.0)/double(N)*(double(0.5)**(f x 0.0)))
|> stdout.WriteLine

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

int main() {
  int H, W;
  cin >> H >> W;
  int res1, res2;
  vector<vector<int>> grid(H, vector<int>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      string tmp;
      cin >> tmp;
      if (tmp == "snuke") {
        res1 = i;
        res2 = j;
        break;
      }
    }
  }
  cout << (char)('A' + res2) << res1+1 << endl;
}


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

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) ( ((a) + ((b) - 1) ) / b)

typedef long long int lli;

using namespace std;

int main(void) {
	char march[] = {'M', 'A', 'R', 'C', 'H'};
	lli array[5];
	memset(array, 0, sizeof(lli) * 5);
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		char s[11];
		scanf("%s", s);
		for (int j = 0; j < 5; j++) {
			if (s[0] == march[j]) {
				array[j]++;
			}
		}
	}

	lli ans = 0L;
	for (int i = 0; i < 3; i++) {
		for (int j = i+1; j < 4; j++) {
			for (int k = j+1; k < 5; k++) {
				ans += array[i] * array[j] * array[k];
			}
		}
	}

	printf("%lld\n", ans);
	return 0;
}



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

int main() {
	long long a, b, c;
	cin >> a >> b>>c;
	if (a%c != 0) {
		a = a + (c - a%c);
	}
	if (a - b > 0) {
		cout << 0 << endl;
	}
	else {
		cout << ((b - a) / c + 1) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
grand = Array.new
 
while true
    score = gets.split.map(&:to_i)
    break if score[0]==-1 && score[1]==-1 && score[2]==-1
    if score[0]==-1 || score[1]==-1
        grand << "F"
    elsif score[0] + score[1] >= 80
        grand << "A"
    elsif score[0] + score[1] >= 65
        grand << "B"
    elsif score[0] + score[1] >= 50
        grand << "C"
    elsif score[0] + score[1] >= 30
        if score[2] >= 50
            grand << "C"
        else
            grand << "D"
        end
    else
        grand << "F"
    end
end
 
grand.each{|e|
    puts e
}

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

template<class T>inline bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };

ll n, a, b, c, d;
unordered_map<ll, ll> memo;
ll cost(ll x){
    if(x == 0) return 0;
    if(x == 1) return d;
    if(memo.count(x)) return memo[x];

    ll result = LLONG_MAX / d > x ? x * d : LLONG_MAX;
    ll rate, pay;
    
    rate = 2;
    pay = a;
    chmin(result, cost(x / rate) + x % rate * d + pay);
    chmin(result, cost((x + rate - 1) / rate) + abs(rate - x % rate) * d + pay);

    rate = 3;
    pay = b;
    chmin(result, cost(x / rate) + x % rate * d + pay);
    chmin(result, cost((x + rate - 1) / rate) + abs(rate - x % rate) * d + pay);

    rate = 5;
    pay = c;
    chmin(result, cost(x / rate) + x % rate * d + pay);
    chmin(result, cost((x + rate - 1) / rate) + abs(rate - x % rate) * d + pay);

    return memo[x] = result;
}

int main(){
    int t; 
    cin >> t;
    for(int i = 0; i < t; i++) {
        memo.clear();
        cin >> n >> a >> b >> c >> d;
        cout << cost(n) << endl;;
    }

    return 0;
}


Measured memory_bytes: 4088
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N, A, res;
  cin >> N;
  cin >> A;
  res = N%500;
  if (res > A) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
//use proconio::input;
use std::cmp::min;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        h: [i32; n],
    }
    let mut dp = vec![0; n];
    let m = 2;
    dp[1] = (h[1] - h[0]).abs();
    for i in m..n {
        let mut dpi = dp[i - 1] + (h[i] - h[i - 1]).abs();
        for j in 1..(m + 1) {
            dpi = min(dpi, dp[i - j] + (h[i] - h[i - j]).abs());
        }
        dp[i] = dpi;
    }

    println!("{}", dp[n - 1]);
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void)
{
  char s[2];
  scanf("%s", s);

  if (s[0] == 'A')
    puts("T");
  else if (s[0] == 'G')
    puts("C");
  else if (s[0] == 'T')
    puts("A");
  else if (s[0] == 'C')
    puts("G");

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <bits/stdc++.h>

using namespace std;

double cnt = 0, k = 0, n = 0, p = 0;
void coin(double x) {
	x *= 2;
	cnt++;
	if (x < k) {
		coin(x);
	} else {
		p += (1 / n * 1.00000000) * pow(0.500000000, cnt);
		cnt = 0;
	}
}

int main() {
	cin >> n >> k;
	for (double i = 1; i < n + 1; i++) {
		if (i >= k) {
			p += 1 / n;
		} else {
			double cnt = 0;
			coin(i);
		}
	}
	printf("%.16f\n", p);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
using namespace std;

int n_equal(string a,string b,int n)
{
    int t=a.size();
    for(int i=0;i<t;i++)
    {
        if(a[i]!=b[(i+n)%t]) return 0;
    }
    return 1;
}

int main()
{
    int t,j;
    string a,b;
    cin>>a>>b;
    t=a.size();
    int flag=0;
    for(j=0;j<t;j++)
    {
        if(n_equal(a,b,j)) flag=1;
    }
    if (flag) printf("Yes");
    else printf("No");
    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    
    vector<double> p(n);
    vector<vector<double>> dp(n+1,vector<double>(n+1));
    
    for(int i = 0; i < n; i++) cin >> p[i];
    
    dp[0][0] = 1;
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            dp[i+1][j] += dp[i][j] * (1 - p[i]);
            dp[i+1][j+1] += dp[i][j] * p[i];
        }
    }
    
    double ans = 0;
    
    for(int i = n/2 + 1; i <= n; i++){
        ans += dp[n][i];
    }
    
    cout << fixed << setprecision(10) << ans << endl;
    
}


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

#define LOCAL 0

#define lli long long int
#define llu unsigned long long int
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);

const long double EPS = 1e-10;
const int MOD = 1000000007ll;
const int mod1 = 1000000009ll;
const int mod2 = 1100000009ll;
int INF = (int)1e9;
lli INFINF = (lli)1e18;
int debug = 0;
long double PI = acos(-1.0);

using namespace std;

int bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
int bit(lli _mask,int _i){return (_mask&(1ll<<_i))==0?0:1;}
int add(int a,int b,int m=MOD){int x=a+b;while(x>=m)x-=m;while(x<0)x+=m;return x;}
int sub(int a,int b,int m=MOD){int x=a-b;while(x<0)x+=m;while(x>=m)x-=m;return x;}
int mul(int a,int b,int m=MOD){lli x=a*1ll*b;x%=m;while(x<0)x+=m;return (int)x;}
int ldtoint(ld x){return (int)(x+0.5);}lli ldtolli(ld x){return (lli)(x+0.5);}
int powermod(lli _a,lli _b,int _m=MOD){lli _r=1;while(_b){if(_b%2==1)_r=mul(_r,_a,_m);_b>>=1;_a=mul(_a,_a,_m);}return _r;}

template<class T1,class T2>ostream&operator<<(ostream& os,const pair<T1,T2>&p){os<<"["<<p.first<<","<<p.second<<"]";return os;}
template<class T>ostream&operator<<(ostream& os,const vector<T>&v){os << "[";bool first=true;for (T it:v){if (!first)os<<", ";first = false;os<<it;}os<<"]";return os;}
template<class T>ostream&operator<<(ostream& os,set<T>&v){os<<"[";bool first=true;for (T it:v){if(!first)os<<", ";first=false;os<<it;}os<<"]";return os;}
template<class T1,class T2>ostream&operator<<(ostream& os,map<T1,T2>&v){os<<"[";bool first=true;for(pair<T1,T2> it:v){if(!first)os<<", ";first=false;os<<"("<<it.F<<","<<it.S<<")";}os<<"]";return os;}
template<class T>void parr(T a[],int s,int e){cout<<"[";for(int i=s;i<e;i++)cout<<a[i]<<", ";cout<<a[e]<<"]\n";}

lli N;
lli A[100010];
lli ans[100010];

int main()
{
if(LOCAL){
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    debug = 1;
}
    srand (time(NULL));

    cin>>N;
    for(int i=1;i<=N;i++)
        cin>>A[i];

    vector<pair<lli,lli> > v;
    for(int i=1;i<=N;i++){
        v.pb({A[i],-i});
    }
    sort(all(v));
    for(int i=0;i<N;i++)
        v[i].S = -v[i].S;

    reverse(all(v));

    lli X = INF + 10;
    lli tot = 0;
    v.pb({0,0});

    for(int i=0;i<N;i++){
        int j = i;
        for(;j<=N;j++){
            if(v[i].F != v[j].F)
                break;
            X = min(X,v[i].S);
        }
        j--;
        ans[X] += -1*(v[j+1].F-v[i].F)*(j+1);
        i=j;
    }
    for(int i=1;i<=N;i++)
        cout<<ans[i]<<"\n";

    return 0;
}


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

int main(){
    //入力
    int a,b,c;
    cin >> a >> b >> c;
    vector<int> v={a,b,c};
    sort(v.begin(),v.end());
    if(v.at(0)+v.at(1)==v.at(2)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
use std::cmp::*;
use std::collections::BTreeSet;
use std::io::*;
use std::str::FromStr;
//portable utility
#[allow(dead_code)]
fn switch<T>(flag: bool, true_value: T, false_value: T) -> T {
    if flag {
        true_value
    } else {
        false_value
    }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_string() -> Vec<char> {
    read::<String>().chars().collect()
}

#[allow(dead_code)]
fn read_vector<T: FromStr>(number: i32) -> Vec<T> {
    (0..number).map(|_| read()).collect()
}

fn main() {
    let (n, m): (i32, i32) = (read(), read());
    let mut a_list: Vec<i32> = read_vector(n);
    a_list.sort();
    let a_sum: i32 = a_list.iter().sum();
    let cmp = (a_sum as f32 / (4.0 * m as f32)).ceil() as i32;
    for index in 0..m as usize {
        let index = a_list.len() - index - 1;
        //println!("{} {}", a_list[index as usize], cmp);
        if a_list[index as usize] < cmp {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
def game(a, n):
    cards = sorted(a, reverse=True)
    alice = [cards[i] for i in range(n) if i % 2 == 0]
    bob = [cards[i] for i in range(n) if i % 2 != 0]
    return sum(alice) - sum(bob)


if __name__ == '__main__':
    n = int(input())
    a = map(int, input().split())
    print(game(a, n))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  float N_f,ans;
  cin >> N;
  N_f=N;
  
  if(N%2==0){
    ans=0.5;
  }else{
    ans=((N_f+1)/2)/N_f;
  }

  cout << ans << endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
ll k (ll a){
    a--;
    ll ans =0;
    while(a != 0){
        ans += a;
        a--;
        
    }
    return ans;
}

int main(){
    int n;
    cin  >> n;
    vector<string> vec(n);

    string s;
    REP(i,n){
        cin >> s;
        SORT(s);
        vec[i] = s;
    }
    SORT(vec);

    map<string, ll> m;
    REP(i,n){
        m[vec[i]]++;
    }

    ll ans = 0;

    for(auto x:m){
        if(x.second > 1 ){
            ll y = x.second;
            ll x = k(y);
            ans += x;
        } 
    }

    

    cout << ans <<endl;

    
}






Measured memory_bytes: 12032
// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

int t, n;

const int N = 2e5+50;

char s[N];

int main(int argc, char const *argv[]) {
    // code
    deque<char> Q;
    bool rev = false;
    scanf("%s", s);
    n = strlen(s);
    for (int i=0; i<n; ++i)
        Q.push_back(s[i]);
    int q;
    scanf("%d", &q);
    for (int i=0; i<q; ++i) {
        static int op[10];
        int t;
        scanf("%d", &t);
        --t;
        int f;
        if (t) scanf("%d%s", &f, op);
        --f;
        if (t == 0) {
            rev ^= 1;
        } else {
            f ^= rev;
            if (f == 0)
                Q.push_front(op[0]);
            else
                Q.push_back(op[0]);
        }
    }
    if (!rev)
        while (!Q.empty()) {
            putchar(Q.front());
            Q.pop_front();
        }
    else
        while (!Q.empty()) {
            putchar(Q.back());
            Q.pop_back();
        }
    putchar('\n');

    return 0;
}


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

#define MAX 1<<15

int n;

double cost[MAX];

vector<pair<double,double> > v;


double dist(int a,int b){
	return sqrt((v[a].first-v[b].first)*(v[a].first-v[b].first)+(v[a].second-v[b].second)*(v[a].second-v[b].second));
}
struct st{
	int a;
	int b;
	double c;
};
bool operator<(const st a,const st b){
	return a.c<b.c;
}
vector<st> ed;
int belong[MAX];
inline int root(int b){
	if(belong[b]==-1){
		return b;
	}
	return belong[b]=root(belong[b]);
}
inline void merge(int a,int b){
	a=root(a);
	b=root(b);
	if(a==b)return;
	belong[a]=b;
}
double dp[1<<15];
vector<double> C;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int a,b,c;
		cin>>a>>b>>c;
		v.push_back({a,b});
		C.push_back(c);
	}
	for(int i=1;i<(1<<n);i++){
		double node=0;
		double num=0;
		memset(belong,-1,sizeof(belong));
		ed.clear();
		for(int j=0;j<n;j++){
			if(((i>>j)&1)==0)continue;
			num+=1;
			node+=C[j];
			for(int k=j+1;k<n;k++){
				if(((i>>k)&1)==0)continue;
				ed.push_back({j,k,dist(j,k)});
			}
		}
		sort(ed.begin(),ed.end());
		for(auto &it:ed){
			if(root(it.a)!=root(it.b)){
				merge(it.a,it.b);
				cost[i]+=it.c;
			}
		}
		node-=cost[i];
		node/=num;
		//cout<<node<<endl;
		node=max(node,0.0);
		cost[i]=node;
	}
	dp[0]=LLONG_MAX;
	for(int i=0;i<(1<<n);i++){
		for(int j=((i+1)|i);j<(1<<n);j++,j|=i){
			int ex=(j^i);
			dp[j]=max(dp[j],min(dp[i],cost[ex]));
		}
	}
	printf("%.16f\n",dp[(1<<n)-1]);
	return 0;
}


Measured memory_bytes: 896
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());
        List<String> list = new ArrayList<String>();
        for (int j=0; j<w; j++){
            list.add(String.valueOf(j+1));
        }
        for (int i=0; i<n; i++){
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        }
        for (int k=0; k<list.size(); k++){
            System.out.println(list.get(k));
        }
    }
}

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

typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;

const int INF = 1 << 28;
int N, M;

void solve() {
    vector<vector<P> > v(N);
    for (int i = 0; i < M; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        x--;
        y--;
        v[x].push_back(P(z, y));
        v[y].push_back(P(z, x));
    }

    for (auto& i : v) {
        sort(i.begin(), i.end());
    }

    int res = INF;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < v[i].size(); j++) {
            priority_queue<P, vector<P>, greater<P> > que;
            vec used(N, false);
            used[i] = used[v[i][j].second] = true;
            for (auto k : v[i]) {
                if (k.first >= v[i][j].first) que.push(k);
            }

            for (auto k : v[v[i][j].second]) {
                if (k.first >= v[i][j].first) que.push(k);
            }

            int Max = v[i][j].first;

            while (que.size()) {
                P p = que.top(); que.pop();
                int w = p.first;
                int now = p.second;
                if (used[now]) continue;
                used[now] = true;
                Max = max(Max, w);
                if (Max - v[i][j].first > res) break;
                for (auto e : v[now]) {
                    int tmp = e.first - v[i][j].first;
                    if (tmp >= 0 && tmp < res && !used[e.second]) {
                        que.push(e);
                    }
                }
            }

            bool flag = true;
            for (int i = 0; i < N; i++) {
                if (!used[i]) {
                    flag = false;
                    break;
                }
            }

            if (flag) {
                res = min(res, Max - v[i][j].first);
            }
        }
    }

    cout << (res > 10000 ? -1 : res) << endl;
}

int main() {
    while (cin >> N >> M, N || M) solve();

    return 0;
}

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

int main(){
    int L, R, d;

    cin >> L >> R >> d;

    int count = 0;
    for (int i = L; i <= R; i++)
    {
        if (i % d == 0){
            count += 1;
        }
    }
    cout << count << endl;
}

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

int main(){
    
    int n, min, max;
    long ave=0;
    int x;
    
    cin >> n;
    
    for(int i = 0; i < n; ++i){
        cin >> x;
        
        if(i == 0){
            min = x;
            max = x;
        }
        
        if(min > x){
            min = x;
        }
        
        if(max < x){
            max = x;
        }
        
        ave += x;
    }
    
    cout << min << " " << max << " " << ave << endl;
    
    
    return 0;
}


Measured memory_bytes: 3108
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl;
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2

ll mo = 1000000007;
vector<int>e[101010];
int n, k;
int pUsed[101010];
int dist[101010];
ll ans = 1;
void dfs(int p,int now) {
	ll sub = (dist[now] <= 2) ? dist[now] : 2;
	ans *= k - sub - pUsed[(p == -1)?100050:p];
	ans %= mo;
	pUsed[(p == -1) ? 100050 : p]++;

	fore(x, e[now]) {
		if (x != p) {
			dist[x] = dist[now] + 1;
			dfs(now,x);
		}
	}
}


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

	rep(i, 0, n - 1) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		e[a].pb(b);
		e[b].pb(a);
	}
	dfs(-1,0);
	puts(ans);

	return 0;
}


Measured memory_bytes: 9984
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
string S;
int K;
/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>S>>K;

    priority_queue<string> v;
    set<string> st;
    REP(i,0,S.size()){
        REP(j,1,S.size()-i+1){

            if(v.size() == K){
                if(v.top() > S.substr(i, j)) {
                    if(st.find(S.substr(i, j)) == st.end()) {
                        v.pop();
                        v.push(S.substr(i, j));
                        st.insert(S.substr(i, j));
                    }
                }else{
                    break;
                }
            }else{
                if(st.find(S.substr(i, j)) == st.end()) {
                    v.push(S.substr(i, j));
                    st.insert(S.substr(i, j));
                }
            }

//            if(st.find(S.substr(i, j)) == st.end()){
//                //cout<<S.substr(i, j)<<endl;
//                v.push(S.substr(i, j));
//                st.insert(S.substr(i, j));
//            }
        }
    }

//    while(v.size() > K){
//        v.pop();
//    }

    cout<<v.top()<<endl;

//    while(!v.empty()){
//        cout<<"-- "<<v.top()<<endl;
//        v.pop();
//    }

    return 0;
}


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

int main(){
    int n;
    string s;
    cin>>n>>s;
    vector<int> lis(123);
    int temp;
    for (int i=0;i<n;i++){
        temp=s[i];
        lis[temp]++;
    }
    long long ans=1;
    for (int i=97;i<123;i++){
        if (lis[i]!=0){
            ans*=(lis[i]+1);
            ans%=1000000007;
        }
    }
    ans=(ans==0)?1000000006:ans-1;
    cout<<ans;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
long long MOD=1000000007;

int main(int argc, char* argv[])
{
	int N;
	cin>>N;
	int i=0;
	long long aw=1;
	for (i=1;i<=N;i++){
		aw *=i;
		aw %=MOD;
	}
	cout<<aw<<endl;
	return 0;
}

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main() {
  int n, w;
  cin >> n >> w;
  vector<ll>we(n);
  vector<ll>v(n);
  rep(i, 0, n){
      cin >> we[i] >> v[i];
  }
  ll dp[110][100100];

  rep(i, 0, 110)rep(j, 0, 100100)dp[i][j]=inf;

  dp[0][0]=0;

  rep(i, 0, n){
    rep(j, 0, 100100){
      chmin(dp[i+1][j],dp[i][j]);
      if(j-v[i]<0)continue;
      chmin(dp[i+1][j],dp[i][j-v[i]]+we[i]);
    }
  }
  int ans = 0;
  rep(i, 0, 100100){
      if(dp[n][i]<=w)ans = max(ans, i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 86272
#include<bits/stdc++.h>
#define ll long long
#define sort(x) sort(x.begin(), x.end())
#define loop(n) for(ll i = 0; i<n; i++)
using namespace std;

int main(){
    ll n; cin>>n;
    string s; cin>>s;
    ll count = 0;
    loop(n-1){
        if(s[i]!=s[i+1]) count++;
    }
    cout<<count+1;
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  sort(S.begin(), S.end());
  if (S == "abc") {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  
  
  
  
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <stack>
#include <limits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);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 inf 0x3f3f3f3f
#define INF INT_MAX/3
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second

int main(void) {
	string s; cin >> s;
	REP(i,s.size()-1){
		if(s[i] == s[i+1]){
			++i;
			cout << i  << " " << i+1 << endl;
			return 0;
		}
		else if(i+2 < s.size() and s[i] == s[i+2]){
			++i;
			cout << i << " " << i+2<<endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;
	return 0;
}


Measured memory_bytes: 512
class UnionFind():
    def __init__(self, n):
        self.parent = [-1]*n
    def root(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]
    def union(self, x,y):
        root_x = self.root(x)
        root_y = self.root(y)
        if root_x == root_y:
            return False
        if self.parent[root_x] < self.parent[root_y]:
            self.parent[root_x] += self.parent[root_y]
            self.parent[root_y] = root_x
        else:
            self.parent[root_y] += self.parent[root_x]
            self.parent[root_x] = root_y
        return True

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
ans = 0
for i in range(m):
    UF = UnionFind(n)
    use = ab[::]
    use.pop(i)
    for a, b in use:
        UF.union(a-1, b-1)
    if sum([j<0 for j in UF.parent])!=1:
        ans += 1
print(ans)


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



int main() {
    double n;
    cin >> n;
    
    int o = (n+1) / 2;
    
    double ans = 1;
    if(o != 0)
        ans = o / n;
    
    cout << fixed << setprecision(8) << ans << endl;
    
    
    
    
    return 0;
}




Measured memory_bytes: 3788
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	cin>>n;
	int brojac=0;
	ll broj=1;
	ll brojce=0;
	while(brojce<n)
	{
		brojce+=broj;
		brojac++;
		broj++;
	}
	cout<<brojac<<endl;

}

Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))
dp = [float('inf')]*N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
  dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print(dp[N-1])

Measured memory_bytes: 13928
def gcd(u, v):
    while v:
        u, v = v, u % v
    return u

N, K = [int(x) for x in input().split()]
A    = [int(x) for x in input().split()]

g = 0
for i in A:
    g = gcd(i, g)

if K % g or K > max(A):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


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

using namespace std;
using ll = long long;

ll gcd(ll a, ll b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}

ll lcm(ll a, ll b) {
  return (a * b) / gcd(a, b);
}

int main() {
  ll a, b;
  cin >> a >> b;
  cout << lcm(a, b) << endl;
  return 0;
}


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

#define ALL(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef vector<int> vi;

int mod = 1e9 + 7;

void solve(void) {

	int n;
	cin >> n;

	vector<vi> A(n, vi(n));

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

	vi dp(1<<n);
	dp[0] = 1;

	for(int s = 0; s < (1<<n); s++) {
		int man = __builtin_popcount(s);
		for(int fem = 0; fem < n; fem++) {
			if((s & (1<<fem)) == 0) {
				if(A[man][fem]) {
					dp[s|(1<<fem)] += dp[s];
					dp[s|(1<<fem)] %= mod;
				}
			}
		}
	}

	cout << dp[(1<<n)-1] << '\n';

}

int main(void) {

	solve();

	return 0;
}


Measured memory_bytes: 8448
#include<iostream>

using namespace std;

int main(){

  int start, end;

  int roll = 0;

  while(cin >> start >> end){
    if(start == 0 && end == 0) break;
    if(roll != 0) cout << endl;
    int sum = 0;

    for(int i = start; i <= end; i++){
      if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
	cout << i << endl;
	sum++;
      }
    }
    if(sum == 0) cout << "NA" << endl;
    roll++;
  }

  return 0;
}

Measured memory_bytes: 0
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var a string
    fmt.Scan(&a)
    ans := "G"
    switch{
        case a=="A":
            ans = "T"
        case a=="T":
            ans = "A"
        case a=="G":
            ans = "C"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
int n ;
string s ;

bool find (string t){
    char b = t[0] ;
    int r = 0 ;
    rep(i, n){
        if(s[i] == b && r == 2){
            r++ ;
            break ;
        }
        if(s[i] == b){
            r++ ;
            b = t[r] ;
        }
    }
    return r == 3 ;
}
int main() {
    cin >> n ;
    cin >> s ;
    int ans = 0 ;
    for(int i = 0; i <= 999 ; i++){
        string k = to_string(i) ;
        if(k.size() == 2){
            k = "0" + k ;
        }
        if(k.size() == 1){
            k = "00" + k ; 
        }
        if(find(k)){
            ans++ ;
        }
    }
    cout << ans << endl ;
} 

Measured memory_bytes: 3748
//package src.com.jetman.atcoder;

import java.util.*;

/**
 * @description:
 * @author: Jetman
 * @create: 2020-08-29 14:39
 **/
public class Main {

    Scanner sc = new Scanner(System.in);

    long MOD = 1000000000 + 7;

    long dp[][];

    private void slove() {

        String s = sc.next();
        int len = s.length();
        if (s.charAt(len-1) == 's') {
            s+="es";
        } else {
            s+="s";
        }


        System.out.println(s);



    }

    private void build(Map<Integer, List<Integer>> edge, int l, int r) {
        List<Integer> list = edge.getOrDefault(l, new ArrayList<>());
        list.add(r);
        edge.put(l,list);
    }


    public static void main(String[] args) {
        new Main().slove();
    }
}


Measured memory_bytes: 38420
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int k,n;cin >> k >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  int res = 1e+9;
  res = min(res , a[n-1] - a[0]);
  rep(i,n-1){
    res = min(res , k - a[i+1] + a[i] );
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 1152
import os, sys, re, math

N,M,X,Y = map(int,input().split(' '))

x_ary = list(map(int,input().split(' ')))
y_ary = list(map(int,input().split(' ')))
x_ary.sort()
y_ary.sort()

flg = False
for i in range(x_ary[-1], y_ary[0]):
    if i > X and i < Y:
        flg = True
        break
if flg:
    print('No War')
else:
    print('War')


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
char c[100005],s[100005];
int t;
int a,b;
int main() {
	scanf("%s",c);
	int l=strlen(c);
	for(int i=0;i<l;i+=2)
		s[t++]=c[i];
	for(int i=0;i<t;i++)
		cout<<s[i];
}


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

namespace AtcoderTemplateForCSharp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine()
                .Split(' ')
                .Select(int.Parse);

            var t = input.ElementAt(0);
            var x = input.ElementAt(1);

            Console.WriteLine(t / (double)x);
        }
    }
}


Measured memory_bytes: 11348
#include <algorithm>
#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <vector>
using namespace std;

int main()
{
    
    int N;
    cin >> N;
           
    vector<int>Data;
    for (int i = 0; i < N; i++) {
        Data.push_back(i);
        cin >> Data[i];
    }
           
    int result = 0;
    int small = 9999999;
    for (int i = 1; i <= 100; i++) {
        for (int j = 0; j < Data.size(); j++) {
            result += (Data[j] - i) * (Data[j] - i);
        }
        small = min(small, result);
        result = 0;
        
    }
    cout << small << endl;
    
    return 0;   
}

Measured memory_bytes: 256
// ...

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

//-----------------------------------------------------------------------------------
typedef long long int ll;
typedef long double ld;
#define endl "\n"
#define int long long
#define float long double
#define mm multimap
#define pb push_back
#define ff first
#define ss second
#define ln length
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repe(i,a,b)  for(int i=a;i<=b;i++)
#define m_p make_pair
#define go_flash ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
const int mod = 1000000007;
//-----------------------------------------------------------------------------------
void primeFactors(int p) {
    while (!(p % 2)) {p /= 2;} for (int i = 3; i <= sqrt(p); i += 2) {
        while (!(p % i)) {p /= i;}
    } if (p > 2) {;}
}
//-----------------------------------------------------------------------------------
template<typename...T>void input(T &...args) {((cin >> args), ...);}
template<typename...T>void print(T &&...args) {((cout << args << " "), ...);}
template<typename...T>void deb(T &&...args) {((cerr << args << " "), ...); cerr << endl;}
//#define debug(x) cerr<<#x<<" => "<<x<<" ";
//-----------------------------------------------------------------------------------
void forv(vector<int> &v, int n) {int x; for (int i = 0; i < n; i++) {cin >> x; v.pb(x);}}
void printv(vector<int> v) {for (auto i : v) {cout << i << " ";}}
void fora(int a[], int n) {for (int i = 0; i < n; i++)cin >> a[i];}
void printa(int a[], int n) {for (int i = 0; i < n; i++)cout << a[i] << " ";}
void dmap(map<int, int> mp) {for (auto i : mp)cout << i.ff << " " << i.ss << endl;}
void dmmap(mm<int, int> mp) {for (auto i : mp)cout << i.ff << " " << i.ss << endl;}
void sortra(int a[], int n) {sort(a, a + n, greater<int>());}
void sortrv(vector<int> &v) {sort(all(v), greater<int>());}
//-----------------------------------------------------------------------------------
inline void guts() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif
}
//-----------------------------------------------------------------------------------

signed main() {
    go_flash; guts();

    int t = 1;
    // cin >> t;
    while (t--) {
        //Your Code Blows HERE
        int n; cin >> n;
        int a[n]; fora(a, n);

        int sf = 0, ans = 0;

        for (int i = n - 1; i > -1; i--) {
            ans += a[i] * sf;
            sf += a[i];
            ans %= mod;
            sf %= mod;
        }

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

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

int main() {
    int a,b;
    cin>>a>>b;
    int c=a+b,d=a-b,e=a*b;
    c=max(c,d);
    c=max(c,e);
    cout<<c<<endl;
}


Measured memory_bytes: 256