akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
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,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  int x,y;cin>>x>>y;

  ll ans=0;

  if(x==1)ans+=300000;
  else if(x==2)ans+=200000;
  else if(x==3)ans+=100000;
  if(y==1)ans+=300000;
  else if(y==2)ans+=200000;
  else if(y==3)ans+=100000;

  if(x==1&&y==1)ans+=400000;

  out(ans);

  return 0;
}


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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

int main(){
    int N;
    cin >> N;
    vector<int64_t> C(N);
    for(int i=0; i<N; i++) cin >> C[i];
    sort(C.rbegin(), C.rend());
    int64_t ans = 0;
    for(int i=0; i<N; i++){
        int64_t res = C[i];
        mul(res, 1 + i * inv_mod(2) % MOD);
        add(ans, res);
    }
    mul(ans, power_mod(2, 2*N-1));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
n=int(input())
data=[int(input()) for i in range(n)]
data.sort()


ans=0
head=0
tail=n-1

tmp=n//2
for i in range(n-1):
    if(i%2==0):
        ans+=abs(data[tmp] - data[head])
        tmp=head
        head+=1
    else:
        ans+=abs(data[tmp] - data[tail])
        tmp=tail
        tail-=1

if(i%2==1):
    tmp_ans=ans
    ans=0
    head=0
    tail=n-1

    tmp=n//2
    for i in range(n-1):
        if(i%2==1):
            ans+=abs(data[tmp] - data[head])
            tmp=head
            head+=1
        else:
            ans+=abs(data[tmp] - data[tail])
            tmp=tail
            tail-=1
    ans=max([tmp_ans,ans])

print(ans)

Measured memory_bytes: 7512
N = int(input())
A = list(map(int,input().split()))
a_s = sum(A)
lis=[0]*(N-1)
tmp = 0
sub=0
for i,a in enumerate(A[:-1:]):
  x = A[i]*2-tmp
  sub+=x
  lis[i]=x
  tmp = x
  
ans = [0]*N
a = a_s-sub
ans[0]=a
for i in range(1,N):
  if i%2==1:
    ans[i]=lis[i-1]-a
  else:
    ans[i]=lis[i-1]+a
    
print(*ans)

Measured memory_bytes: 17720
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using CHY72;

namespace CHY72{
    
    public class PointXY<T>where T:IComparable {
        public T X , Y;
        public bool Flag = false;
        public PointXY(T _X,T _Y) {
            X = _X; Y = _Y;
        }
        public static bool operator ==(PointXY<T> P1, PointXY<T> P2) {
            return (P1.X.CompareTo( P2.X) == 0 && P1.Y.CompareTo (P2.Y) == 0);
        }
        public static bool operator !=(PointXY<T> P1, PointXY<T> P2) {return !(P1 ==P2);}
        public override int GetHashCode() {return X.GetHashCode() ^ Y.GetHashCode();}
        public override bool Equals(object obj) {
            if (obj == null || this.GetType() != obj.GetType()) {return false;}
            return (this == (PointXY<T>)obj);
        }         

    }
    
}    

public class Program {
    static bool ReadLine_1(ref int num1, bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str);
        return (Fin0 && num1 == 0);
    }
    static int  ReadLine_1() {
        return  int.Parse(Console.ReadLine());
    }
    static bool ReadLine_2(ref int num1, ref int num2, char Spliter = ' ', bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str.Split(Spliter)[0]);
        num2 = int.Parse(str.Split(Spliter)[1]);
        return (Fin0 && num1 == 0);
    }
    static int[] ReadLine72(char Spliter = ' ') {
        return Console.ReadLine().Split(Spliter).Select(s => int.Parse(s)).ToArray();
    }

    const int DefaultMax = 727272;
    static int w, h;
    static int[][] Map;
    static bool[][] Checked;

    static bool Check(int i ,int j) {
        if (Map[i][j] == 0) { return false; }
        else if (Map[i][j] == 1 && Checked[i][j]) {return false;}
        else if (Map[i][j] == 1 && !Checked[i][j]) {
            Checked[i][j] = true;
            if (i > 0 && j > 0) { Check(i - 1, j - 1); }
            if (i > 0 )         { Check(i - 1, j); }
            if (i > 0 && j < w-1) { Check(i - 1, j + 1); }
            if          (j < w-1) { Check(i , j + 1); }
            if (i < h-1 && j > 0) { Check(i + 1, j - 1); }
            if          (j > 0) { Check(i , j - 1); }
            if (i < h-1 && j < w-1) { Check(i + 1, j + 1); }
            if (i < h-1)          { Check(i + 1, j ); }
            return true;
        }
        return false;
    }

    static void Main(string[] args) {
        while (true) {
            int output = 0;
            w = 0; h = 0;
            if (ReadLine_2(ref w, ref h)) return;
            Map= new int[h][];
            Checked = new bool[h][];
            for (int i = 0; i < h; i++) {
                 Map[i] = ReadLine72();
                Checked[i] = new bool[w];
            }
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (Check(i, j)) output++;
                }
            }
            Console.WriteLine(output);
        }
    }
}

Measured memory_bytes: 6304
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int num[2];
char matrix[51][51];	
int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
bool solve_problem(int,int);

int get_problem(){
int width, height;
	
	cin >> width >> height; cin.ignore();
	bool a =	solve_problem(width,height);

	if(a == true) printf("Yes");
	if(a == false) printf("No");
	
}

bool solve_problem(int width, int height){
	bool answer = true; 
	string line;
	for(int i= 0; i < height; i++){
		getline(cin, line);
		for(int j = 0; j < width; j++){
				matrix[i][j] = line[j];
		}
	}

	
	for(int i= 0; i < height; i++){
		for(int j = 0; j < width; j++){
			if(matrix[i][j] == '#'){
				//cout << -3;
				answer = false;
				for(int k = 0; k < 4; k++){
					int nx = j + dx[k], ny = i + dy[k];
					if(0 <= nx && nx < width && 0 <= ny && ny <= height && matrix[ny][nx] == '#') answer = true;
				}
				if(answer == false) return false;
			}		
		}
	}
	return true;
}

int main() {
	get_problem();
	return 0;	

}

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

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define repi(i,j,N) for(int (i)=(j);(i)<(N);(i)++)
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define ll long long

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;

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

	int n;cin>>n;
	vi a;
	for(int i=0;i<n;i++) {
        int c;cin>>c;
        a.pb(c);
	}

	vi dp(n,0);
	dp[1]=abs(a[0]-a[1]);

	for(int i=2;i<n;i++) {
        dp[i] = min(dp[i-1] + abs(a[i-1]-a[i]),dp[i-2] + abs(a[i-2]-a[i]));
	}

    cout<<dp[n-1];

    return 0;
}


Measured memory_bytes: 1144
N=int(input())

A=[]
A=list(map(int,input().split()))
wa=sum(A)
AA=[0]*(10**5+1)
for i in A:
    AA[i]=AA[i]+1
Q=int(input())
B=[0]*Q
C=[0]*Q
for i in range(Q):
    B[i],C[i]=map(int,input().split())
    #print('{wa},{C},{B},{AA}'.format(wa=wa,C=C[i],B=B[i],AA=AA[B[i]]))
    #print('{wa},{C},{B},{AA}'.format(wa=wa, C=C[i], B=B[i], AA=AA[B[i]]))
    wa=wa+(C[i]-B[i])*AA[B[i]]
    AA[C[i]]=AA[C[i]]+AA[B[i]]
    AA[B[i]]=0
    print(wa)




Measured memory_bytes: 86032
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

#define hi(x) ((x)>>16)
#define lo(x) ((x)&0xffff)

struct comp{
    bool operator()(const unsigned a, const unsigned b){return hi(a)*lo(a) < hi(b)*lo(b);}
};

int main(){
	int n,w,d;
	for(;scanf("%d%d%d",&n,&w,&d),w;){
	vector<unsigned> v;
	v.push_back((w<<16)+d);
	for(;n--;){
		int p,s,state=0;
		scanf("%d%d",&p,&s);p--;
		s%=hi(v[p])+lo(v[p]);
		
		unsigned x=hi(v[p]),y=lo(v[p]),_x=0,_y=0;
		for(;s--;)
			if(state==0){_x++;if(_x==x)state=1;}else if(state==1)_y++;
		unsigned x1, x2, y1, y2;
		switch(state){
			case 0:{
				x1=_x;x2=x-_x;
				y1=y2=y;
				break;
			}
			case 1:{
				x1=x2=x;
				y1=_y;y2=y-_y;
				break;
			}
		}
		
		v.erase(v.begin()+p);
		if(x1*y1>x2*y2){
			v.push_back((x2<<16)+y2);
			v.push_back((x1<<16)+y1);
		}else{
			v.push_back((x1<<16)+y1);
			v.push_back((x2<<16)+y2);
		}
	}
	
	sort(v.begin(), v.end(), comp());
	for(;v.size();){
		printf("%d", hi(v[0])*lo(v[0]));
		v.erase(v.begin());
		if(v.size())printf(" ");
	}
	printf("\n");
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a = 1, b = 1, i = 1;
	while ((a != 0)||(b != 0)){
		if (i != 1)
			cout << endl;
		i++;
		cin >> a >> b;
		if ((a != 0)||(b != 0))
			for (int i = 1; i <= a; i++){
				for (int j = 1; j <= b; j++){
					if ((i % 2 == 0)&&(j % 2 == 1))
						cout << '.';
						else if ((i % 2 == 1)&&(j % 2 == 0))
							cout << '.';
							else cout << '#';
				}
				cout << endl;
			}
	}
}


Measured memory_bytes: 3084
// Practice AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let mut vs = vec![];
    for _ in 0 .. n {
        vs.push(get!());
    }
    vs.sort();
    let mut ans = vs[0] as f64;
    for &v in vs.iter() {
        ans = (ans + v as f64) / 2.0;
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn a() {
    let s = read!(String);
    let t = read!(String);

    let c_s: Vec<char> = s.chars().collect::<Vec<char>>();
    let t_s: Vec<char> = t.chars().collect::<Vec<char>>();
    let mut ans = 0;
    for i in 0..c_s.len() {
        if c_s[i] == t_s[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn b() {
    let (a, b) = read!(usize, usize);
    if b == 1 {
        println!("0");
        return;
    }
    let mut ans = 1;
    let mut cnt = a;
    while cnt < b {
        ans += 1;
        cnt += a - 1;
    }
    println!("{}", ans);
}

fn c() {
    let n = read!(usize);
    let h: Vec<usize> = read![[usize]];

    // 最長部分減少列（ただし連続）の長さを求める その長さ-1が答え
    let mut max_len = 0;
    let mut len = 0;
    let mut prev_h = 0;
    for i in 0..n {
        if prev_h >= h[i] {
            prev_h = h[i];
            len += 1;
        } else {
            prev_h = h[i];
            if max_len < len {
                max_len = len;
            }
            len = 1;
        }
    }
    if max_len < len {
        max_len = len;
    }
    println!("{}", max_len - 1);
}

fn d() {
    let n = read!(usize);

    let ans = (n * (n - 1)) / 2;
    println!("{}", ans);
}

fn e() {
    unimplemented!();
}

fn f() {
    unimplemented!();
}

fn main() {
    d();
}


Measured memory_bytes: 4476
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long LL;
int n,m;
LL a[100000+10];
int par[100000+10];
priority_queue<LL> mini[100000+10];

int fpar(int x){
	if (par[x]==-1)return x;
	par[x]=fpar(par[x]);
	return par[x];
}
priority_queue <LL > pq1;
LL ans=0;
int main(){
	scanf("%d%d",&n,&m);
	for (int f1=0;f1<n;f1++)scanf("%lld",&a[f1]);
	for (int f1=0;f1<n;f1++){par[f1]=-1;}
	for (int f1=0;f1<m;f1++){
		int i,j;
		scanf("%d%d",&i,&j);
		i=fpar(i);
		j=fpar(j);
		par[j]=i;
	}
	for (int f1=0;f1<n;f1++){
		int j=fpar(f1);
		mini[j].push(-a[f1]);
	}
	if (n==1+m){
		printf("0\n");
		return 0;
	}
	for (int f1=0;f1<n;f1++){
		if (par[f1]==-1){
			ans-=mini[f1].top();
			mini[f1].pop();
			while (!mini[f1].empty()){
				pq1.push(mini[f1].top());
				mini[f1].pop();
			}	
		}
	}
	
	if (int(pq1.size())>=n-m-2){
		for (int f1=1;f1<=n-m-2;f1++){
			ans-=pq1.top();
			pq1.pop();
		}
		printf("%lld\n",ans);
	} else printf("Impossible\n");
}


Measured memory_bytes: 7680
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n, y;
  cin >> n >> y;
  // a + b + c = n
  // 10000*a + 5000*b + 1000*c = y
  rep(a,2001) {
    rep(b,2001) {
      int c = n - a - b;
      if (c < 0) continue;
      int total = 10000*a + 5000*b + 1000*c;
      if (total == y) {
        cout << a SP b SP c << endl;
        return 0;
      }
    }
  }
  cout << -1 SP -1 SP -1 << endl;
  return 0;
}

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define ok cout << "ok" << endl;
#define sp << " " <<
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const ll inf = 9e18;
template<typename T1, typename T2> ll ceill(T1 a, T2 b){ return (a+b-1)/b; }
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

class debug
{
public:
    typedef long long ll;
    template<typename T> void vd(vector<T> vec);
    template<typename T> void vd2(vector<vector<T>> vec);
    template<typename T> void ad(T *arr, ll n);
    template<typename T, size_t N> void ad2(T (&arr)[N], ll n);
    template<typename T> void md(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vd(vector<T> vec)
{
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T> void debug::vd2(vector<vector<T>> vec)
{
    for(auto vv : vec) for(auto vvv : vv) cout << vvv << " ";
    cout << endl;
}

template<typename T> void debug::ad(T *arr, ll n)
{
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T, size_t N> void debug::ad2(T (&arr)[N], ll n)
{
    for(int i=0; i<=N; i++) for(int j=0; j<=n; j++) cout << arr[i][j] << " ";
    cout << endl;
}

template<typename T> void debug::md(T mp)
{
    cout << "key : value" << endl;
    for(auto const& m : mp) cout << m.first << " : " << m.second << endl;
    cout << endl;
}
debug debug;

class APoor {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int a, b, c;
	    in >> a >> b >> c;
	    if(a == b && b != c) ans(true, out);
	    else if(a == c && b != c) ans(true, out);
	    else if(b == c && a != b) ans(true, out);
	    else ans(false, out);
	}
};


int main() {
	APoor solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main(){
	int h, n, sum_a;
	string ans;
	cin >> h >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sum_a = 0;
	for(int i=0; i<n; i++){
		sum_a += a[i];
	}
	if(sum_a >= h){
		ans = "Yes";
	}else{
		ans = "No";
	}
	cout << ans << endl;
	return 0;
	
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}





int main() {
    int D;
    cin >> D;
    vector<int>c(26);
    rep(i,26) cin >> c[i];
    vector<vector<ll>>s(D,vector<ll>(26));
    rep(i,D) {
        rep(j,26) cin >> s[i][j];
    }
    vector<ll>t(D);
    vector<ll>last(26);
    vector<ll>ans;
    ll score = 0;
    ll init_score = 0;
    rep(i,D) {
        ll tmp = 0;
        ll contest = -1;
        for(int t = 1;t<=26;t++) {
            score += s[i][t-1];
            last[t-1] = i+1;
            rep(j,26) {
                score -= c[j]*((i+1)- last[j]);
            }
            if(tmp<score) {
                tmp = score;
                contest = t;
            }
            score = init_score;
        }
        init_score = tmp;
        ans.push_back(contest);
    }
    rep(i,D) {
        cout << ans[i] << endl;
    }
    
}

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

#define N 105

int n,A[N],m;

int main(){
	cin>>n>>m;
	for(int i=1;i<=n;++i)
	cin>>A[i];
	sort(A+1,A+n+1);
	int Ans;
	Ans=0;
	for(int i=1;i<=n;++i)
	if(m-A[i]>=0)
	Ans++,m-=A[i];
	if(m>0&&Ans==n)
	Ans--;
	cout<<Ans<<endl;
	return 0;
}

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

int main() {
	ll n,flag=0;
	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
		if(arr[i]%2==0 && (arr[i]%3!=0 && arr[i]%5!=0))
		flag=1;
	}
	if(flag==0)
	cout<<"APPROVED"<<endl;
	else
	cout<<"DENIED"<<endl;
	
	return 0;
}

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

/*iamsorry*/
 
#define thegamebegins   ios_base::sync_with_stdio(false); cin.tie(nullptr); //cout.tie(nullptr);
#define fileio          freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define int             long long
#define float           long double
#define E               "\n"
#define S               " "
#define INF             9e18
#define M7              1000000007
#define M9              998244353
#define PI              3.141592653589793238L
#define lcm(a,b)        ((a)/__gcd((a),(b)))*(b)
#define midl(l,r)       ((l)+((r)-(l))/2)
#define prec(n)         fixed<<setprecision(n)
#define in(arr,n)       for(int i=0; i<(n); ++i) cin>>arr[i]
#define fi(i,x,y)       for(int i=(x); i<(y); ++i)
#define fb(i,x,y)       for(int i=(x); i>=(y); --i)
#define fa(i,s)         for(auto i:(s))
#define fp(i,s)         for(auto i=(s).begin(); i!=(s).end(); ++i)
#define pf(i,s)         for(auto i=(s).rbegin(); i!=(s).rend(); ++i)
#define all(s)          (s).begin(), (s).end()
#define rev(s)          (s).rbegin(), (s).rend()
#define vc              vector
#define fr              first
#define sc              second
#define pb              push_back
#define eb              emplace_back
#define ins             insert
#define emp             emplace

#ifdef DOPPELLEBEN
template<typename T1,typename T2> ostream& operator<<(ostream &out,const pair<T1,T2> &p) {return out<<'('<<p.first<<", "<<p.second<<')';}
template<typename T> auto operator<<(ostream &out,T &&x)->decltype(x.begin(),out) {out<<'{'; for(auto it=x.begin();it!=x.end();++it)out<<*it<<(it==prev(x.end())?"":", "); return out<<'}';}
void dump() {}
template<typename T,typename... Args> void dump(T &&x,Args... args) {cerr<<" "<<x; dump(args...);}
struct ND{~ND(){cerr<<"]\n";}};
#define dbg(x...) cerr<<" ["<<(strcmp(#x,"")?#x ":":""),dump(x),ND(),cerr<<""
#else
#define dbg(...) 0 && cerr
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rann(n) rng()%(n)
#define ran(l,r) (l)+rng()%((r)-(l)+1)

template<typename T,typename t> T maxm(T &x,t y) {if(y>x)x=y; return x;}
template<typename T,typename t> T minm(T &x,t y) {if(y<x)x=y; return x;}
template<typename T> int sz(T &&x) {return (int)((x).size());}

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int,int>;
using mii = map<int,int>;
using vvi = vector<vector<int>>;
using vpii = vector<pair<int,int>>;
using seti = set<int>;
using setd = set<int,greater<int>>;
using pqmx = priority_queue<int>;
using pqmn = priority_queue<int,vector<int>,greater<int>>;

/*__*/

void Main() {
    int n,d; cin>>n>>d;
    int ans=0;
    fi(i,0,n) {
        int x,y; cin>>x>>y;
        ans+=sqrt(x*x+y*y)<=d;
    }
    cout<<ans;
}

signed main() {
    thegamebegins
    
    int T=1;
    // cin>>T;
    while(T--) Main();

    return 0;
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n, q; cin >> n;
  lint s = 0;
  map<lint, int> m;
  rep(i, n){
    lint a; cin >> a; m[a]++;
  }
  for(auto p: m) s += p.fi * p.se;
  cin >> q;
  rep(i, q){
    lint b, c, d; cin >> b >> c;
    d = c - b;
    s += m[b]*d;
    m[c] += m[b];
    m[b] = 0;
    cout << s << "\n";
  }
  return 0;
}

Measured memory_bytes: 9528
#include<stdio.h>
#define MAX 100000

struct Card{
  char s;
  int v;
};

struct Card L[MAX], R[MAX];

void merge(struct Card A[], int n, int left, int mid, int right){
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  //左部分のマージ
  for( i = 0 ; i < n1 ; i++ ){
    L[i] = A[left + i];
  }
  // 右部分のマージ
  for( i = 0 ; i < n2 ; i++ ){
    R[i] = A[mid + i];
  }
  L[n1].v = R[n2].v = 2000000000;
  i = j = 0;
  for( k = left ; k < right ; k++){
    //　L側とR側に振り分け
    if( L[i].v <= R[j].v ){
      A[k] = L[i++];
    }else{
      A[k] = R[j++];
    }
  }
}

void m_sort(struct Card A[], int n, int left, int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    m_sort(A, n, left, mid);
    m_sort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

// 要素を分割し、要素の標準（ピボット）となる要素の番号を返す。
int partition(struct Card A[], int n, int p, int r){
  int i, j;
  struct Card t, x;
  // t 一時避難用、x元カード保持
  x = A[r];
  i = p - 1;
  for( j = p ; j < r ; j++ ){
    if( A[j].v <= x.v ){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i+1];
  A[i+1] = A[r];
  A[r] = t;
  return i + 1;
}

void quickSort(struct Card A[], int n ,int p, int r){
  int q;
  if( p < r ){
    // 要素の分割化
    q = partition(A, n, p, r);
    // 分割した左部分
    quickSort(A, n, p, q-1);
    // 分割した右部分
    quickSort(A, n, q+1, r);
  }
}

int main(){
  int i, n, v;
  //クイックソートとマージソートを比べるために二つ配列を用意する
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d", &n);
  for( i = 0 ; i < n ; i++){
    scanf("%s %d", S, &v);
    A[i].s = B[i].s = S[0];
    A[i].v = B[i].v = v;
  }
  //マージソート
  m_sort(A, n, 0, n);
  //クイックソート
  quickSort(B, n, 0, n-1);

  for( i = 0 ; i < n ; i++){
    //クイックソートとマージソートを比べる
    if( A[i].s != B[i].s ) stable = 0;
  }

  if( stable == 1 ) printf("Stable\n");
  else printf("Not stable\n");
  for(i = 0 ; i < n ; i++){
    printf("%c %d\n", B[i].s, B[i].v);
  }
  return 0;
}



Measured memory_bytes: 4044
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  double a,b;
  cin>>a>>b;
  YESNO(floor(a/2+0.5)>=b);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 // int t;
 // cin>>t;
 // while(t--){
    string a,b;
    cin>>a;
    int cnt=0;
    cin>>b;
    int x=a.size();
    for(int i=0;i<x;++i){
      if(a[i]!=b[i])
      ++cnt;
    }
    cout<<cnt;
    // }
  return 0;
}

Measured memory_bytes: 3860
height, width = map(int, input().strip().split())


def get_min(H, W):
    min_whole = 100000000000
    for h in range(1, H):
        S_a = h * W
        w = W // 2
        S_b = (H - h) * w
        S_c = (H - h) * (W - w)
        pat1 = max(S_a, S_b, S_c) - min(S_a, S_b, S_c)
        pat2 = 1000000000

        h_b = (H - h) // 2
        S_b = h_b * W
        S_c = (H - h - h_b) * W
        tmp = max(S_a, S_b, S_c) - min(S_a, S_b, S_c)
        if pat2 > tmp:
            pat2 = tmp
        min_loop = min(pat1, pat2)
        if min_whole > min_loop:
            min_whole = min_loop
    return min_whole


port = get_min(height, width)
land = get_min(width, height)
print(min(port, land))

Measured memory_bytes: 3064
#pragma GCC optimize(3)
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7ffffffe
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double dl;
using namespace std;

signed main(){
	int n,k;
	cin>>n>>k;
	vector<int> v(n);
	rep(i,n){
		cin>>v[i];
	}
	double d=0.00000000;
	rep(i,k){
		d+=(v[i]+1.00000000)/2.00000000;
	}
	double ans=-1.00000000;
	rep(i,n-k+1){
		ans=max(ans,d);
		d-=(v[i]+1.00000000)/2.00000000;
		d+=(v[i+k]+1.00000000)/2.00000000;
	}
	printf("%.08lf",ans);
	return 0;
}

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

int main()
{
  int a,b;
  cin>>a>>b;
  int cnt=0;
  for (int i=a; i<=b;i++)
  {
    int r= i%10;
    int s= i/10000%10;
    int t= i/10%10;
    int u= i/1000%10;
    if (r==s&&t==u) cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toInt)
    val a = Array(n) { readLine()!! }
    val b = Array(m) { readLine()!! }
    for (i in 0..n - m) {
        for (j in 0..n - m) {
            val found = (0 until m).all { y ->
                (0 until m).all { x -> a[i + y][j + x] == b[y][x] }
            }
            if (found) {
                println("Yes")
                return
            }
        }
    }
    println("No")
}


Measured memory_bytes: 38208
import sys


def main():
    _ = int(input())

    imps = sys.stdin.readlines()

    db = {}
    for imp in imps:
        c, k = imp.split(' ')
        if c == 'insert':
            db[k] = 0
        elif k in db:
            print('yes')
        else:
            print('no')


main()

Measured memory_bytes: 108356
#include <stdio.h>

int main(void)
{
	int x, a, b;

	scanf("%d %d %d", &x, &a, &b);
	
	if (a >= b) {
		printf("delicious\n");
	}
	else if (b - a <= x) {
		printf("safe\n");
	}
	else {
		printf("dangerous\n");
	}

	return 0;
}

Measured memory_bytes: 128
//region #include <cp_helper>
#include <algorithm>
#include <array>
#include <bitset>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define io() ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vii vector<ii>
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define pin(n) in(n.first) >> n.second
#define vin(a, n) for (int i=0; i<n; i++) in(a[i])
#define viin(a, n) for (int i=0; i<n; i++) in2(a[i].first, a[i].second);
#define out(n) cout << n
#define outs(n) out(n) << ' '
#define outn(n) out(n) << '\n'
#define out2(n, m) cout << n << ' ' << m
#define out2s(n, m) out2(n, m) << ' '
#define out2n(n, m) out2(n, m) << '\n'
#define pout(n) out2(n.first, n.second)
#define pouts(n) pout(n) << ' '
#define poutn(n) pout(n) << '\n'
#define vout(a) for (auto i : a) outs(i)
#define viout(a) for (auto i : a) out2n(i.first, i.second)
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pp(a, b) emplace_back(make_pair(a, b))
#define fori(i, n) for (int i=0; i<n; i++)
#define foris(i, a, b) for (int i=a; i<b; i++)
#define ford(i, n) for (int i=n-1; i>=0; i--)
#define fords(i, a, b) for (int i=a; i>=b; i--)
#define forr(i, a) for (auto i : a)
const int mod = (int)(1e9) + 7;
//endregion

int main() {
    io();
    string s;
    in(s);
    int n = s.length(), i=0, ans=0, stat=0;
    while (i<n) {
        ans++;
        if (stat) {
            stat = 0;
            i++;
        } else {
            if (s[i] != s[i-1]) i++;
            else if (i>=n-1) {
                ans--;
                break;
            } else {
                stat = 1;
                i += 2;
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 720
N=int(input())
four,two,one=0,0,0
for a in map(int,input().split()):
    if a%4==0:
        four+=1
    elif a%2==0:
        two+=1
    else:
        one+=1
if two==0:
    if four+1>=one:
        print('Yes')
    else:
        print('No')
else:
    if four>=one:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 11480
N = int(input())
dp = [[0] * 3 for j in range(N)]
d = []
for i in range(N):
    a, b, c = map(int, input().split())
    if i == 0:
        dp[0][0] = a
        dp[0][1] = b
        dp[0][2] = c
    else:
        d.append((a, b, c))


for i in range(1, N):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i][k] = max(dp[i][k], dp[i - 1][j] + d[i - 1][k])

num = 0
for i in range(3):
    num = max(num, dp[N - 1][i])
print(num)

Measured memory_bytes: 40352
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> x_m, x_p;
    x_p.push_back(0);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x < 0) {
            x_m.push_back(-x);
        } else if (x > 0) {
            x_p.push_back(x);
        } else {
            k--;
            if (k == 0) {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    x_m.push_back(0);
    reverse(all(x_m));
    int ans = INT_MAX;
    //左からl個取ると思う
    for (int l = 0; l <= k; l++) {
        int r = k - l;
        if (l >= x_m.size() || r >= x_p.size()) {
            continue;
        }
        int f = min(x_m[l], x_p[r]);
        int s = max(x_m[l], x_p[r]);
        ans = min(ans, f * 2 + s);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, int> P3;
const ll MOD = ll(1e9)+7;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-11;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int T;
    cin >> T;
    REP(t,T){
        int n, k, ans = 0;
        cin >> n >> k;
        vector<int> x(n), d(n-1);
        REP(i,n) cin >> x[i];
        REP(i,n-1) d[i] = x[i+1] - x[i];
        SORT(d);
        REP(i,n-k) ans += d[i];
        cout << ans << endl;
    }
    return 0;
}



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

int a[5];
int sum = 0;
int ave = 0;

int main(){
	for(int i = 0; i < 5; i++){
		cin >> a[i];
	}
	
	for(int i = 0; i < 5; i++){
		if(a[i] < 40)
			a[i] = 40;
	}
	
	for(int i = 0; i < 5; i++){
		sum += a[i];
	}
	ave = sum/5;
	cout << ave << endl;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll h, w;
  cin >> h >> w;
  vector<vl> g(h + 2, vl(w + 2, -2));
  queue<pair<int, int>> q;
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) {
    char c;
    cin >> c;
    if(c == '#') {
      g[i][j] = 0;
      q.push({i, j});
    } else
      g[i][j] = -1;
  }
  while(!q.empty()) {
    int i = q.front().first;
    int j = q.front().second;
    q.pop();
    rep(k, 4) {
      int ni = i + dir[k];
      int nj = j + dir[k + 1];
      if(g[ni][nj] != -1) continue;
      g[ni][nj] = g[i][j] + 1;
      q.push({ni, nj});
    }
  }
  ll ans = 0;
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) ans = max(ans, g[i][j]);
  cout << ans << endl;
}

Measured memory_bytes: 19172
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        
        Scanner scanner = new Scanner(System.in);
        String[] arr = new String[2];
        for(int i = 0;i < arr.length;i++) {
            arr[i] = scanner.nextLine();
        }

        String[] strmaster = arr[0].split(" ");

        Integer[] nm = new Integer[2]; 
        for (int i = 0; i < strmaster.length; i++) {
            nm[i] = Integer.parseInt(strmaster[i]);
        }

        int n = nm[0];
        int m = nm[1];

        strmaster = arr[1].split(" ");
        List<Integer> listA = new ArrayList<>(); 
        for (int i = 0; i < strmaster.length; i++) {
            listA.add(Integer.parseInt(strmaster[i]));
        }
        
        Collections.sort(listA, Collections.reverseOrder());

        int totalVotes = 0;
        for (Integer integer : listA) {
            totalVotes = totalVotes + integer;
        }

        boolean flag = true;
        for (int i = 0; i < m; i++) {
            if (listA.get(i) < ((totalVotes + (4 * m) - 1) / (4 * m))) {
                flag = false;
            }
        }
        
        if (flag) {
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        scanner.close();
    }
}

Measured memory_bytes: 21844
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //------------------------------
    int s;cin>>s;
    int h=s/3600;s%=3600;
    int m=s/60;s%=60;
    cout<<h<<":"<<m<<":"<<s<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------







































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

int main()
{
    int N, T;
    cin >> N >> T;
    int minc = 1001;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int c, t;
        cin >> c >> t;
        if (T < t)
            continue;
        if (c < minc)
        {
            ans = i;
            minc = c;
        }
    }
    if (minc == 1001)
        cout << "TLE" << endl;
    else
        cout << minc << endl;
    return 0;
}

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

int main() {
    int a[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};

    int x, y;
    cin >> x >> y;

    if (a[x] == a[y]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>

#define mod 1000000007

using namespace std;
 
int main(void){
	
	string s;
	
	cin >> s;
	
	cout << s.rfind("Z")-s.find("A")+1;
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <unordered_set>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.begin(), v.end(), greater<int>);
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge{
    int to, cost;
};

struct dt{
    int t, x, y;
};

int main(){
    int n;
    cin >> n;
    int t, x, y;
    t = x = y = 0;
    REP(i, n){
        int tt, tx, ty;
        cin >> tt >> tx >> ty;
        int cost = abs(tx - x) + abs(ty - y);
        int ct = tt - t;
        if(cost > ct || (ct - cost) % 2 == 1){
            cout << "No" << endl;
            return 0;
        }else{
            t = tt; y = ty; x = tx;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define INF 0x3f3f3f3f

using namespace std;

typedef pair<int, int> TYPE;

template<typename tp> inline void read(tp &x) {
	x = 0; register char c = getchar(); register bool f = 0;
	for (; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
	for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
	if (f) x = -x;
}

TYPE d[100010];
int n;

int main() {
    read(n);
    int maxl = 0, minr = INF, maxn = 0;
    for (int i = 1; i <= n; ++i) {
        read(d[i].first), read(d[i].second);
        maxl = max(maxl, d[i].first);
        minr = min(minr, d[i].second);
        maxn = max(maxn, d[i].second - d[i].first + 1);
    }
    sort(d + 1, d + n + 1);
    for (int i = n - 1; i > 0; --i) {
        d[i].second = min(d[i].second, d[i + 1].second);
    }
    int ans = 0;
    for (int i = 1; i < n; ++i) {
        ans = max(ans, ((minr - d[i].first + 1) > 0? (minr - d[i].first + 1): 0) + ((d[i + 1].second - maxl + 1) > 0? (d[i + 1].second - maxl + 1): 0));
    }
    printf("%d", max(ans, maxn + (minr - maxl + 1 < 0? 0: minr - maxl + 1)));
    return 0;
} 


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define ALL(x) x.begin(),x.end()
 
template <typename T>
void cetak(T t){cout << t << ')' << endl;}
template <typename T, typename... V>
void cetak(T t, V... v) {cout << t; if (sizeof...(v)) cerr << ", "; cetak(v...);}
 
#define debug(x...) cout<< '(' << #x << ") = ("; cetak(x) 
#define sz(x) (int)(x.size())
#define lt(x) (int)(x.length())

const int MOD = 1e9 + 7;
const int mx = 1e5 + 10;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
    vector<int> ve(n);
    iota(ALL(ve), 0);
    double sum = 0;
    do{
        for(int i = 1; i < n; i++){
            sum += sqrt((x[ve[i]] - x[ve[i - 1]]) * (x[ve[i]] - x[ve[i - 1]]) + (y[ve[i]] - y[ve[i - 1]]) * (y[ve[i]] - y[ve[i - 1]]));
        }

    }while(next_permutation(ALL(ve)));
    for(int i = 1; i <= n; i++) sum /= (double)(i);
    cout << fixed << setprecision(9) << sum << endl;
}


Measured memory_bytes: 256