akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static ArrayList<String> s = new ArrayList<String>();
	public static void main(String[] args) throws IOException {
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n= in.nextInt();
		int [] a= new int[n];
		int num4=0;
		int num2= 0;
		int b=0;
		for (int i = 0; i < a.length; i++) {
			a[i]= in.nextInt();
			if(a[i]%4==0){
				num4++;
			}
			else if(a[i]%2==0){
				num2++;
			}
			else{
				b++;
			}
		}
		if(b==num4+1&&num2==0){
			System.out.println("Yes");
			return;
		}
		if(b>num4){
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
		
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

		public double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		public String next() throws IOException {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
				return next();
			}
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}



Measured memory_bytes: 36512
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){

  SCIN(s);CIN(k);
  int n = s.size();
  V v(n);
  REP(i,n)v[i]=s[i]-'a';

  for(int i=0;i!=n-1;++i){
    if(!v[i])continue;
    if(26-v[i]<=k){
      k-=(26-v[i]);
      v[i]=0;
    }
  }

  v[n-1]+=k;
  v[n-1]%=26;
  REP(i,n)
    cout<<char('a'+v[i]);
  ENDL;
  return 0;

  return 0;
}

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

#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <ull> vu;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pi;
typedef vector <pair <int, int>> vpi;

int a, b, c;

void read() {
  cin >> a >> b >> c;
}

void solve() {
  int ans = 0;
  int x = min({a, b, c});
  int z = max({a, b, c});
  int y = a ^ b ^ c ^ x ^ z;
  ans += z - y;
  y = z;
  x += ans;
  ans += (z - x) / 2;
  if ((x & 1) != (z & 1))
    ans += 2; 
  cout << ans;
}

int main() {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  //cin >> t;           // PLEASE REMOVE IT IF NEEDED
  while(t) {
    --t;
    read();
    solve();
  }
  return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int MAXN = (int)1e5 + 10 ;

char str[MAXN]  ;
int dp[MAXN][2] ;

int getc (char c){
    if (c == '1' || c == '4' || c == '7') return 1 ;
    if (c == '2' || c == '8') return 2 ;
    return 3 ;
}

int main(){
    while (~scanf("%s",str)){
        if (str[0]=='#') break ;
        int n = strlen(str) ;
        dp[1][0] = dp[1][1] = 0 ;
        for (int i = 2 ; i <= n ; i++){
            char c = str[i-1] ;
            int now = getc(c) , last = getc(str[i-2]) ;
            dp[i][0] = dp[i-1][0] + 1 ;
            if (now <= last)
                dp[i][0] = min(dp[i][0] , dp[i-1][1]) ;
            dp[i][1] = dp[i-1][1] + 1 ;
            if (now >= last)
                dp[i][1] = min(dp[i][1] , dp[i-1][0]) ;
        }
        printf("%d\n",min(dp[n][0],dp[n][1]));
    }
    return 0 ;
}

Measured memory_bytes: 1844
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=100005;
i64 a[maxn];
int n,q,m;
inline int erfen(i64 v,int m){
	int l=0,r=m,ans=0;
	while(l<=r){
		int md=(l+r)>>1;
		if(a[md]<=v)
			ans=md,l=md+1;
		else
			r=md-1;
	}return ans;
}
i64 t[maxn];
i64 cnt[maxn];
int main(){
	read(n);read(q);//int m=0;
	a[m=1]=n;
	rep(i,1,q){
		i64 x;scanf("%lld",&x);
		while(m&&a[m]>=x)m--;
		a[++m]=x;
	}t[m]=1;
	per(i,m,2){
		i64 v=a[i];
		for(int pos=erfen(v,i-1);pos!=0;pos=erfen(v,i-1)){
			t[pos]+=t[i]*(v/a[pos]);
			v%=a[pos];
		}cnt[v]+=t[i];
	}
	cnt[a[1]]+=t[1];
	per(i,a[1],1)cnt[i]+=cnt[i+1];
	rep(i,1,n)printf("%lld\n",cnt[i]);
    return 0;
}


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

int table[200];
int dp1[1000001];
int dp2[1000001];

int main(){
	for(int i=0;i < 200;i++){
		table[i]=i*(i+1)*(i+2)/6;
	}
	for(int i=0;i < 1000001;i++) dp1[i]=dp2[i]=99999999;
	dp1[0]=dp2[0]=0;
	for(int i=0;i < 1000001;i++){
		for(int j=1;j < 200;j++){
			if(i+table[j] <= 1000000) dp1[i+table[j]] = min(dp1[i+table[j]],dp1[i]+1);
			if(table[j]%2 && i+table[j] <= 1000000) dp2[i+table[j]] = min(dp2[i+table[j]],dp2[i]+1);
		}
	}
	int n;
	while(cin >> n,n){
		cout << dp1[n] << " " << dp2[n] << endl;
	}
	return 0;
}



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

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


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    vector<string> s(N);
    for (int i=0;i<N;i++) cin >> s[i];
    string ans;
    for (int i=0;i<N;i++){
        if (s[i] == "AB"){
            if (A == 0 && B == 0){
                cout << "No" << "\n";
                return 0;
            } else if (A == 0){
                ans.push_back('A');
                A++; B--;
            } else if (B == 0){
                ans.push_back('B');
                A--; B++;
            } else{
                if (i==N-1){
                    ans.push_back('A');
                    A++; B--;
                } else {
                    if (s[i+1] == "BC"){
                        ans.push_back('B');
                        A--;B++;
                    } else {
                        ans.push_back('A');
                        A++;B--;
                    }
                }
            }
        } else if (s[i] == "BC"){
            if (B == 0 && C == 0){
                cout << "No" << "\n";
                return 0;
            } else if (B == 0){
                ans.push_back('B');
                B++; C--;
            } else if (C == 0){
                ans.push_back('C');
                B--; C++;
            } else{
                if (i==N-1){
                    ans.push_back('B');
                    B++; C--;
                } else {
                    if (s[i+1] == "AC"){
                        ans.push_back('C');
                        B--;C++;
                    } else {
                        ans.push_back('B');
                        B++;C--;
                    }
                }
            }
        } else {
            if (A == 0 && C == 0){
                cout << "No" << "\n";
                return 0;
            } else if (A == 0){
                ans.push_back('A');
                A++; C--;
            } else if (C == 0){
                ans.push_back('C');
                A--; C++;
            } else{
                if (i==N-1){
                    ans.push_back('A');
                    A++; C--;
                } else {
                    if (s[i+1] == "AB"){
                        ans.push_back('A');
                        A++;C--;
                    } else {
                        ans.push_back('C');
                        A--;C++;
                    }
                }
            }
        }
    }
    cout << "Yes" << "\n";
    for (int i=0;i<N;i++) cout << ans[i] << "\n";

    return 0;   
}

Measured memory_bytes: 6700
#include<stdio.h>

int main(void)
{
int a, b, c, d;
int s=0;

scanf("%d %d %d %d", &a, &b, &c, &d);
s+=(a>b)?b:a;
s+=(c>d)?d:c;
printf("%d\n", s);
return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		if(a < b && b < c)	System.out.println("Yes");
		else			System.out.println("No");
	}
}

Measured memory_bytes: 17160
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
	int n,t,x,y;
	int x1=0,y1=0,t1=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>t>>x>>y;
		if((t-t1)-abs(x-x1)-abs(y-y1)>=0 && ((t-t1)-abs(x-x1)-abs(y-y1))%2==0){
			t1=t;
			x1=x;
			y1=y;
		}
		else{
			cout<<"No"<<endl;
			return(0);
		}
	}
	cout<<"Yes"<<endl;
    return(0);
}

Measured memory_bytes: 3596
from collections import deque

n=int(input())
s=input()
q=deque([])
t=""

for i in s:
  if i=="(":
    q.append(i)
  else:
    if q:
      q.pop()
    else:
      t+="("
u=")"*len(q)
print(t+s+u)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define INF 1000000000000
#define MOD 1000000007LL
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;

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

int N; cin >> N;
VP ab(N-1); 
VVI G(N+1);
rep(i, 0, N-1) {
    cin >> ab[i].first >> ab[i].second;
    G[ab[i].first].emplace_back(ab[i].second);
    G[ab[i].second].emplace_back(ab[i].first);
}
map<PII, int> Gc; // Gc[edge] = color number
int K = 0;
rep(i, 1, N+1) K = max(K, (int)G[i].size());
cout << K << endl;

// BFS で着色
VI color(N+1, 0); // color[v] = 親との辺の色．木だから親は1つ．未訪問は0．
queue<int> que;
que.push(1); 
color[1] = -1;
while (!que.empty()) {
    int v = que.front(); 
    que.pop();

    int c = 1;
    for (int nv : G[v]) {
        if (color[nv]) continue; 

        if (c == color[v]) ++c;
        Gc[PII(v, nv)] = Gc[PII(nv, v)] = color[nv] = c;
        ++c;
        que.emplace(nv);
    }
}
for(PII p: ab) cout << Gc[p] << "\n";

}
// 書いて考える．場合分け
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 21376
#include <bits/stdc++.h>
using namespace std; using ll=int_fast64_t; using ld=long double; using pll=pair<ll,ll>; using pld=pair<ld,ld>;
void solve(); int main(){cin.tie(0); ios::sync_with_stdio(false); cout<<fixed<<setprecision(10); solve();}
#define fi first
#define se second
#define SELECTOR(_1,_2,_3,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
template<class T> void contout(const T &v){for(auto it=v.begin();it!=v.end();++it,cout<<(it!=v.end()?" ":"\n"))cout<<*it;}
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}

void solve(){
  ll n,m; cin>>n>>m;
  const ll inf=1<<30;
  auto A=make_v(n,n,inf);
  rep(_,m){
    ll a,b; cin>>a>>b;
    --a; --b;
    A[a][b]=1;
  }

  // Warshall-Floyd
  auto B=A;
  rep(k,n)rep(i,n)rep(j,n){
    B[i][j]=min(B[i][j],B[i][k]+B[k][j]);
  }

  // output
  ll len=inf;
  ll index=-1;
  rep(i,n){
    if(len>B[i][i]){
      len=B[i][i];
      index=i;
    }
  }
  if(len==inf){
    cout<<-1<<"\n";
    return;
  }

  // path restoration
  ll u,v;
  u=v=index;
  vector<ll> path{u};
  while(B[u][v]!=A[u][v]){
    rep(w,n){
      if(B[u][v]==A[u][w]+B[w][v]){
        u=w;
        path.push_back(w);
        break;
      }
    }
  }
  cout<<path.size()<<"\n";
  for(ll v:path) cout<<v+1<<"\n";
}

Measured memory_bytes: 18048
#include <stdio.h>

int main(){
	int a,b,c,d,result=0;
	
	scanf("%d%d%d%d",&a,&b,&c,&d);
	
	if(a>=b){result=result+b;}else{
		result=result+a;
		}
	
	if(c>=d){result=result+d;}else{
		result=result+c;
		}
	printf("%d",result);
	}

Measured memory_bytes: 128
import math
import sys
from itertools import accumulate
from functools import reduce
import queue
from fractions import gcd

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = list(map(int, sys.stdin.readlines()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

if __name__ == "__main__":
    n,k= map(int, sys.stdin.readline().split())
    h = list(map(int, sys.stdin.readlines()))
    h.sort()
    # print(h)
    ans=10**9
    for i in range(n-k+1):
        # print("i:",h[i])
        # print("i+k:",h[i+k-1])
        tmp=h[i+k-1]-h[i]
        ans=min(ans,tmp)
        # print("tmp:",ans)
    print(ans)

Measured memory_bytes: 16480
import math

x, n = map(int, input().split())
p = list(map(int, input().split()))

ans = -1
dif = 10000
for i in range(102):
    if i in p:
        continue
    else:
        if abs(x - i) < dif:
            ans = i
            dif = abs(x - i)

print(ans)


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    string s; cin >> s;

    int n = s.size();
    for(int i = 0; i < n; i++){
        if(i % 2 == 0 && (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) continue;
        if(i % 2 != 0 && (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')) continue;
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  
	ll h,n;
  	cin >> h >> n;
  	vi a(n);
  	rep(i,n) cin >> a[i];
  	ll x=0; 
  	rep(i,n) x+= a[i];
  	if(h<=x) Yes
    No
 	
  	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1e18;

ll C[51][51];

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

    ll N, A, B;
    cin >> N >> A >> B;

    vector<ll> V(N);
    for (auto&& v : V) {
        cin >> v;
    }

    sort(V.begin(), V.end(), greater<ll>());

    double ave = 0;
    double sum = 0;
    for (ll i = 0; i < A; i++) {
        sum += V[i];
    }
    ave = sum / A;
    for (ll i = A; i < B; i++) {
        sum += V[i];
        ave = max(ave, sum / (i + 1));
    }

    printf("%.15f\n", ave);

    for (ll i = 0; i <= N; i++) {
        for (ll j = 0; j <= i; j++) {
            if (j == 0 || j == i) {
                C[i][j] = 1;
            } else {
                C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
            }
        }
    }

    ll n = 0;
    for (auto v : V) {
        if (v == V[A - 1]) {
            n++;
        }
    }

    ll r = 0;
    for (ll i = 0; i < A; i++) {
        if (V[i] == V[A - 1]) {
            r++;
        }
    }

    if (V[0] == V[A - 1]) {
        ll ans = C[n][A];
        for (ll i = A; i < B && V[0] == V[i]; i++) {
            ans += C[n][i + 1];
        }
        printf("%lld\n", ans);
    } else {
        printf("%lld\n", C[n][r]);
    }

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
//#define mod 998244353ll
#define flagcount __builtin_popcount
#define flag(x) (1ll << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1ll << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll N;
    cin >> N;
    vector<string> S(N);
    loop(i, N) cin >> S[i];
    ll ans = 0;
    loop(i, N)
    {
        vector<string> check(N);
        loop(j, N)
        {
            string now = S[j] + S[j];
            string nownow = now.substr(i, N);
            check[j] = nownow;
        }
        bool C = true;
        loop(j, N)
        {
            loop(k, N)
            {
                if (check[j][k] != check[k][j])
                    C = false;
            }
        }
        if (C)
            ans += N;
    }
    putout(ans);
    return 0;
}


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

int main()
{
	int X, A, B;
	cin >> X >> A >> B;
	int distA = abs(X - A);
	int distB = abs(X - B);

	if (distA < distB)
		cout << "A";
	else
		cout << "B";

	return 0;
}

Measured memory_bytes: 256
N = int(input())
mod = 10 ** 9 + 7

if N < 3 :
    print(0)
else :
    # A0 G1 C2 T3
    # AGC,ACG,GACはすぐ消す
    # AGx,AxGにはCを足しちゃいけないことにする
    
    dp = [1] * 64
    dp[6] = dp[9] = dp[18] = 0
     
    for _ in range(N-3) :
        dp_ = [0] * 64
        for i in range(64) :
            for j in range(4) :
                if j == 2 and i in [1, 4, 5, 7, 13] :
                    continue
                ni = (i*4+j)%64
                dp_[ni] += dp[i]
                dp_[ni] %= mod
        dp = dp_
        dp[6] = dp[9] = dp[18] = 0
        
    print(sum(dp) % mod)

Measured memory_bytes: 43632
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
ll h,w;
cin >> h >> w;
ll ans;
if(h%2==0||w%2==0) {
  ans = h*w/2;
} else {
  ans = (h*w+1)/2;
}
if(h==1||w==1) ans=1;
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
int main() {
    int N; cin >> N;
    vector<int>A(N);
    rep(i, N)cin >> A[i];
    sort(A.begin(), A.end());
    int ans=0;
    rep(j, N-1)ans = (min(abs(A[N-1] / 2 - ans), abs(A[N-1] / 2-A[j])) == abs(A[N-1] / 2-A[j]) ? A[j] : ans);
    cout << A[N-1]<<" "<<ans << endl;
}

Measured memory_bytes: 3788
#include<stdio.h>

int main(){
	//nの用意
	int n;
	scanf("%d", &n);
	//配列pの用意
	int p[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &p[i]);
	}
	//2番目に小さい数のカウント
	int cnt = 0;
	for(int i = 0; i < n - 2; i++){
		if(p[i] < p[i + 1] && p[i + 1] < p[i + 2] || p[i] > p[i + 1] && p[i + 1] > p[i + 2]){
			cnt++;
		}
	}
	//表示
	printf("%d\n", cnt);

	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

int solve() {
    string s; cin >> s;
    for (char c: s) if (c == '7') return !printf("Yes");
    return printf("No");
}

int main() {
    init();
    int t = 1; //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3744
A=[list(map(int,input().split())) for i in range(3)]
N=int(input())
B=[int(input()) for i in range(N)]
C=[[0]*3 for i in range(3)]

for i in range(3):
	for j in range(3):
		C[i][j]=False
		for k in range(N):
			if A[i][j]==B[k]:
				C[i][j]=True
answer="No"
for i in range(3):
	if (C[i][0] and C[i][1] and C[i][2]):
		answer="Yes"
	if (C[0][i] and C[1][i] and C[2][i]):
		answer="Yes"
if (C[0][0] and C[1][1] and C[2][2]):
	answer="Yes"
if (C[2][0] and C[1][1] and C[0][2]):
	answer="Yes"
print(answer)

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

using namespace std;

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

	int n, m;
	cin >> n >> m;
	vector<string> a(n);
	vector<string> b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	for (int y = 0; y <= n - m; y++) {
		for (int x = 0; x <= n - m; x++) {
			bool g = true;
			for (int cy = 0; cy < m; cy++) {
				for (int cx = 0; cx < m; cx++) {
					if (b[cy][cx] != a[y + cy][x + cx]) {
						g = false;
						cy = 99;
						break;
					}
				}
			}
			if (g) {
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";

	return 0;
}



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

int n, k;
vector <int> from[2010];
int deep[2010];

void dfs(int x, int last){
	for (int i = 0; i < from[x].size(); i++){
		int v = from[x][i];
		if (v == last) continue;
		deep[v] = deep[x] + 1, dfs(v, x);
	}
}

int main(){
	scanf("%d%d", &n, &k);
	for (int i = 1; i < n; i++){
		int u, v; scanf("%d%d", &u, &v);
		from[u].push_back(v);
		from[v].push_back(u);
	}
	if (k & 1){
		int ans = 0x3f3f3f3f;
		for (int u = 1; u <= n; u++){
			for (int i = 0; i < from[u].size(); i++){
				int v = from[u][i];
				deep[u] = deep[v] = 0;
				dfs(u, v), dfs(v, u);
				int cnt = 0;
				for (int j = 1; j <= n; j++){
					cnt += deep[j] > (k - 1) / 2;
				}
				ans = min(ans, cnt);
			}
		}
		printf("%d\n", ans);
		return 0;
	} else {
		int ans = 0x3f3f3f3f;
		for (int i = 1; i <= n; i++){
			deep[i] = 0, dfs(i, i);
			int cnt = 0;
			for (int j = 1; j <= n; j++){
				cnt += deep[j] > k / 2;
			}
			ans = min(ans, cnt);
		}
		printf("%d\n", ans);
		return 0;
	}
	return 0;
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 1e9;
const int MB = 30;
const int MOD = 1e9 + 7;
const double PI = atan2(0, -1);


void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 1; i < n; i++) {
        int x;
        cin >> x;
        x--;
        a[x]++;
    }
    for (int i : a) cout << i << "\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //int t;
    //cin >> t;
    int t = 1;
    //srand(time(0));
    cout.precision(12);
    cout << fixed;
    while (t--) solve();
}

Measured memory_bytes: 4784
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n + 1];
		long[] sum = new long[n + 1];
		a[0] = 0;
		sum[0] = 0;
		for(int i = 1; i < n + 1; i++) {
			a[i] = sc.nextInt();
			sum[i] = sum[i - 1] + Math.abs(a[i] - a[i - 1]);
		}
		for(int i = 1; i < n + 1; i++) {
			long ans = 0;
			ans += sum[i - 1];
			if(i != n) {
				ans += Math.abs(a[i + 1] - a[i - 1]);
				ans += sum[n] - sum[i + 1];
				ans += Math.abs(a[n]);
			} else {
				ans += Math.abs(a[n - 1]);
			}
			System.out.println(ans);
		}

	}

}


Measured memory_bytes: 69108
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int h, w;
    cin >> h >> w;
    vector<int> a, b;
    for (int i = 0; i < h; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < w; ++j) {
            if(s[j] == 'B'){
                a.emplace_back(i+j);
                b.emplace_back(i-j);
            }
        }
    }
    auto P = minmax_element(a.begin(),a.end()), Q = minmax_element(b.begin(),b.end());
    cout << max(*P.second-*P.first, *Q.second-*Q.first) << "\n";
    return 0;
}


Measured memory_bytes: 3204
x, k, d = map(int, input().split())
prev = 0
r = min(abs(x) // d, k)
x = x - (r*d) if x > 0 else x + (r*d)
k -= r
while k != 0:
  prev = x
  x = x-d if abs(0-(x-d)) < abs(0-(x+d)) else x+d
  k -= 1
  if prev * x < 0 or x == 0:
    k %= 2
print(abs(x))

Measured memory_bytes: 9204
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    int N, t = 0, y = 0, z = 0, c = 0, i;
    cin >> N;
    string a[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        if (a[i] == "AC")
            t = t + 1;
        if (a[i] == "WA")
            y = y + 1;
        if (a[i] == "TLE")
            z = z + 1;
        if (a[i] == "RE")
            c = c + 1;
    }
    cout << "AC x " << t << endl;
    cout << "WA x " << y << endl;
    cout << "TLE x " << z << endl;
    cout << "RE x " << c << endl;
    return 0;
}

Measured memory_bytes: 6612
//import java.io.File;
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
try{
		//Scanner scan = new Scanner(new File("in.txt"));
		Scanner scan = new Scanner(System.in);


		int[] alpha = new int['z'-'a'+1];

		while(scan.hasNext()) {
			char[] arr = scan.nextLine().toCharArray();
			for(int i = 0; i < arr.length; i++) {
				if(arr[i] >= 'a' && arr[i] <= 'z') {
					alpha[arr[i]-'a']++;
				}
				if(arr[i] >= 'A' && arr[i] <= 'Z') {
					alpha[arr[i]-'A']++;
				}
			}
		}

		for(int i = 0; i < alpha.length; i++) {
			char letter = 'a';
			letter += i;
			System.out.println(letter+" : "+alpha[i]);
		}
		

}catch(Exception e) {
	e.printStackTrace();
}
	}
}

Measured memory_bytes: 26036
#include<stdio.h>

int main(void)
{
   int a,b;
   int c = 0;
   int i,q,z;
   
   while(c == 0){
   
      scanf("%d", &a);   scanf("%d", &b);
      
      if(a==0){
         if(b==0){
            break;}}
            
      for(i=1;i<=a;i++){
         for(q=1;q<=b;q++){
            
            if(i==1 || i==a || q==1 || q==b){
               printf("#");}
            else{
               printf(".");}
         }
         printf("\n");
      }
      printf("\n");
   }
   return 0;
}


Measured memory_bytes: 2012
#include<bits/stdc++.h>
using namespace std;
int main ()
{
	int a,b,c=0,k,r;
	cin>>a>>b;
	k=a/b;
	r=a%b;
	if(r==0)
	{
		cout<<k;
	}
	else{
		cout<< k+1;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b;
    while( cin >> a >> b ){
        int c = a + b;
        int d = 0;
        while(c > 0 ){
            d++;
            c /= 10;
        }
        cout << d << endl;
    }
}


Measured memory_bytes: 3040
import sys
N, M = map(int, raw_input().split())
A = [raw_input() for i in range(N)]
B = [raw_input() for i in range(M)]
for i in range(N):
    if i + M - 1 >= N:
        break
    for j in range(N):
        if j + M - 1 >= N:
            break
        match = True
        for k in range(M):
            for l in range(M):
                if A[i + k][j + l] != B[k][l]:
                    match = False
                    break
            if not match:
                break
        if match:
            print "Yes"
            sys.exit(0)
print "No"


Measured memory_bytes: 6528
import sys

def main():
    n = int(input())
    A = list(map(int, input().split()))
    co = 10**18

    ans = 1

    if 0 in A:
        print(0)
        return

    for i_A in A:
        ans *= i_A
        if ans > co:
            print(-1)
            return
    
    print(ans)
    return


if __name__ == "__main__":
    main()
    sys.exit(0)

Measured memory_bytes: 84764
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            if(n==0)
                break;
            int[][] graph = new int[11][11];
            for(int[] temp:graph) Arrays.fill(temp, 1<<20);
            for(int i=0; i<11; i++) graph[i][i] =0;
            int num_v = 0;
            for(int i=0; i<n; i++){
                int x = sc.nextInt();
                int y = sc.nextInt();
                int d = sc.nextInt();
                num_v = Math.max(num_v, Math.max(x, y)+1);
                graph[x][y] = d;
                graph[y][x] = d;
            }
            for(int k=0; k<num_v; k++)
                for(int i=0; i<num_v; i++)
                    for(int j=0; j<num_v; j++)
                    {
                        graph[i][j] = Math.min(graph[i][j], graph[i][k]+graph[k][j]);
//                        System.out.println(i+","+j+","+graph[i][j]);
                    }
            int min_dis = Integer.MAX_VALUE;
            int min_v = -1;
            for(int i=0; i<num_v; i++){
                int sum = 0;
                for(int j=0; j<num_v; j++) sum+=graph[i][j];
                if(sum < min_dis){
                    min_dis = sum;
                    min_v = i;
                }
            }
            System.out.println(min_v+" "+min_dis);
        }
    }
}


Measured memory_bytes: 26072
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n,m=mp()
uf = UnionFind(n+1)
for i in range(m):
    a,b=mp()
    uf.union(a,b)
ans=0
for i in range(n+1):
    ans=max(ans,uf.size(i))
print(ans)

Measured memory_bytes: 83644
#include <bits/stdc++.h>
using namespace std;
#define int                     long long   
#define double                  long double
#define endl                    "\n"
#define pb                      push_back
#define PI                      3.1415926535897932384626433832795l
#define F                       first
#define S                       second
#define mp                      make_pair
#define f(i,n)                  for(int i=0;i<n;i++)
#define fastio                  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)                  (v).begin(),(v).end()
#define rall(v)                 (v).rbegin(),(v).rend()
#define gcd(a,b)                __gcd((a),(b))
#define fill(a,value)           memset(a,value,sizeof(a));
#define minn(v)                 *min_element(v.begin(), v.end());
#define maxx(v)                 *max_element(v.begin(), v.end());
#define print(x)                cout<<(x)<<endl;
#define sum(v)+x                accumulate(v.begin(), v.end(),x);
#define debug(x)                cout<<#x<<'='<<(x)<<endl;
typedef pair<int,int>           pii;
typedef vector<int>             vi;
signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    int n;
    cin>>n;
    vi a(n);
    f(i,n)cin>>a[i];
    int arr[n+1]={0};
    f(i,n)arr[a[i]]++;
    int choices[n+1]={0};
    for(int i=1;i<=n;i++)
    {
        choices[i]=(arr[i]*(arr[i]-1))/2;
    }

    int total=0;
    for(int i=1;i<=n;i++)
    {
        total+=choices[i];
    }
    for(int i=0;i<n;i++)
    {
        int x=total-choices[a[i]]+((arr[a[i]]-1)*(arr[a[i]]-2))/2;
        print(x)
    }
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 7940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

const int MAX = 2000010;
ll fac[MAX], finv[MAX], inv[MAX];
bool Pre = true;
void cominit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    FOR(i, 2, MAX) {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
ll com(int n, int k) {
    if (Pre) {
        cominit();
        Pre = false;
    }
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll semisolve(int y, int x) { return com(y + x, x); }
ll solve(int y, int x) {
    ll ret = 0;
    eFOR(i, 0, y)(ret += semisolve(i + 1, x)) %= mod;
    return ret;
}

int main() {
    init();

    int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
    ll ans = solve(r2, c2);
    (ans -= solve(r1 - 1, c2) - mod) %= mod;
    (ans -= solve(r2, c1 - 1) - mod) %= mod;
    (ans += solve(r1 - 1, c1 - 1)) %= mod;
    cout << ans << "\n";
}

Measured memory_bytes: 47104
#include <bits/stdc++.h>
#include <queue>
#include <string.h> 
#include <stdint.h>
 
#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
 
#define ll long long
#define ld long double
#define ull unsigned long long
#define ut uint64_t
 
#define pb push_back
#define ins insert
#define er erase
 
#define fi(i, b) for (int i=0;i<b;i++)
#define fll(i, b) for (ll i=0;i<b;i++)
#define fla(i,a,b) for (ll i=a;i<b;i++)
 
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vb vector<bool>
#define vst vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define vv(n,m) vector<vector<ll> > vec( n , vector<ll> (m, 0))
 
 
#define all(v) v.begin(), v.end()
#define lb lower_bound
#define ub upper_bound
#define mxe max_element
#define mne min_element
 
#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(), v.rend())
 
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
 
#define mii map<int, int>
#define mll map<ll, ll>
#define umii unordered_map<int, int>
#define umll unordered_map<ll, ll>
 
#define si set<int>
#define sll set<ll>
#define usi unordered_set<int>
#define usll unordered_set<ll>
#define spii set<pii>
#define spll set<pll>
 
#define pqi priority_queue<int>
#define pqll priority_queue<ll>
 
 #define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
 
#define nl "\n"
using namespace std;
 
 
ll md = 1000000007;
ll ma = 998244353;
 
ll pw(ll a, ll b)
{
    ll c = 1, m = a;
    while (b){
        if (b & 1)c = (c * m);
        m = (m * m);
        b /= 2;
    }
    return c;
}
 
ll pwmd(ll a, ll b){
    ll c = 1, m = a;
    while (b){
        if (b & 1)
            c = ((c * m)) % md;
        m = (m * m) % md;
        b /= 2;
    }
    return c;
}
 
ll modinv(ll n)
{
    return pwmd(n, md - 2);
}
ll min(ll a,ll b){
    if(a>=b)return b;
    return a;
}
bool prime(ll a){
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }return true;
}
int binomialCoeff(ll n, ll k)  
{  
    ll res = 1;  
    if ( k > n - k )  
        k = n - k;  
    for (ll i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);  
    }  
  
    return res;  
}  

 
// Here we go...

void solve(){
      ll n,s;
      cin>>n>>s;
      if(n<=s)cout<<"unsafe\n";
      else cout<<"safe\n";
      
}


int main(){
    
    fast;
    ll t=1;
    //cin>>t;
    
    while(t--){
        solve();
    }
    return 0;
    }
    
// KHATAM HO GAYA:)...







Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
void oj()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	return;
}

int main()
{
	//oj();
	int a,b,c1,c2;
	cin>>a>>b>>c1>>c2;
	double a1=30.0*c1 + 0.5*c2;
	double a2=(c2/5)*30 + ((int)c2%5)*6;
	double angle=((a1-a2) )* M_PI_2 /90;
	long double ans=sqrt((a*a)+(b*b)-(2*a*b*cos(angle)));
	cout<<fixed<<setprecision(20)<<ans;
	return 0;
}

Measured memory_bytes: 4152
#include <bits/stdc++.h>
using LL = long long;
const LL MOD = 1e9+9;
using namespace std;



int main(){
    int A,B,C;cin >> A >> B >> C;
    if(max({A,B,C}) == A){
        cout<<"A"<<endl;
        return 0;
    }
    if(max({A,B,C}) == B){
        cout<<"B"<<endl;
        return 0;
    }
    if(max({A,B,C}) == C){
        cout<<"C"<<endl;
    }
}



Measured memory_bytes: 3076
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n-1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(a, n) sort(a, a+n)
#define VSORT(v) sort(v.begin(), v.end())

using namespace std;

int main()
{
    long n, k;

    cin >> n >> k;

    cout << min(n % k, abs(k - (n % k))) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int prime[1000000];

int main(void)
{
	int i, j;
	int n;
	int c;
	
	for (i = 0; i < 1000000; i++){
		prime[i] = 1;
	}
	
	prime[0] = 0;
	prime[1] = 0;
	
	for (i = 2; (i * i) < 1000000; i++){
		if (prime[i] == 1){
			for (j = 2; (i * j) < 1000000; j++){
				prime[(i * j)] = 0;
			}
		}
	}
	
	
	while (scanf("%d", &n) != EOF){
		c = 0;
		for (i = 0; i <= n; i++){
			if (prime[i] == 1){
				c++;
			}
		}
		printf("%d\n", c);
	}
	
	
	
	return (0);
}

Measured memory_bytes: 4500