akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>

using namespace std;

int main(void){
  string S;
  int cnt = 0,ans = 0;

  cin >> S;

  for(char s : S){
    if(s == 'R') cnt++;

    else cnt = 0;

    ans = max(cnt,ans);
  }

  cout << ans << endl;

  return 0;
}


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

typedef long long LL;

const int N=100,M=1000;

int n,a[N+9];

void into(){
  scanf("%d",&n);
  for (int i=1;i<=n;++i)
	scanf("%d",&a[i]);
}
int mx,mn;

void Get_mxn(){
  mx=0;mn=M;
  for (int i=1;i<=n;++i) mx=max(mx,a[i]),mn=min(mn,a[i]);
}

int last[N+9],tmp[N+9];
int ta[N+9],tb[N+9],tc[N+9],cta,ctb,ctc;

bool Get_tmp(int m){
  int flag=1;
  for (int i=1;i<=m;++i) --a[last[i]],tmp[i]=0;
  Get_mxn();
  if (mn<<1>=mx){
	for (int i=1;i<=m;++i) tmp[i]=last[i];
	sort(tmp+1,tmp+m+1);
  }else if (mn*2+1==mx){
	int flagmn=0,flagmx=0;
	cta=ctb=ctc=0;
	for (int i=m+1;i<=n;++i)
	  if (a[last[i]]==mn) flagmn=1;
      else if (a[last[i]]==mx&&flagmn) flagmx=1;
	for (int i=1;i<=m;++i)
	  if (a[last[i]]==mx) ta[++cta]=last[i],flagmx=1;
    sort(ta+1,ta+cta+1);
    if (flagmn&&flagmx) flag=0;
    for (int i=1;i<=m;++i)
	  if (a[last[i]]==mn) tc[++ctc]=last[i];
    sort(tc+1,tc+ctc+1);
	for (int i=1;i<=ctc;++i) ta[++cta]=tc[i];
    for (int i=1;i<=m;++i)
	  if (a[last[i]]<mx&&a[last[i]]>mn) tb[++ctb]=last[i];
    sort(tb+1,tb+ctb+1);
    merge(ta+1,ta+cta+1,tb+1,tb+ctb+1,tmp+1);
  }else flag=0;
  for (int i=1;i<=m;++i) ++a[last[i]];
  return flag;
}

int now[N+9],cn;

bool Check_cmp(){
  for (int i=1;2333;++i)
	if (tmp[i]^now[i]) return tmp[i]<now[i];
}

int ans[N*M+9],ca;

void Get_ans(){
  Get_mxn();
  if (mn<<1<mx) return;
  for (int i=1;i<=n;++i) ca+=a[i],last[i]=i;
  Get_tmp(n);
  for (int i=1;i<=n;++i) --a[ans[i]=last[i]=tmp[i]],tmp[i]=0;
  for (int i=n+1;i<=ca;){
	for (int j=1;j<=n;++j) now[j]=0;
	now[1]=n+1;cn=0;
	for (int j=1;j<=n;++j){
	  if (i+j-1>ca) continue;
	  if (!Get_tmp(j)) continue;
	  if (Check_cmp()){
		cn=j;
		for (int k=1;k<=j;++k) now[k]=tmp[k];
	  }
	}
	for (int j=1;j<=cn;++j) --a[ans[i++]=now[j]];
    for (int j=1;j<=n;++j) last[j]=ans[i-n+j-1];
  }
}

void work(){
  Get_ans();
}

void outo(){
  if (!ca) puts("-1");
  else{
	for (int i=1;i<=ca;++i)
	  printf("%d ",ans[i]);
    puts("");
  }
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 998244353;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 62;
constexpr double EPS = 1e-9;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
  }
} initializer;

template<typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

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

template<typename Tuple, size_t N>
struct TuplePrinter {
  static void print(const Tuple &t) {
    TuplePrinter<Tuple, N-1>::print(t);
    cout << ", " << get<N-1>(t);
  }
};

template<typename Tuple>
struct TuplePrinter<Tuple, 1> {
  static void print(const Tuple &t) {
    cout << get<0>(t);
  }
};

template<typename... T>
ostream &operator<<(ostream &os, const tuple<T...> &tup) {
  os << "(";
  TuplePrinter<decltype(tup), sizeof...(T)>::print(tup);
  return os << ")";
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }
#define dump(...) cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);cout<<'\n';

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


int main() {
  int n; cin>>n;
  vector<long long> d(n);
  rep(i, n) cin>>d[i];
  vector<long long> cnt(100010, 0);
  rep(i, n) ++cnt[d[i]];

  if (d[0] != 0) {
    print(0);
    return 0;
  }
  REP(i, 1, n) if (d[i] == 0) {
    print(0);
    return 0;
  }

  long long ans = 1;
  int c = 1;
  bool flag = true;
  REP(i, 1, 100010) {
    if (flag == false and cnt[i] > 0) {
      print(0);
      return 0;
    } else if (cnt[i] == 0) {
      flag = false;
    } else {
      rep(j, cnt[i]) ans = (ans * c) % MOD;
      c = cnt[i];
    }
  }
  print(ans);

  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

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

	int n, a, b;
	cin >> n >> a >> b;

	if (a == b) {
		cout << "1\n";
		return 0;
	}

	if (b < a || n < 2) {
		cout << "0\n";
		return 0;
	}

	cout << (long long) (n - 2) * (b - a) + 1 << "\n";

	return 0;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int V = scanner.nextInt();
        int E = scanner.nextInt();
        scanner.nextLine();

        Kruskal kruskal = new Kruskal(V);
        for (int i = 0; i < E; i++) {
            int[] e = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            kruskal.addEdge(e[0], e[1], e[2]);
        }

        List<Edge> usedEdges = kruskal.run();
        System.out.println(usedEdges.stream().mapToLong(x -> x.cost).sum());
    }
}

class UnionFindTree {
    int size;
    int[] par;
    int[] rank;

    public UnionFindTree(int size) {
        this.size = size;
        par = new int[size];
        for (int i = 0; i < size; i++) {
            par[i] = i;
        }
        rank = new int[size];
        Arrays.fill(rank, 1);
    }

    private int root(int x) {
        if (x == par[x]) {
            return x;
        }
        int root = root(par[x]);
        par[x] = root;
        return root;
    }

    public boolean same(int x, int y) {
        return root(x) == root(y);
    }

    public void merge(int x, int y) {
        int xr = root(x);
        int yr = root(y);
        if (rank[xr] < rank[yr]) {
            par[xr] = yr;
        } else {
            par[yr] = xr;
            if (rank[xr] == rank[yr]) {
                rank[xr]++;
            }
        }
    }

}

class Kruskal {
    private int size;
    Queue<Edge> edges;
    UnionFindTree uft;

    public Kruskal(int size) {
        this.size = size;
        edges = new PriorityQueue<>(Comparator.comparingInt(x -> x.cost));
        uft = new UnionFindTree(size);
    }

    public void addEdge(int from, int to, int cost) {
        edges.add(new Edge(from, to, cost));
    }

    public List<Edge> run() {
        List<Edge> usedEdges = new ArrayList<>();
        while (!edges.isEmpty()) {
            Edge e = edges.poll();
            if (uft.same(e.from, e.to)) {
                continue;
            }
            uft.merge(e.from, e.to);
            usedEdges.add(e);
        }
        return usedEdges;
    }

}


class Edge {
    public final int from;
    public final int to;
    public final int cost;

    public Edge(int from, int to, int cost) {
        this.from = from;
        this.to = to;
        this.cost = cost;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Edge edge = (Edge) o;
        return from == edge.from &&
                to == edge.to &&
                cost == edge.cost;
    }

    @Override
    public int hashCode() {
        return Objects.hash(from, to, cost);
    }
}



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

template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

const long long INF = (1ll << 60);

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

	for(int n; cin >> n && n;) {
		if(n == 2) {
			int p1, d1, p2, d2;
			cin >> p1 >> d1 >> p2 >> d2;
			cout << abs(p1 - p2) << endl;
			continue;
		}

		vector<int> single;
		vector<pair<int, int>> multiple;

		single.reserve(n);
		multiple.reserve(n);

		for(int i = 0; i < n; ++i) {
			int p, d;
			cin >> p >> d;

			if(d == 1) single.emplace_back(p);
			else multiple.emplace_back(p, d);
		}

		sort(single.begin(), single.end());
		sort(multiple.begin(), multiple.end());

		long long cost = 0;
		for(int i = 0; i < static_cast<int>(multiple.size()) - 1; ++i) {
			--multiple[i].second;
			--multiple[i + 1].second;
			cost += abs(multiple[i].first - multiple[i + 1].first);
		}

		if(single.size() == 0) {
			cout << cost << endl;
			continue;
		}

		vector<int> m_pos;
		m_pos.reserve(n * n);
		for(const auto &m_island : multiple) {
			for(int j = 0; j < m_island.second; ++j) {
				m_pos.emplace_back(m_island.first);
			}
		}

		const int s_size = single.size();
		const int m_size = m_pos.size();

		if(s_size > m_size) {
			cout << -1 << endl;
			continue;
		}

		vector<int> near(s_size);
		for(int i = 0; i < s_size; ++i) {
			near[i] = lower_bound(m_pos.begin(), m_pos.end(), single[i]) - m_pos.begin();
		}

		int prev_near = 0;
		const int len = s_size + s_size + 1;
		vector<long long> dp(len, cost);

		for(int i = 0; i < s_size; ++i) {
			const int diff = near[i] - prev_near;
			for(int j = 0; j < len; ++j) {
				dp[j] = dp[min(j + diff, len - 1)];
			}

			vector<long long> tmp(len, INF);
			for(int j = 0; j < len - 1; ++j) {
				const int k = near[i] - s_size + j;
				if(k < 0) continue;
				if(k >= m_size) break;
				chmin(tmp[j + 1], dp[j] + abs(single[i] - m_pos[k]));
			}

			for(int j = 0; j < len - 1; ++j) {
				chmin(tmp[j + 1], tmp[j]);
			}

			dp = move(tmp);
			prev_near = near[i];
		}

		cout << dp.back() << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 47296
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <math.h>
#include <bitset>
#include <queue>

using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> gu(n);
    for (int i = 0; i < n; i++) {
        cin >> gu[i];
    }

    sort(gu.begin(), gu.end());
    double maxv = 0;

    double value = gu[0];
    for (int i = 1; i < gu.size(); i++) {
        value = (value + gu[i]) / 2;
    }
    maxv = max(maxv, value);


    cout << maxv;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<set>
#include<list>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<limits>
#include<unordered_map>
#include<cctype>
#pragma warning(disable:4996)
using namespace std;

#define debug(i) cout<<"<debug> "<<#i<<" "<<i<<" <\\debug>"<<endl
#define mfor(i,a,b) for(int i=(a);i<=(b);i++)
#define mrep(i,a,b) for(int i=(a);i>=(b);i--)
#define lll __int128
#define Re register
#define mem(a,b) memset(a,(b),sizeof(a))
#define Design ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl '\n'
typedef pair<int, int> intpair;
typedef pair<long long int, long long int> llpair;
typedef long long int ll;
const int INF = 0x3f3f3f3f;
const long long int INFLL = 0x3f3f3f3f3f3f3f3f;
#pragma comment(linker, "/STACK:1024000000,1024000000") 

const ll mod = 1e9 + 7;

long long fpow(long long a, long long n, long long mod)
{
    if (n == 0)        return 1;
    else if (n & 1) return a * fpow(a, n - 1, mod) % mod;
    else
    {
        long long num = fpow(a, n / 2, mod) % mod;
        return num * num % mod;
    }
}

long long getinv(long long a, long long mod)
{
    return fpow(a, mod - 2, mod);
}

const int maxn = 5010;
ll f[maxn][maxn];

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    f[0][0] = 1;
    mfor(i,0,n)
    {
        mfor(j, 0, i)
        {
            (f[i + 1][j + 1] += f[i][j] << 1) %= mod;
            (f[i + 1][max(j - 1, 0)] += f[i][j]) %= mod;
        }
    }
    cout << f[n][s.length()] * getinv(fpow(2, s.length(), mod), mod) % mod;
}

Measured memory_bytes: 119892
#愚直に2000**3 = (2*10**3)**3=8*10**9となり間に合わない

N,Y = map(int,input().split())
flag = 0
for i in range(N+1):
  if flag == 1:
    break
  else:
    for j in range(N-i+1):
      z = N-i-j
      if z<0:
        z = 0
      if 10000*i+5000*j+1000*z == Y:
        print(i,j,z)
        flag += 1
        break
if flag == 0:
  print(-1,-1,-1)

Measured memory_bytes: 3188
#!/usr/bin/env python3
import sys


def solve(S: str):
    if S == 'ARC':
        print('ABC')
    else:
        print('ARC')
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9044
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <algorithm>

int main() {
  int N;
  std::cin >> N;
  std::vector<long long> A(N + 1, 0);
  std::vector<long long> B(N + 1, 0);
  for (int i = 1; i <= N; ++i) { std::cin >> A[i]; }
  for (int i = 1; i <= N; ++i) { std::cin >> B[i]; }
  for (int i = 0; i + 1 <= N; ++i) { A[i + 1] += A[i]; }
  for (int i = 0; i + 1 <= N; ++i) { B[i + 1] += B[i]; }
  long long ans = 0;
  for (int i = 1; i <= N; ++i) {
    ans = std::max(ans, A[i] + B[N] - B[i - 1]);
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}

int main(){
	int a,b;scanf("%d%d",&a,&b);
	int p=1;
	for(int i=0;i<b;i++)p*=2;
	printf("%d\n",p*(1900*b+100*(a-b)));
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int n;

bool check(vi& s) {
    ll cur = 0;
    vi cnt(8);

    for (int i = 0; i < s.size(); i++) {
        cnt[s[i]]++;
        cur = 10 * cur + s[i];
    }
    bool b = cur <= n;
    b &= cnt[3] && cnt[5] && cnt[7];
    return b;
}

void next(vi& s) {
    for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == 0)
            s[i] = 3;
        else if (s[i] == 3)
            s[i] = 5;
        else if (s[i] == 5)
            s[i] = 7;
        else
            continue;

        for (int j = i + 1; j < s.size(); j++) {
            s[j] = 3;
        }
        break;
    }
}

int main() {
    fastio();

    cin >> n;

    vi s(10, 0);

    int ans = 0;
    while (count(all(s), 7) != s.size()) {
        if (check(s)) ans++;
        next(s);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int N,t[100005],M,p,x,i,j;
	scanf("%d",&N);
	for(i=1; i<=N; i++) {
		scanf("%d",&t[i]);
	}
	scanf("%d",&M);
	for(i=0; i<M; i++) {
		int sum=0;
		scanf("%d %d",&p,&x);
		for(j=1; j<=N; j++) {
			if(j==p) {
				sum+=x;
				continue;
			}
			sum+=t[j];
		}
		printf("%d\n",sum);

	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
main()
{
	int i, n;
	char a[1010];
	scanf("%s", a);
	scanf("%d", &n);
	for (i=0; i<strlen(a); i=i+n)
	{
		printf("%c", a[i]);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
#include <functional>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

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

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

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll LINF = 1001002003004005006ll;
const ll INF = 1001001001;
const double pi = acos(-1);

int main()
{
    ll a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(void)
{
	char s[4];
	int i;
	
	scanf("%s", s);
	
	if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]){
		printf("Bad\n");
	}
	else{
		printf("Good\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=1;i<=n;i++)
#define pb push_back
#define pf push_front
#define mp make_pair
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
vector <pii> con[100005];
ll dis[100005];
bool vis[100005];
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for (int i=1;i<n;i++){
		int a,b,c;
		cin>>a>>b>>c;
		con[a].pb(mp(b,c));
		con[b].pb(mp(a,c));
	}
	int k,q;
	cin>>q>>k;
	dis[k]=0;
	vis[k]=1;
	queue <int> que;
	que.push(k);
	while (!que.empty()){
		int now=que.front();
		ll cost=dis[now];
		que.pop();
		int sz=con[now].size();
		for (int i=0;i<sz;i++){
			int to=con[now][i].first;
			if (vis[to]) continue;
			dis[to]=cost+con[now][i].second;
			que.push(to);
			vis[to]=1;
		}
	}
	for (int i=0;i<q;i++){
		int x,y;
		cin>>x>>y;
		cout<<dis[x]+dis[y]<<endl;
	}
}


Measured memory_bytes: 8820
public static class Program
{
  public static void Main(string[] args)
  {
     string[] input = System.Console.ReadLine().Split(' ');
      int a = int.Parse(input[0] + input[1]);
     int sqrtInt = (int)System.Math.Sqrt(a);
     string answer = (sqrtInt * sqrtInt == a)
       ? "Yes"
       : "No";
     System.Console.WriteLine(answer);
  }
}

Measured memory_bytes: 13140
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <vector>

using namespace std;

#define debug(x) (cout << # x ": " << x << endl)
#define int long long int
#define repeat(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()

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

    int na[200001];
    vector<int> va;
    memset(na, 0, sizeof(int) * 200001);
    repeat(i, n) {
        int a;
        cin >> a;

        ++na[a];
        va.push_back(a);
    }

    int sum = 0;
    repeat(i, n) {
        sum += (na[i + 1] - 1) * na[i + 1] / 2;
    }

    for (auto x: va) {
        int n = na[x];
        cout << sum - n * (n - 1) / 2 + (n - 2) * (n - 1) / 2 << endl;
    }
}

Measured memory_bytes: 6464
import copy
H,W,K = map(int,input().split())
initial = []
for i in range(H):
    initial.append(list(input()))
def count_black(c):
    counter = 0
    for i in range(len(c)):
        for j in range(len(c[0])):
            if c[i][j] == '#':
                counter += 1
    return counter
n = H+W
pattern = []
for i in range(2 ** n):
    tmp = [False] * n
    for j in range(n):
        if i >> j & 1:
            tmp[j] = True
    pattern.append(tmp)
counter = 0
for i in range(len(pattern)):
    c = copy.deepcopy(initial)
    for h in range(H):
        if pattern[i][h]:
            c[h] = ['o' for _ in range(W)]
        for w in range(H,H+W):
            if pattern[i][w]:
                for tmp in range(H):
                    c[tmp][w-H] = 'o'
    if count_black(c) == K:
        counter += 1
print(counter)

Measured memory_bytes: 9752
//9-2-11
#include<stdio.h>
int n,i;
int isprime(int n){
	int i;
	for(i=2;i*i<=n;i++){
		if(n%i==0)	return 0;
	}
	return 1;
}
int main(){
	int p,q;
	while(1){
		scanf("%d",&n);
		if(n==0)	break;
		//??§???????????????????????????0??¨1???????????????????????????
		for(i=n;i>1;i--){
			//????????¨????´???°???
			if(isprime(i)==1 && isprime(i-2)==1){
				p=i-2;	q=i;
				break;
			}
		}
		printf("%d %d\n",p,q);
	}
	return 0;
}

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

int N, M, a, val;
li res = 0;
vector<int> A(100010);
priority_queue<int> pq;

int main(){
    cin >> N >> M;
    
    for(int i = 0; i < N; i++){ cin >> A[i]; pq.push(A[i]); }
    for(int i = 0; i < M; i++){ val = pq.top(); pq.pop(); pq.push(val/2); }
    while(!pq.empty()){ res += pq.top(); pq.pop(); }
    
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  int r;
  int count[9] = {0};
  rep(i,N){
    cin >> r;
    r = min(3200,r);
    count[r/400]++;
  }
  int ansmax=0, ansmin=0;
  for(int i=0;i<8;i++){
    if(count[i]!=0){
      ansmin++;
    }
  }
  ansmax = ansmin + count[8];
  cout << max(1,ansmin) << " " << ansmax << endl;
  return 0;


}


Measured memory_bytes: 256
import java.util.*;

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

    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans = 0;

    if(a > 12){
      ans = b;
    } else if(a > 5){
      ans = b / 2;
    }

    System.out.println(ans);
  }
}


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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N, K;
int dp[2200][2200];
int mod = 1e9 + 7;
signed main() {
    cin >> N >> K;
    for (int i = 1; i <= N + 1; i++) { dp[0][i] = 1; }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N + 1; j++) {
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
        }
    }
    for (int i = 1; i <= K; i++) {
        int b = K - i, r = N - K - i + 1;
        if (b < 0 || r < 0) { cout << 0 << endl; }
        else { cout << (dp[b][i] * dp[r][i + 1]) % mod << endl; }
    }
}


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

using namespace std;

int t;
int N;
int d[110], f[110];
vector<vector<int> > adj(110);
void dfs(int cur){
    d[cur] = t;
    t += 1;
    //cerr << "visiting " << cur << " " << t << endl;
    for(int i = 0; i < adj[cur].size(); ++i){
        int dst = adj[cur][i];
        if(d[dst] == 0){
            dfs(dst);
        }
    }
    f[cur] = t;
    t++;
}

int main(){
    cin >> N;
    t = 1;
    int u, k;
    for(int i = 0; i < N; ++i){
        d[i] = 0;
        f[i] = 0;
    }
    for(int i = 0; i < N; ++i){
        cin >> u >> k;
        for(int j = 0; j < k; j++){
            int v;
            cin >> v;
            adj[u].push_back(v);
        }
        sort(adj[u].begin(), adj[u].end());
    }
    for(int i = 1; i < N+1; ++i){
        if(d[i] == 0) dfs(i);
    }
    
    for(int i = 1; i < N+1; ++i){
        cout << i << " " << d[i] << " " << f[i] << endl;
    }
}

Measured memory_bytes: 3176
#include <iostream>
//#include <numeric>
#include <vector>
//#include <cstdint>
//#include <string>
//#include <cstdlib>
using namespace std;

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

	if (a < 10 && b < 10) {
		cout << a * b;
	}
	else {
		cout << "-1";
	}

	return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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 (b<a) { a=b; return 1; } return 0; }

int check[100100],N,M,l,r,ans;

int main(){
    cin>>N>>M;
    rep(i,100100)check[i]=0;
    rep(i,M){
        cin>>l>>r;
        l--;
        check[l]++;
        check[r]--;
    }
    rep(i,N){
        check[i+1]+=check[i];
        if(check[i]==M)ans++;
    }
    out(ans);
    
}


Measured memory_bytes: 768
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	Dictionary<int, int> cost = new Dictionary<int, int> { [1] = 2, [2] = 5, [3] = 5, [4] = 4, [5] = 5, [6] = 6, [7] = 3, [8] = 7, [9] = 6 };
	void Solve()
	{
		var I = G;
		int N = I[0], M = I[1];
		var A = G;
		Array.Sort(A);
		Array.Reverse(A);
		// dp[n] = (マッチ n 本で作れる整数の桁数の最大値)
		var dp = new int[N + 1];
		for (var n = 1; n <= N; n++) { dp[n] = int.MinValue; foreach (var a in A) if (cost[a] <= n) dp[n] = Max(dp[n], dp[n - cost[a]] + 1); }
		var L = dp[N];
		var s = new int[L];
		for (var i = 0; i < L; i++)
			foreach (var a in A)
				if (N >= cost[a] && L - i == 1 + dp[N - cost[a]])
				{
					s[i] = a;
					N -= cost[a];
					break;
				}
		WriteLine(string.Join("", s));
	}
}


Measured memory_bytes: 13536
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int cnt1=0,cnt2=0,cnt3=0,cnt4=0;
    while(n--)
    {
        string s;
        cin>>s;
        if(s=="AC")
            cnt1++;
        else if(s=="WA")
            cnt2++;
        else if(s=="TLE")
            cnt3++;
        else
            cnt4++;
    }
    cout<<"AC"<<" x "<<cnt1<<endl;
    cout<<"WA"<<" x "<<cnt2<<endl;
    cout<<"TLE"<<" x "<<cnt3<<endl;
    cout<<"RE"<<" x "<<cnt4<<endl;

    return 0;
}


Measured memory_bytes: 3212
#include <stdio.h>

int main( void )
{
int W, H, x, y, r;
scanf( "%d %d %d %d %d", &W, &H, &x, &y, &r );
if ( x - r < 0 || W < x + r || y - r < 0 || H < y + r ) {
printf( "No\n" );
}
else {
printf( "Yes\n" );
}
return 0;
}


Measured memory_bytes: 2688
from collections import defaultdict
import sys
# input = sys.stdin.buffer.readline
def input(): return sys.stdin.readline().rstrip()

class UnionFind():
    """ Union-Find木の実装（ランクあり） """
    def __init__(self, n):
        self.n = n
        self.parent = [-1]*(n+1)    # parent 親 マイナスだったら根で、絶対値が集合の数
        self.rank   = [0]*(n+1)     # rank 深さ

    def root(self, x):
        """ 木の根を求める """
        if self.parent[x] < 0:      # xが根
            return x
        else:
            self.parent[x] = self.root(self.parent[x])  # 経路圧縮
            return self.parent[x]
            
    def unite(self, x, y):
        """ xとyの属する集合を併合 """
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return 0
        elif self.rank[x] > self.rank[y]:
            self.parent[x] += self.parent[y]
            self.parent[y] = x
        else:
            self.parent[y] += self.parent[x]
            self.parent[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def isSame(self, x, y):
        """ xとyが同じ集合に属するか否か """
        return self.root(x) == self.root(y) or x==y
    
    def size(self, x):
        """ xと同じ集合に属する数 """
        return -self.parent[self.root(x)]

N, M, K = map(int, input().split())
# friend = [[0]*N for _ in range(N)]
friend = defaultdict(lambda : 1)
uf = UnionFind(N)
for i in range(M):
    A, B = map(int, input().split())
    friend[A] += 1
    friend[B] += 1
    uf.unite(A, B)

# block = [[0]*N for _ in range(N)]
block = defaultdict(int)
for j in range(K):
    C, D = map(int, input().split())
    if uf.isSame(C, D):
        block[C] += 1
        block[D] += 1

ans = [0] * (N+1)
for i in range(1, N+1):
    ans[i] = uf.size(i) - friend[i] - block[i]
print(*ans[1:])


Measured memory_bytes: 33552
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll x;
	cin >> x;
	if (x < 1200) {
		cout << "ABC" << endl;
	}
	else {
		cout << "ARC" << endl;
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> pll;
const lli mod = 998244353;
const lli inf = 1e18;

int main(){
	int a,b,m;
	cin >> a >> b >> m;
	vector<int> aa(a),bb(b);
	for(int i=0; i<a; i++){
		cin >> aa[i];
	}
	for(int i=0; i<b; i++){
		cin >> bb[i];
	}
	int ans = *min_element(aa.begin(), aa.end()) + *min_element(bb.begin(), bb.end());
	for(int i=0; i<m; i++){
		int x,y,c;
		cin >> x >> y >> c;
		x--; y--;
		ans = min(ans, aa[x]+bb[y]-c);
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
// OURL: https://atcoder.jp/contests/abc116/tasks/abc116_c
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v); }

template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(vector<vector<A>> v) { string res; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res;}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

vector<int> hs;

int solve(int c, int i, int j) {
  // int c = 0;
  debug(i, j);
  int mine = 1000, d=-1;
  RREP(k,i,j) {
    if (hs[k] < mine) {
      mine = hs[k];
      d = k;
    }
  }
  int ret = mine - c;
  if (hs[i] == hs[j-1] && hs[i] == mine) {
    if (j-i>2) {
      ret += solve(mine, i+1, j-1);
    }
    return ret;
  }
  if (d != i) {
    ret += solve(mine, i, d);
  }
  if (d + 1 < j) {
    ret += solve(mine, d+1, j);
  }
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  hs = make_v<int>(n);
  REP(i,n) {
    cin >> hs[i];
  }
  debug(n, hs);
  cout << solve(0, 0, n) << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    ll n,k;
    cin>>n>>k;
    if(n<=k)cout<<"1"<<endl;
    else cout<<"0"<<endl;
    return 0;
}


Measured memory_bytes: 3116
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;

static class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        for (var i = 1; i <= n; i++) Console.WriteLine(f(i));
    }

    static int f(int n) {
        var res = 0;
        for (int x = 1; x < 100; x++) for (int y = 1; y < 100; y++)
        for (int z = 1; z < 100; z++) if (x*x+y*y+z*z+x*y+y*z+z*x == n) res++;
        else if (x*x+y*y+z*z+x*y+y*z+z*x > n) break;
        return res;
    }
}


Measured memory_bytes: 27280
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n,k;cin>>n>>k;
    if((n+1)/2>=k)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 3544
#include <iostream>

using namespace std;

int main() {
	double x1,x2,x3,x4;
	double y1,y2,y3,y4;
	double incAB, incCD;
	int count=0;
	cin>>count;
	for(int i=0; i<count; i++) {
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		incAB = (y2-y1) / (x2-x1);
		incCD = (y4-y3) / (x4-x3);
		if(incAB == incCD) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

using namespace std;

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

    int ans = 0;
    for (int i = 1; i < N; ++i) {
        bool used[2][26];
        fill(used[0], used[1] + 26, false);

        for (int j = 0; j < i; ++j) {
            used[0][S[j] - 'a'] = true;
        }
        for (int j = i; j < N; ++j) {
            used[1][S[j] - 'a'] = true;
        }

        int cnt = 0;
        for (int k = 0; k < 26; ++k) {
            cnt += (used[0][k] && used[1][k]);
        }

        ans = max(ans, cnt);
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    double ab, bc, ca;
    cin >> ab >> bc >> ca;
    cout << (ab * bc / 2) << endl;
}


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

using namespace std;
using ll =long long;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;

const ll oo =0x3f3f3f3f3f3f3f3fLL;
const double eps=1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main(){ cin.sync_with_stdio(0);
    ll N, M, X; cin >> N >> M >> X;
    vl cs(N);
    vvl A(N, vl(M));

    FOR(i, 0, N) {
        cin >> cs[i];
        FOR(j, 0, M) {
            cin >> A[i][j];
        }
    }

    ll res = oo;

    for (ll mask = 0ll; mask < (1 << N); mask ++) { // 4096
        ll cost = 0;
        vl level(M);

        FOR(i, 0, N) {
            if (!(mask & (1 << i))) {
                continue;
            }
            cost += cs[i];
            FOR(j, 0, M) {
                level[j] += A[i][j];
            }
        }

        bool success = true;
        FOR(i, 0, M) {
            if (level[i] < X) {
                success = false;
                break;
            }
        }

        if (success) {
            res = min(res, cost);
        }
    }

    if (res == oo) {
        cout << -1 << endl;
    } else {
        cout << res << endl;
    }
} //cin.tie(0) bei schnellem Wechseln


Measured memory_bytes: 3664
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#define ll long long
#define ull unsigned long long
#define ci const int&
#define cl const long long&
#define cul const unsigned long long&
#define io_f std::ios::sync_with_stdio(false)
using namespace std;

int n,k;

int main() {
    cin >> n >> k;
    if (k % 2) {
        cout << (ll)pow((ll)(n/k),3.0);
    } else {
        ll ans = (ll)pow((ll)((n+k/2)/k),3.0);
        cout << (ll)pow((ll)(n/k),3.0) + ans;
    }
    return 0;
}

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

int main() {
  int a,b,c,d;
  
  cin >> a >> b >> c >> d;
  
 for(int i=0;i<110;i++){
   c -=b;
   
   if(c <= 0){
     cout << "Yes" << endl;
     return 0;
   }
   a -= d;
   
   if(a <= 0){
     cout << "No" << endl;
     return 0;
   }
   
 }
  
}

Measured memory_bytes: 3648
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int i = 1;
        while(x != 0) {
            System.out.println("Case " + Integer.toString(i) + ": " + Integer.toString(x));
            i++;
            x = scanner.nextInt();
        }
    }
}



Measured memory_bytes: 43460
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
#define ff first
#define ss second
#define endl '\n'
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
//#include "debug.cpp"

string s;
int k;

int dp[101][2][4];
int rec(int p,int c,int kk) {
	//cout<<p<<" "<<c<<" "<<kk<<endl;
	
	if(p>s.size() or kk>k)
		return 0;

	if(p==s.size()){
		return (k==kk);
	}

	int &tmp=dp[p][c][kk];
	if(tmp!=-1)
		return tmp;
	tmp=0;
	if(c){
		for(int i=0;i<=s[p]-'0';i++)
			tmp+=rec(p+1,(i==s[p]-'0'),kk+(i>0));
	}
	else{
		for(int i=0;i<=9;i++)
			tmp+=rec(p+1,0,kk+(i>0));
	}
	return tmp;
}


int32_t main()
{
	boost;
  	if(0){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif // ONLINE_JUDGE
    }
	cin>>s;
	cin>>k;
	memset(dp,-1,sizeof dp);
	int ans=rec(0,1,0);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import itertools
import math
n = int(input())
x = [0] * n
y = [0] * n
l = list(range(n))
ans = 0
for i in range(n):
    x[i], y[i] = map(int, input().split())
for v in itertools.permutations(l, 2):
    ans += math.sqrt((x[v[0]] - x[v[1]])**2 + (y[v[0]] - y[v[1]])**2)
print(ans/n)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;

ht dp;

long int solve(long int h){
	if(h == 1)
		return 1;
	if(h == 0)
		return 0;

	if(dp[h])
		return dp[h];

	long int ans = solve(h/2);
	return dp[h] = ans + ans + 1;
}

int main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
   
   	long int h;
   	cin>>h;

   	cout<<solve(h);
   return 0;
}

Measured memory_bytes: 256
n = gets.chomp!.to_i
#inp = [2, 3, 1]
inp = gets.split(" ").map(&:to_i)
hs = {}
for i in 0..n-1 do
  hs[i] = inp[i]
end

#p hs
hs = hs.sort_by{ |_, v| v }
#p hs

for j in 0..n-2 do
  print("#{hs[j][0]+1} ")
end
print("#{hs[n-1][0]+1}\n")

Measured memory_bytes: 24024
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18

ll mod = 1e9+7;
const ll MAX_N = 3000;
/**/

vector<ll> divisor(ll N){ // 約数を求める
	vector<ll> ans;
	REP(i,N+1){
		if (i==0) continue;
		if (i*i>N)break;
		if (N%i==0){
			ans.pb(i);
			if (i!=N/i)ans.pb(N/i);
		}
	}
	sort(ans.begin(), ans.end());
  return ans;
}

int main() {
	// 入力
	ll X;cin>>X;
	
	// 解法
	vector<ll> fac = divisor(X);
	// REP(i,fac.size()) printf("%lld, ", fac[i]);
	// printf("\n");
	
	bool find = false;
	ll A,B;
	REP(i,fac.size()){
		if (find) break;
		REP(j,1e3){
			ll a_tmp = j;
			ll b_tmp = a_tmp - fac[i];
			ll tmp = pow(a_tmp, 5)- pow(b_tmp, 5);
			ll tmp2 = pow(a_tmp, 3)- pow(b_tmp, 3);
			// printf("%lld, %lld, %lld\n", a_tmp, b_tmp, tmp);
			if (tmp==X){
				find = true;
				A = a_tmp;
				B = b_tmp;
			}
			if (find) break;
			// if (B>0 & tmp>X) break;
			// if (B<0 & tmp2<0) break;
			// if (B<0 & tmp2>0) break;
		}
		if (find) break;
	}
	// cout<<find<<endl;
	printf("%lld %lld\n", A, B);
	// bool ans = false;
	// ll B[N];REP(i,N)B[i] = 0; // 配列を作って0で初期化
	// printf("%s\n", S.c_str()); // stringをprint
	// if (true) ans = true;
	// REP(i,N) printf("%lld, %lld\n", i, A[i]);
	// REP(i,N) printf("%lld, ", A[i]);
	// printf("\n");
	// // DP
	// memset(dp, -1, sizeof(dp));
	// REP(i,N) rec(i);
	
	// map<ll, ll> mp; // 連想配列 map<key:数値, value:出現回数の偶奇> 
	// for (ll i = 0; i < N; ++i){
	// 	auto itr = mp.find(A[i]);        // s[i] が設定されているか？
	// 	if(itr != mp.end() ) {
	// 	     mp[A[i]] = (mp[A[i]] + 1) % 2; // ある場合
	// 	}
	// 	else {
	// 	     mp[A[i]] = 1 ;
	// 	}
	// }
	// ll ans = 0;
 
	// //for(auto itr = mp.begin(); itr != mp.end(); ++itr){
	// //    cout << itr->first << " " << itr->second << endl;
	// //}
 
	// for(auto itr = mp.begin(); itr != mp.end(); ++itr) sum += itr->second;
 
	// //出力
	// cout << ans << endl;
	// printf("%lld\n", ans);
	// if (ans) printf("Yes\n");
	// else printf("No\n");
}


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

int main(){
  int n;
  cin>>n;
  int z=0,o=0,t=0;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    if(x%4==0){
    t++;
    }
    else if(x%2==0){
    o++;
    }
    else{
    z++;
    }
  }
  if(z<=t){
    cout<<"Yes"<<endl;
  }
  else if(z-1==t&&o==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256