akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#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(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
    string s;
    cin >> s;
    ll n = s.size();
    vll c(26);
    REP(i, n) c[s[i] - 'a']++;
    ll res = 1000, tmp, cnt;
    REP(i, 26){
        if(!c[i]) continue;
        char p = 'a' + i;
        tmp = 0, cnt = 0;
        REP(j, n){
            if(s[j] != p) cnt++;
            else{
                tmp = max(tmp, cnt);
                cnt = 0;
            }
        }
        tmp = max(tmp, cnt);
        res = min(res, tmp);
    }
    cout << res << endl;
    return 0;
}

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

ll solve() {
    ll N, Ma, Mb, a,b,c;
    cin >> N >> Ma >> Mb;
    vector<ll> A(N), B(N), C(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i] >> B[i] >> C[i];
    }
    int INF = 1e8;
    int V = 10000, Z = V/2;
    vector<vector<int>> dp(N+1, vector<int>(V, INF));
    auto val = [&](int a, int b) {
        return Mb * a - Ma * b;
    };
    for ( int i = 1; i <= N; i++ ) {
        int v = val(A[i-1],B[i-1]);
        int c = C[i-1];
        dp[i][Z+v] = c;
        for ( int x = 0; x < V; x++ ) {
            dp[i][x] = min(dp[i][x], dp[i-1][x]);
            if ( x-v >= 0 && x-v < V ) dp[i][x] = min(dp[i][x], dp[i-1][x-v] + c);
        }
    }
    ll ans = dp[N][Z];
    if ( ans >= INF ) ans = -1;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>

int main(void)
{
	int a[5];
	int b, c, d;
	
	scanf("%d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4]);
	
	for (b = 0; b < 5; b++) {
		for (c = 0; c < 5; c++) {
			if (a[b] < a[c]) {
				d = a[b];
				a[b] = a[c];
				a[c] = d;
			}
		}
	}
	
	for (b = 4; b >= 0; b--) {
		if (b != 0) {
			printf("%d ", a[b]);
		}
		else {
			printf("%d", a[b]);
		}
	}
	
	printf("\n");
	
	return (0);
}	

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

int main() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  string mix = "";
  for (int i=0;i<n;i++) {
    mix += s[i];
    mix += t[i];
  }
  cout << mix << endl;
}

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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> istream& operator>>(istream &is, vector<T> &v) { for(auto &it : v) is >> it; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int N = 2e5+5;

void solve(){
    int n;
    cin >> n;
    vi A(n), B(n);
    vi cnt(n+1);
    for(auto &x: A) cin >> x, cnt[x]++;
    for(auto &x: B) cin >> x, cnt[x]++;

    for(int i = 1; i <= n; ++i) if(cnt[i] > n){
        cout << "No\n";
        return;
    }

    reverse(All(B));
    int l = 0, r = n-1;
    for(int i = 0; i < n; ++i){
        if(A[i] == B[i]){
            if(B[l] != A[i] && A[i] != A[l]) swap(B[l++], B[i]);
            else swap(B[r--], B[i]);
        }
    }

    cout << "Yes\n";
    for(int i = 0; i < n; ++i)
        cout << B[i] << " \n"[i==n-1];
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


Measured memory_bytes: 7952
#include<stdio.h>
int linearSearch(int A[],int n, int key){
  int i;;
  for(i=0;i<n;i++){
    if(A[i]==key)return i;
  }
  return -1;
}
int main(){
  int i,n,A[10001],q,key,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(linearSearch(A,n,key)!=-1){
      sum++;
    }
  }
  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2108
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>



int solve(int E) {
  int ans = INT_MAX, x, y, z;
  for (z = 0; z*z*z<=E; z++) {
    for (y = 0; y*y<=E; y++) {
      x = E - z*z*z - y * y;
      if (x < 0) continue;
      if (!(x + y * y + z * z * z == E)) continue;
      if (x + y + z < ans) ans = (x + y + z);
    }
  }
  return ans;
}
	
int main(int argc, char *argv[])
{
  int d;
  while (fscanf(stdin, "%d", &d) && d != 0) {
    int ans = solve(d);
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 604
import sys
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if x in a:
    if y in a:
        print('Yes')
        sys.exit()
if x in b:
    if y in b:
        print('Yes')
        sys.exit()
if x in c:
    if y in c:
        print('Yes')
        sys.exit()
print('No')


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int N;
vector<vector<pair<int, int64_t>>> g;
vector<int64_t> dist;

void dfs(int curr, int par) {
  for (auto e: g[curr]) {
    int dest; int64_t cost; tie(dest, cost) = e;
    if (dest == par) continue;
    dist[dest] = dist[curr] + cost;
    dfs(dest, curr);
  }
}

int main() {
  cin >> N; g.resize(N);
  dist.resize(N);
  rep(i, N - 1) {
    int a, b, c; cin >> a >> b >> c;
    a--, b--;
    g[a].emplace_back(b, c);
    g[b].emplace_back(a, c);
  }
  int Q, K; cin >> Q >> K;
  K--;
  dfs(K, -1);
  rep(_, Q) {
    int x, y; cin >> x >> y;
    x--, y--;
    cout << dist[x] + dist[y] << "\n";
  }
}


Measured memory_bytes: 14336
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) throws Exception {
		MScanner sc=new MScanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		int n=sc.nextInt(),k=sc.nextInt();
		int[]in=sc.takearr(n);
		PriorityQueue<Integer>pq=new PriorityQueue<Integer>(Collections.reverseOrder());
		for(int i:in)pq.add(i);
		while(k-->0)pq.poll();
		long sum=0;
		while(!pq.isEmpty())sum+=pq.poll();
		pw.println(sum);
		pw.flush();
	}
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] takearr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] takearrl(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public Integer[] takearrobj(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] takearrlobj(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 56776
from copy import deepcopy

n = int(input())
ls = list(input().split())
C1 = []
for s in ls:
    C1.append((s[0], s[1]))
C2 = deepcopy(C1)


# bubble_sort: 2d
def bubble_sort(ls):
    n = len(ls)
    for _ in range(n):
        for j in range(n-1):
            if ls[j][1] > ls[j+1][1]:
                ls[j], ls[j+1] = ls[j+1], ls[j]
    return ls


# selection_sort: 2d
def selection_sort(ls):
    n = len(ls)
    for i in range(n):
        minj = i
        for j in range(i, n):
            if ls[j][1] < ls[minj][1]:
                minj = j
        if minj != i:
            ls[i], ls[minj] = ls[minj], ls[i]
    return ls


ans1 = []
ans2 = []
for c in bubble_sort(C1):
    ans1.append(c[0]+c[1])
for c in selection_sort(C2):
    ans2.append(c[0]+c[1])
print(*ans1)
print('Stable')
print(*ans2)
if ans1 == ans2:
    print('Stable')
else:
    print('Not stable')



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

#define FO(i,a,b) for (int i = (a); i < (b); i++)
#define sz(v) int(v.size())

using namespace std;

typedef long long ll;
ll a, b, c;

int main() {
    scanf("%lld %lld %lld", &a, &b, &c);
    if (a%2 == 0 || b%2 == 0 || c%2 == 0) printf("0\n");
    else printf("%lld\n", min(a*b,min(a*c,b*c)));
}



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

typedef long long ll;

ll N;
vector<ll> A, B;
ll R;

int main() {
  cin >> N;
  A.resize(N);
  for (ll i = 0; i < N; ++i) cin >> A[i];
  B.resize(N);
  for (ll i = 0; i < N; ++i) cin >> B[i];
  for (ll k = 28; k >= 0; --k) {
    ll bit = 1 << k, mask = bit - 1;
    ll r = 0;
    vector<ll> a_low, b_low;
    for (ll i = 0; i < N; ++i) {
      if (A[i] & bit) (r += N) %= 2;
      a_low.push_back(A[i] & mask);
      if (B[i] & bit) (r += N) %= 2;
      b_low.push_back(B[i] & mask);
    }
    sort(b_low.begin(), b_low.end());
    for (ll x : a_low) {
      (r += b_low.end() - lower_bound(b_low.begin(), b_low.end(), bit - x)) %=
          2;
    }
    R = R * 2 + r;
  }
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 10336
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,sum1=1,sum2=1,sum3=1;
cin>>a>>b;
sum1=a+b;
sum2=a-b;
sum3=a*b;
if(sum1>=sum2&&sum1>=sum3)cout<<sum1;
else if(sum2>=sum1&&sum2>=sum3)cout<<sum2;
else cout<<sum3;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        for (int i = 0; i < 3; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int counteven = 0;
        for (int i = 0; i < 3; i++) {
            if (a[i] % 2 == 0) {
                counteven++;
            }
        }

        int ans = 0;
        if (counteven == 0 || counteven == 3) {
            ans += (a[2] - a[0]) / 2;
            ans += (a[2] - a[1]) / 2;
        } else if (counteven == 1) {
            if (a[2] % 2 == 0) {
                ans += (a[1] - a[0]) / 2;
                ans += a[2] - a[1];
            } else if (a[1] % 2 == 0) {
                ans += (a[2] + 1 - a[1]) / 2;
                ans += (a[2] - a[0]) / 2;
                ans += 1;
            } else if (a[0] % 2 == 0) {
                ans += (a[2] + 1 - a[0]) / 2;
                ans += (a[2] - a[1]) / 2;
                ans += 1;
            }
        } else if (counteven == 2) {
            if (a[2] % 2 == 1) {
                ans += (a[1] - a[0]) / 2;
                ans += a[2] - a[1];
            } else if (a[1] % 2 == 1) {
                ans += (a[2] + 1 - a[1]) / 2;
                ans += (a[2] - a[0]) / 2;
                ans += 1;
            } else if (a[0] % 2 == 1) {
                ans += (a[2] + 1 - a[0]) / 2;
                ans += (a[2] - a[1]) / 2;
                ans += 1;

            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std ;
long long a[10100] ;

int main()
{
  long long n , m ;
  string s ;
  cin >> n >> m >> s ;
  long long ans = 0 ;
  if(m == 2 || m == 5)
   {
     for(int i = 0 ;i < n ;i ++)
      if((s[i] - '0') % m == 0)
       ans += i + 1 ;
   }
  else
   {
     a[0] = 1 ;
     long long v = 0 , t = 1 ;
     for(int i = n - 1; i >= 0 ;i --)
      {
        v += t * (s[i] - '0') ;
        v %= m ;
        ans += a[v] ;
        a[v] ++ ;
        t *= 10 ;
        t %= m ;
      }

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



Measured memory_bytes: 644
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
long long i[3000000];
bool o;
bool ans[5];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=inf,e=0,f=0,g=0,h=0,j=0;
  string s;
  o=true;
  cin >>a>>b;
  cin >>s;
  for(int n=0;n<a;n++){
    if(s[n]<'0'||s[n]>'9') o=false;
  }
  if(s[a]!='-') o=false;
  for(int n=a+1;n<a+1+b;n++){
    if(s[n]<'0'||s[n]>'9') o=false;
  }
  if(o) cout <<"Yes\n";
  else cout <<"No\n";
  return (0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#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 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 ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int main(){
    CIN(N);
    I vec;
    REP(a,N){
        CIN(b);
        vec.pb(b);
    }
    LL ans = LINF;
    for(int a = 0;a <= 200;a++){
        LL w = 0;
    REP(b,N){
        w += abs(vec.at(b)-a+100)*abs(vec.at(b)-a+100);
    }
    ans = min(w,ans);
    }
    COUT(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

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

    string s, t;
    cin >> s >> t;

    rep(i, sz(s))
    {
        if (s[i] != t[i]) {
            cout << "No" << endl;
            return 0;
        }
    }


    cout << "Yes" << endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,i=0,j,c=0,p,m=0,max=0,h[100000],dp[100000];
    string s;
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> h[i];
    }
    dp[1]=abs(h[0]-h[1]);
    dp[2]=abs(h[0]-h[2]);
    for(i=3;i<n;i++)
    {   
        dp[i]=min(abs(h[i]-h[i-2])+dp[i-2],abs(h[i]-h[i-1])+dp[i-1]);
    }
    cout << dp[n-1] << endl;
    return 0;

}


Measured memory_bytes: 5176
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long

void solve() {
    int N; cin >> N;
    int a[100100];
    rep(i, N) cin >> a[i];
    map<int, int> mp;
    rep(i, N) {
        if(a[i] % 2 == 1) mp[0] ++;
        else if(a[i] % 4 == 2) mp[1] ++;
        else mp[2] ++;
    }
    int A = mp[2], B = mp[0] + (mp[1] != 0 ? 1 : 0);
    if(B <= A + 1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 640
n = int(input())
a = [int(x) for x in input().split()]

min_value = a[0]
result = 0

for x in a:
  diff = min_value - x
  if x < min_value:
    result += diff
    min_value = x + diff
  else:
    min_value = x
    
print(result)

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

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ') ;
            uint H = uint.Parse(input[0]);
            uint N = uint.Parse(input[1]);

            int[] A = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();
            int A_sum = A.Sum();
            if (A_sum >= H) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 19680
#include "bits/stdc++.h"

using namespace std;

const int maxn = 5e6 + 5;
const int MOD = 1e9 + 7;

struct mi {
      long long v;
      explicit operator long long() const { return v; }
      mi() { v = 0; }
      mi(long long _v) { v = (-MOD < _v && _v < MOD) ? _v : _v % MOD; if (v < 0) { v += MOD; } }

      friend bool operator == (const mi& a, const mi& b) { return a.v == b.v; }
      friend bool operator != (const mi& a, const mi& b) { return !(a == b); }
      friend bool operator < (const mi& a, const mi& b) { return a.v < b.v; }

      mi& operator += (const mi& m) { if ((v += m.v) >= MOD) { v -= MOD; } return *this; }
      mi& operator -= (const mi& m) { if ((v -= m.v) < 0) { v += MOD; } return *this; }
      mi& operator *= (const mi& m) { v = v * m.v % MOD; return *this; }
      mi& operator /= (const mi& m) { return (*this) *= inv(m); }

      friend mi pow(mi a, long long p) { mi ans = 1; assert(p >= 0); for (; p; p /= 2, a *= a) { if (p & 1) { ans *= a; } } return ans; }
      friend mi inv(const mi& a)       { assert(a.v != 0); return pow(a, MOD - 2); }

      mi operator - () const { return mi(-v); }
      mi& operator ++ () { return *this += 1; }
      mi& operator -- () { return *this -= 1; }
      mi operator ++ (int) { mi temp; temp.v = v++; return temp; }
      mi operator -- (int) { mi temp; temp.v = v--; return temp; }

      friend mi operator + (mi a, const mi& b) { return a += b; }
      friend mi operator - (mi a, const mi& b) { return a -= b; }
      friend mi operator * (mi a, const mi& b) { return a *= b; }
      friend mi operator / (mi a, const mi& b) { return a /= b; }

      friend ostream& operator << (ostream& os, const mi& m) { os << m.v; return os; }
      friend istream& operator >> (istream& is, mi& m) { long long x; is >> x; m.v = x; return is; }
};

mi fact[maxn];
mi ifact[maxn];

void preCalc() {
	fact[0] = 1;
	ifact[0] = 1;
	for (int i = 1; i < maxn; i++) {
		fact[i] = i * fact[i - 1];
		ifact[i] = 1 / fact[i];
	}
}

mi nCr(int n, int r) {
	if (n < 0 or r < 0 or n < r) {
		return 0;
	}
	return fact[n] * ifact[r] * ifact[n - r];
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	
	preCalc();
	
	int r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	mi ans = 0;
	for (int c = c1; c <= c2; c++) {
		mi add = 0;
		if (c + r2 >= c) {
			mi ncr = nCr(c + r2 + 1, c + 1);
			ncr = ncr - (c - 1);
			add = ncr;
		}
		if (c + r1 > c) {
			mi ncr = nCr(c + r1 + 1 - 1, c + 1);
			ncr = ncr - (c - 1);
			add -= ncr;
		}
		ans += add;
	}
	cout << ans << endl;
}

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

int main () {
    int A, B, C, K;
    int sum = 0;

    cin >> A >> B >> C >> K;

    if (K <= A) {
        sum = K;
    } else if (K <= A + B) {
        sum = A;
    } else {
        sum = A - (K - A - B);
    }

    cout << sum;

    return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  int n,m;
  cin >> n >> m;
  vector<ll> v(n+1,0);
  rep(i,m){
    int a,b;cin >> a >> b;
    v[a]++;
    v[b]++;
  }
  rep(i,n+1)if(v[i] & 1){
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  





  return 0;
}

Measured memory_bytes: 1024
n, k = list(map(int, input().split()))

mod = 10**9 + 7

# xの逆元を求める。フェルマーの小定理より、 x の逆元は x ^ (mod - 2) に等しい。計算時間はO(log(mod))程度。
def modinv(x):
    return pow(x, mod-2, mod)

# 二項係数の左側の数字の最大値を max_len　とする。nとかだと他の変数と被りそうなので。
# factori_table = [1, 1, 2, 6, 24, 120, ...] 要は factori_table[n] = n!
# 計算時間はO(max_len * log(mod))

max_len = 2 * n - 1 #適宜変更する

factori_table = [1] * (max_len + 1)
factori_inv_table = [1] * (max_len + 1)
for i in range(1, max_len + 1):
    factori_table[i] = factori_table[i-1] * (i) % mod
    factori_inv_table[i] = modinv(factori_table[i])

def binomial_coefficients(n, k):
    # n! / (k! * (n-k)! )
    if k <= 0 or k >= n:
        return 1
    return (factori_table[n] * factori_inv_table[k] * factori_inv_table[n-k]) % mod

if k >= n-1:
    # nHn = 2n-1 C n
    print(binomial_coefficients(2 * n - 1, n))
else:
    # 移動がk回←→ 人数0の部屋がk個以下
    # 人数0の部屋がちょうどj個のものは
    # nCj(人数0の部屋の選び方) * jH(n-j) (余剰のj人を残りの部屋に入れる)
    ans = 0
    for j in range(k+1):
        if j == 0:
            ans += 1
        else:
            ans += binomial_coefficients(n, j) * binomial_coefficients(n-1, j) 
            ans %= mod
    print(ans)


Measured memory_bytes: 35828
#include<iostream>
#include<string>
using namespace std;
int main(){
  while(true){
    string s1;
    cin>>s1;
    if(s1==".")
      break;
    string s2;
    cin >> s2;
    if(s1==s2){
      cout<<"IDENTICAL"<<endl;
      continue;
    }
    string t1 = s1;
    string t2 = s2;
    while(true){
      size_t d1b = t1.find('\"');
      if(d1b == string::npos)
        break;
      t1.replace(d1b,1,"@");

      size_t d1e = t1.find('\"');
      t1.replace(d1e,1,"@");

      size_t d2b = t2.find('\"');
      if(d2b == string::npos)
        break;
      t2.replace(d2b,1,"@");

      size_t d2e = t2.find('\"');
      t2.replace(d2e,1,"@");

      string u1 = s1;
      u1.replace(d1b+1,d1e-d1b-1, "");
      string u2 = s2;
      u2.replace(d2b+1,d2e-d2b-1, "");
      if(u1==u2){
        t1=u1;
        t2=u2;
        break;
      }
    }
    if(t1==t2){
      cout<<"CLOSE"<<endl;
    }else{
      cout<<"DIFFERENT"<<endl;
    }
  }
  return 0;
}



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

int main(){
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    ll ans = 1<<30;
    
    rep(i, (x>y? x+1: y+1)){
        ll sum = 0;
        sum += c*i*2;
        if(x-i>0)sum += a*(x-i);
        if(y-i>0)sum += b*(y-i);
        if(sum < ans){
            ans = sum;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3592
#include<cstdio>
using namespace std;
int main()
{
	int n,y;
	scanf("%d%d",&n,&y);
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n-i;j++)
		{
			if(i*10000+j*5000+(n-i-j)*1000==y)
			{
				printf("%d %d %d\n",i,j,n-i-j);
				return 0;
			}
		}
	}
	printf("-1 -1 -1\n");
	return 0;
}

Measured memory_bytes: 128
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::f64::consts::PI;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn find_m(n: u64) -> Option<usize> {
    for i in 1..2*n+1 {
        if i*(i-1) == 2*n {
            return Some(i as usize);
        } else if i*(i-1) > 2*n {
            break;
        }
    }
    None
}


fn main() {
    let line: Vec<u64> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = line[0];
    match find_m(n) {
        Some(m) => {
            println!("Yes");
            println!("{}", m);

            let mut memo = vec![Vec::new(); m];
            let mut tmp = 1;
            for i in 0..m {
                for j in i+1..m {
                    memo[i].push(tmp);
                    memo[j].push(tmp);
                    tmp += 1;
                }
            }
            for i in 0..m {
                println!("{} {}", memo[i].len(), memo[i].iter().map(|x| x.to_string()).collect::<Vec<String>>().join(" "));
            }
        },
        None => {
            println!("No");
        },
    }

}


Measured memory_bytes: 3008
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 201

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

bool calc(){
  char s[SIZE];
  stack<char> st;
  
  scanf("%[^\n]%*[\n]",s);

  if(s[0]=='.') return false;
  
  for(int i=0;s[i]!='.';i++){
    if(s[i]=='[' || s[i]=='(') st.push(s[i]);
    if(s[i]==']'){
      if(st.empty() || st.top()!='['){
	puts("no");
	return true;
      }
      st.pop();
    }
    if(s[i]==')'){
      if(st.empty() || st.top()!='('){
	puts("no");
	return true;
      }
      st.pop();
    }
  }

  if(st.empty()) puts("yes");
  else puts("no");
  
  return true;
}

int main(){
  
  while(calc());
  
  return 0;
}

Measured memory_bytes: 3044
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

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

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

const int MOD = 1000000007;

struct Pony
{
    long a, b;
 
    Pony(long a_, long b_)
    {
        a = a_;
        b = b_;
    }
 
    bool operator<(const Pony &another) const
    {
        return b < another.b;
    };
};

int fac(int k){
    int sum = 0;
    for (int i = 1; i <= k; ++i)
    {
        sum += i;
    }
    return sum;
}

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

  long n;
  string k;

  cin >> n >> k;

    cout << (n >= 3200 ? k : "red") << endl;
}


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

int main() {
  int N;
  cin >> N;

  vector<int> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i);
  }

  int p_sum= 0;
  for(int i=0; i<N; i++){
    p_sum+= data.at(i);
  }
  int p_opt1= p_sum/N;
  int p_opt2= p_opt1+ 1;

  int cal1= 0;
  int cal2= 0;
  for(int i=0; i<N; i++){
    cal1+= (data.at(i)- p_opt1)*(data.at(i)- p_opt1);
    cal2+= (data.at(i)- p_opt2)*(data.at(i)- p_opt2);
  }
  
  cout << min(cal1, cal2) << endl;
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_STR_MAX		50										// 最大文字数
#define D_CHAR_CHG		'?'										// 置き換わった文字

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 文字列 S に文字列 T を重ね、鍵を作成
int
fStrOver(
	char *pcpStrS				// <I> 文字列 S
	, char *pcpStrT				// <I> 文字列 T
)
{
	int i, j;

	// 長さ
	int liLenS = strlen(pcpStrS);
	int liLenT = strlen(pcpStrT);
	if (liLenS < liLenT) {
		return -1;
	}

	// 重ねる箇所を検索
	for (i = liLenS - liLenT; i >= 0; i--) {

		// 重ねられるか１文字ずつチェック
		for (j = 0; j < liLenT; j++) {
			if (pcpStrS[i + j] != D_CHAR_CHG && pcpStrS[i + j] != pcpStrT[j]) {
				break;
			}
		}
		if (j == liLenT) {		// OK
			break;
		}
	}
	if (i < 0) {			// なし
		return -1;
	}

	// 重ねる
	strncpy(&pcpStrS[i], pcpStrT, liLenT);

	// 置き換わった文字を 'a' に変換
	for (i = 0; i < liLenS; i++) {
		if (pcpStrS[i] == D_CHAR_CHG) {
			pcpStrS[i] = 'a';
		}
	}

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	char lc1Buf[1024], lc1Out[1024];

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 文字列 S 取得
	char lc1StrS[D_STR_MAX];
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%s", lc1StrS);

	// 文字列 T 取得
	char lc1StrT[D_STR_MAX];
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%s", lc1StrT);

	// 文字列 S に文字列 T を重ね、鍵を作成
	int liRet = fStrOver(lc1StrS, lc1StrT);

	// 結果セット
	if (liRet == 0) {
		sprintf(lc1Out, "%s\n", lc1StrS);
	}
	else {
		sprintf(lc1Out, "UNRESTORABLE\n");
	}

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val s = sc.nextLine()
    for (i1 in 0..1) {
        for (i2 in 0..1) {
            val a = Array(n) { false }
            a[0] = i1 == 1
            a[1] = i2 == 1
            for (i in 1 until n - 1) {
                if ((s[i] == 'o' && a[i]) || (s[i] == 'x' && !a[i])) {
                    a[i + 1] = a[i - 1]
                }
                if ((s[i] == 'o' && !a[i]) || (s[i] == 'x' && a[i])) {
                    a[i + 1] = !a[i - 1]
                }
            }
            var ok = true
            if ((s[0] == 'o' && a[0]) || (s[0] == 'x' && !a[0])) {
                if (a[1] != a[n - 1]) ok = false
            }
            if ((s[0] == 'o' && !a[0]) || (s[0] == 'x' && a[0])) {
                if (a[1] == a[n - 1]) ok = false
            }
            if ((s[n - 1] == 'o' && a[n - 1]) || (s[n - 1] == 'x' && !a[n - 1])) {
                if (a[0] != a[n - 2]) ok = false
            }
            if ((s[n - 1] == 'o' && !a[n - 1]) || (s[n - 1] == 'x' && a[n - 1])) {
                if (a[0] == a[n - 2]) ok = false
            }
            if (ok) {
                println(a.map { if (it) "S" else "W" }.joinToString(""))
                return
            }
        }
    }
    println(-1)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;
  int D, X;
  cin >> D >> X;
  vector<int> A(N);
  rep(i, 0, N) { cin >> A[i]; }
  // 1+ a(n-1)<=d
  cout << X + accumulate(all(A), 0,
                         [&](int b, int a) { return b + (D - 1) / a + 1; })
       << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
using namespace std;
using ll = long long;
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; }

map<int,int> m;

int main() {
  int N;
  cin >> N;

  for(int i=2;i<=N;++i){
    int num = i;
    for(int j=2;j<=N;++j) {
		  while (num%j == 0) {
			  m[j]++;
			  num /= j;
	  	}
	  }
  }

  int up4=0;
  int up2=0;

  for(int i=2;i<=N;++i){
    if(m[i]>=4) ++up4;
    else if(m[i]>=2) {
      ++up2;
      // cout << i << endl;
    }
  }

  int ans = 0;
  ans += up4*(up4-1)*(up4-2+up2)/2;

  // cout << up4 << endl;

  int up14=0;
  up4=0;

  for(int i=2;i<=N;++i){
    if(m[i]>=14) ++up14;
    else if(m[i]>=4) ++up4;
  }

  ans += up14*(up14-1+up4);

  int up24=0;
  up2=0;

  for(int i=2;i<=N;++i){
    if(m[i]>=24) ++up24;
    else if(m[i]>=2) ++up2;
  }

  ans += up24*(up24-1+up2);

  for(int i=2;i<=N;++i){
    if(m[i]>=74) ++ans;
  }

  cout << ans << endl;


}



Measured memory_bytes: 256
/* @BEGIN_OF_SOURCE_CODE */
// created by salazar slytherin
#include<bits/stdc++.h>
using namespace std;

#define read                   freopen("in.txt","rt",stdin)
#define write                  freopen("out.txt","wt",stdout)
#define fresh                  {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define PI                     3.1415926535897932384626433832795
#define mems(ds_name,val)      memset(ds_name,val,sizeof(ds_name))
#define ll					   long long


//      template <class T> inline T  bigmod(T p,T e,T M){ll ret=1;for(;e>0;e>>=1){if(e&1)ret=(ret*p)%M;p=(p*p)%M;}return (T)ret;}
//      template <class T> inline T  gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//      template <typename T> string NumberToString(T pNumber)	{ostringstream oOStrStream;oOStrStream << pNumber;return oOStrStream.str();}


//      int lcm(int a, int b) {return (a*b)/gcd(a,b);}
//      ll  powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
//      void dec2bin(int n)   {int rem;if(n<=1){v.push_back(n);return;}rem=n%2;dec2bin(n/2);v.push_back(rem);}  // ***vector type
      bool isprime(ll x)    {if(x<=1)return 0;ll n=sqrt(x);for(ll i=2;i<=n;i++){if(x%i==0)return 0;}return 1;}

vector<int >v;
int main()
{
    fresh;
//    read;//write;

    ll n;
    cin>>n;
    ll even,odd;
    even=odd=0;
    for(int i=0;i<n;i++){
        int x;cin>>x;
        if(x%2==0)even++;
        else odd++;
    }
    if(odd%2==0)cout<<"YES\n";
    else cout<<"NO\n";

    return 0;

}



/* @END_OF_SOURCE_CODE */


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long ans=0;
int main(){
	int n,k,r,s,p;
	string t;
	cin>>n>>k>>r>>s>>p>>t;
	for(int i=0;i<k;i++){
		int ss=1;
		char c=t[i];
		for(int j=i+k;j<n;j+=k){
			if (t[j]!=c){
				ss=(ss+1)/2;
				if (c=='r') ans+=ss*p;
				if (c=='s') ans+=ss*r;
				if (c=='p') ans+=ss*s;
				c=t[j];
				ss=1;
				continue;
			}
			ss++;
		}
		ss=(ss+1)/2;
		if (c=='r') ans+=ss*p;
		if (c=='s') ans+=ss*r;
		if (c=='p') ans+=ss*s;
		ss=0;
	}
	cout<<ans;
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int n;
  cin >> n;
  vi dp(n+1, inf);
  dp[0] = 0;
  rep(i,n) {
    for(int j = 1; i+j <= n; j *= 6) chmin(dp[i+j], dp[i]+1);
    for(int j = 1; i+j <= n; j *= 9) chmin(dp[i+j], dp[i]+1);
  }
  cout << dp[n] << endl;
}

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

int main() {
  long A, B, C, D;
  string ans = "";
  cin >> A >> B >> C >> D;
  
  while (A > 0 && C > 0){
    C = C - B;
    if (C <= 0) {
      ans = "Yes";
      break;
    }
    A = A - D;
    if (A <= 0) {
      ans = "No";
      break;
    }
  } 
  
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
typedef long long ll;

using namespace std;
using Graph = vector<vector<int>>;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int N;

void Main()
{
    cin >> N;
    ll num;
    ll ans = 1;
    ll lim = 1000000000000000000;
    int flag = 0;

    REP(i, N) {
        cin >> num;
        if (num == 0) {
            cout << "0" << endl;
            return;            
        }

        if (ans > (lim / num)) {
            ans = 1;
            flag = 1;
        }
        ans = ans * num;
    }

    if (flag == 1 and ans != 0) {
        cout << "-1" << endl;
        return;
    }
    cout << ans << endl;
}
 
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
const int N=1e5+5;
#define ll long long
#define inf 0x3f3f3f3f
#define mem(x) memset(x,0,sizeof(x))
#define sca(x) scanf("%d",&x)
#define scall(x) scanf("%lld",&x)
#define eps 1e-6
ll num[100005];
int main()
{
	ll n;scall(n);
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		int x;sca(x);
		num[x]++;
		ans+=x;
	}
	int q;sca(q);
	while(q--)
	{
		ll x,y;
		scall(x);scall(y);
		ans-=(num[x]*x);
		ans+=(num[x]*y);
		num[y]+=num[x];
		num[x]=0;
		printf("%lld\n",ans);
	}
 } 

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define M               1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO()
{
	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
}

int mod(int x)
{
	return ((x % M + M) % M);
}
int add(int a, int b)
{
	return mod(mod(a) + mod(b));
}
int mul(int a, int b)
{
	return mod(mod(a) * mod(b));
}
int minu(int a, int b)
{
	return mod(mod(a) - mod(b));
}

int power(int a, int n)
{
	int ans = 1;
	while (n)
	{
		if (n & 1)
		{
			ans = mul(ans, a);
		}
		a = mul(a, a);
		n = n >> 1;
	}

	return ans;
}

int32_t main()
{
	FIO();
	int n; cin >> n;
	int a  = power(10, n);
	int b = power(9, n);
	int c = power(8, n);

	int ans = minu(add(a, c), mul(2, b));
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3544
#include <iostream>

using namespace std;

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  if(a > b) {
    int t = a;
    a = b;
    b = t;
  }
  if(a > c) {
    int t = a;
    a = c;
    c = t;
  }
  if(b > c) {
    int t = b;
    b = c;
    c = t;
  }
  cout << a << ' ' << b << ' ' << c << endl;
  return 0;
}

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

#define rep(i, n) for(int i = 0; i < n;i++)

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

    if(B >= K){
        //ans += K;
        cout << ans << endl;
        return 0;
    }else{
        //ans += B;
        K -= B;
    }

    if(C >= K){
        ans -= K;
        cout << ans << endl;
        return 0;
    }else{
        ans -= C;
        K -= C;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



char buf[105];

int main(){

	int x = 0,maximum = 0;

	int N;
	scanf("%d",&N);
	scanf("%s",buf);

	for(int i = 0; buf[i] != '\0'; i++){
		if(buf[i] == 'I'){

			x++;
			maximum = max(maximum,x);

		}else{

			x--;
		}
	}

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

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a, b;
  int height = 0;
  scanf("%d %d", &a, &b);
  
  for (int i = 1; i <= b - a; i++) {
    height += i;
  }
  
  printf("%d", height - b);
  
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(){
  double n, m;

  while(scanf("%lf %lf", &n, &m) != EOF){
    if(n < 35.5 && m < 71)
      printf("AAA\n");
    else if(n < 37.5 && m < 77)
      printf("AA\n");
    else if(n < 40 && m < 83)
      printf("A\n");
    else if(n < 43 && m < 89)
      printf("B\n");
    else if(n < 50 && m < 105)
      printf("C\n");
    else if(n < 55 && m < 116)
      printf("D\n");
    else if(n < 70 && m < 148)
      printf("E\n");
    else
      printf("NA\n");
  }
  return 0;
}

Measured memory_bytes: 0