akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char cn[120000], * ci = cn + 20, ct, c, * owa = cn + 119980;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	swap(c, ci[8]);
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	swap(c, ci[8]);
	ci += (64 - dig >> 3) + 1;

	if (ci - owa > 0) {
		memcpy(cn, owa, 20);
		ci -= 119980;
		fread(cn + 20, 1, 119980, stdin);
	}
	return tmp;
}
//inline int getint() {
//	int A = 0;
//	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
//	
//	if (ci - owa > 0) {
//		memcpy(cn, owa, 20);
//		ci -= 119980;
//		fread(cn + 20, 1, 119980, stdin);
//	}
//
//	return A;
//}

char* di = cn;
const int MAX = 200000;
class shuturyoku_unko {
public:
	char C[MAX * 6 + 10];
	int K[MAX + 10];
	constexpr shuturyoku_unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[1] = 1;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = K[i] + keta;
		}
	}
} f;
inline void putint(ll X) {
	int ue = X / 100000;
	if (ue) {
		for (int i = f.K[ue]; i < f.K[ue + 1]; i++)* di++ = f.C[i];
		int sita = X - ue * 100000ll;
		rep(i, 5 - f.K[sita + 1] + f.K[sita])* di++ = '0';
		for (int i = f.K[sita]; i < f.K[sita + 1]; i++)* di++ = f.C[i];
	}
	else for (int i = f.K[X]; i < f.K[X + 1]; i++)* di++ = f.C[i];
	*di++ = '\n';
}

int B[200010];

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


	fread(ci, 1, 119980, stdin);

	int N = getint();
	ll kotae = 0;
	int A[200000];
	rep(i, N) kotae += B[(A[i] = getint())]++;
	int i = 0;
	
	int amari = N % 10000;
	int shou = N / 10000;
	rep(j, shou) {
		rep(k, 10000) putint(kotae - B[A[i++]] + 1);
		fwrite(cn, 1, di - cn, stdout);
		di = cn;
	}
	rep(k, amari) putint(kotae - B[A[i++]] + 1);
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int N, odd = 0, even = 0;
    cin >> N;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        if(a%2)odd++;
        else even++;
    }
    even += (odd / 2);
    odd %= 2;
    while(even > 1){
        int tmp = even % 2;
        even /= 2;
        even += tmp;
    }
    if(odd + even == 1)cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD  998244353
#define PB push_back
#define MP make_pair
#define F first
#define S second

ll dpS[222222];

signed main()
{
	ll N, K;
	cin >> N >> K;
	vector<pair<ll, ll>> LR;
	REP(i, K){
		ll l, r;
		cin >> l >> r;
		LR.PB(MP(l, r));
	}
	dpS[0] = 0;
	dpS[1] = 1;
	FOR(i, 2, N){
		dpS[i] = dpS[i-1]%MOD;
		REP(k, K){
			dpS[i] = (dpS[i]+dpS[max(i-LR[k].F, 0LL)]-dpS[max(i-LR[k].S-1, 0LL)]+MOD)%MOD;
		}
	}
	cout << (dpS[N]-dpS[N-1]+2*MOD)%MOD << endl;
}


Measured memory_bytes: 5188
package main
import "fmt"
import "sort"


type Edge struct {
	a,b int 
}
type Edges []Edge


func (e Edges) Len() int {
	return len(e)
}

func (e Edges) Swap (i,j int){
	e[i],e[j] = e[j],e[i]
}

func (e Edges) Less (i,j int) bool {
	return e[i].b < e[j].b
}

func main() {
	var n, m int
	var edge Edges
	fmt.Scan(&n, &m)

	for i := 0; i < m; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		a--
		b--
		if a > b{
			a,b = b,a
		}
		edge = append(edge, Edge{a:a, b:b})
	}

	sort.Sort(edge)

	var min int = -1
	var ans int = 0
	for i := 0 ; i < m; i++{
		if min <= edge[i].a {
			min = edge[i].b
			ans++
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 8960
def main():
    s = input()
    length = len(s)-1
    count = s.count('B')
    init = sum([i for i in range(len(s)) if s[i] == "B"])
    processed = sum(range(length-count+1, length+1))

    print(processed-init)


if __name__ == '__main__':
    main()


Measured memory_bytes: 11368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main(){
    int n, sum = 0, maxi = 0; cin >> n;
    rep(i, n){
        int p; cin >> p;
        sum += p;
        maxi = max(maxi, p);
    }
    cout << sum - maxi / 2 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	public static void main(String[] args) {
	long N =sc.nextLong();
	long A =sc.nextLong();
	long B =sc.nextLong();
	long ans=0;
		ans+=((long)N/(A+B))*A;
		if(A-N%(A+B)>0) {
			ans+=N%(A+B);
		}else if(A-N%(A+B)<=0) {
			ans+=A;
		}
	p(ans);
	
	
	}
}

Measured memory_bytes: 22868
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

#define ll long long

int main()
{
    ll N;
    std::cin >> N;

    std::vector<std::string> S(N);
    for(ll i=0; i < N; i++) {
        std::cin >> S[i];
    }

    std::sort(S.begin(), S.end());

    ll sum = 1;
    std::string tmp = S[0];

    for(ll i=1; i < N; i++) {
        if(tmp != S[i]) {
            sum++;
            tmp = S[i];
        }
    }

    std::cout << sum << std::endl;
}

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

const int M=1e5+5;
int h[M];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&h[i]);
	int i=0,j;
	int ans=0;
	while(i<n)
	{
		j=i+1;
		while(j<n&&h[j]<=h[j-1])
			j++;
		ans=max(ans,j-i-1);
		i=j;
	}
	printf("%d\n",ans);
	return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define per(i, b) per2(i, 0, b)
#define per2(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define ALL(c) (c).begin(), (c).end()
#define SZ(x) ((int)(x).size())

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

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

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

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

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

bool c[110][110];

int main() {
    ll X, Y;
    cin >> X >> Y;
    puts(abs(X - Y) > 1 ? "Alice" : "Brown");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  vector<ll> ans;
  ll sum = 0;
  for(ll i=1;i<=N;++i) {
    ans.push_back(i);
    sum += i;
    if(sum>=N) break;
  }
  ll nuku = sum - N;
  for(int i=0;i<ans.size();++i) {
    if(ans[i]==nuku) continue;
    cout<<ans[i]<<endl;
  }
}



Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
#include <deque>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	deque<ll> de;
	ll x;
	for(int i = 0; i < n; i++)
	{
		cin >> x;
		de.push_back(x);
	}
	sort(de.begin(), de.end());
	deque<ll> que, tmp;
	tmp = de;
	que.push_front(de[0]);
	de.pop_front();
	bool flag = false;
	ll cnt = 0;
	for(int i = 1; i < n; i++)
	{
		if(flag == false)
		{
			if(cnt % 2 == 0)
			{
				que.push_front(de.back());
				de.pop_back();
			}
			else
			{
				que.push_back(de.back());
				de.pop_back();
			}
			cnt++;
			if(cnt == 2)
			{
				flag = true;
				cnt = 0;
			}
		}
		else
		{
			if(cnt % 2 == 0)
			{
				que.push_front(de.front());
				de.pop_front();
			}
			else
			{	
				que.push_back(de.front());
				de.pop_front();
			}
			cnt++;
			if(cnt == 2)
			{
				flag = false;
				cnt = 0;
			}
		}
	}
	deque<ll> que2;
	de = tmp;
	reverse(de.begin(), de.end());
	que2.push_front(de[0]);
	de.pop_front();
	cnt = 0;
	flag = false;
	for(int i = 1; i < n; i++)
	{
		if(flag == false)
		{
			if(cnt % 2 == 0)
			{
				que2.push_front(de.back());
				de.pop_back();
			}
			else
			{
				que2.push_back(de.back());
				de.pop_back();
			}
			cnt++;
			if(cnt == 2)
			{
				flag = true;
				cnt = 0;
			}
		}
		else
		{
			if(cnt % 2 == 0)
			{
				que2.push_front(de.front());
				de.pop_front();
			}
			else
			{
				que2.push_back(de.front());
				de.pop_front();
			}
			cnt++;
			if(cnt == 2)
			{
				flag = false;
				cnt = 0;
			}
		}
	}
	ll ans1 = 0, ans2 = 0;
	//cout << que[0] << " ";
	for(int i = 1; i < n; i++)
	{
		//cout << que[i] << " ";
		ans1 += abs(max(que[i], que[i - 1]) - min(que[i], que[i - 1]));
	}
	//cout << endl;
	//cout << que2[0] << " ";
	for(int i = 1; i < n; i++)
	{
		//cout << que2[i] << " ";
		ans2 += abs(max(que2[i], que2[i - 1]) - min(que2[i], que2[i - 1]));
	}
	//cout << endl;
	cout << max(ans1, ans2) << endl;
	return 0;
}



Measured memory_bytes: 2816
import java.io.PrintWriter
import java.util.*

val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (n, m) = listOfInt()
    val items = listOfLong()
    val pq = PriorityQueue<Long>(n){ o1, o2 -> o2.compareTo(o1)}
    pq.addAll(items)

    repeat(m) {
        pq.add(pq.poll()/2L)
    }

    println(pq.sum())
}

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }
fun listOfLong() = listOfString().map { it.toLong() }

fun println(value : Any) {
    pw.println(value)
}

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

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define REP(i, n) for(int i = 0; (i) < (n); ++(i))
#define FOR(i, n) for(int i = 1; (i) <= (n); ++(i))
#define dump(x) cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e16;
const int MOD = 1e9 + 7;
// const lint LINF = 1e18;
const double eps = 0.000000001;  //もとの値の10^(-16)まで

using namespace std;

// typedef pair<int, int> P;
// priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
// cout << fixed << setprecision(10) << ans << endl;
// int gcd(int a,int b){return b?gcd(b,a%b):a;}
int a[300000];
int dp[300000][2][3];

signed main() {
  int n;
  cin >> n;
  REP(i, n) {
    cin >> a[i + 1];
  }
  dp[0][1][0] = -INF;
  dp[0][1][1] = -INF;
  dp[0][1][2] = -INF;
  dp[0][0][1] = -INF;
  dp[0][0][2] = -INF;
  for(int i = 1; i <= n; i++) {
    REP(k, 3) {
      if(n % 2 == 0 && k == 2) continue;
      dp[i][0][0] = dp[i - 1][1][0];
      dp[i][1][0] = dp[i - 1][0][0] + a[i];
      dp[i][0][1] = max(dp[i - 1][0][0], dp[i - 1][1][1]);
      dp[i][1][1] = dp[i - 1][0][1] + a[i];
      dp[i][0][2] = max(dp[i - 1][0][1], dp[i - 1][1][2]);
      dp[i][1][2] = dp[i - 1][0][2] + a[i];
    }
  }
  int ans = -INF;
  //REP(i, n+1) {
    int anss0 = -INF;
    int anss1 = -INF;
    int anss2 = -INF;


    REP(j, 2) {
      REP(k, 3) {
        //anss0 = max(anss0, dp[i][j][0]);
        //anss1 = max(anss1, dp[i][j][1]);
        //anss2 = max(anss2, dp[i][j][2]);
        //if(n % 2 == 0 && k == 2) continue;
        if(n%2==0){
            ans = max(ans, dp[n][j][1]);
            ans = max(ans, dp[n-1][1][0]);
        }
        else{
            ans = max(ans, dp[n][j][2]);
            ans = max(ans, dp[n-1][1][1]);
            ans = max(ans, dp[n-2][1][0]);
        }
      }
    //}
    //cout << "i=" << i << " " <<  anss0 << " "<< anss1 << " " << anss2 <<  endl;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 14548
N = int(input())
S = str(input())

alfa = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
count = len(S)
for i in range(0, count, 1):
    cmd = alfa.find(S[i])
    ans += alfa[cmd + N]
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> void mmax(T &m, const T q) { if (m < q) m = q; }
template<typename T> void mmin(T &m, const T q) { if (m > q) m = q; }
template<typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

const string YES = "YES";
const string NO = "NO";

int main()
{
    map<int, int> ma;
    REP(i, 6)
    {
        int a;
        cin >> a;
        ma[a]++;
    }
    bool flg = true;
    for (auto v : ma) if (v.second == 3) flg = false;
    cout << (flg ? YES : NO) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

using namespace std;


const int maxn = 10e6+10;
int p[maxn];int s[maxn];
int vis[maxn] = {0};
int n,m;
int find(int x){
    if(p[x] != x) p[x] = find(p[x]);
    return p[x];
}

int main()
{
    scanf("%d%d",&n,&m);

    for(int i =1 ;i<=n ; i++ ){
        p[i] = i;
        s[i] = 1;
    }

    for(int i = 0 ; i<m ; i++ ){
        int x,y;
        scanf("%d%d",&x,&y);
        x = find(x);
        y = find(y);
        if(x==y) continue;
        p[y] = x;
        s[x] += s[y];

    }

    int ans = 0;
    for(int i = 1 ; i<=n-1 ; i++ ){
        int pa = find(i);
        int pb = find(i+1);
        if(pa!=pb){
            p[pa] = pb;
            ans++;
        }
    }
    cout << ans;




    return 0;
}


Measured memory_bytes: 4516
using System;
using System.Collections;
using System.Collections.Generic;

class Program {

    static void Main (string[] args) {
        string[] strtemp = Console.ReadLine ().Split (' ');
        int X = int.Parse (strtemp[0]);
        int Y = int.Parse (strtemp[1]);
        if (Y - 2 * X >= 0 && (Y - 2 * X) % 2 == 0 && 4 * X - Y >= 0 && (4 * X - Y) % 2 == 0) {
            Console.WriteLine ("Yes");
        } else {
            Console.WriteLine ("No");
        }
    }

}

//dotnet run --project test

Measured memory_bytes: 27476
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	string s; cin >> s;
	bool bflag;
	// for(int i = 1; i < 4; i++){
	// 	if(s[i-1] == s[i])bflag = true;
	// }
	if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]){
		//bflag = true;
			cout << "Bad"<< endl;
		}else{
			cout << "Good" << endl;
		}

	//cout << ((bflag) ? "Bad" : "Good") << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class CXYZTriplets {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        map<int, int> f;
        FOR(x, 1, 100) {
            FOR(y, 1, 100) {
                FOR(z, 1, 100) {
                    int val = x * x + y * y + z * z + x * y + y * z + z * x;
                    f[val]++;
                }
            }
        }
        FOR(i, 1, N) {
            cout << f[i] << endl;
        }
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CXYZTriplets solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 5988
using System;

namespace AtCoder.ABC097
{
    class c
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Trim();
            var line = Console.ReadLine().Trim();
            var K = int.Parse(line);
            var list = new string[K];
            for(var i = 0; i < s.Length; ++i)
            {
                for(var j = 1; j <= s.Length - i && j <= K; ++j)
                {
                    var str = s.Substring(i,j);
                    for(var k = 0; k < K; ++k)
                    {
                        if (list[k] == default(string))
                        {
                            list[k] = str;
                            break;
                        }
                        else
                        {
                            var equalFlg = false;
                            
                            for(var l = 0; l < K; ++l)
                            {
                                if (list[l] == str)
                                {
                                    equalFlg = true;
                                    break;
                                }
                            }
                            if (equalFlg) break;
                            if (list[k].CompareTo(str) > 0)
                            {
                                for (var l = K - 1; l > k; --l)
                                {
                                    list[l] = list[l - 1];
                                }
                                list[k] = str;
                            }
                            else continue;
                        }
                    }

                }
            }
            Console.WriteLine(list[K - 1]);
        }
    }
}


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

using namespace std;

int main(void) {
  string S;
  int K;
  cin >> S >> K;

  set <string> t;
  for(int i = 1; i <= K; i++) {
    for(int j = 0; j + i - 1 < S.length(); j++) {
      string u = S.substr(j, i);
      t.insert(u);
    }
  }
  long long count = 0;
  for(auto i: t) {
    count++;
    if(count == K) {
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 1664
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

int main(){

	int N,E,limit,tmp,minimum;
	scanf("%d %d",&N,&E);

	limit = pow(2,N);

	int cost[N][N];

	for(int i = 0; i < N; i++){
		for(int k = 0; k < N; k++)cost[i][k] = BIG_NUM;
	}

	int from,to,value;

	for(int i = 0; i < E; i++){
		scanf("%d %d %d",&from,&to,&value);
		cost[from][to] = value;
	}

	int** dp = new int*[N];
	for(int i = 0; i < N; i++){
		dp[i] = new int[limit];
		for(int k = 0; k < limit; k++){
			dp[i][k] = BIG_NUM;
		}
	}

	minimum = BIG_NUM;

	tmp = pow(2,0);

	dp[0][tmp] = 0;

	for(int state = 0; state <= limit-1; state++){
		for(int k = 0; k < N; k++){
			if(dp[k][state] == BIG_NUM)continue;
			for(int a = 0; a < N; a++){
				if(state & (1 << a)){
					if(state == limit-1 && a == 0){
						if(cost[k][0] != BIG_NUM)dp[0][limit-1] = min(dp[0][limit-1],dp[k][state]+cost[k][0]);
					}
				}else{
					if(cost[k][a] != BIG_NUM){
						tmp = state + pow(2,a);
						dp[a][tmp] = min(dp[a][tmp],dp[k][state]+cost[k][a]);
					}
				}
			}
		}
	}

	minimum = min(minimum,dp[0][limit-1]);


	if(minimum == BIG_NUM){
		printf("-1\n");
	}else{
		printf("%d\n",minimum);
	}

}

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

using namespace std;
int main() {
    int N,a,b,c;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> a;
        cin >> b;
        cin >> c;
        a *= a;
        b *= b;
        c *= c;
        int m = max(a,max(b,c));
        if(m == (a+b+c)-m){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;

}

Measured memory_bytes: 2968
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
typedef int val_t;
struct RBST{
	struct Node{
		Node *lp,*rp;
		int size;
		val_t val,mini;
		Node(val_t v):val(v),mini(v),size(1),lp(NULL),rp(NULL){}
	};
	Node *root;
	RBST():root(NULL){}
	int size(Node *x){return !x?0:x->size;}
	val_t mini(Node *x){return !x?INF:x->mini;}
	Node* update(Node *x){
		if(x==NULL)return x;
		x->size = 1+size(x->lp)+size(x->rp);
		x->mini = min(min(x->val,mini(x->lp)),mini(x->rp));
		return x;
	}
	Node* merge(Node* x,Node* y){
		if(x==NULL)return y;
		if(y==NULL)return x;
		int m = x->size , n = y->size;
		if(rand()%(m+n)<m){
			x->rp = merge(x->rp,y);
			return update(x);
		}else{
			y->lp = merge(x,y->lp);
			return update(y);
		}
	}
	typedef pair<Node*,Node*> Np;
	Np split(Node *x,int k){ //[0,k),[k,n)
		if(x==NULL)return Np(NULL,NULL);
		if(k<=size(x->lp)){
			Np s = split(x->lp,k);
			x->lp = s.sec;
			return mp(s.fi,update(x));
		}else{
			Np s = split(x->rp,k-size(x->lp)-1);
			x->rp = s.fi;
			return mp(update(x),s.sec);
		}
	}
	void insert(int k,val_t val){
		Np s = split(root,k);
		root = merge(merge(s.fi,new Node(val)),s.sec);
		return;
	}
	int erase(int k){
		Np s = split(root,k);
		Np s2 = split(s.sec,1);
		root = merge(s.fi,s2.sec);
		return s2.fi->val;
	}
	val_t query(int l,int r){ //[l,r)
		Np s = split(root,l);
		Np s2 = split(s.sec,r-l);
		val_t ret = s2.fi->mini;
		root = merge(merge(s.fi,s2.fi),s2.sec);
		return ret;
	}
	void shift(int l,int r){ //[l,r)
		Np s = split(root,l);
		Np s2 = split(s.sec,r-l);
		Np s3 = split(s2.fi,r-l-1);
		root = merge(s.fi,merge(merge(s3.sec,s3.fi),s2.sec));
		return;
	}
}tree;
int main()
{
	int N,Q;
	scanf("%d %d",&N,&Q);
	for(int i=0;i<N;i++){
		int a;
		scanf("%d",&a);
		tree.insert(i,a);
	}
	for(int i=0;i<Q;i++){
		int x,y,z;
		scanf("%d %d %d",&x,&y,&z);
		if(x==0){
			z++;
			tree.shift(y,z);
		}else if(x==1){
			z++;
			printf("%d\n",tree.query(y,z));
		}else{
			tree.erase(y);
			tree.insert(y,z);
		}
	}
	return 0;
}

Measured memory_bytes: 13704
#include<iostream>
using namespace std;
int main()
{
	int a,i,j;
	cin>>a;
    for(i=1;i<=9;i++)
     for(j=1;j<=9;j++)
     if(a==i*j)
     {
	 cout<<"Yes"<<endl;
     return 0;}
     if(i==10&&j==10)
     cout<<"No";
     return 0;
     
     
     
     
	
	
	
 } 

Measured memory_bytes: 256
def seinokazu(num):
    if num >= 0:
        return num
    else:
        num = -1 * num
        return num


n = input()
n = int(n)
clear = False

nexs = []

now = 0
x = 0
y = 0

for z in range(n):
    nexs.append(input())

for i in range(n):
    aa = nexs[i].split(" ")
    nex = int(aa[0])
    xx = int(aa[1])
    yy = int(aa[2])

    xsa = xx - x
    xsa = seinokazu(xsa)
    ysa = yy - y
    ysa = seinokazu(ysa)
    xysa = xsa + ysa
    nsa = nex - now
    if xysa > nsa:
        clear = False
        break
    else:
        sa = xysa - nsa
        sa = seinokazu(sa)
        if sa % 2!=0:
            clear = False
            break
        else:
            clear = True
    now = nex
    x = xx
    y = yy

if clear:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 10276
/**
 * 
 * @param {String} input 
 */
function Main(input) {
    input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
    var [n] = input[0].split(' ');
    
    let sum = 0;    

    for (var v of n) {
        const num = parseInt(v, 10);
        
        sum += num;
        if(sum > 9) sum -= 9;
    }
	//出力
	console.log(sum % 9 === 0 ? 'Yes': 'No');
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 35616
#include<iostream>
using namespace std;
//エイシングプロコン2020
//C問題
int main(){
	int n;
	cin >> n;
	int ans[10050] = { 0 };
	int v;
	for (int i = 1; i <= 105; i++){
		for (int j = 1; j<= 105;j++){
			for (int k = 1; k<= 105; k++){
				v = i*i + j*j + k*k + i*j + j*k + k*i;
				if (v<10050){
					ans[v] += 1;
				}
			}
		}
	}
	for (int i = 1; i <= n; i++){
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3668
# -*- coding: utf-8 -*-

n,m=map(int, input().split())

ka = []

for i in range(n):
    ka.append(list(map(int,input().split())))
#print(ka)

common = [i for i in range(1,m+1)]
#print(common)

for i in range(n):
    #commonとka[1:]の共通項をcommonに格納
    temp = common + ka[i][1:]
    common = [x for x in set(temp) if temp.count(x) > 1]

print(len(common))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 998244353;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

LL calc(LL N, LL M, LL D) {
	VLL V(M,1);
	LL ans = 0;
	while (true) {
		for (LL m = 0; m < M - 1; m++) {
			if (abs(V[m] - V[m + 1]) == D)ans++;
		}
		LL m = M-1;
		for (; m >= 0; m--) {
			if (V[m] != N)break;
		}
		if (m == -1)return ans;
		V[m]++;
		for (LL mm = m + 1; mm < M; mm++)V[mm] = 1;
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	//for (LL n = 1; n <= 10; n++) {
	//	for (LL m = 2; m <= 6; m++) {
	//		for (LL d = 0; d < n; d++) {
	//			//cout << "n,m,d = " << n << "," << m << "," << d << ":";
	//			//cout << calc(n, m, d) << "/(n^m);\n";
	//			LL d0 = calc(n, m, d);
	//			LL d1 = 2*(m-1);
	//			for (LL p = 0; p < m - 2; p++)d1 *= n;
	//			d1 *= n - d;
	//			if (d0 != d1) {
	//				cout << "n,m,d = " << n << "," << m << "," << d << ":";
	//				cout << d0 << "vs" << d1 << "\n";
	//			}
	//		}
	//		cout << "\n";
	//	}
	//	cout << "####################\n";
	//}
	LL N, M, D;
	cin >> N >> M >> D;
	LD ans = (LD)2 * (M - 1) * (N - D) / N / N;
	if (D == 0)ans /= 2;
	cout << setprecision(12) << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define fe(x) for(int i=be[x];i;i=e[i].ne)
#define fe2(x) for(int i=be2[x];i;i=e2[i].ne)
using namespace std;
int n,m,be[1050],et,xx,yy,zz;
struct edg{
	int y,z,ne;
};
struct edg2{
	int y,ne;
};
edg e[3000],e2[3000];
long long f[1050];
int q[2000000],he,ta,et2,be2[1050],ci[1050];
bool inq[1050],vis[1050];
inline void add_edge(int x,int y,int z){
	e[++et].y=y;
	e[et].z=z;
	e[et].ne=be[x];
	be[x]=et;
	e2[++et2].y=x;//!!!!
	e2[et2].ne=be2[y];
	be2[y]=et2;
}
int main(){
	scanf("%d%d",&n,&m);
	fo(i,1,m){
		scanf("%d%d%d",&xx,&yy,&zz);
		add_edge(xx,yy,zz);
	}
	fo(i,1,n) f[i]=-(long long)0x7ffffffff*(long long)(n+5);
	f[1]=0;
	q[he=ta=1]=n;
	vis[n]=1;
	while (he<=ta){
		int &x=q[he];
		fe2(x){
			int &y=e2[i].y;
			if (!vis[y]){
				vis[y]=1;
				q[++ta]=y;
			}
		}
		he++;
	}
	//fo(i,1,n) printf("vis%d:%d\n",i,vis[i]);
	
	q[he=ta=1]=1;
	inq[1]=1;//!!!
	while (he<=ta){
		int &x=q[he];//be[x]!!!!!!!!
		fe(x){
			int &y=e[i].y;
			if (vis[y]&&f[x]+e[i].z>f[y]){
				f[y]=f[x]+e[i].z;
				ci[y]++;
				if (ci[y]>n){
					printf("inf\n");
					return 0;
				}
				if (!inq[y]){
					inq[y]=1;
					q[++ta]=y;
				}
			}
		}
		inq[x]=0;
		he++;
	}
	printf("%lld\n",f[n]);
	return 0;
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
#include <random>
#define REP(i, n) for (ll i = 0; i < ll(n); ++i)
#define RREP(i, n) for (ll i = ll(n) - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define RFOR(i, m, n) for (ll i = ll(n) - 1; i >= ll(m); --i)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll t1, t2, a1, a2, b1, b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
  if (t1 * a1 + t2 * a2 == t1 * b1 + t2 * b2) {
    cout << "infinity" << endl;
    return 0;
  }
  ll m = t1 * a1 + t2 * a2 - t1 * b1 - t2 * b2;
  ll ans = 0;
  ll l = -1, r = INF * INF / abs(m);
  while (r - l > 1) {
    ll mid = (r + l) / 2;
    ll pos = m * mid;
    if (b1 > a1) {
      if (0 <= pos && pos < t1 * (b1 - a1)) {
        l = mid;
      } else {
        r = mid;
      }
    } else {
      if (t1 * (b1 - a1) < pos && pos <= 0) {
        l = mid;
      } else {
        r = mid;
      }
    }
  }
  ans += l + 1;
  l = -1, r = INF * INF / abs(m);
  while (r - l > 1) {
    ll mid = (r + l) / 2;
    ll pos = m * mid + t1 * (a1 - b1);
    if (b2 > a2) {
      if (0 <= pos && pos < t2 * (b2 - a2)) {
        l = mid;
      } else {
        r = mid;
      }
    } else {
      if (t2 * (b2 - a2) < pos && pos <= 0) {
        l = mid;
      } else {
        r = mid;
      }
    }
  }
  ans += l + 1;
  cout << ans - 1 << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };

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

	ll n, m, ans = 0;
	cin >> n;
	vi dp(n),v(n);
	rep(i, n) cin >> v[i];
	dp[1] = abs(v[1] - v[0]);
	REP(i, 2, n) {
		dp[i] = min(dp[i - 2] + abs(v[i] - v[i - 2]), dp[i - 1] + abs(v[i] - v[i - 1]));
	}
	//rep(i, n) cout << dp[i] << " ";
	//cout << endl;
	cout << dp[n-1] << endl;
	return 0;
}


Measured memory_bytes: 1024
n=int(raw_input())
a=map(int,raw_input().split())
#color=[hai,cha,midori,mizu,ao,ki,daidai,aka]
c=[0 for i in xrange(8)]
ext=0
for x in a:
 if 1<=x<=399:
  c[0]=1
 elif 400<=x<=799:
  c[1]=1
 elif 800<=x<=1199:
  c[2]=1
 elif 1200<=x<=1599:
  c[3]+=1
 elif 1600<=x<=1999:
  c[4]=1
 elif 2000<=x<=2399:
  c[5]=1
 elif 2400<=x<=2799:
  c[6]=1
 elif 2800<=x<=3199:
  c[7]=1
 else:
  ext+=1
res1=8-c.count(0)+ext
res2=res1-ext
if res2==0:
 res2=1
print res2,res1


Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;
int main(){
int ans=0;
  long N,K;
  cin>>N>>K;
  while(ans>=0){
    if(N>=K){
      N=N/K;
      ans++;
    }else{
	ans++;
      break;
    }
  }
  cout<<ans<<endl;
}

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

int main() {
	int n;
	cin >> n;
	int m;
	m = 0;
	int l;
	l = n;
	while (n != 0) {
		m += n % 10;
		n /= 10;
	}
	if (l % m == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main () {
    int m, f, r;
    while(true) {
        scanf("%d %d %d", &m, &f, &r);
        char rank = 'F';
        if (m == -1 && f == -1 && r == -1) break;
        int sum = m + f;
        if (m == -1 || f == -1) {
            rank = 'F';
        } else if (80 <= sum) {
            rank = 'A';
        } else if (65 <= sum && sum < 80) {
            rank = 'B';
        } else if (50 <= sum && sum < 65) {
            rank = 'C';
        } else if (30 <= sum && sum < 50) {
            rank = 'D';
            if (50 <= r) rank = 'C';
        } else if (sum < 30) {
            rank = 'F';
        }
        printf("%c\n", rank);
    }

    return 0;
}

Measured memory_bytes: 1028
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,k; cin >> n >> k;
  	int l[n]; for(int i=0;i<n;i++) cin>>l[i];
  	sort(l,l+n,greater<int>());
  	int ans=0;
  	for(int i=0;i<k;i++){
      ans+=l[i];
    }
  	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        String[] str = sc.next().split("");
        if(str[2].equals(str[3]) && str[4].equals(str[5])){
          System.out.print("Yes");
        }else{
          System.out.print("No");
        }
    }
}

Measured memory_bytes: 21972
#include<iostream>
#include<string>

using namespace std;

int main(){
    string s;
    long long ans=0;
    cin>>s;
    for(int i=0;i<(1<<s.size()-1);i++){
        long long sm = 0;
        long long a = s[0] - '0';
            for(int j=0;j<s.size()-1;j++){
                if(i&(1<<j)){
                    sm += a;
                    a =0;
                }
                a = a*10+s[j+1]-'0';
            }
            sm += a;
            ans +=sm;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e18+7;

int sx,sy,tx,ty;

int main(){ 

cin.tie(0);
ios::sync_with_stdio(false);

cin>>sx>>sy>>tx>>ty;

for(int i=0; i<tx-sx; i++){
	cout<<'R';
}
for(int i=0; i<ty-sy; i++){
	cout<<'U';
}
for(int i=0; i<tx-sx; i++){
	cout<<'L';
}
for(int i=0; i<ty-sy; i++){
	cout<<'D';
}
cout<<'D';
for(int i=0; i<=tx-sx; i++){
	cout<<'R';
}
for(int i=0; i<=ty-sy; i++){
	cout<<'U';
}
cout<<'L';
cout<<'U';
for(int i=0; i<=tx-sx; i++){
	cout<<'L';
}
for(int i=0; i<=ty-sy; i++){
	cout<<'D';
}
cout<<'R'<<endl;

}


Measured memory_bytes: 256
import math
import queue
import bisect
import heapq

mod = 1e9+7

def swap(a,b):
    return (b,a)

def gcd(a,b):
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def divisors(a):
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def main():
    n,m = map(int,input().split())
    a = [-x for x in map(int,input().split())]
    heapq.heapify(a)
    for i in range(m):
        x = heapq.heappop(a)
        if x%2==0:
            heapq.heappush(a,x//2)
        else:
            heapq.heappush(a,x//2+1)
    ans = 0
    for i in range(n):
        ans += heapq.heappop(a)*(-1)
    print(ans)
    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 15324
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
typedef long long ll;
ll f[60];
ll p[60];
using namespace std;
int main()
{
    ll n,k;
    cin>>n>>k;
    f[0]=1;
    p[0]=1;
    for(int i=1;i<=n;i++)
    {
	f[i]=3+2*f[i-1];
	p[i]=1+2*p[i-1];
//	cout<<f[i]<<' '<<p[i]<<endl;
    }
    ll sum=0;
    if(k>f[n])k=f[n];
    while(n>=0)
    {
	if(k==0) break;
	if(n==0)
        {
	    sum++;
	    break;
        }
//	if(k==0) break;
	if(k==f[n])
	{
	    sum+=p[n];
	    break;
	}
	if(k==f[n-1]+2)
	{
	    sum+=p[n-1]+1;
	    break;
	}
	if(k>f[n-1]+2)
	{
	    sum+=p[n-1]+1;
	    k=k-2-f[n-1];
	}
	else if(k<f[n-1]+2) k=k-1;
	n--;
    }
    cout<<sum<<endl;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> s(h, vector<char> (w));
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> s.at(i).at(j);
    }
  }
  vector<int> dx(4);
  vector<int> dy(4);
  dx = {1, -1, 0, 0};
  dy = {0, 0, 1, -1};
  bool can = true;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s.at(i).at(j) == '.') continue;
      bool can2 = false;
      for(int d = 0; d < 4; d++){
        int di = i + dy.at(d);
        int dj = j + dx.at(d);
        if(di < 0 || di >= h) continue;
        if(dj < 0 || dj >= w) continue;
        if(s.at(di).at(dj) == '#') can2 = true;
      }
      if(!can2) can = false;
    }
  }
  
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 5000000000000000000L; // change so that it's slightly larger than (2*10^9)^{2}
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, K; cin >> N >> K;
    vector<ll> x(N), y(N);
    rep(i, N){cin >> x.at(i) >> y.at(i);}

    vector<ll> x_axis(x), y_axis(y);

    sort(x_axis.begin(), x_axis.end());
    sort(y_axis.begin(), y_axis.end());
    x_axis.erase(unique(x_axis.begin(), x_axis.end()), x_axis.end());
    y_axis.erase(unique(y_axis.begin(), y_axis.end()), y_axis.end());

    ll area = INF;
    ll W = x_axis.size(), H = y_axis.size();
    rep(i, W - 1){
        rep2(j, 1, W){
            rep(k, H - 1){
                rep2(l, 1, H){
                    ll xmin = x_axis.at(i), xmax = x_axis.at(j);
                    ll ymin = y_axis.at(k), ymax = y_axis.at(l);
                    ll cnt = 0;
                    rep(m, N){
                        if (xmin <= x.at(m) && x.at(m) <= xmax && ymin <= y.at(m) && y.at(m) <= ymax){
                            cnt += 1;
                        }
                    }
                    if (cnt >= K){
                        ll tmp_area = (xmax - xmin) * (ymax - ymin);
                        if (tmp_area < area){area = tmp_area;}
                    }
                }
            }
        }
    }
    cout << area << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    long long  l,r,sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>l>>r;
        sum+=(r-l+1);
    }
    cout<<sum;
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,a,b; cin>>x>>a>>b;
    cout<<(x-a)%b<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

//chMIN
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    ll n,k;
    cin >> n >> k;

    vector<ll> h(n);
    rep(i,n){
        cin >> h[i];
    }

    ll dp[200001];
    ll INF = 1e9;
    rep(i,200001){
        dp[i] = INF;
    }
    dp[0] = 0;

    for(ll i=0; i<n; i++){
        for(ll j=1; j<=k; j++){
        chmin(dp[i+j] , dp[i] + abs(h[i+j]-h[i]));
        }
    }

    dunk(dp[n-1]);

}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int main(){
    string s; cin >> s;
    int a[4];
    for(int i=0; i<4; i++){
        a[i] = s[i] - '0';
    }
    int sum;
    char op[3];
    for(int i=0; i<(1<<3); i++){ //{0,1,2,3}の部分集合の全探索
        sum=a[0];
        for(int j=0; j<3; j++){
            if(i & (1 << j)){ //iのjビットにフラグが立ってたら真
                op[j] = '+';
                sum += a[j+1];
            }else{
                op[j] = '-';
                sum -= a[j+1];
            }
        }
        if(sum == 7){
            break;
        }
    }
    for(int i=0; i<3; i++){
        cout << a[i] << op[i];
    }
    cout << a[3] << "=7" << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

sum_a = sum(A) // 2

cs_even = [0]
cs_odd = [0]

cse = 0
cso = 0
for i in range(0, N-2, 2):
    cse += A[i]
    cso += A[i+1]
    cs_even.append(cse)
    cs_odd.append(cso)
cse += A[N-1]
cs_even.append(cse)

ans_arr = []
for i in range(N):
    c0 = 0
    c1 = 0
    if i % 2 == 0:
        ans = sum_a - cs_even[i//2] - cs_odd[(N-1)//2] + cs_odd[i//2]
    else:
        ans = sum_a - cs_odd[i//2] - cs_even[(N+1)//2] + cs_even[(i+1)//2]
    ans *= 2
    ans_arr.append(str(ans))

print(' '.join(ans_arr))

Measured memory_bytes: 22848