akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
char S[3];

void solve(){
	rep(i, 3){
		if(S[i] == '1')
			cout << 9;
		else
			cout << 1;
	}
	cout << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> S;
		solve();
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func solve() {
	var n int
	fmt.Scan(&n)

	h := make([]int, n)
	sc := bufio.NewScanner(os.Stdin)
	buffer := make([]byte, 10000)
	sc.Buffer(buffer, 2000000)
	sc.Scan()
	args := strings.Split(sc.Text(), " ")
	for i := 0; i < n; i++ {
		h[i], _ = strconv.Atoi(args[i])
	}

	able := true
	b := h[0] - 1
	for i := 1; i < n; i++ {
		if b <= h[i]-1 {
			b = h[i] - 1
		} else if b <= h[i] {
			b = h[i]
		} else {
			able = false
			break
		}
	}

	if able {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func main() {
	solve()
}


Measured memory_bytes: 6528
# C - Welcome to AtCoder

import numpy as np

N, M = map(int, input().split())
AC = np.zeros(N, dtype=np.int64)
WA = np.zeros(N, dtype=np.int64)

for i in range(M):
    p, S = map(str, input().split())
    if AC[int(p)-1]==0:
        if S=='AC':
            AC[int(p)-1] = 1
        else:
            WA[int(p)-1] += 1

print(sum(AC), sum(AC * WA))

Measured memory_bytes: 15180
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n;
    cin >> n;
    vl a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    ll ret = 0;
    while (true) {
        ll add = 0;
        for (int i = 0; i < n; ++i) {
            if (a[i] >= n) {
                ll temp = (a[i] - n) / n + 1;
                a[i] -= temp * (n + 1);
                add += temp;
            }
        }
        for (int i = 0; i < n; ++i) {
            a[i] += add;
        }
        if (add == 0)
            break;
        ret += add;
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int N,M;
struct range{int l,r;range*next;}a[300010],*fir[300010];
int b[100010];
void add(int i,int x){for(;i<=M;i+=i&-i)b[i]+=x;}
int query(int i){int s=0;for(;i;i-=i&-i)s+=b[i];return s;}
int main(){
	scanf("%d%d",&N,&M);
	for(int i=0,l,r;i<N;i++){
		scanf("%d%d",&l,&r);++r;
		a[i]=(range){l,r,fir[r-l]};fir[r-l]=a+i;
	}
	for(int i=1;i<=M;i++){
		for(range*j=fir[i];j;j=j->next,N--)add(j->l,1),add(j->r,-1);
		int ans=N;
		for(int j=i;j<=M;j+=i)ans+=query(j);
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 7296
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	int r, g, ans;
	cin >> r >> g;
	ans = g * 2 - r;
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 256
N, M = map(int, input().split(" "))
# print(N, M)

H = list(map(int, input().split(" ")))

# print(H)

data = []

for i in range(N):
  data.append([])

# print(data)
  
for i in range(M):
  way1, way2 = map(int, input().split(" "))
  data[way1-1].append(way2)
  data[way2-1].append(way1)

  
count = 0
for i in range(N):
  is_higher = False
  mountain_hights = [0]
  for j in data[i]:
    mountain_hights.append(H[j - 1])
  if H[i] > max(mountain_hights):
    count += 1

print(count)

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

using namespace std;

int main()
{
    long long n, mini=1000000000000;
    cin >> n;
    
    for (long long i=1; i*i<=n; i++){
        if(n%i==0){
            mini = min(i+n/i-2, mini);
        }
    }
    
    cout << mini;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
list = [list(map(int,input().split())) for x in range(N)]

x0, y0, h0 = 0, 0, 0

#hが0でない組をサンプルとして代入
for i in range(N):
    if list[i][2]:
        x0, y0, h0 = list[i]

for Cx in range(101):
    for Cy in range(101):
        H = h0 + abs(x0 - Cx) + abs(y0 - Cy)
        for i in range(len(list)):
            if list[i][2] != max(H-abs(list[i][0]-Cx)-abs(list[i][1]-Cy),0):
                break
        else:
            print(Cx,Cy,H)


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


using namespace std;

const int MAX = 100000;
typedef long long ll;

int n, k;
ll T[MAX];

ll check(ll P) {
    int i = 0;
    for (int j = 0; j < k; j++) {
        ll s = 0;
        while (s + T[i] <= P) {
            s += T[i];
            i++;
            if (i == n)
                return n;
        }
    }
    return i;
}


ll solve() {
    ll left = 0, right = 100000 * 10000, mid;
    while (right - left > 1) {
        mid = (left + right) / 2;
        int v = check(mid);
        if (v >= n)
            right = mid;
        else
            left = mid;
    }
    return right;
}


int main() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) { cin >> T[i]; }
    ll ans = solve();
    cout << ans << endl;
}


Measured memory_bytes: 3904
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#pragma GCC optimize ("O3")
	#define NDEBUG
#endif
// #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	string s, t;
	while(cin >> s >> t) {
		int ans = 0;
		REP(i, SZ(s)) {
			ans += (s[i] == t[i]);
		}
		cout << ans << endl;
	}
	return 0;
}


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

const int64_t BIT=60,MOD=1e9+7;
bool Free[BIT+5][2][2][2];
int64_t l,r,F[BIT+5][2][2][2];
vector<int64_t> L,R;

vector<int64_t> Bin(int64_t x)
{
	vector<int64_t> rs;
	for(int64_t i=0;i<=BIT;i++)
	{
		rs.push_back(x%2);
		x/=2;
	}
	reverse(rs.begin(),rs.end());
	return rs;
}

int64_t DP(int64_t i,int64_t isOne,int64_t isGreater,int64_t isSmaller)
{
	if(i==BIT+1)
		return 1;
	if(Free[i][isOne][isGreater][isSmaller]==true)
		return F[i][isOne][isGreater][isSmaller];
	Free[i][isOne][isGreater][isSmaller]=true;
	int64_t rs=0;
	for(int64_t t1=(isGreater==false?L[i]:0);t1<=1;t1++)
		for(int64_t t2=t1;t2<=(isSmaller==false?R[i]:1);t2++)
		{
			int64_t newIsGreater=isGreater|(t1>L[i]);
			int64_t newIsSmaller=isSmaller|(t2<R[i]);
			if(isOne==false&&t1==0&&t2==1)
				continue;
			int64_t newIsOne=isOne|(t1==1);
			rs=(rs+DP(i+1,newIsOne,newIsGreater,newIsSmaller))%MOD;
		}
	return F[i][isOne][isGreater][isSmaller]=rs;
}

int main()
{
	ios_base::sync_with_stdio(false);
	// freopen("F.inp","r",stdin);
	cin>>l>>r;
	L=Bin(l);
	R=Bin(r);
	cout<<DP(0,0,0,0);
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  int i;
  for(i = 0; i < n; i++)
  {
    cin >> a.at(i);
  }
  int count = 0;
  bool skip = false;
  for(i = 1; i < n; i++)
  {
    if(skip)
    {
      skip = false;
    }
    else if(a.at(i) == a.at(i-1))
    {
      count++;
      skip = true;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n,x;

    while (true) {
        cin >> n >> x;
        if (n == 0 && x == 0)
            break;

        int count = 0;

        for (int i = 1; i < n; i++) {
            for (int j = i+1; j < n; j++) {
                int k = x - i - j;
                if (k > j && k <= n)
                    count++;
            }
        }
        cout << count << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int M;
  cin >> N >> M;
  int s[M],c[M];
  for(int i=0;i<M;i++){
    cin >> s[i] >> c[i];
  }
  int ans=-1;
  if(N==1){
    for(int i=9;i>=0;i--){
      int check=0;
      for(int j=0;j<M;j++){
        if(c[j]!=i) check=1;
      }
      if(check == 0) ans = i;
    }
  } else if(N==2){
    for(int i=99;i>=10;i--){
      int check = 0;
      for(int j=0;j<M;j++){
        int keta = ceil(pow(10,3-s[j]))/10;
        if(((i%(keta*10)-i%keta)/keta)!=c[j])check = 1;
      }
      if(check == 0) ans = i;
    }
  }else if(N==3){
    for(int i=999;i>=100;i--){
      int check = 0;
      for(int j=0;j<M;j++){
        int keta=ceil(pow(10,4-s[j]))/10;
        if(((i%(keta*10)-i%keta)/keta)!=c[j])check = 1;
      }
      if(check == 0) ans = i;
    }
  }
  cout << ans;
}


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

static const int MAX = 2000;

int ans[MAX];

int main(){
    int n, x, y;
    cin >> n >> x >> y;

    for(int i = 1; i <= n; i++){
        for(int j = i+1; j <= n; j++){
            int z;
            if(j <= x){
                z = j-i;
            }
            else if(j <= y){
                if(i <= x){
                    z = min( j-i, x-i+1+y-j );
                }
                else{
                    z = min( j-i, i-x+1+y-j );
                }
            }
            else{
                if(i <= x){
                    z = x-i+1+j-y;
                }
                else if(i <= y){
                    z = min( j-i, i-x+1+j-y );
                }
                else{
                    z = j-i;
                }
            }
            ans[z]++;
        }
    }

    for(int i = 1; i < n; i++){
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N], m;
string s, t;

void yes(){
   cout<<"Yes"<<endl;
   //exit (0);
}
void no(){
   cout<<"No"<<endl;
   //exit (0);   
}


int32_t main(){_

   int x, n;

   cin >> x >> n;

   set<int> ms;
   for (int i = -1000; i <= 1000; ++i)
   {
      ms.insert(i);
   }

   for (int i = 0; i < n; ++i)
   {
      int x;
      cin >> x;
      ms.erase(ms.find(x));
   }

   int ans = inf;
   int ret = inf;
   for(auto it: ms){
      if (abs(it - x) < ans){
         ans = abs(it - x);
         ret = it;
      }
   }
   
   cout<<ret;

   return 0;
}

Measured memory_bytes: 3708
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	a := nextInt()
	b := nextInt()
	min := (a * 100) / 8
	max := ((b + 1) * 100) / 10
	for i := min; i < max; i++ {
		i8 := (i*108)/100 - i
		i10 := (i*110)/100 - i
		if i8 == a && i10 == b {
			fmt.Println(i)
			return
		}
	}
	fmt.Println(-1)
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int ok[n],lap[n],dist[n],t[n+1],x[n+1],y[n+1];
  x[0]=y[0]=0,t[0]=0;
  for(int i=1;i<=n;i++){
    cin>>t[i]>>x[i]>>y[i];
    lap[i-1]=t[i]-t[i-1];
    dist[i-1]=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
    ok[i-1]=abs(lap[i-1]-dist[i-1]);
    }
  for(int i=0;i<n;i++){
    if(dist[i]>lap[i]){
      cout<<"No"<<endl;
      return 0;
      }
    if(ok[i]%2==1){
      cout<<"No"<<endl;
      return 0;
      }
    }
  cout<<"Yes"<<endl;
  return 0;
  }

  
    

Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
int main()
{
    char* a = (char*)malloc(sizeof(char));
    scanf("%c",&a[0]);
    int i = 0;
    while((int)a[i]!=10)
    {
        i++;
        a = (char*)realloc(a,(i + 1)*sizeof(char));
        scanf("%c",&a[i]);
    }
    int max = 0,mediator = 0,j = 0;
    while(j < i + 1)
    {
        if(a[j] == 'R') {
            mediator++;
        }
        else{
            if (mediator > max){
                max = mediator;
                mediator = 0;
            } 
        }
        j++;
    }
    printf("\n%d",max);
    free(a);
    return 0;
}


Measured memory_bytes: 2084
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    vector<ll> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];
    sort(h.begin(), h.end());
    ll ans = INF;
    for(int i = 0; i <= n - k; i++)
    {
        ans = min(h[i + k - 1] - h[i], ans);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1024
// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
string ans[] = {"not coprime", "setwise coprime", "pairwise coprime"};
int a[1010101], b[1010101], c[1010101];
set<int> divisors[1010101];

int main() {
    
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    rep(i, N) scanf("%d", &a[i]);
    
    // 2. 素因数を取得.
    repx(i, 2, 1010101){
        if(b[i]) continue;
        // max_12.txt, max_13.txt で, WA版となったことで, 
        // j が i で 割り切れる場合の考慮が漏れていたことが判明し, ロジック修正.
        // repex(j, i * 2, 1010101, i){
        repex(j, i, 1010101, i){
            b[j]++;
            if(j % i == 0) divisors[j].insert(i);
        }
    }
    
    // 3. "pairwise coprime" であるかの判定.
    int idx = 2;
    rep(i, N){
        bool ok = false;
        for(auto &p : divisors[a[i]]){
            // 前回以前に出てきた素因数が見つかったら, 
            // "pairwise coprime" でないことが分かるので, 終了.
            if(!c[p]){
                c[p]++;
            }else{
                idx--;
                ok = !ok;
                break;
            }
        }
        if(ok) break;
    }
    
    // 4. GCD(A[1], ..., A[N]) の 計算.
    // -> gcd = 1 の 場合は, 少なくとも, "setwise coprime" になる.
    int gcd = a[0];
    repx(i, 1, N) gcd = __gcd(gcd, a[i]);
    if(gcd != 1) idx--;
    
    // 5. 出力.
    printf("%s\n", ans[idx].c_str());
    return 0;
    
}

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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)

int main(void){
  int n;
  cin>>n;
  vector<int> d(n);



  r(i,n){
    cin>>d.at(i);
  }
  sort(d.rbegin(),d.rend());

  int cnt=1,maxi=1;
  r(i,n-1){
    if(d.at(i)>d.at(i+1))cnt++;
    else maxi=max(maxi,cnt);
  }
  cout<<cnt<<endl;
return 0;}


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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

int n;cin>>n;
map<string, int> mp;
for(int i=0;i<n;i++){
  string s;cin>>s;
  mp[s]++;
}

cout<<"AC x "<<mp["AC"]<<endl;
cout<<"WA x "<<mp["WA"]<<endl;
cout<<"TLE x "<<mp["TLE"]<<endl;
cout<<"RE x "<<mp["RE"]<<endl;

  
  return 0;
}


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

using namespace std;

int FindGCD(int a, int b) {
  if (a == b) {
    return a;
  }
  else {
    if (a > b) swap(a, b);
    int r = b % a;
    if (r == 0) return a;
    else return FindGCD(r, a);
  }
}

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }

  if (N == 2) {
    cout << max(A[0], A[1]) << endl;
  }
  else {
    int gcd;
    
    vector<int> v(N);
    gcd = A[0];
    for (int i = 0; i < N; ++i) {
      gcd = FindGCD(gcd, A[i]);
      v[i] = gcd;
    }

    vector<int> w(N);
    gcd = A[N - 1];
    for (int i = N - 1; i >= 0; --i) {
      gcd = FindGCD(gcd, A[i]);
      w[i] = gcd;
    }

    int ans = 1;
    for (int i = 0; i < N; ++i) {
      if (i == 0) {
	gcd = w[i + 1];
      }
      else if (i == N - 1) {
	gcd = v[i - 1];
      }
      else {
	gcd = FindGCD(v[i - 1], w[i + 1]);
      }
      ans = max(ans, gcd);
    }
    cout << ans << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    long long int n,d;
    cin>>n>>d;
    int ans = 0;
    for(int i=0;i<n;i++)
    {
        long long int x,y;
        cin>>x>>y;
        long double dist = sqrt(x*x + y*y);
        if(dist<=d)
        ans++;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 3672
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    s = set(lmi())
    print('Yes') if len(s) == 2 else print('No')

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
pI(x)=parse(Int,x)
pM(x::Array{SubString{String},1})=map(pI,x)
function main()
  n,k=pM(split(readline()))
  h=pM(split(readline()))
  dp=Int[100000000000 for i=1:n+k]
  dp[1]=0
  for i=1:n-1
    for j=1:k
      if i+j<=n
        dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
      end
    end
  end
  println(dp[n])
end
main()
if isdefined(Base, :mystdin);close(mystdin);end


Measured memory_bytes: 165904
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
S = input().rstrip()

# "Y"が入っていれば4色
print("Four" if S.count("Y") > 0 else "Three")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const ll inf = 1e17+7;

int Q,H,S,D,N;

ll choose(int n) {
    if (n==0) return 0;
    int lit;
    ll  c1 = 1ll*n*4*Q,
        c2 = 1ll*n*2*H,
        c3 = 1ll*n*S,
        c4 = 1ll*(n/2)*D;
    if (c1==0) c1=inf;
    if (c2==0) c2=inf;
    if (c3==0) c3=inf;
    if (c4==0) c4=inf;
   // if (n!=N) return 0;
    ll mi=inf;
    if (mi > c1) {
        mi=c1;
        lit=1;
    }
    if (mi > c2) {
        mi=c2;
        lit=1;
    }
    if (mi > c3) {
        mi=c3;
        lit=1;
    }
    if (mi > c4) {
        mi=c4;
        lit=2;
    }
    return mi+choose(n - n/lit*lit);
}

int main() {
   // freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>Q>>H>>S>>D;
    cin>>N;
    cout<<choose(N);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string S;
    cin >> S;
    int cnt = 0;
    for (int i = 0; i < N-2; ++i) {
        if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}

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

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

	int N = 0;
	cin >> N;

	vector<int> A(N), B(N), C(N - 1);
	for (int i = 0; i < N; i++)
		cin >> A[i];
		
	for (int i = 0; i < N; i++)
		cin >> B[i];

	for (int i = 0; i < N - 1; i++)
		cin >> C[i];

	int manzoku = 0;
	for (int i = 0; i < N; i++)
	{
		manzoku += B[A[i] - 1];
		if (i < N - 1)
			if ((A[i + 1] - A[i]) == 1)
			{
				manzoku += C[A[i] - 1];
			}
	}


	cout << manzoku;

	return 0;
}

Measured memory_bytes: 256
<?php

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set('display_errors', 'Off');

// define('DEBUG', true);
define('DEBUG', false);

fscanf(STDIN, "%s", $S);
fscanf(STDIN, "%d", $w);

$arrS = str_split($S);

for ($i = 0; $i < count($arrS); $i += $w) {
    echo $arrS[$i];
}
echo PHP_EOL;


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

using namespace std;

typedef short sho;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str; 
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
typedef pair<ld,ld> pld;
 
typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pld> vpd;

#define STDIO
#define mp make_pair 
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define begin(x) (x).begin() 
#define end(x) (x).end()
#define rbegin(x) (x).rbegin()
#define rend(x) (x).rend()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front 
#define pb push_back
#define pp push
#define lb lower_bound
#define ub upper_bound

inline void checkmin(int &x, int y){x = min(x, y);}
inline void checkmax(int &x, int y){x = max(x, y);}
inline void sortsm(int &x, int &y) {int a = min(x, y), b = max(x, y); checkmin(x, a); checkmax(y, b);}
inline void sortbi(int &x, int &y) {sortsm(x, y); swap(x, y);}

const int maxn=1e5+10;

int n,m;
int x[maxn],y[maxn];
int degree[maxn];

vector<int> edge[maxn];
int dp[maxn];
queue<int> Q;
//bool vis[maxn];

int main() {
	#ifndef STDIO
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /* start code */
    memset(dp,0,sizeof dp);
    memset(degree,0,sizeof degree);
//  memset(vis,0,sizeof vis);
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
    	cin>>x[i]>>y[i];
    	edge[x[i]].pb(y[i]);
    	degree[y[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(!degree[i])
		{
//			vis[i]=true;
			Q.pp(i);
		}
	}
//	for(int i=1;i<=n;i++)
//	{
//		cout<<degree[i]<<" ";
//	}
//	cout<<endl;
	while(!Q.empty())
	{
		int now=Q.front();
//		cout<<now<<endl;
		Q.pop();
//		for(auto to : edge[now])
//		{
//			degree[to]--;
//		}
		for(auto to : edge[now])
		{
			dp[to]=max(dp[to],dp[now]+1);
			degree[to]--;
			if(!degree[to])
			{
				Q.pp(to);
			}
		}
//		for(int i=1;i<=n;i++)
//		{
//			if(!degree[i]&&!vis[i])
//			{
//				vis[i]=true;
//				Q.pp(i);
//			}
//		}
	}
	int ans=0;
	for(auto dist : dp)
	{
		checkmax(ans,dist);
	}
	cout<<ans<<endl;
    /* end code */
	return 0;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
  T r;
  while (a)
    r = b, b = a, a = r % a;
  return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

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

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n;
int x, y;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
cin>> x >> a >> b;
if(b-a<=0) pr("delicious");
else if (b-a<=x)pr("safe");
else pr("dangerous");
  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{
	int a,b;
	cin>>a>>b;
	if(a<=8&&b<=8)cout<<"Yay!"<<endl;
	else cout<<":("<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
 
int main() {
  int A, B, C; cin >> A >> B >> C;
  cout << max (0, C - (A - B)) << endl;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,k = map(int,readline().split())
lst1 = []
for i in range(n):
    lst1.append( int(readline()))
lst1.sort()
ans = 10**9
for i in range(n-k+1):
    ans = min(ans,abs(lst1[i+k-1]-lst1[i]))

print(ans)



Measured memory_bytes: 44508
#include <bits/stdc++.h>
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
using namespace std;
const int MOD = 1000000007; 
typedef long long ll;
typedef string str;

ll min_l(ll a,ll b){return a<b?a:b;}
ll max(ll a,ll b){return a>b?a:b;}
 
ll sep(int a, int b){
    ll pre=1<<30,a1,a2;
    for(ll i=1;i<a;i++){
        a1=max(llabs(b*i-b*((a-i)/2)),llabs(b*i-b*(a-i-(a-i)/2)));
        a2=max(llabs(b*i-(a-i)*(b/2)),llabs(b*i-(a-i)*(b-b/2)));
        pre=min_l(pre,min_l(a1,a2));
    }
    return pre;
}
 
int main(void){
    ll h,w;
    cin>>h>>w;
    cout<<min_l(sep(h,w),sep(w,h));
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    string s; cin >> s;
    cout << s[0] << s.size()-2 << s[s.size()-1] << endl;
}


Measured memory_bytes: 256
import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
A = inintl()

m = min(A)

mod_min = 10**9

for a in A:
    if a % m == 0:
        continue
    mod_min = min(mod_min, a % m)

if mod_min == 10**9:
    print(m)
else:
    print(math.gcd(m, mod_min))


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

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

    map<char, int> mp;
    string s;
    cin >> s;
    for(int i = 0; i < 4; i++){
        mp[s[i]]++;
    }

    if(mp.size() != 2){
        cout << "No" << endl;
        return 0;
    }

    for(auto x : mp){
        if(x.second != 2){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int main() {
	long long int a,b,c,d,x,y,z,k;
	cin>>a>>b>>c>>d;
	long long int ans=0;
      
	x=max(a,b)*max(c,d);
	y=min(a,b)*min(c,d);
	z=max(a,b)*min(c,d);
	k=min(a,b)*max(c,d);
	
	ans=max(x,y);
	ans=max(ans,z);
	ans=max(ans,k);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(void)
{
    int rect_w, rect_h, x, y, r;

    scanf("%d %d %d %d %d", &rect_w, &rect_h, &x, &y, &r);

    if (x >= r && x + r <= rect_w && y >= r && y + r <= rect_h){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 584
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

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

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


#include <iostream>

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

    cout << 48 - M << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

int main() {

	long A, B;
	cin >> A >> B;

	if (B % A == 0) {
		cout << A + B << endl;
	}
	else {
		cout << B - A << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif

static void C_task();

int main()
{
	C_task();
	
	fflush(stdout);
	return 0;
}

static void C_task()
{
	LLONG W, H, x, y;
	scanf(" %lld %lld %lld %lld", &W, &H, &x, &y);

	int pattern = 0;
	double sq = (H * W) / 2.0;

	if (((x == W / 2) && ((W % 2) == 0)) && ((y == H / 2) && ((H % 2) == 0)) && (H != 1) && (W != 1)) {
		pattern = 1;
	}

	printf("%.6f %d", sq, pattern);
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N=int(input().rstrip())
h=list(map(int,input().rstrip().split()))

dp=[0]*N
for i in range(N):
    dp[i]=1000000000000
dp[0]=0

for i in range(1,N,1):
    dp[i]=min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
    if(i>1):        
        dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))

print(dp[N-1])
          


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

using namespace std;

int main()
{
    int m,a,b;
    cin>>m>>b;
    a=max(m,b);
    b=min(m,b);
    if(a==2&&b==1)
        cout<<"3\n";
    else if(a==3&&b==2)
        cout<<"1\n";
    else if(a==3&&b==1)
        cout<<"2\n";
    return 0;

}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();

        int[] ac = new int[N];
        int[] pena = new int[N];

        for(int i=0; i<M; i++){
            int p = sc.nextInt();
            String S = sc.next();
            p--;
            if(ac[p] == 1) continue;
            if(S.equals("AC")){
               ac[p] = 1;
            } else {
                pena[p]++;
            }
        }

        int AC=0, PENA = 0;
        for (int i = 0; i < N; i++) {
            AC += ac[i];
            if(ac[i] == 1) PENA += pena[i];
        }
        System.out.println(AC + " " + PENA);

    }
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    vector<int> cnt(n + 1, 0);
    int now = - 1;
    int tmp = 0;
    for (int i = 0; i < n; i++){
        if (a[i] != now){
            now = a[i];
            tmp = 1;
        }
        else tmp++;
        cnt[tmp]++;
    }
    vector<int> acc(n + 1, 0);
    for (int i = 1; i <= n; i++) acc[i] = acc[i - 1] + cnt[i];
    int ok = n;
    for (int i = 1; i <= n; i++){
        while(acc[ok] < (long long)ok * i) ok--;
        cout << ok << endl;
    }
}


Measured memory_bytes: 4352
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)
INF = 1 << 60


def input():
    return stdin.readline().strip()


def main():
    N = int(input())
    A = [list(map(int, input().split())) for _ in range(N)]

    ans = 0
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if A[i][j] > A[i][k] + A[k][j]:
                    print(-1)
                    return

    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            if all(A[i][j] < A[i][k] + A[k][j] for k in range(N) if k != i and k != j):
                ans += A[i][j]

    print(ans)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 45532
#include <bits/stdc++.h>
#define MAXN 310
using namespace std;
int n,sushi[4],a,cnt;
double dp[MAXN][MAXN][MAXN];

int main(){
	cin>>n;
	for(int i=0;i<n;cin>>a,++sushi[a],++i);
	for(int i=0;i<=sushi[3];++i){
		for(int j=0;j<=sushi[3]+sushi[2];++j){
			for(int k=0;k<=sushi[3]+sushi[2]+sushi[1];++k){
				if(i+j+k==0) continue;
				cnt=i+j+k;
				if(i) dp[i][j][k]+=dp[i-1][j+1][k]*i/cnt;
				if(j) dp[i][j][k]+=dp[i][j-1][k+1]*j/cnt;
				if(k) dp[i][j][k]+=dp[i][j][k-1]*k/cnt;
				dp[i][j][k]+=1.0*n/cnt;
			}
		}
	}
	cout<<fixed<<setprecision(15)<<dp[sushi[3]][sushi[2]][sushi[1]]<<endl;
	return 0;
}

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

int main(){
    int n,M=0,ans=0;
    cin >> n;
    for(int i = 0;i < n;i ++){
        int h;
        cin >> h;
        M = max(h,M);
        if(h>=M) ans ++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <queue>
#include <map>
#include <stack>
using namespace std;
 
int dx[8]={1,-1,0,0,1,1,-1,-1};
int dy[8]={0,0,1,-1,-1,1,-1,1};
 
 
int main() {
int t,p,r;
while(cin>>t>>p>>r && t){
int pe[55][15]={0};
int wr[55][15]={0};
int a,b,c;
string s;
for(int q=0;q<r;q++){
cin>>a>>b>>c>>s;
if(s=="CORRECT"){
pe[a][b]=c+wr[a][b]*1200;
//cout<<pe[a][b]<<endl;
}
else{
wr[a][b]++;
}
}
vector<pair<pair<int,int>,int> > ve;

for(int i=1;i<t+1;i++){
int seikai=0,pena=0;
for(int j=1;j<p+1;j++){
if(pe[i][j]>0){
//cout<<i<<" "<<j<<endl;
seikai++;
pena=pena+pe[i][j];
}
}
//cout<<seikai<<" "<<pena<<endl;
ve.push_back(make_pair(make_pair(-seikai,pena),i));
}
sort(ve.begin(),ve.end());
for(int i=0;i<t;i++){
cout<<ve[i].second<<" "<<-ve[i].first.first<<" "<<ve[i].first.second<<endl;

}




}

	return 0;
 
   }

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


 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  double d=0;
  for(int i=0;i<n;i++){
  	double a;
    cin >> a;
    d+=1/a;
  }
  
  cout << 1/d << endl;

  
  
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
const int maxn = 1010;
int num[maxn][maxn];
using namespace std;
int lcd(string x,string y){
	int m = x.size();
	int n = y.size();
	int i,j;
    x = ' '+x;
    y = ' '+y;
	for(i=0;i<=m;i++) num[i][0] = 0;
	for(j=1;j<=n;j++) num[0][j] = 0;
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			if(x[i]==y[j])
				num[i][j] = num[i-1][j-1]+1;
			else
				num[i][j] = max(num[i-1][j],num[i][j-1]);	
		}	
	}
	return num[m][n];
}
int main(){
    int t;
    string a,b;
    cin>>t;
    while(t--){
    	cin>>a>>b;
    	cout<<lcd(a,b)<<endl;
	}
    return 0;
}


Measured memory_bytes: 7036
#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <map>

using namespace std;
using ll = long long;

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

	vector< vector <vector <ll> > > v(n + 1, vector <vector <ll> > (n + 1, vector<ll>(50 * n + 1, 0)));
	v[0][0][0] = 1;

	for (int i = 1; i <= n; ++i)
	{
		int x;
		cin >> x;

		for (int j = 0; j < i; ++j)
		{
			for (int k = 0; k < 50 * n + 1 - x; ++k)
			{
				v[i][j][k] += v[i - 1][j][k];
				v[i][j + 1][k + x] += v[i - 1][j][k];
			}
		}

	}

	ll cnt = 0;

	for (int j = 1; j <= n; ++j)
	{
		for (int k = 0; k <= 50 * n; ++k)
		{
			if (k == j * a)
				cnt += v[n][j][k];
		}
	}

	cout << cnt << endl;

	return 0;
}

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

signed main(){
    int m;
    long long a,b;
    int N = 10000;
    vector<bool>p(N,true);
    vector<int>prm;
    p[0] = p[1] = false;
    for(int i = 2;i<N;i++){
        if(p[i]){
            for(int j = 2; j*i < N;j++)
                p[i*j] = false;
            prm.emplace_back(i);
        }
    }
    vector<int>vv = prm;
    while(scanf("%lld%lld%lld",&m,&a,&b)){
        if(m==0)break;
        int maxi = -10000000;
        int ans1,ans2;
        for(auto && p :prm){
            for(auto && q:vv){
                if(p*q <= m  and  p*b >= q*a and p*q > maxi and p <= q){
                    ans1 = max(p,q);
                    ans2 = min(p,q);
                    maxi = p*q;
                }
            }
        }
        printf("%d %d\n",ans2,ans1);
    }
}



Measured memory_bytes: 3252
#include <stdio.h>
#include <string.h>

void swap(char *a,char *b){
	char tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int h, w;
char t[30][31];

void fall(void){
	int i, j, k;
	for(i = h - 2;i >= 0;i--){
		for(j = 0;j < w;j++){
			if(t[i + 1][j] == '.'){
				for(k = i;k < h && t[k + 1][j] == '.';k++);
				t[k][j] = t[i][j];
				t[i][j] = '.';
			}
		}
	}
}

int range(int a,int b){
	return a >= 0 && a < h && b >= 0 && b < w;
}

int main(void){
	int i, j, k, l, n, m, p, f, ans, del[30][30], dx[4] = {0,1,0,-1},dy[4] = {-1,0,1,0};
	char v[30][31];
	scanf("%d%d%d%*c",&h,&w,&n);
	for(i = 0;i < h;i++){
		for(j = 0;j < w;j++)
			v[i][j] = getchar();
		getchar();
	}
	ans = 0;
	for(i = 0;i < h;i++){
		for(j = 0;j < w - 1;j++){
			memcpy(t,v,sizeof(v));
			if(t[i][j] == t[i][j + 1] && t[i][j] == '.') continue;
			swap(&t[i][j],&t[i][j + 1]);
			fall();
			while(1){
				f = 1;
				memset(del,0,sizeof(del));
				for(k = 0;k < h;k++){
					for(l = 0;l < w;l++){
						if(t[k][l] != '.'){
							for(m = 0;m < 4;m++){
								for(p = 0;range(k + dy[m] * p,l + dx[m] * p) && t[k + dy[m] * p][l + dx[m] * p] == t[k][l];p++);
								if(p >= n){
									f = 0;
									for(p = 0;range(k + dy[m] * p,l + dx[m] * p) && t[k + dy[m] * p][l + dx[m] * p] == t[k][l];p++) del[k + dy[m] * p][l + dx[m] * p] = 1;
								}
							}
						}
					}
				}
				if(f) break;
				for(k = 0;k < h;k++)
					for(l = 0;l < w;l++) if(del[k][l]) t[k][l] = '.';
				fall();
			}
			for(k = 0;k < h;k++){
				for(l = 0;l < w;l++) if(t[k][l] != '.') break;
				if(l != w) break;
			}
			if(k == h) ans = 1;
		}
	}
	if(ans)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 1016
/**
*   @author Mustafa Khaled.
*/
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std ;

#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 REP(i, n) FOR(i, 0, n)
#define FastInputOutput ios_base :: sync_with_stdio( 0 ) ; cin.tie( 0 ) ; cout.tie( 0 ) ;
#define ReadFromFile(x)  freopen( x, "rt" , stdin ) ;
#define WriteToFile(x)  freopen( "in.txt", "wt" , stdout ) ;
#define D(x) scanf("%d",&x);
#define LLD(X) scanf("%lld",&x);
#define in(x,...) scanf(x,__VA_ARGS__)
#define out(x,...) printf(x,__VA_ARGS__)
typedef long long ll;

/// for debugging
string to_string(string s) {return '"' + s + '"';}string to_string(const char* s) {return to_string((string) s);}string to_string(bool b) {return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void debug_out() { cerr << endl; }template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) {cerr << " " << to_string(H);debug_out(T...);}
#ifndef ONLINE_JUDGE
    #define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define dbg(...) {}
#endif

/// start driven program
const int OO = 0x3f3f3f3f , N=1e3;


void seive(){
int lp[1000000+7];
vector<int> pr;
	for (int i=2; i<=1000000+1; ++i) {
			if (lp[i] == 0) {
					lp[i] = i;
					pr.push_back(i);
			}
			for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=1000000; ++j) lp[i * pr[j]] = pr[j];

	}
}

bool ok(int val){
}
int bin_search(){ //max
    int l =0 , h =1000;
    int mid;
    while(l<h){
        mid=(l+h)>>1;
        if( ok(mid) ){
            h=mid;
        }else{
            l=mid+1;
        }
    }
    return h;
}

int main(){
    int a,b;
    cin>>a>>b;
    int ans = max(a+b , max(a*b , a-b));
    cout<<ans;
}


Measured memory_bytes: 256
N = int(input())
X = [list(map(int,input().split())) for _ in range(N-1)]
for i in range(N-1):
  t = X[i][1]+X[i][0]
  for j in range(i+1,N-1):
    if t < X[j][1]:
      t  = X[j][1] + X[j][0]
    elif t % X[j][2] == 0:
      t += X[j][0]
    else:
      t += X[j][2] - (t%X[j][2]) + X[j][0]
  print(t)
print(0)

Measured memory_bytes: 3188
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int max = (int)Math.pow(10,9);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int s = sc.nextInt();
        //int ans = new int[n];
        for(int i = 0; i < k; i++){
            System.out.print(s + " ");
        }
        for(int i = k; i < n; i++){
            if(s == max){
                System.out.print(1 + " ");
            }else{
                System.out.print(s+1 + " ");
            }
        }
    }
}

Measured memory_bytes: 43836