akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1e9+7;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy


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

/*#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r+", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w+", stdout);
#endif  */
	
    int N;
    cin >> N;
    vl A(N);
    for(int i=0;i<N;i++) {
    	cin >> A[i];
    }
    vl pre(N);
    pre[0] = A[0];
    for(int i=1;i<N;i++) {
    	pre[i] = (pre[i-1] + A[i]) % MOD;
    }
    ll ans = 0;
    for(int i=1;i<N;i++) {
    	ans = (ans + (pre[i-1] * A[i])%MOD) % MOD;
    }
    cout << ans << '\n';
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 6384
S = input()

n = len(S)

red, blue = 0, 0
for s in S:
    if s == "0":
        if blue > 0:
            blue -= 1
        else:
            red += 1
    else:
        if red > 0:
            red -= 1
        else:
            blue += 1

print(n-red-blue)


Measured memory_bytes: 3188
import java.util.*;
class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n= scan.nextInt();
      	int[] num = new int[n];
      	int[] gcdi = new int[n];
      	int[] gcdj = new int[n];
      	int[] gcds = new int[n];
      
      	for(int i=0;i<n;i++){
        	num[i] = scan.nextInt();
        }
      	gcdi[0] = num[0];
      	for(int i=1;i<n;i++){
        	gcdi[i] = gcd(gcdi[i-1],num[i]);
        }
      	gcdj[n-1] = num[n-1];
      	for(int i=2;i<n+1;i++){
        	gcdj[n-i] = gcd(gcdj[n-i+1],num[n-i]);
        }
      	gcds[0] = gcdj[1];
      	for(int i=1;i<n-1;i++){
        	gcds[i] = gcd(gcdi[i-1],gcdj[i+1]);
        }
      	gcds[n-1] = gcdi[n-2];
      	
      
      	System.out.println(max(gcds));
    }
  	static int gcd(int a, int b){
		int tmp;
      	while((tmp = a%b) != 0){
        	a = b;
            b = tmp;
        }
      	return b;
    }
  	static int max(int[] a){
    	int max=a[0];
      	for(int i=0;i<a.length;i++){
        	if(max < a[i]){
            	max = a[i];
            }
        }
      	return max;
    }
}

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

main(){

        int A,B,K,i;
        scanf("%d %d %d",&A,&B,&K);

        if((B-A+1) < K*2){
                for(i=A;i<=B;i++){
                        printf("%d\n",i);
                }
        }
        else{
                for(i=A;i<=A+K-1;i++){
                        printf("%d\n",i);
                }
                for(i=B-K+1;i<=B;i++){
                        printf("%d\n",i);
                }

        }

}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
    int x;
    int y;
    
    public void solve(){
        Scanner sc = new Scanner(System.in);
        x=sc.nextInt();
        y=sc.nextInt();
        System.out.println((x*y)+" "+(x*2+y*2));
    }
    
    public static void main(String[] args){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 17304
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
int main() {
	int a, b;
	std::cin >> a >> b;
	if (a < b) {
		std::cout << "a < b" << std::endl;
	}
	else if (a == b) {
		std::cout << "a == b" << std::endl;
	}
	else {
		std::cout << "a > b" << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3104
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
const long long inf=1e9+7;
const long long mod=1e9+7;
const int64_t CYCLES_PER_SEC=2800000000;
//
inline uint32_t Xor128(){
	static uint32_t x=123456789;
	static uint32_t y=362436069;
	static uint32_t z=521288629;
	static uint32_t w=88675123;
	uint32_t t=x^(x<<11);
	x=y;y=z;z=w;
	return w=(w^(w>>19))^(t^(t>>8));
}
struct Timer{
	int64_t start;
	Timer(){reset();}
	void reset(){start=getcycle();}
	void plus(double a){start-=(a*CYCLES_PER_SEC);}
	inline double get(){return (double)(getcycle()-start)/CYCLES_PER_SEC;}
	inline int64_t getcycle(){
		uint32_t low,high;
		__asm__ volatile ("rdtsc":"=a"(low),"=d"(high));
		return ((int64_t)low)|((int64_t)high<<32);
	}
};
long long gcd(long long a,long long b){
	if(a%b==0){
		return b;
	}else{
		return gcd(b,a%b);
	}
}
int main(){
	long long a,b;
	cin>>a>>b;
	vector<long long> c,d,e;
	for(long long i=1;i*i<=a;i++){
		if(a%i==0){
			c.push_back(i);
			if(i*i!=a){
				c.push_back(a/i);
			}
		}
	}
	for(long long i=1;i*i<=b;i++){
		if(b%i==0){
			d.push_back(i);
			if(i*i!=b){
				d.push_back(b/i);
			}
		}
	}
	sort(c.begin(),c.end());
	sort(d.begin(),d.end());
	for(long long i=0;i<c.size();i++){
		if(*lower_bound(d.begin(),d.end(),c[i])==c[i]){
			e.push_back(c[i]);
		}
	}
	vector<long long> ans;
	for(long long i=0;i<e.size();i++){
		bool f=true;
		for(long long j=0;j<ans.size();j++){
			if(ans[j]*ans[j]>e[i]){
				break;
			}
			if(gcd(e[i],ans[j])!=1){
				f=false;
			}
		}
		if(f){
			ans.push_back(e[i]);
		}
	}
	cout<<ans.size()<<endl;
	return 0;
}


Measured memory_bytes: 512
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;
 
void Main()
{
  int N;
  
  cin >> N;
  
  int min;
  int S[N*N*N];
  int count = 0;
  int sum = 0;
  
  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= N; j++){
      for(int k = 1; k <= N; k++){
        
        //最小値判別
        if(i <= j){
          if(i <= k){
            min = i;
          }
          else{
            min = k;
          }
        }
        else{
          if(j <= k){
            min = j;
          }
          else{
            min = k;
          }
        }
        
        //最大公約数判定
        for(int l = 1; l <= min; l++){
          if(i % l == 0 && j % l == 0 && k % l == 0)
            S[count] = l;
        }
        
        //カウントアップ
        count++;
        
      }
    }
  }
  
  for(int i = 0; i < N*N*N; i++){
    sum += S[i];
  }
  
  printf("%d", sum);
	
	
}
 
int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 34960
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        int N = sc.nextInt();
        int[] a = new int[N];
        for (int i=0; i<N; i++) {
            a[i] = sc.nextInt();
        }

        System.out.println(solve(N, a));
    }

    private static int solve(int N, int[] a) {
        int current = 1;
        for (int i=0; i<N; i++) {
            current = a[current-1];

            if (current == 2) return i+1;
        }

        return -1;
    }
}

Measured memory_bytes: 50456
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <unordered_set>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <map>
#include <ctime>
#include <set>
#define endl '\n'
#define ll unsigned long long
#define mod 1000000007
#define NCONS 100001
#define MACRO(a) for(int a = 1; a < 1001; a++)

using namespace std;

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

	int X; cin >> X;
	int acc = 0;
	int i;
	for (i = 0; acc < X; i++)
	{
		acc += i;
	}
	cout << i-1 << endl;

	return 0;
}

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

#define scan(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define FASTER std::ios::sync_with_stdio(false)
#define DEBUG(x) cout<<#x<<" = "<<x<<endl

#define pb push_back
#define mk make_pair
#define vp vector<pair<ll,ll> >
#define se second
#define fi first
#define vi vector<ll>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define fab(i,a,b) for(ll i=a;i<=b;i++)
#define inp(n,a) for(ll i=0;i<n;i++){cin>>a[i];}
#define strToInt(x,z) istringstream y(x);y>>z  //(string,integer)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b / __gcd(a,b);
#define MOD 1000000007
#define pi 3.14159265
using namespace std;
long double a[100010], b[100010],n,p;

int main() 
{
	//FASTER;
	ll x, y;
	cin >> x >> y;
	if(abs(x-y) <=1)cout << "Brown" <<endl;
	else cout << "Alice" <<endl;

	return 0;
}		

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
main(){
    int n,x;
    scanf("%lld%lld",&n,&x);
    int a[n];
    for (int i = 0; i < n; i++){
        scanf("%lld",&a[i]);
    }
    int s[n+1]; s[0] = a[0], s[n] = a[n-1];
    for (int i = 1; i < n; i++) s[i] = a[i]+a[i-1];
    int ans = 0;
    for (int i = 0; i <= n; i++){
        int k = max(0ll,s[i]-x);
        ans += k;
        s[i+1] -= k;
    }
    printf("%lld",ans);

}


Measured memory_bytes: 1792
#include <iostream>
#include <limits>

using namespace std;
int main()
{
    long long a,b,c,d;
    cin >> a >> b >> c >> d;
    long long res= numeric_limits<long long>::min();

    if(a*c >= res) res = a*c;
    if(a*d >= res) res = a*d;
    if(b*c >= res) res = b*c;
    if(b*d >= res) res = b*d;

    cout << res;
}

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

using static Input;
using static Util;
class Program
{
    static int K;
    static int[] A;

    static void INPUT()
    {
        K = NextInt();
        A = LineInt();
    }
    static void OUT()
    {
        var b = false;
        for (var i = A[0]; i <= A[1]; i++)
        {
            if (i % K == 0)
            {
                b = true;
                break;
            }
        }

        Console.WriteLine(b ? "OK" : "NG");
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{

}




Measured memory_bytes: 19132
#include <stdio.h>

int main()
{
	int S,h,m,s;

	scanf("%d",&S);

	h = S/(60*60);
	m = (S%3600)/60;
	s = (S%3600)%60;

	printf("%d:%d:%d\n",h,m,s);

	return 0;
}

Measured memory_bytes: 592
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B754 solver = new B754();
        solver.solve(1, in, out);
        out.close();
    }

    static class B754 {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            String s = in.string();
            long ans = 973261980476L;
            for (int i = 0; i < s.length() - 2; i++) {
                ans = Math.min(ans, Math.abs(753 - Integer.parseInt(s.substring(i, i + 3))));
            }
            out.println(ans);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 22228
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           node(a,b,c)                 mp(mp(a,b),c)
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=200005;
vector<pi>adj[M];
int vis[M],dis[M];
void dfs(int u,int sum)
{
    vis[u]=1;
    dis[u]=sum;
    for(auto x:adj[u])
    {
       int v=x.fi;
       int w=x.si;
       if(vis[v])
       {
           int chk=dis[v]-dis[u];
           if(chk!=w)
           {
               cout<<"No"<<endl;
               exit(0);
           }
           continue;
       }
       dfs(v,sum+w);
    }
}
 main()

{
    fast
    int n,m;
    cin>>n>>m;
    f(i,1,m)
    {
        int u,v,w;
        cin>>u>>v>>w;
        adj[u].pb(mp(v,w));
        adj[v].pb(mp(u,-w));
    }
    f(i,1,n)
    {
        if(vis[i])continue;
        dfs(i,0);
    }
    cout<<"Yes"<<endl;
    return 0;

}





































Measured memory_bytes: 23792
#include <iostream>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  
  b = b * 2;
  int c = a - b;
  if(c > 0) {
    cout << c;
  }
  else {
    cout << 0;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0)break;
		vector<int> a(n);
		double avg, num; avg = num = 0;
		rep(i, 0, n) {
			cin >> a[i];
			avg += a[i];
		}
		avg /= n;
		rep(i, 0, n) {
			num += (a[i] - avg)*(a[i] - avg);
		}
		double std_dev = sqrt(num / n);
		cout << std_dev << endl;
	}
	return 0;
}


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

int main() {
  int A,B,C,D ;
  cin >> A >> B >> C >> D;
  if (A + B > C + D){
    cout << "Left" << endl;
  }
  else if (A + B < C + D){
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;



int main(){
  int N;
  ll C;
  cin >> N >> C;
  vector<ll> x(N), v(N);
  REP(i, N){
    cin >> x[i] >> v[i];
  }
  vector<ll> sum(N+1, 0), msum(N+1, 0), rsum(N+1, 0), rmsum(N+1, 0);
  REP(i, N){
    if(i==0){
      sum[i+1] = sum[i]+v[i]-x[i];
    }
    else{
      sum[i+1] = sum[i] + v[i] -(x[i]-x[i-1]);
    }
    msum[i+1] = max(msum[i], sum[i+1]);
  }
  REPR(i, N-1){
    if(i==N-1){
      rsum[i] = rsum[i+1] + v[i] - (C-x[i]);
    }
    else{
      rsum[i] = rsum[i+1] + v[i] - (x[i+1]-x[i]);
    }
    rmsum[i] = max(rsum[i], rmsum[i+1]);
  }

  ll ans = 0;
  ll cost = 0;
  REP(i, N+1){
    ll gain = sum[i] - cost + rmsum[i];
    ans = max(ans, gain);
    if(i != N){
      cost = x[i];
    }
  }
  // cout << ans << endl;
  cost = 0;
  REPR(i, N){
    ll gain = rsum[i] - cost + msum[i];
    ans = max(ans, gain);
    if(i!=0){
      cost = (C - x[i-1]); 
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7956
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    long A,B,C,K,max=0,cnt=0;
    cin >>A>>B>>C>>K;
    if(K<=A+B){
        if(K<A){
            max=K;
        }else{
            max=A;
        }
    }else{
        max=A-(K-A-B);
    }
    cout << max;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main()
{
	int i, N, K, P[5001], C[5001];
	scanf("%d %d", &N, &K);
	for (i = 1; i <= N; i++) scanf("%d", &(P[i]));
	for (i = 1; i <= N; i++) scanf("%d", &(C[i]));

	int j, k, dist[5001], period;
	long long ans = -(1 << 30), tmp[5001], max, loop;
	for (i = 1; i <= N; i++) {
		for (j = 1; j <= N; j++) {
			dist[j] = 0;
			tmp[j] = 0;
		}
		for (k = 1, j = i, dist[j] = k, max = -(1 << 30); k <= K && dist[P[j]] == 0; j = P[j]) {
			dist[P[j]] = ++k;
			tmp[P[j]] = tmp[j] + C[P[j]];
			if (tmp[P[j]] > max) max = tmp[P[j]];
		}
		if (k > K || tmp[j] + C[P[j]] <= tmp[P[j]]) {
			if (max > ans) ans = max;
			continue;
		}
		period = dist[j] - dist[P[j]] + 1;
		loop = tmp[j] + C[P[j]] - tmp[P[j]];
		j = P[j];
		tmp[j] += loop * ((K - dist[j] + 1) / period);
		if (tmp[j] > max) max = tmp[j];
		for (k = j; P[j] != k; j = P[j]) {
			tmp[P[j]] += loop * ((K - dist[P[j]] + 1) / period);
			if (tmp[P[j]] > max) max = tmp[P[j]];
		}
		if (max > ans) ans = max;
	}

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

Measured memory_bytes: 1832
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
using namespace std;
using Graph = vector<vector<int>>;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;

#define For(N,i) for(int i = 0; i < N; i++)
int main(){
	int N;
	cin>>N;
	vector<ll>H(N);
	For(N,i){
		cin>>H[i];
	}
	int cnt=0;
	int ans = 0;
	for(int i = N-1; i >= 0; i--){
		if(i != 0){
			if(H[i] <= H[i-1]){
				cnt++;
			}else{
				ans = max(ans,cnt);
				cnt = 0;
			}
		}
		if(i == 0){
			ans = max(ans,cnt);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

void solve(istream& cin, ostream& cout) {
  int n;
  cin >> n;
  vector<int> a(n - 1);
  REP(i, n - 1) cin >> a[i];
  map<int, int> m;
  FOR(i, 1, n) {
    m[i] = 0;
  }
  REP(i, n - 1) {
    m[a[i]]++;
  }
  int index = 1;
  for (auto it = m.begin(); it != m.end(); it++) {
    cout << it->second << endl;
  }
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


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


void solve(std::string S){
    if(S=="Sunny")cout<<"Cloudy"<<endl;
    if(S=="Cloudy")cout<<"Rainy"<<endl;
    if(S=="Rainy")cout<<"Sunny"<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX(x, y) (((x) > (y)) ? (x) : (y))

int main() {

	int n, i, max;
	scanf("%d", &n);

	unsigned short A[n+1];
	unsigned short B[n+1];

	max = (1<<30)*-1;
	for (i = 0; i < n; i++) {
		scanf("%hu", &A[i+1]);
		max = MAX(max, A[i+1]);
	}
	int C[max+1];
	memset(C, 0, sizeof(C));

	for (i = 0; i < n; i++) C[A[i+1]]++;
	for (i = 1; i <= max; i++) C[i] += C[i-1];

	for (i = n; i >= 1; i--) {
		B[C[A[i]]] = A[i];
		C[A[i]]--;
	}

	printf("%d", B[1]);
	for (i = 2; i <= n; i++) {
		printf(" %d", B[i]);
	}
	printf("\n");

	return 0;
}



Measured memory_bytes: 10524
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        b[i] = a[i];
        if (i > 0)
            b[i] ^= b[i - 1];
    }
    int l = 0, r = 0;
    ll ans = 0;
    while (l < n) {
        int orA = l > 0 ? b[r] ^ b[l - 1] : b[r];
        while (r < n - 1 && (orA & a[r + 1]) == 0) {
            orA |= a[r + 1];
            ++r;
        }
        ans += r - l + 1;
        ++l;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;

int main()
{
    int A, B;
    int E = 1;
    int i = 0;
    cin >> A >> B;
        while(1){
            if(B == 1){
                break;
            }
             E += A-1;
            i++;
            if(E >= B) break;
        }
    cout << i;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { string S;
  cin >> S;
  if(S[0]==S[1]&&S[1]==S[2]){
    puts("No");
    return 0;
  }
  if(S[0]==S[1]){
    if(S[2]==S[3]){
      puts("Yes");
      return 0;
    }    
  }
  if(S[0]==S[2]){
    if(S[1]==S[3]){
      puts("Yes");
      return 0;
    }
  }
  if(S[0]==S[3]){
    if(S[1]==S[2]){
      puts("Yes");
      return 0;
    }
  }

  puts("No");
}

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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

const ll MOD = TEN(9) + 7;

int main() {
    int N;
    cin >> N;
    ll ans = 1;
    for (int i = 2; i <= N; ++i) {
        bool pr = 1;
        for (int j = 2; j < i; ++j) {
            if (i % j == 0) {
                pr = 0;
            }
        }
        if (!pr) continue;
        int u = 0, x = N;
        while (x) {
            x /= i;
            u += x;
        }
        ans = ans * (u + 1) % MOD;
    }
    cout << ans << endl;
    return 0;
}

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


using namespace std;

typedef long long ll;
const double eps = 1e-9;



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

    string s;
    cin>>s;
   int r = 0;
   for(int i=0;i<3;i++)
   {
       if(s[i]=='R')
       {
           r++;
       }
   }
   if(r==2)
   {
       if(s[1]=='R')
       {
           cout<<2<<endl;
       }
       else
       {
           cout<<1<<endl;
       }
   }
   else
   {
       cout<<r<<endl;
   }





}

/*
 ll x,k,d;
    cin>>x>>k>>d;
    if(x==0)
    {
        if(k%2)
        {
            cout<<x+d<<endl;;
        }
        else
        {
            cout<<0<<endl;
        }
    }
    else if(x>0)
    {
        if(x-k*d>=0)
        {
            cout<<x-k*d<<endl;
        }
        else
        {
           ll moves = x/d;
            ll ans;
            if((k-moves) % 2 == 0)
            {
                ans = x-moves*d;

            }
            else
            {
                ans = llabs(x-moves*d - d);
            }
            cout<<ans<<endl;

        }


    }
    else if(x<0)
    {
        if(x+k*d<=0)
        {
            cout<<x+k*d<<endl;
        }
        else
        {
           ll moves = x/d * -1;
            ll ans;
            if((k-moves) % 2 == 0)
            {
                ans = x+moves*d;

            }
            else
            {
                ans = llabs(x+moves*d + d);
            }
            cout<<ans<<endl;

        }
    }

*/


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
#define ALL(v) v.begin(), v.end()


ll t[100010];
ll h[100010];

ll root(ll x){
    if(t[x]==x){
        return x;
    }else{
        return t[x]=root(t[x]);
    }
}

int main(){
    ll N;
    cin>>N;
    
    if(N<1200){
        cout<<"ABC";
    }else if(N<2800){
        cout<<"ARC";
    }else{
        cout<<"AGC";
    }
    return 0;
    
    // REP(i,N){
    //     t[i]=i;//t.push_back(i);
    //     h[i]=0;//h.push_back(0);
    // }
    // REP(ttttt,Q){
    //     ll q;
    //     cin>>q;
    //     if(q==0){
    //         ll a,z;
    //         cin>>a>>z;
    //         ll mi=min(root(a),root(z));
    //         ll ma=max(root(a),root(z));
    //         if(a!=z){
    //             if(h[mi]==h[ma]){
    //                 t[ma]=mi;
    //                 h[mi]++;
    //             }else if(h[mi]>h[ma]){
    //                 t[ma]=mi;
    //             }else{
    //                 t[mi]=ma;
    //             }
    //         }
    //     }else{
    //         ll a,z;
    //         cin>>a>>z;
    //         cout<<(root(a)==root(z)?"Yes":"No")<<endl;
    //     }
    // }
    // REP(i,N){
    //     sl(i,":",t[i],h[i]);
    // }
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3596
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] A = new int[n];
        for(int i = 0; i < n; i++){
            A[i] = input.nextInt();
        }

        buildMaxHeap(A);
        //System.out.println(Arrays.toString(A));
        for(int i = 0; i < A.length; i++){
            System.out.print(" " + A[i]);
        }
        System.out.println();
    }

    static void maxHeapify(int[] A,int i){
        int l = 2*i+1;
        int r = 2*i+2;
        int largest = 0;
        if(l < A.length && A[l] > A[i]){
            largest = l;
        }else {
            largest = i;
        }

        if(r < A.length && A[r] > A[largest]){
            largest = r;
        }

        if(largest != i){
            int temp = A[largest];
            A[largest] = A[i];
            A[i] = temp;
            maxHeapify(A,largest);
        }
    }
    static void buildMaxHeap(int[] A){
        for(int i = A.length / 2; i >= 0; i--){
            maxHeapify(A,i);
        }
    }
}


Measured memory_bytes: 165880
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include <random>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,const vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,const pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  int n;
  scanf("%d",&n);
  vi a(n);
  rep(i,n) scanf("%d",&a[i]);
  ll sum = 0;
  sort(rng(a));
  int ans = 0;
  rep(i,n-1) {
    sum += a[i];
    ans++;
    if (sum*2 < a[i+1]) ans = 0;
  }
  ans++;
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int ara_D[100][200];
int ara[100000];
char ara1[100000];
int main()
{
    int i,j,k,l;
    long long n,f_n,f_t,t,fee,pay1,pay2;
    scanf("%lld %lld %lld %lld",&n,&f_n,&f_t,&t);
    if(n<=f_n)
    {
        fee=n*f_t;
    }
    else
    {
        pay1=f_n*f_t;
        pay2=(n-f_n)*t;
        fee=pay1+pay2;
    }
    printf("%lld\n",fee);
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll n;
  cin>>n;
  map<string,ll> ma;
  rep(i,0,n){
    string s;
    cin>>s;
    ma[s]++;
  }
  cout << "AC x" << " " << ma["AC"] << endl;
  cout << "WA x" << " " << ma["WA"] << endl;
  cout << "TLE x" << " " << ma["TLE"] << endl;
  cout << "RE x" << " " << ma["RE"] << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  ll a, b, c;
  cin>>a>>b>>c;
  cout<<((c-a-b>0) && (a+b-c)*(a+b-c)>4*a*b ? "Yes" : "No")<<'\n';
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
typedef struct data *node;
struct data{
    int key;
    node par;
    node left;
    node right;
};

void insert(int);
node find(int);
void delete(int);
node makenode(int);
void Preorder(node);
void Inorder(node);

node root;

int main (){
    int n,i,x;
    char com[10];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",com);
        if(com[0]=='i'){
            scanf("%d",&x);
            insert(x);
        }
        else if(com[0]=='p'){
            Inorder(root);
            printf("\n");
            Preorder(root);
            printf("\n");
        }
        else if(com[0]=='f'){
            scanf("%d",&x);
            if(find(x)==NULL){
                printf("no\n");
            }
            else{
                printf("yes\n");
            }
        }
        else if(com[0]=='d'){
            scanf("%d",&x);
            delete(x);
        }
    }
    return 0;
}
void insert(int z){
    node x,y,t;
    y=NULL;
    x=root;
    while(x!=NULL){
        y=x;
        if(z<x->key){
            x=x->left;
        }
        else{
            x=x->right;
        }
    }
    t=makenode(z);
    t->par=y;
    if(y==NULL){
        root=t;
    }
    else if(z<y->key){
        y->left=t;
    }
    else{
        y->right=t;
    }
}
node makenode (int z){
    node x;
    x=(node)malloc(sizeof(struct data));
    x->key=z;
    x->left=NULL;
    x->right=NULL;
    return x;
}
void Preorder(node u){
    if(u==NULL){
        return;
    }
    printf(" %d",u->key);
    Preorder(u->left);
    Preorder(u->right);
}
void Inorder(node u){
    if(u==NULL){
        return;
    }
    Inorder(u->left);
    printf(" %d",u->key);
    Inorder(u->right);
}
node find(int x){
    node n;
    n=root;
    while(n!=NULL){
        if(n->key==x){
            return n;
        }
        else if(x<n->key){
            n=n->left;
        }
        else{
            n=n->right;
        }    
    }
    return NULL;
}
void delete(int x){
    node n;
    n=find(x);
    if(n->left==NULL && n->right==NULL){
        if(n->par->left->key==x){
            n->par->left=NULL;
        }
        else{
            n->par->right=NULL;
        }
    }
    else if(n->left!=NULL && n->right!=NULL){
        if(n->par->left->key==x){
            n->par->left=n->right;
            n->par->left->left=n->left;
        }
        else{
            n->par->right=n->right;
            n->par->right->left=n->left;
        }
        n->right->par=n->par;
        n->left->par=n->right;
    }
    else{
        if(n->par->left->key==x){
            if(n->left==NULL){
                n->par->left=n->right;
                n->right->par=n->par;
            }
            else{
                n->par->left=n->left;
                n->left->par=n->par;
            }
        }
        else{
            if(n->left==NULL){
                n->par->right=n->right;
                n->right->par=n->par;
            }
            else{
                n->par->right=n->left;
                n->left->par=n->par;
            }
        }
    }
    free(n);
}


Measured memory_bytes: 20608
#include <iostream>
#include <stack>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;
#define endl "\n"
using Int = long long;
Int gcd(Int a, Int b){
    if(b==0) return a;
    return gcd(b, a%b);
}
int main() {
    ios::sync_with_stdio(false);
    Int N;
    cin>>N;
    vector<Int>monsters(N,0);
    sort(monsters.begin(),monsters.end());
    for(int i=0;i<N;i++){
        cin>>monsters[i];
    }
    Int ans=monsters[0];
    for(int i=1;i<N;i++){
        ans=gcd(ans,monsters[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
import heapq
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    n = int(input())
    A = [-int(i) for i in input().strip().split()]
    heapq.heapify(A)
    ans = 0
    for i in range(2 * n):
        a = heapq.heappop(A)
        if i % 2 == 1:
            ans -= a

    print(ans)


if __name__ == "__main__":
    main()


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll S;
    cin >> S;

    if(S == 1 || S == 2){
        cout << 4 << endl;
        return 0;
    }
    else{
        ll count = 0;
        ll check = 0;
        while(1){
            count++;
            if(S == 4) check++;
            if(check == 2){
                cout << count << endl;
                return 0;
            }
            if(S % 2 == 0) S = S / 2;
            else S = S = 3*S+1;
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

int compar(const void *a,const void *b)
{
    return *(int *)a-*(int *)b;
}

int main(void)
{
    int N,K;
    scanf("%d",&N);
    int d[N];
    for(int i=0;i<N;i++){
        scanf("%d",&d[i]);
    }
    int d_size=sizeof(d)/sizeof(d[0]);
    qsort(d,d_size,sizeof(d[0]),compar);
    
    K=d[N/2]-d[N/2-1];
    printf("%d\n",K);
    return 0;
}


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


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

    int k = -1;
    for(int i = 1; i*(i+1) <= 2*n; ++i) {
        if(i*(i+1) == 2*n) {
            k = i;
            break;
        }
    }
    if(k == -1) {cout << "No\n"; exit(0);}

    // |S[i]| = k
    // {S[0], S[1], ..., S[k]}

    vector<vector<int>> S(k+1);
    for(int i = k; i >= 1; --i) {
        for(int j = 0; j < i; ++j,--n) {
            S[j].push_back(n);
            S[i].push_back(n);
        }
    }

    cout << "Yes\n";
    cout << k+1 << endl;
    rep(i,k+1) {
        cout << k << " ";
        rep(j,k) {
            cout << S[i][j] << (j==k-1?"\n":" ");
        }
    }

    return 0;
}

Measured memory_bytes: 4484
#include <bits/stdc++.h>
using namespace std; bool ooo = 0; template <typename T> ostream& operator << (ostream& _o_, const vector <T> &_v_) { if(!_v_.empty()) {_o_ << '['; copy(_v_.begin(), _v_.end(), ostream_iterator <T> (_o_, ", ")); _o_ << "\b\b]"; } return _o_; } struct Dbg { template <typename T> Dbg& operator, (const T& v) { cerr << v << ", "; return *this; } } Dbg;
#define debug(args...)  if(ooo) { cerr << #args << " = "; Dbg, args; cerr << endl; }

int n, k;

signed main() {
	cin >> n >> k;
	cout << (k == 1 ? 0 : n - k);
}


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

#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;



int main(){FIN
    using T = tuple<ll,ll,ll,ll>; 
    ll x,y,z,k;
    cin>>x>>y>>z>>k;
    vll a(x), b(y), c(z);
    REP(i,x) cin>>a[i];
    REP(i,y) cin>>b[i];
    REP(i,z) cin>>c[i];
    VSORTR(a); VSORTR(b); VSORTR(c);
    priority_queue<T> pq;
    map<T,ll> mp;
    pq.push(make_tuple(a[0]+b[0]+c[0],0,0,0));
    REP(i,k){
        T ans = pq.top();
        pq.pop();
        ll& sm= get<0>(ans);
        ll& i1 = get<1>(ans);
        ll& i2 = get<2>(ans);
        ll& i3 = get<3>(ans);
        // if(sm==18) cout<<i1<<i2<<i3<<endl;
        cout<<sm<<endl;
        T T1 = make_tuple(a[i1+1]+b[i2]+c[i3], i1+1,i2,i3);
        T T2 = make_tuple(a[i1]+b[i2+1]+c[i3], i1,i2+1,i3);
        T T3 = make_tuple(a[i1]+b[i2]+c[i3+1], i1,i2,i3+1);
        if (i1+1<x && !mp[T1]) {pq.push(T1); mp[T1]++;}
        if (i2+1<y && !mp[T2]) {pq.push(T2); mp[T2]++;}
        if (i3+1<z && !mp[T3]) {pq.push(T3); mp[T3]++;}

        

    }
    
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
typedef long long ll;
string S;
int main(){
	cin>>S;
	ll ans=0,b=0;
	for(int i=S.size()-1;i>=0;i--){
		if (S[i]=='B'){
			ans+=(int)S.size()-1-i-b;
			b++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640