akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
#define bug(a)       cerr << #a << " : " << a << endl;
#define itc(n) char(n+48)
#define cti(ch) (ch-48)
#define pb push_back
template<class T>void ExEuclid(T n, T m, T &a, T &b, T &gcd){if(m==0){gcd=n;a=1;b=0;return;}ExEuclid(m,n%m,a,b,gcd);T x=a;a=b;b=x-(n/m)*a;}
template<class T>T gcd(T n, T m){if(m==0){return n;}gcd(m,n%m);}
template<class T>T lcm(T n, T m){return (n*m)/gcd(n,m);}
template<class T>string to_string(T n){ostringstream convert;convert<<n;return convert.str();}
template<class T>ll to_int(T s){ll num=0,power=0;for(int i=s.size()-1; i>=0; i--)num+=(pow(10.0,power++)*(s[i]-'0'));return num;}
template<class T>bool is_mod(T n, T m){if(n%m==0)return true;return false;}
template<class T>bool is_upper(T s){for(int i=0; i<s.size(); i++)if(s[i]>90 || s[i]<65)return false;return true;}
template<class T>bool is_lower(T s){for(int i=0; i<s.size(); i++)if(s[i]>122 || s[i]<97)return false;return true;}
template<class T>bool is_palindrome(T s){T s1=s;reverse(s1.begin(),s1.end());if(s==s1)return true;return false;}
template<class T>int digit_sum(T s){int sum=0; for(int i=0; i<s.size(); i++)sum+=cti(s[i]);return sum;}
template<class T>T mod(T n, T m){return ((n%m)+m)%m;}
template<class T>T Big_mod(T base, T power, T MOD){
    if(power==1)return base;
    if(power & 1)return ((base%MOD)*(Big_mod(base,power-1,MOD))%MOD)%MOD;
    else {T temp=(Big_mod(base,power>>1,MOD));return ((temp%MOD)*(temp%MOD))%MOD;}
}
template<class T>T doStringSum(T s1, T s2){int len1=s1.length(), len2=s2.length();
    if(len1<len2)return doStringSum(s2, s1);
    T ans="";int carry=0, i, s;
    for(i=1;i<=len1;i++){s = carry+cti(s1[len1-i]);if(i<=len2)s += cti(s2[len2-i]);
    ans = itc(s%10)+ans;carry = s/10;}if(carry!=0)ans = itc(carry)+ans;
    return ans;
}
template<class T>T dostringmultiply(T s1, T s2){int len1=s1.length(), len2=s2.length();
    if(len1<len2)return dostringmultiply(s2,s1);
    int i,j,p, carry=0;T result, net="", c;
    for(i=len2-1;i>=0;i--){carry=0;result="";c="";
    for(j=len1-1;j>=0;j--){p=cti(s1[j])*cti(s2[i]);result = itc((p+carry)%10)+result;carry=(p+carry)/10;}
    if(carry!=0){c=to_string(carry);result=c+result;}
    for(j=i;j<len2-1;j++)result+="0";net=doStringSum(net,result);}
    return net;
}

int main()
{
    fast;
    int n,m;
    cin>>n;
    int a[n+5];
    for(int i=0; i<n; i++)cin>>a[i];
    int ans=0;
    for(int i=1; i<n-1; i++){
        if(a[i] != max(a[i],max(a[i+1],a[i-1])) && a[i] != min(a[i],min(a[i+1],a[i-1])))ans++;
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
str_N_M = input()
N, M = map(int, str_N_M.split(' '))

old_flag = []
for i in range(1, N + 1):
    old_flag.append(input())

X = 2500
for white_row in range(1, N - 1):
    for blue_row in range(white_row + 1, N):
        paint_square = 0

        for row in old_flag[:white_row]:
            list_row_w = list(row)
            for moji_w in list_row_w:
                if moji_w == 'B' or moji_w == 'R':
                    paint_square += 1

        for row in old_flag[white_row : blue_row]:
            list_row_b = list(row)
            for moji_z in list_row_b:
               if moji_z == 'W' or moji_z == 'R':
                   paint_square += 1

        for row in old_flag[blue_row:]:
            list_row_r = list(row)
            for moji_r in list_row_r:
                if moji_r == 'B' or moji_r == 'W':
                    paint_square += 1

        if paint_square < X:
            X = paint_square

print(X)

Measured memory_bytes: 7736
#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define eps 1e-9

using namespace std;

int main()
{

    ll t,n,m,f,a,b,c,l,r,q,k,x,y,z,ans,mn,mx,sum=0;
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    cin>>x>>y;

    if(y%2==0 && y>=(2*x) && y<=(4*x))
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }


}


Measured memory_bytes: 3492
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    
    // i think we should compare if a equal b first
    //if a==b so the result is a+b
    // else we will find the bigger one and press it twice
    // so the result is bigger+ bigger-1
    // you can print it now and return
    // it mean print answer and return after each if 
    // so you dont need to use else
    if(a == b) {

        cout << a + b << endl;
        return 0;
    }

    cout << max(a, b) * 2 -1 << endl;
    return 0;
// nice but duplicate return 0;
// nice
// thank you
// arigathanks gozaimuch=> arigatou and thank you so much
}


Measured memory_bytes: 256
n = int(input())
l = [[0,0,0]]
for i in range(n):
    t,x,y = map(int,input().split())
    l.append([t,x,y])
for i in range(n):
    t,x,y = l[i][0],l[i][1],l[i][2]
    t_,x_,y_ = l[i+1][0],l[i+1][1],l[i+1][2]
    if t_ - t < (abs(x-x_)+abs(y-y_)) or (t_-t-(abs(x-x_)+abs(y-y_)))%2 != 0:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 88824
#include<stdio.h>
int add_A(int *,int,int);//引数 （配列、使用できる数字の最大があるインデックス,qの現在値）
int main(){
  int i/*ループ用*/ ,j/*ループ用*/ ,A[20] ,n ,q ,m ,v/*ソート用数字避難*/;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);

  for(i = 1; i<n;i++){//使用できる数字を昇順にソート
    v = A[i];
    j = i - 1;
    while( j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
  }

  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf("%d",&m);
    if(add_A(A,n-1,m))printf("yes\n");//関数の戻値によって表示を変化
    else printf("no\n");
  }
  return 0;
}
int add_A(int *array,int n,int m){
  int i;
  
  for(i=n;i>=0;i--){
    
    if(m == array[i])return 1;
    if(m - array[i]>0){
      if(add_A(array,i-1 ,m - array[i]))return 1;
    }
  }
  return  0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll x,a,b,lim=1e10;
    cin>>x>>a>>b;
    if(b<=a)
        cout<<"delicious"<<endl;
    else if(a>=(b-x))
        cout<<"safe"<<endl;
    else
        cout<<"dangerous"<<endl;




    return 0;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const ll INF = 1LL << 60;

ll N;
map<string, ll> mp;

int main() {
    cin >> N;
    rep(i, N) {
        string tmp;
        cin >> tmp;
        mp[tmp]++;
    }

    cout << mp.size() << endl;
}

Measured memory_bytes: 19260
package main

import "fmt"

func main() {
	var (
		a1, b1 int
		a2, b2 int
		a3, b3 int
	)
	fmt.Scanf("%d %d\n", &a1, &b1)
	fmt.Scanf("%d %d\n", &a2, &b2)
	fmt.Scanf("%d %d\n", &a3, &b3)

	var xs []int

	xs = append(xs, a1, b1, a2, b2, a3, b3)

	var ys [4]int

	for i := 0; i < 6; i++ {
		ys[xs[i]-1]++
	}

	a := true
	var b bool
	for _, y := range ys {
		if y == 0 {
			a = false
		} else if y == 2 {
			b = true
		}
	}

	if a && b {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

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

int main(){
	int n, m;
	cin >> n;
	vector<string> s(n);
	for(int i=0; i<n; i++){
		cin >> s.at(i);
	}
	cin >> m;
	vector<string> t(m);
	for(int i=0; i<m; i++){
		cin >> t.at(i);
	}
	vector<int> num(n);
	for(int i=0; i<n; i++){
		for(int j=i; j<n; j++){
			if(s.at(i)==s.at(j)){
				num.at(i)++;
			}
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			if(s.at(i)==t.at(j)){
				num.at(i)--;
			}
		}
	}
	sort(num.begin(), num.end());
	reverse(num.begin(), num.end());
	if(num.at(0)>=0){
		cout << num.at(0) << endl;
	}
	if(num.at(0)<0){
		cout << 0 << endl;
	}
}


Measured memory_bytes: 3640
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;



//Combination MOD
const ll MOD = INF + 7;

int d[3] = {-1, 0, 1};
int main(){
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h)cin >> s[i];

    vector<vector<int>> cnt(h, vector<int>(w, -1));

    rep(i, h){
        rep(j, w){
            if(s[i][j] == '#')continue;
            int c = 0;
            rep(d1, 3){
                rep(d2, 3){
                    if(d[d1] == 0 && d[d2] == 0)continue;
                    int ni = i + d[d1], nj = j + d[d2];
                    if(ni < 0 || ni >= h || nj < 0 || nj >= w)continue;
                    if(s[ni][nj] == '#')c++;
                }
            }
            cnt[i][j] = c;
        }
    }
    rep(i, h){
        rep(j, w){
            if(cnt[i][j] == -1)cout << '#';
            else cout << cnt[i][j];
            
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;


long saidaikouyakusuu(long a, long b) {
	if (a < b) swap(a, b);
	while (a%b > 0) {
		long c = a % b;
		a = b; b = c;
	}
	return b;
}

int main()
{
	int n;
	cin >> n;
	long answer;
	cin >> answer;
	for (long i = 1; i < n; i++) {
		long m;
		cin >> m;
		answer = saidaikouyakusuu(m, answer);
	}

	cout << answer << endl;
	
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, l, r) for(ll i = l; i < r; i++)
#define rep(i, N) FOR(i, 0, N)
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll MOD = round(1e9+7);

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

    int ans = a+a*a+a*a*a;
    cout << ans << endl;
    return 0;
}


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

int main(){
  int a,b;
  cin >> a >> b;
  if(a==b)cout << "Draw" ;
  else if(a==1||(a>b&&b!=1)) cout << "Alice";
  else if(b==1||(b>a&&a!=1)) cout << "Bob";
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

var h, w int
var s [][]string

type point struct {
	x int
	y int
}

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

func bfs() int {
	var queue []point
	distance := make([][]int, w)
	inf := 1000000
	for i := range distance {
		distance[i] = make([]int, h)
		for j := range distance[i] {
			distance[i][j] = inf
		}
	}

	queue = append(queue, point{0, 0})
	distance[0][0] = 0

	for len(queue) > 0 {
		p := queue[0]
		queue = queue[1:]
		if p.x == w-1 && p.y == h-1 {
			break
		}
		for i := 0; i < 4; i++ {
			next := point{p.x + dx[i], p.y + dy[i]}
			if next.x >= 0 && next.x < w && next.y >= 0 && next.y < h && s[next.y][next.x] != "#" && distance[next.x][next.y] == inf {
				queue = append(queue, next)
				distance[next.x][next.y] = distance[p.x][p.y] + 1
			}
		}
	}
	if goal := distance[w-1][h-1]; goal != inf {
		return goal
	}
	return -1
}

func main() {
	fmt.Scan(&h, &w)

	s = make([][]string, h)
	for i := range s {
		var tmp string
		fmt.Scan(&tmp)
		s[i] = strings.Split(tmp, "")
	}

	min := bfs()
	if min == -1 {
		fmt.Println(min)
	} else {
		black := 0
		for _, v := range s {
			for _, w := range v {
				if w == "#" {
					black++
				}
			}
		}
		fmt.Println(h*w - black - min - 1)
	}
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;

int H, W;
int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> H >> W) {
        if(H == 0) break;
        vector<ll> a(H), b(W);
        for(int i = 0; i < H; i++) cin >> a[i];
        for(int i = 0; i < W; i++) cin >> b[i];
        ll ans = 0;
        for(int val = 1; val <= 20; val++) {
            int numh = 0, numw = 0;
            for(int i = 0; i < H; i++) numh += a[i] == val;
            for(int i = 0; i < W; i++) numw += b[i] == val;
            ans += val * max(numh, numw);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3188
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */

using namespace std;

/* ---------- Type Abbreviation ---------- */

template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

using ll = long long;

#define fst first
#define snd second
#define mp make_pair
#define mt make_tuple

/* ---------- conversion ---------- */

#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)
#define DOUBLE(n) static_cast<double>(n)

/* ---------- container ---------- */

#define ALL(v) (v).begin(), (v).end()
#define SIZE(v) (LL((v).size()))

#define FIND(v, k) (v).find(k) != (v).end()
#define VFIND(v, k) find(ALL(v), k) != (v).end()

#define gsort(b, e) sort(b, e, greater<decltype(*b)>())

/* ----------- debug ---------- */

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
	os << "[";
	for (auto vv : v)
		os << vv << ",";
	return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
	os << "[";
	for (auto vv : v)
		os << vv << ",";
	return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
	return os << "(" << p.fst << "," << p.snd << ")";
}

/* ---------- Constants ---------- */

// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */

template <typename T>
T sq(T a) {
	return a * a;
}

template <typename T>
T gcd(T a, T b) {
	if (a > b) return gcd(b, a);
	return a == 0 ? b : gcd(b % a, a);
}

template <typename T, typename U>
T mypow(T b, U n) {
	if (n == 0) return 1;
	if (n == 1) return b /* % MOD */;
	if (n % 2 == 0) {
		return mypow(b * b /* % MOD */, n / 2);
	}
	else {
		return mypow(b, n - 1) * b /* % MOD */;
	}
}

ll pcnt(ll b) {
	return __builtin_popcountll(b);
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

int main() {
	int N;
	cin >> N;
	int A[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int cnt=0;
	for (int i = 0; i < N - 1; i++) {
		if (A[i] == A[i + 1]) {
			cnt++;
			A[i + 1] = N + 1;
		}
	}
	cout << cnt << endl;
	return 0;

}


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

const int MAX_N = 40;

int N;
int POS = 0;

vector<int> PRE;
vector<int> IN;
vector<int> POST;

void restore(int l, int r) {
  if (l >= r) return;
  int root = PRE[POS++];
  int m = distance(IN.begin(), find(IN.begin(), IN.end(), root));
  restore(l, m);
  restore(m+1, r);
  POST.push_back(root);
}

void solve() {
  restore(0, N);
}

int main() {
  int t; cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> t;
    PRE.push_back(t);
  }

  for (int i = 0; i < N; i++) {
    cin >> t;
    IN.push_back(t);
  }

  solve();
  for (int i = 0; i < N; i++) {
    if (i) cout << ' ';
    cout << POST[i];
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 1216
#include <stdio.h>
int main()
{
int a,b,c,x,answer;
 scanf("%d%d%d",&a,&b,&c);
 answer=0;
for(x=a;b>=x;x++){
  if(c%x==0) answer=answer++;
 }
printf("%d\n",answer);
return 0;
}

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

int main()
{
    int i,j,a=0,b=0,c=0,t=0,n,m;
    string temp;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>temp;
        m=temp.size();
        for(j=0;j<m;j++)
        {
            if(temp[j]=='A'&&temp[j+1]=='B')
                t++;
        }
        if(temp[0]=='B')
        {
            if(temp[j-1]=='A')
                c++;
            else
                b++;
        }
        else if(temp[j-1]=='A')
            a++;
    }
    if(a&&b)
        printf("%d",c+min(a,b)+t);
    else
        printf("%d",max(c-1+(a||b),0)+t);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n, G, pd[100010], w[110], p[110];
int main()
{
    cin>>n>>G;
    for(int i=1; i<=n; i++)
        cin>>w[i]>>p[i];
    for(int i=1; i<=n; i++)
        for(int j=G-w[i]; j>=0; j--)
            pd[j+w[i]]=max(pd[j+w[i]], pd[j]+p[i]);
    cout<<pd[G];
    return 0;
}


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

int selection_sort(int n, int A[]){
    int sw = 0;
    for(int i = 0; i < n; i++){
        int minj = i;
        for(int j = i; j < n; j++){
            if(A[minj] > A[j]){
                minj = j;
            }
        }
        int temp = A[minj];
        A[minj] = A[i];
        A[i] = temp;
        if(minj != i) sw++;
    }
    return sw;
}


int main(){
    int N, counter; cin >> N;
    int array[N];
    for(int i = 0; i < N; i++) cin >> array[i];
    counter = selection_sort(N, array);

    for(int i = 0; i < N; i++){
        if(i == N-1) cout << array[i] << endl;
        else cout << array[i] << " ";
    }
    cout << counter << endl;

    return 0;
}

Measured memory_bytes: 3104
/**
*	  Name: Ajay
*	  Institute: IIITH 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define ll long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vii vector<ppi>
#define vll vector<ll>
#define mp make_pair
#define fi first
#define se second
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void input()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}

int main()
{      
  fastio();
  string s;
  cin>>s;
  int n,i,k=0;
  n=s.size();
  string temp="",prev="";
  for(i=0;i<n;i++)
  {

    if(temp+s[i]!=prev)
    {
      prev=temp+s[i];
      k++;
      temp="";
    }
    else
      temp+=s[i];
  }

  if(temp.size()>0 && temp!=prev)
  	k++;
  cout<<k;
  return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>

using ll = long long;

int main() {
    int N, K;
    std::cin >> N >> K;
    std::vector<int> A(N);
    for (int i = 0; i < N; i++) {
        std::cin >> A[i];
    }
    N--;
    K--;
    std::cout << (N + (K - 1)) / K << std::endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
#define fi first
#define se second
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    Int n;
    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 res = 0;
    for (Int i = 0; i < n; i++) {
        res += b[a[i] - 1];
        if (i < n -1) {
            if (a[i] + 1 == a[i + 1]) {
                res += c[a[i] - 1];
            }
        }
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long gcd(long long x, long long y){
    int r = 0;
    if(x < y){
        swap(x, y);
    }
    while(y > 0){
        r = x % y;
        x = y;
        y = r;
    }
    return x;
}

int main(){
    long long x, y;
    cin >> x >> y;
    cout << gcd(x, y) << endl;
    
    return 0;
}


Measured memory_bytes: 3112
#include <cstdio>
#include <vector>
#include <unordered_set>
using namespace std;

const int MAXN = 1e5+10;
const int MAXM = 1e5+10;

int p[MAXN];
vector<int> G[MAXN];

vector<int> vs;
unordered_set<int> pchks;
bool chk[MAXN];
void dfs(int cur){
	chk[cur] = true;

	pchks.insert(p[cur]);
	vs.push_back(cur);
	for(auto nxt: G[cur]) {
		if(chk[nxt]) continue;
		dfs(nxt);
	}
}

int main() {
	int n,m;
	scanf("%d %d", &n, &m);
	for(int i=1;i<=n;i++){
		scanf("%d", &p[i]);
	}

	for(int i=0;i<m;i++){
		int x, y;
		scanf("%d %d", &x, &y);
		// if(x>y) swap(x, y);
		G[x].push_back(y);
		G[y].push_back(x);
	}

	int ans=0;
	for(int i=1;i<=n;i++){
		if(!chk[i]) {
			dfs(i);
			for(int idx: vs) {
				if(pchks.count(idx)) ans++;
			}

			vs.clear();
			pchks.clear();
		}
	}

	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 13724
#include<iostream>
#include<vector>
using namespace std;
vector<vector<int> > dp;
int n;
int m;
vector<bool> line;
vector<int> chance;
int search(int, int);
int main() {
	cin >> n;
	int num = 0;
	char du;
	line.resize(n);
	dp.resize(n);
	for (int i = 0; i < n; ++i) {
		dp[i].resize(10);
		for (int j = 0; j < 10; ++j) {
			dp[i][j] = -1;
		}
	}
	for (int i = 0; i < n; ++i) {
		cin >> du;
		if (du == '*') {
			line[i] = true;
		}
		else {
			int ca = du - '0';
			line[i] = false;
			if ((n - i) % 2 == 0) {
				num += (ca * 2) / 10 + (ca * 2) % 10;
			}
			else {
				num += ca;
			}
		}
	}
	cin >> m;
	chance.resize(m);
	for (int i = 0; i < m; ++i) {
		cin >> chance[i];
	}
	cout << search(0, num % 10) << endl;
	return 0;
}
int search(int np, int nn) {
	if (np == n) {
		if (nn == 0)return 1;
		else return 0;
	}
	if (dp[np][nn] > -1)return dp[np][nn];
	int res = 0;
	if (line[np]) {
		for (int i = 0; i < m; ++i) {
			if ((n - np) % 2 == 0) {
				res += search(np + 1, (nn + (chance[i] * 2) / 10 + (chance[i] * 2) % 10) % 10);
			}
			else {
				res += search(np + 1, (nn + chance[i]) % 10);
			}
		}
	}
	else {
		res = search(np + 1, nn);
	}
	dp[np][nn] = res;
	return res;
}

Measured memory_bytes: 17564
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


int main(){

	int n,r;
	while(cin >> n >> r && !(n == 0 && r == 0)){
		int pile[51];
		for(int i = 0; i < n; i++){
			pile[i] = i+1;
		}
		for(int i = 0; i < r; i++){
			int p,c;
			cin >> p >> c;
			int tmp[51];
			for(int j = 0; j < c; j++){
				tmp[j] = pile[n-1-j-(p-1)];
			}
			for(int j = p-1; j > 0; j--){
				pile[n-1-(j-1)-c] = pile[n-1-(j-1)];
			}
			for(int j = 0; j < c; j++){
				pile[n-1-j] = tmp[j];
			}
		}
		cout << pile[n-1] << endl;
		
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, M; 
  cin >> N >> M;

  vector<int> sum(110000, 0);
  REP(i, M){
    int l, r;
    cin >> l >> r;
    sum[l]++; sum[r+1]--;
  }

  int ans = 0;
  REP(i, 100010){
    sum[i+1] += sum[i];
    if(sum[i] == M) ans++;
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;
constexpr ll MOD = 1000000007;

int main()
{
  int n;
  cin>>n;
  vecll even(60);
  for(auto&& i:irange(0,n)) {
    ll a;
    cin>>a;
    for(auto&& j:irange(0,60)) {
      if ((a&1) == 0) ++even[j];
      a>>=1;
    }
  }
  ll ans = 0;
  ll p2 = 1;
  for(auto&& v:even) {
    ll tmp = v * (n-v) % MOD * p2 % MOD;
    ans += tmp;
    ans %= MOD;
    p2 *= 2;
    p2 %= MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
  multi(ll first, ll second, ll third)
      : first(first), second(second), third(third) {}
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl P(N);
  REP(i, N) cin >> P[i];
  ll ans = 0;
  REP(i, N - 2) {
    if (P[i + 1] > P[i] && P[i + 1] > P[i + 2])
      continue;
    else if (P[i + 1] < P[i] && P[i + 1] < P[i + 2])
      continue;
    else
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			while ("0 0".equals(buf = br.readLine())==false) {
				StringTokenizer st = new StringTokenizer(buf);
				int n = Integer.parseInt(st.nextToken());
				int s = Integer.parseInt(st.nextToken());
				System.out.println(solve(n,s,0));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static int solve(int n,int s,int r) {
		if (n==0) {
			if (s==0) return 1;
			else return 0;
		}
		else {
			int count = 0;
			for (int i=r;i<=9;i++) {
				count += solve(n-1,s-i,i+1);
			}
			return count;
		}
	}
}

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

string shuffle(string str,int h){
	string head = str.substr(0, h);
	string tail = str.substr(h, str.size()-h);
	return tail + head;
}

int main(){
	string cards;
	int m , h ;

	while(true){
		cin >> cards ;
		if( cards == "-" )break;

		cin >> m;
		for(int i = 0; i < m; i++){
			cin >> h;
			cards = shuffle(cards, h);
		}
		cout << cards << endl;
	}

	return 0;
}

Measured memory_bytes: 3112
#include <iostream>

using namespace std;

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

  if(D == 25){
    cout << "Christmas" << endl;
  }else if(D == 24){
    cout << "Christmas Eve" << endl;
  }else if(D == 23){
    cout << "Christmas Eve Eve" << endl;
  }else if(D == 22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
  return 0;
}


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

int main(int argc, char *argv[])
{
        int a,b,c;
        std::cin >> a >> b >> c;
        if (a < b && b < c) {
                cout << "Yes\n";
        } else {
                cout << "No\n";
        }
        return 0;       
}

Measured memory_bytes: 3036
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for (int i = 0; i < n; ++i)
#define REP(i,k,n) for (int i = k; i <= n; ++i)
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define F first
#define mp make_pair
#define debug1(a) cout<<" a : "<<a<<"\n"
#define debug2(a,b) cout<<" a : "<<a<<" b : "<<b<<"\n"
#define debug3(a,b,c) cout<<" a : "<<a<<" b : "<<b<<" c : "<<c<<"\n"
//#define M 1000000007

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	string s,t;
	cin>>s>>t;
	int l[s.length()+1][t.length()+1];
	rep(i,s.length()+1)
	{ 
		rep(j, t.length()+1)
		{
			l[i][j]=0;
		}
	}
	string ans="";
	REP(i,0,s.length())
	{
		REP(j,0, t.length())
		{
			if (i==0 || j==0)
				l[i][j]=0;
			else if (t[j-1]==s[i-1])
			{
				l[i][j]=max(l[i-1][j-1]+1, l[i][j]);
			}
			else
			{
				l[i][j]=max(l[i][j-1],l[i-1][j]);
			}
		}
	}
	// rep(i,s.length()+1)
	// {
	// 	rep(j,t.length()+1) cout<<l[i][j]<<" ";
	// 	cout<<"\n";
	// }
	int i=s.length(), j=t.length();
	while (i>=1 && j>=1)
	{
		if (l[i][j]==l[i-1][j])
		{
			//ans+=s[i-1];
			i--;
		}
		else if (l[i][j]==l[i][j-1])
		{
			//ans+=t[j-1];
			j--;
		}
		else if (l[i][j]==l[i-1][j-1]+1)
		{
			ans+=s[i-1];
			i--;j--;
		}
	}
	if (ans.length()==0) cout<<ans;
	REPR(i,ans.length()-1,0)
	{
		cout<<ans[i];
	}
}

Measured memory_bytes: 70656
int main()
{
	int A[99][99]={0},i,j,N,t;
	char s,F[4]="SHCD";
	scanf("%d\n",&N);
	for(i=0;i<N;A[s][t]=1,i++)
		scanf("%c %d\n",&s,&t);
	for(i=0;i<4;i++)
		for(j=1;j<14;j++)
			if(!A[F[i]][j])
				printf("%c %d\n",F[i],j);
	return 0;
}

Measured memory_bytes: 644
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

//const long long int MOD = 1000000007;
//const int MOD = 1000000007;
const int MOD = 998244353;
//const long long int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;

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

	cin >> N >> M >> K;
	if ((K < N&&K < M) || (K > N&&K > M))cout << "No\n";
	else cout << "Yes\n";
	return 0;
}

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

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

using namespace std;


int main()
{
	int n,m;
	cin>>n>>m;
	if(n!=m)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	string S, T;
	cin >> S >> T;
	int check = 0;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] != T[i]) {
			check++;
			break;
		}
	}
	if (check == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3620
N = list(input())
n = int(N[-1])
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print('hon')
elif n == 0 or n == 1 or n == 6 or n == 8:
    print('pon')
elif n == 3:
    print('bon')

Measured memory_bytes: 9128
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  int a1[N],a2[N],combo=0,f=0;
  for(int a=0;a<N;a++){
    cin >> a1[a] >> a2[a];
    if(a1[a]==a2[a]){
      combo++;
    }else{
      combo=0;
    }
    if(combo>=3){
      f++;
    }
  }
  if(f>0){
    cout << "Yes";
  }else{
    cout << "No";
  }
}

Measured memory_bytes: 3600
N = gets.to_i
A = gets.split(" ").map(&:to_i)
ans = 1
N.times { |n|
  a = A[n]
  if a == 0
    ans = 0
  end
  if ans != -1
    ans = ans * a
  end
  if ans > 10**18
    ans = -1
  end
}
puts ans

Measured memory_bytes: 21628
h, n = map(int, input().split())
a = []
b = []
for _ in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

dp = [float("inf")] * (2 * 10000 + 1)
dp[0] = 0
for i in range(h):
    for j in range(n):
        if (i + a[j]) > 2 * 10000:
            dp[2 * 10000] = min(dp[2 * 10000], dp[i] + b[j])
            continue
        dp[i + a[j]] = min(dp[i + a[j]], dp[i] + b[j])

ans = float('inf')
for j in range(h, 2 * 10000 + 1):
    ans = min(ans, dp[j])
print(ans)

Measured memory_bytes: 42844
#include <stdio.h>
#include <stdbool.h>

int main() {
	int i, j, H, W;
	char a[101][101];
	bool hf = true, wf = true, k = false;

	scanf("%d %d", &H, &W);

	for (i = 0; i < H; i++) scanf("%s", &a[i]);
	
	for (i = 0; i < H; i++) {
		wf = true;
		for (j = 0; j < W; j++) {
			if (a[i][j] == '#') wf = false;
		}
		if (wf == true)
			for (j = 0; j < W; j++)
				a[i][j] = 'a';
	}
	
	for (j = 0; j < W; j++) {
		hf = true;
		for (i = 0; i < H; i++) {
			if (a[i][j] == '#') hf = false;
		}
		if (hf == true)
			for (i = 0; i < H; i++)
				a[i][j] = 'a';
	}

	for (i = 0; i < H; i++) {
		k = false;
		for (j = 0; j < W; j++) {
			if (a[i][j] != 'a') {
				printf("%c", a[i][j]);
				k = true;
			}
		}
		if(k == true) printf("\n");
	}

	return 0;
}

Measured memory_bytes: 128
import statistics
import math

N = int(input())
input_resident = input()
resident = input_resident.split(" ")
resident_place = []
calc_array = []
result = 0
min = 100
x = 0

for i in resident:
    resident_place.append(int(i))

x = int(round(statistics.mean(resident_place),0))



for R in resident_place:
    result += (R-x)**2

print(result)

Measured memory_bytes: 5260
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n:i32 = read();
    let k:i32 = read();
    let q:i32 = read();
    let mut c:Vec<i32> = vec![0;n as usize];

    for i in 0..q {
        let a:u32 = read();
        let a = a as usize - 1;
        c[a] += 1;
    }

    for i in 0..n {
        if k - (q - c[i as usize]) > 0 {
            println!("Yes");
        } else {
            println!("No");
        }
    }
    
}

Measured memory_bytes: 4732
#include <stdio.h>


int main(void){

  int a,b,x,y,z;
  scanf("%d %d",&a,&b );
  x = a + b;
  y = a - b;
  z = a * b;

  if(x < y){
    x = y;
  }

  if(x < z){
    x = z;
  }

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

  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var str = ReadLine();
        var west = new int[num];
        var east = new int[num];
        if (str[0] == 'W') { west[0] = 1; east[0] = 0; }
        else { west[0] = 0; east[0] = 1; }
        for(var i = 1; i < num; i++)
            if (str[i] == 'W')
            {
                west[i] = west[i - 1] + 1;
                east[i] = east[i - 1];
            }
            else
            {
                west[i] = west[i - 1];
                east[i] = east[i - 1] + 1;
            }
        var min = int.MaxValue;
        for(var i = 0; i < num; i++)
        {
            var a = 0;
            if (i != 0) a = west[i - 1] + east[num - 1] -east[i];
            else a = east[num - 1] -east[0];
            min = Min(a, min);
        }
        WriteLine(min);
    }
}


Measured memory_bytes: 14560
package main

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

func main() {
	L := oneInt()
	fL := float64(L)
	fRoot := fL / float64(3)
	fmt.Print(math.Pow(fRoot, 3))
}

func exp(val int) float64 {
	var temp float64
	for index := 1; index <= val; index++ {
		temp += float64(index)
	}
	return temp / float64(val)
}

func searchAbove(slice []int, target int, index int) int {
	for i := index + 1; i < len(slice); i++ {
		v := slice[i]
		if v >= target {
			return i
		}
	}
	return -1
}

var sc = bufio.NewScanner(os.Stdin)

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}
func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

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

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}


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

const double EPS = 1e-9;

int n;
int ls[4], rs[4];

int main()
{
    double l,r;
    for(int i = 0; i < 4; i++) 
        ls[i] = rs[i] = 0;

    n = 0;
    while(cin >> l >> r) {
        if(l + EPS > 1.1) ls[0]++;
        else if(l + EPS > 0.6 && l < 1.1) ls[1]++;
        else if(l + EPS > 0.2 && l < 0.6) ls[2]++;
        else ls[3]++;

        if(r + EPS > 1.1) rs[0]++;
        else if(r + EPS > 0.6 && r < 1.1) rs[1]++;
        else if(r + EPS > 0.2 && r < 0.6) rs[2]++;
        else rs[3]++;
        n++;
    }
    
    for(int i = 0; i < 4; i++) 
        cout << ls[i] << " " << rs[i] << endl;

}

Measured memory_bytes: 0
# include <cstdio>
# include <vector>

using namespace std;

int main(void) {
  int n, m, i, j, ans = 0;
  scanf( "%d %d", &n, &m );
  vector<int> h( n, 0 ), a( m, 0 ), b( m, 0 ), c( n, 0 );
  for(i = 0;i < n;i++) { scanf( "%d", &h[i] ); }
  for(i = 0;i < m;i++) { scanf( "%d %d\n", &a[i], &b[i] ); }
  
  for(i = 0;i < m;i++) {
    if( h[a[i] - 1] > h[b[i] - 1] ) {
      c[b[i] - 1] = -1;
      if( c[a[i] - 1] >= 0 ) { c[a[i] - 1] = a[i]; }
    } else if( h[a[i] - 1] < h[b[i] - 1] ) {
      c[a[i] - 1] = -1;
      if( c[b[i] - 1] >= 0 ) { c[b[i] - 1] = b[i]; }
    } else {
      c[a[i] - 1] = -1;
      c[b[i] - 1] = -1;
    }
  }

  for(i = 0;i < n;i++) { if( c[i] >= 0 ) ans++; }
  printf( "%d\n", ans );  
  
  return 0; 
}  

Measured memory_bytes: 4300
input = STDIN.read.chomp
is_ok = false
[
    /^keyence.*/,
    /^k.*eyence$/,
    /^ke.*yence$/,
    /^key.*ence$/,
    /^keye.*nce$/,
    /^keyen.*ce$/,
    /^keyenc.*e$/,
    /.*keyence$/,
].each{ |pt|
    if input.match(pt) != nil
        is_ok = true
    end
}

puts is_ok ? "YES" : "NO"

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

int main()
{
    int n;
    cin >> n;
    if (n%2 == 0) printf("%.10f\n", 0.50000000);
    else printf("%.10f\n", (double)(n+1)/2/n);

    return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;

using namespace std;

int main()
{
	int n;
	cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
	vector<int> s = a;
	sort(s.begin(), s.end() , greater<int>());
	rep(i,n) {
		if (a[i] == s[0]) {
			cout << s[1] << endl;
		} else {
			cout << s[0] << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2010;
const int mod=924844033;
int n,m,cnt;
int a[maxn<<1];
ll ans;
ll fac[maxn<<1],g[maxn<<1];
ll f[maxn<<1][maxn<<1][2];
int main()
{
	scanf("%d%d",&n,&m);
	fac[0]=1;for(int i=1;i<=n;i++)fac[i]=(fac[i-1]*i)%mod;
	for(int i=1;i<=m;i++)
	{
		for(int j=i;j<=n;j+=m)a[++cnt]=j;
		for(int j=i;j<=n;j+=m)a[++cnt]=j;	
	}	
	f[1][0][0]=1;
	for(int i=2;i<=cnt;i++)
	{
		for(int j=0;j<=min(i/2,n);j++)
		{
			f[i][j][0]=(f[i-1][j][0]+f[i-1][j][1])%mod;
			if(j>0&&a[i]-a[i-1]==m)f[i][j][1]=f[i-1][j-1][0];	
		}
	} 
	for(int i=0;i<=n;i++)
	{
		g[i]=(f[n<<1][i][0]+f[n<<1][i][1])%mod;
		if(i&1)ans=(ans-g[i]*fac[n-i]%mod+mod)%mod;
		else ans=(ans+g[i]*fac[n-i]%mod)%mod;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 250240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}


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

struct enemy {
    ll time, damage;
    enemy(ll _time, ll _damage) {
        time = _time;
        damage = _damage;
    }
};

bool operator<(enemy a, enemy b) {
    return a.time * b.damage < b.time * a.damage;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
ll N;
ll h[40500], a[40500], d[40500], s[40500];
vector<enemy> v;
ll Total;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    for(int i = 0; i <= N; i++) {
        cin >> h[i] >> a[i] >> d[i] >> s[i];
    }
    for(int i = 1; i <= N; i++) {
        ll damage = a[i] - d[0];
        if(damage <= 0) continue;
        if(s[i] > s[0]) Total += damage;
        ll dam = a[0] - d[i];
        if(dam <= 0) {
            cout << -1 << endl;
            return 0;
        }
        ll timer = (h[i] + dam - 1) / dam;
        v.emplace_back(timer, damage);
    }
    sort(v.begin(), v.end());
    vector<ll> sum(v.size() + 1);
    for(int i = (int)v.size() - 1; i >= 0; i--) {
        sum[i] = sum[i+1] + v[i].damage;
    }
    for(int i = 0; i < v.size(); i++) {
        Total += (v[i].time - 1) * sum[i];
        Total += sum[i+1];
        if(Total >= h[0]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << Total << endl;
    return 0;
}


Measured memory_bytes: 4968
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    println(2*n*π)
end
main()

Measured memory_bytes: 189708
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <random>
#include <set>
#include <map>
#include <queue>
#include <bitset>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)

int main(){
	int n,ans=0;
	cin >> n;
	string s,t="E869120";
	FOR(i,0,n){
		cin >> s;
		ans += t==s;
	}
	cout << ans << endl;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;

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

    rep(i,1,sz(s))cout << "x";
    cout << endl;
    // cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

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

void JpegCompression(int n, int** arr)
{
	int currN=1;
	vector<int> *diagonal=new vector<int>[2*n -1];

	for(int i=0; i<2*n-1; i++)
	{
		int elemN;
		if(i+1 <= n)elemN=i+1;
		else        elemN=2*n-(i+1);

		for(int j=0; j<elemN; j++)
			diagonal[i].push_back(currN++);

		if(i%2 == 1)
			reverse(diagonal[i].begin(), diagonal[i].end());
	}

	for(int y=0; y<n; y++)
	{
		for(int x=0; x<n; x++)
		{
			arr[x][y] = diagonal[x+y].back();
			diagonal[x+y].pop_back();
		}
	}
	delete[] diagonal;
}

int main(void)
{
	int n, nCase=1;
	while(1)
	{
		cin >> n;
		if(n == 0)break;

		int** ppArr=new int*[n];
		for(int i=0; i<n; i++)
			ppArr[i] = new int[n];
		JpegCompression(n, ppArr);
		
		cout << "Case " << nCase++ << ':' << endl;
		for(int y=0; y<n; y++)
		{
			cout.width(3);
			cout << ppArr[0][y];
			for(int x=1; x<n; x++)
			{
				cout.width(3);
				cout << ppArr[x][y];
			}
			cout << endl;
		}
		for(int i=0; i<n; i++)
			delete [] ppArr[i];
		delete[] ppArr;
	}

	return 0;
}

Measured memory_bytes: 1232