akhauriyash/Code-Regression huggingface dataset:
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int A,B,C,K;
	scan(A>>B>>C>>K);
	int cnt=0;
	while(B<=A){
		B*=2;
		cnt++;
	}
	while(C<=B){
		C*=2;
		cnt++;
	}
	if(cnt<=K) prin("Yes");
	else prin("No");
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 200
ll d[MAX_V][MAX_V];
int V;
void warshall_floyd() {
	rep(k, 0, V) rep(i, 0, V) rep(j, 0, V) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int M, R;
	cin >> V >> M >> R;
	int r[R];
	rep(i, 0, R) cin >> r[i];
	rep(i, 0, V) rep(j, 0, V) d[i][j] = (i == j) ? 0 : INF;
	rep(i, 0, M) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		d[a][b] = c;
		d[b][a] = c;
	}
	warshall_floyd();

	ll rsl = INF;
	vector<int> arr;
	rep(i, 0, R) arr.push_back(r[i] - 1);
	vsort(arr);
	do {
		ll tmp_v = 0;
		rep(i, 0, R - 1) {
			tmp_v += d[arr[i]][arr[i + 1]];
		}
		rsl = min(rsl, tmp_v);
	} while(next_permutation(arr.begin(), arr.end()));
	cout << rsl << endl;
}


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

template <typename T>
struct Dijkstra {
    struct Edge {
        int to;
        T cost;
    };

    vector<int> prev;
    vector<vector<Edge>> g;

    Dijkstra(int n) : prev(n, -1), g(n) {}

    void add_edge(int u, int v, T w) { g[u].push_back({v, w}); }
    vector<T> build(int s) {
        using Node = pair<T, int>;
        vector<T> dist(g.size(), -1);
        priority_queue<Node, vector<Node>, greater<Node>> pq;
        pq.push({dist[s] = 0, s});
        while (!pq.empty()) {
            T d = pq.top().first;
            int u = pq.top().second;
            pq.pop();
            if (dist[u] < d) continue;
            for (auto&& v : g[u]) {
                if (dist[v.to] < 0 || dist[v.to] > dist[u] + v.cost) {
                    pq.push({dist[v.to] = dist[u] + v.cost, v.to});
                    prev[v.to] = u;
                }
            }
        }
        return dist;
    }
    vector<int> get_path(int t) {
        vector<int> path;
        for (int i = t; i != -1; i = prev[i]) path.push_back(i);
        reverse(begin(path), end(path));
        return path;
    }
};

int main() {
    int n, x, y;
    cin >> n >> x >> y, x--, y--;
    vector<int> ans(n + 1, 0);
    Dijkstra<int> g(n);
    for (int i = 0; i < n - 1; i++) {
        g.add_edge(i, i + 1, 1);
        g.add_edge(i + 1, i, 1);
    }
    g.add_edge(x, y, 1);
    g.add_edge(y, x, 1);
    for (int i = 0; i < n; i++) {
        auto d = g.build(i);
        for (int j = i + 1; j < n; j++) {
            ans[d[j]]++;
        }
    }
    for (int k = 1; k < n; k++) {
        cout << ans[k] << endl;
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const int mod = 1e5;
const int MAX = 1e7;

int main() {
    double r; cin >> r;
    double ans = 2 * r * 3.1415926535897;
    printf("%.10f\n",ans);
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
lli mod = 1e9 + 7;
lli memo[300005] = {};
set<int> v[300005] = {};

int main() {
  int n;
  cin >> n;
  vector<int> c(n);
  rep(i, n) cin >> c[i];
  rep(i, n) v[c[i]].insert(i);
  memo[n - 1] = 1;
  rrep(i, n - 1) {
    memo[i] = memo[i + 1];
    auto s = v[c[i]].find(i);
    s++;
    if (s != v[c[i]].end() && *s != i + 1) {
      memo[i] = (memo[*s] + memo[i]) % mod;
    }
  }
  cout << memo[0] << endl;
}


Measured memory_bytes: 26752
#include<stdio.h>
int main(void){
  long long int a,b;
  scanf("%lld %lld",&a,&b);
  for(int loop=1;loop<=b;loop++){
    if((a*loop)%b==0){
      printf("%lld",a*loop);
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 128
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    flag = True
    for a in A:
        if a % 2 != 0:
            continue
        else:
            if a % 3 != 0 and a % 5 != 0:
                flag = False
    if flag:
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == '__main__':
    main()

Measured memory_bytes: 9148
package main

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

type process struct {
	name    string
	remains int
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	q, err := nextInt(sc)
	if err != nil {
		panic(err)
	}
	processes := make([]process, n)
	for i, _ := range processes {
		name := nextStr(sc)
		remain, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		processes[i] = process{name, remain}
	}
	handle(processes, q)
}

func handle(processes []process, q int) {
	time := 0
	for len(processes) > 0 {
		process := &processes[0]
		if process.remains <= q {
			time += process.remains
			fmt.Printf("%s %d\n", process.name, time)
			processes = processes[1:]
		} else {
			process.remains = process.remains - q
			time += q
			processes = append(processes[1:], *process)
		}
	}
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

func nextStr(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 6640
//template
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

//repetition-----------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl
#define CIN(x) cin>>(x)

int main(){

	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){

		//A点を原点に移動
		x2 -= x1; y2 -= y1;
		x3 -= x1; y3 -= y1;
		xp -= x1; yp -= y1;

		double k1, k2;
		if (x2 != 0){
			k2 = (yp - (xp / x2)*y2) / (y3 - (x3 / x2)*y2);
			k1 = (xp - k2*x3) / x2;
		}
		else{
			k1 = (xp - (yp / y2)*x2) / (x3 - (y3 / y2)*x2);
			k2 = (yp - k1*y3) / y2;
		}

		if ((k1 > 0) && (k2 > 0) && (k1 + k2 < 1)) COUT("YES");
		else COUT("NO");
	}

	return 0;

}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a) {if(a){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
void YESNO(int a) {if(a){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}}
void AorB(int a,string b,string c) {if(a){cout<<b<<endl;}else{cout<<c<<endl;}}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int Scount=0,ans=0;
    string s;
    cin>>s;
    REP(i,0,s.size()){
        if(s[i]=='S') Scount++;
        else{
            if(Scount==0) ans++;
            else Scount--;
        }
    }
    cout<<ans+Scount<<endl;
    return 0;
}


Measured memory_bytes: 720
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = input()

    R = 0
    G = 0
    B = 0

    for s in S:
        if s == 'R':
            R += 1
            continue
        elif s == 'G':
            G += 1
            continue
        elif s == 'B':
            B += 1
    

    total = 0

    for i in range(N-2):
        for j in range(i+1, N-1):
            if 2*j-i >= N:
                break
            if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]:
                total += 1

    print(R*G*B - total)


if __name__ == '__main__':
    main()

Measured memory_bytes: 68416
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
int main(){
    ll N;
    cin >> N;
    ll ans = 1;
    for(int i = 1; i <= N; i++){
        ans *= i;
        if(ans > 1000000007){
            ans = ans % 1000000007;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>

int main() {
  intmax_t t1, t2, a1, a2, b1, b2;
  scanf("%jd %jd %jd %jd %jd %jd", &t1, &t2, &a1, &a2, &b1, &b2);

  if (t1*a1 + t2*a2 == t1*b1 + t2*b2)
    return puts("infinity"), 0;

  if (a1 < b1 || (a1 == b1 && t1*a1 + t2*a2 > t1*b1 + t2*b2)) {
    std::swap(a1, b1);
    std::swap(a2, b2);
  }

  // a1 >= b1
  if (t1*a1 + t2*a2 > t1*b1 + t2*b2)
    return puts("0"), 0;

  intmax_t d = - (t1*a1 + t2*a2) + (t1*b1 + t2*b2);
  intmax_t u = t1*b1 + t2*b2;

  auto f = [&](intmax_t i) -> bool {
             return t1*a1 >= t1*b1 + d*i;
           };

  auto fs = [&](intmax_t i) -> bool {
              return t1*a1 > t1*b1 + d*i;
            };

  intmax_t lb = 0;
  intmax_t ub = (u+d-1)/d + 10;
  while (ub-lb > 1) {
    intmax_t mid = (lb+ub) >> 1;
    (f(mid)? lb: ub) = mid;
  }
  intmax_t res = 2*lb;
  if (fs(lb)) ++res;
  printf("%jd\n", res);
}


Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli x;
    lli y;
    cin>>x>>y;
    lli ans=0;
    lli pre=400000-x*100000;
    if(pre>0){ 
        ans+=pre;
    }
    pre=400000-y*100000;
    if(pre>0){ 
        ans+=pre;
    }
    if(y==1&&x==1){ 
        ans+=400000;
    }
    out(ans);


}

Measured memory_bytes: 3616
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>

using namespace std;

/**
 * amazingly fast input
 * NOTE: fread_unlocked does not work on macOS.
 */
const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
  if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
  return *ci++;
}
inline int getint() {
  int A = 0;
  if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
  else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
  return A;
}
inline void flus() {
  while (getcha() != ' ');
}

struct Node;
struct Color {
  int n;
};

using NodePtr = shared_ptr<Node>;
using ColorPtr = shared_ptr<Color>;

struct Node {
  int id;
  ColorPtr color = nullptr;
  vector<NodePtr> followings;
  vector<NodePtr> blockings;

  int get_n_candidates () {
    int n_followings = 0;
    for (auto x : followings) {
      if (color == x->color) n_followings++;
    }

    int n_blockings = 0;
    for (auto x : blockings) {
      if (color == x->color) n_blockings++;
    }

    return color->n - n_followings - n_blockings - 1;
  }
};

void dfs (NodePtr node0, ColorPtr color) {
  stack<NodePtr> S;
  S.push(node0);

  while (!S.empty()) {
    NodePtr node = S.top(); S.pop();

    if (!node->color) {
      node->color = color;
      color->n++;
    }

    for (auto x : node->followings) {
      if (!x->color) S.push(x);
    }
  }
}

void assign_color (vector<NodePtr> nodes) {
  for (auto node : nodes) {
    if (node->color) continue;

    ColorPtr color = make_shared<Color>();
    dfs(node, color);
  }
}

/**
 * main
 */
int main () {
  int N = getint();
  int M = getint();
  int K = getint();

  vector<NodePtr> nodes(N);

  for (size_t i = 0; i < N; i++) {
    nodes[i] = make_shared<Node>();
    nodes[i]->id = i;
  }

  for (size_t i = 0; i < M; i++) {
    int A = getint();
    int B = getint();

    nodes[A-1]->followings.push_back(nodes[B-1]);
    nodes[B-1]->followings.push_back(nodes[A-1]);
  }

  for (size_t i = 0; i < K; i++) {
    int A = getint();
    int B = getint();

    nodes[A-1]->blockings.push_back(nodes[B-1]);
    nodes[B-1]->blockings.push_back(nodes[A-1]);
  }

  assign_color(nodes);

  for (size_t i = 0; i < N; i++) {
    printf("%d%c", nodes[i]->get_n_candidates(), (i == N - 1) ? '\n' : ' ');
  }
}


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

#define LL long long
#define RG register

using namespace std;
template<class T> T gi() {
	T x = 0; bool f = 0; char c = getchar();
	while (c != '-' && (c < '0' || c > '9')) c = getchar();
	if (c == '-') f = 1, c = getchar();
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f ? -x : x;
}
const int N = 5010;
struct node { int to, nxt; } g[N << 1];
int lst[N], gl, n, f[N], a[N];
void add(int x, int y) {
	g[++gl] = (node) {y, lst[x]}; lst[x] = gl;
	g[++gl] = (node) {x, lst[y]}; lst[y] = gl;
}
void dfs(int u, int ff) {
	f[u] = 0;
	for (int i = lst[u]; i; i = g[i].nxt) {
		int v = g[i].to; if (v == ff || a[v] >= a[u]) continue;
		dfs(v, u); if (!f[v]) { f[u] = 1; break; }
	}
	return ;
}
int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	n = gi<int>();
	for (int i = 1; i <= n; i++) a[i] = gi<int>();
	for (int i = 1; i < n; i++) add(gi<int>(), gi<int>());
	for (int i = 1; i <= n; i++) {
		dfs(i, 0);
		if (f[i]) printf("%d ", i);
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;

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

	ll d, t, s;
	cin >> d >> t >> s;
	cout << ((d <= t * s) ? "Yes\n" : "No\n");

	return 0;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<long double>A(N);
	long double ave = 0;
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
		ave += A.at(i);
	}
	ave /= N;
	int ans = 0;
	long double s = 99999;
	for (int i = 0; i < N; i++) {
		if (abs(A.at(i) - ave) < s) {
			ans = i;
			s = abs(A.at(i) - ave);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	ll W = fetch<ll>();
	ll H = fetch<ll>();

	if(H % 3 == 0 || W % 3 == 0) {
		cout << "0\n";
		return;
	}

	ll answ = min(H, W);

	for(int t = 0; t < 2; ++t) {
		for(ll i = 0; i <= H; ++i) {
			ll a = i * W;
			ll b = (H - i) * (W / 2);
			ll c = (H - i) * ((W + 1) / 2);

			ll gap = max({a, b, c}) - min({a, b, c});
			answ = min(answ, gap);
		}

		swap(H, W);
	}

	cout << answ << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
#define MAXX 500005
#define INF INT_MAX

#define PI   3.14159265358979323846264338327950
 
#define PB push_back 
#define PF push_front
#define F first
#define S second
 
#define fixx(n) fixed << setprecision(n) 
 
#define ll 	 long long 
 
#define mod  1000000007



int main()
{
	FAST;
	int n, m;
	cin >> n >> m;
	
	for(int i = 0; i <= m/10000; i ++){
		for(int j = 0; j <= (m - i*10000)/5000; j ++){
			int k = m- i*10000 - j*5000;
			k /= 1000;
				if(i + j + k == n && (i*10000 + j*5000 + k*1000) == m){
					cout << i << " " << j << " " << k;
					return 0;
				}
			
		}
	}
	cout << "-1 -1 -1";
	return 0;
}

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

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(X: int):
    if X in [7,5,3]:
        print(YES)
    else:
        print(NO)

    return


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

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
  int a,b,c;cin>>a>>b>>c;
  if(a>=b&&b>=c)cout<<c+b;
  else if(a>=c&&c>=b)cout<<b+c;
  else if(b>=c&&c>=a)cout<<a+c;
  else if(b>=a&&a>=c)cout<<a+c;
  else if(c>=a&&a>=b)cout<<a+b;
  else cout<<a+b;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
#define foreach(c,itr) for(__typeof(c)::iterator itr=c.begin();itr!=c.end();itr++)
typedef long long ll;
typedef long double ld;
const ll mod=1000000007;
int i,j;

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

    int n;
    cin>>n;
    ll ten=1,nine=1,eight=1;
    rep(i,n){
    	ten=ten*10%mod;
    	nine=nine*9%mod;
    	eight=eight*8%mod;
	}
	ten%=mod; nine%=mod; eight%=mod;
	ll ans=ten-nine*2%mod+eight;
	if(ans<0)ans+=mod;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3588
def main():
  n, m = map(int, input().split())
  data = list(map(int, input().split()))

  sum_v = sum(data)

  count = 0
  for d in data:
    if sum_v / ( 4 * m ) <= d:
      count += 1
    else:
      pass
  
  if count >= m:
    print("Yes")
  else:
    print("No")

if __name__ == "__main__":
  main()

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

int main() {
  
  string S;
  
  cin >> S;
  
  if(S == "SUN") {
    
    cout << "7" << endl;
    
  } else if(S == "MON") {
    
    cout << "6" << endl;
    
  } else if(S == "TUE") {
    
    cout << "5" << endl;
    
  } else if(S == "WED") {
    
    cout << "4" << endl;
    
  } else if(S == "THU") {
    
    cout << "3" << endl;
    
  } else if(S == "FRI") {
    
    cout << "2" << endl;
    
  } else if(S == "SAT") {
    
    cout << "1" << endl;
    
  }
  
  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = j;i<k;i++)
int N;
int A[10];
bool DFS(int Aindex,int x,int y){
  if(Aindex ==10)return true;
  if(x>A[Aindex] && y>A[Aindex])return false;
  bool m=false;
  if(x<A[Aindex])m=max(m,DFS(Aindex+1,A[Aindex],y));
  if(y<A[Aindex])m=max(m,DFS(Aindex+1,x,A[Aindex]));
  return m;
}
int main(){
  cin >> N;
  string ans[2]={"NO","YES"};
  rep(i,0,N){
    rep(i,0,10){
      cin >>A[i];
    }
    cout << ans[DFS(0,0,0)]<<endl;
  }
  return 0;
}



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

using namespace std;

int main()
{
  int n,i;
  unsigned long long s = 0;
  cin >> n;

  for(i=1;i<=n;i++){
    if(!(i%3==0) && !(i%5==0)) s += (unsigned long long)i;
  }

  cout << s;

  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack> 
#include <bitset>
#include <queue>
#include <assert.h>
#include <unordered_map>
using namespace std;

int main()
{
	long long n;
	cin >> n;
	long long ans = 0;
	for (long long i = 2; i * i <= n; i++) {
		if (n % i) continue;
		int cnt = 0;
		while (n % i == 0) n /= i, cnt++;
		for (int j = 1; j <= cnt; j++) {
			cnt -= j;
			ans++;
		}
	}

	if (n > 1) ans++;
	cout << ans << endl;
	return 0;
}


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

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

int main() {
  int n, m;
  cin >> n >> m;
  map<ll, int> xm, ym;
  vector<ll> a(n), b(n), c(n), d(m), e(m), f(m);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i];
    xm.insert({a[i], 0});
    xm.insert({b[i], 0});
    ym.insert({c[i], 0});
  }
  for (int i = 0; i < m; i++) {
    cin >> d[i] >> e[i] >> f[i];
    xm.insert({d[i], 0});
    ym.insert({e[i], 0});
    ym.insert({f[i], 0});
  }

  int h = 2 * ym.size() + 1;
  int w = 2 * xm.size() + 1;
  vector<ll> xv(w, -1e9), yv(h, -1e9);
  {
    int i = 1;
    for (auto& e : xm) {
      xv[i] = xv[i + 1] = e.first;
      e.second = i;
      i += 2;
    }
  }
  {
    int i = 1;
    for (auto& e : ym) {
      yv[i] = yv[i + 1] = e.first;
      e.second = i;
      i += 2;
    }
  }

  vector<vector<bool>> v(h, vector<bool>(w));
  for (int i = 0; i < n; i++) {
    int y = ym[c[i]];
    for (int x = xm[a[i]], t = xm[b[i]]; x <= t; x++) v[y][x] = true;
  }
  for (int i = 0; i < m; i++) {
    int x = xm[d[i]];
    for (int y = ym[e[i]], t = ym[f[i]]; y <= t; y++) v[y][x] = true;
  }

  vector<vector<ll>> s(h, vector<ll>(w));
  for (int i = 2; i + 1 < h; i += 2) {
    for (int j = 2; j + 1 < w; j += 2) {
      s[i][j] = (yv[i + 1] - yv[i - 1]) * (xv[j + 1] - xv[j - 1]);
    }
  }

  int sy = lower_bound(yv.begin(), yv.end(), 0) - yv.begin() - 1;
  int sx = lower_bound(xv.begin(), xv.end(), 0) - xv.begin() - 1;

  // cerr << sy << ' ' << sx << endl;
  // for (int i = 0; i < h; i++) {
  //   for (int j = 0; j < w; j++) {
  //     if (i % 2 == 0 && j % 2 == 0) {
  //       cout << s[i][j];
  //     } else {
  //       cout << ".#"[v[i][j]];
  //     }
  //   }
  //   cout << endl;
  // }

  ll r = s[sy][sx];
  bool inf = false;
  vector<vector<bool>> visited(h, vector<bool>(w));
  visited[sy][sx] = true;
  queue<pair<int, int>> q;
  q.push({sy, sx});
  while (!q.empty()) {
    auto [y, x] = q.front();
    q.pop();
    for (int i = 0; i < 4; i++) {
      int y2 = y + dy[i], x2 = x + dx[i];
      if (unsigned(y2) >= h || unsigned(x2) >= w) {
        inf = true;
        continue;
      }
      if (v[y2][x2]) continue;
      if (visited[y2][x2]) continue;
      visited[y2][x2] = true;
      q.push({y2, x2});
      r += s[y2][x2];
    }
  }

  if (inf) {
    cout << "INF" << endl;
  } else {
    cout << r << endl;
  }
}


Measured memory_bytes: 294724
#include<iostream>
using namespace std;
const int MAXN=100005;
int n,m,cnt;
int f[MAXN];
int find (int x)
{
	if(f[x]==x)
		return x;
	else
		return f[x]=find(f[x]);
}
int main()
{
	cin>>n>>m;
	cnt=n;
	for(int i=1;i<=n;i++)
	{
		f[i]=i;
	}
	for(int i=1;i<=m;i++)
	{
		int x,y,z;
		cin>>x>>y>>z;
		int fx=find(x);
		int fy=find(y);
		if(fx!=fy)
		{
			f[fx]=fy;
			cnt--;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; }
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;


typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;


struct UnionFind {
    vector<ll> Parent;

    UnionFind(int N){
        Parent = vector<ll>(N,-1);
    }

    ll root(int A){
        if (Parent[A]<0) return A;
        return Parent[A] = root(Parent[A]);
    }

    ll size(int A){
        return -Parent[root(A)];
    }

    bool connect(int A, int B){
        A = root(A);
        B = root(B);
        if (A == B) return false;

        if(size(A) < size(B)) swap(A,B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

    ll N, M;
    cin >> N >> M;

    vi a(M),b(M);
    REP(i,M) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    vector<ll> ans(M);
    ans[M-1] = (ll)N*(N-1)/2;

    UnionFind uf(N);

    for (int i= M-1; i>=1; i--){
        ans[i-1] = ans[i];
        if (uf.root(a[i]) != uf.root(b[i])) {
            ans[i-1] -= uf.size(a[i])*uf.size(b[i]);
            uf.connect(a[i],b[i]);
        } else {

        }
    }

    REP(i,M) cout << ans[i] << endl;

    return 0;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)((x).size()))

typedef long long ll;

const ll mod = 1000000007;
const double pi = 3.1415926535897932384626;

ll powmod(ll a, ll b) {ll res = 1; ll rem = a % mod; for (; b; b >>= 1) {if (b & 1) res = (res * rem) % mod; rem = (rem * rem) % mod;} return res;}

int main()
{	
#ifdef hannibal_08
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif
    
	ll n = 0ll;
	scanf("%lld", &n);

	ll a = -1ll;
	ll b = 2ll;
	ll c = 0ll;
	ll ret = 0ll;

	for (int i = 1; i <= n; ++i) {
		c = a + b;
		ret = c;
		c = b;
		b = ret;
		a = c;
	}

	printf("%lld\n", ret);

	return 0;
}


Measured memory_bytes: 256
// May this submission get accepted
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// 標準入出力
struct inp {
    size_t sz;
    inp(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
inp inp1; // input one
template <typename T> void say(T &x, char end = '\n') { cout << x << end; }
template <typename T> void say(vector<T> &x, char sep = ' ', char end = '\n') { for (size_t i = 0, sz = x.size(); i < sz; i++) { cout << x[i] << (i == sz-1 ? end : sep); } }

// モジュール


// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    ll a = inp1;
    ll b = inp1;

    string s(a, '0'+b), t(b, '0'+a);

    cout << (s < t ? s : t) << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
ll mod= 1e9 + 7;



int main() {
  int p,q,r;
  cin >> p >>q >> r;
  cout << min({p+q,q+r,r+p}) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

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

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)cin >> a[i];
    sort(ALL(a), greater<ll>());

    ll ans = a[0];
    ll base = 1;
    rep(i, n-2){
        ans += a[base];
        if(i&1)base++;
    }

    cout << ans << endl;

}

Measured memory_bytes: 4836
#include<stdio.h>

#define S 101
int graph[S][S];
int d[S];
int queue[S];
int n;

void init(){
	int i, j;
	int u, k, v;
	scanf("%d", &n);
	for( i = 1; i <= n; i++ ){
		d[i] = -1;
		for( j = 1; j <= n; j++ ){
			graph[i][j] = 0;
		}
	}
	for( i = 1; i <= n; i++ ){
		scanf("%d", &u);
		scanf("%d", &k);
		for( j = 0; j < k; j++ ){
			scanf("%d", &v);
			graph[i][v] = 1;
		}
	}
	return;
}

void printGraph(){
	int i, j;
	for( i = 1; i <= n; i++ ){
		for( j = 1; j < n; j++ ){
			printf("%d ", graph[i][j]);
		}
		printf("%d\n", graph[i][n]);
	}
	return;
}

int bfs(int s){
	int i,j;
	int qs=0, qe=0;
	queue[qe++] = s;
	d[s] = 0;
	while( qs < qe ){
		i = queue[qs++];
		for( j = 1; j <= n; j++ ){
			if( graph[i][j] == 1 && d[j] == -1 ){
				queue[qe++] = j;
				d[j] = d[i]+1;
			}
		}
	}
	return 0;
}

void print(){
	int i;
	for( i = 1; i <= n; i++ ){
		printf("%d %d\n", i, d[i]);
	}
	return;
}

int main(){
	int i;
	init();
	bfs(1);
	print();
	return 0;
}

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

int main()
{
  int a, b, c, d;
  int left, right;
  
  cin >> a >> b >> c >> d;
  
  left = a + b;
  right = c + d;
  
  if (left > right)
  {
    cout << "Left" << endl;
  }
  else if (left == right)
  {
    cout << "Balanced" << endl;
  }
  else
  {
    cout << "Right" << endl;
  }
}


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

int main(){
    int n,sum=0;
    long a[10000]={0};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }

    for(int i=0;i<n;i++){
        int count=0;
        if(a[i]==2) sum++;
        else{
            if(a[i]%2==0){
                count++;
                goto exit;
            }
            for(int j=3;j*j<=a[i];j=j+2){
                if(a[i]%j==0){
                    count++;
                    break;
                }
            }
            exit:
            ;
            if(count==0)    sum++;        
        }
    }

    cout<<sum<<'\n';

}


Measured memory_bytes: 3160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <stdio.h>
using namespace std;
int main() {
    int n;
    string Ya, Ha;
    int Yscore = 0, Hscore = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> Ya >> Ha;
        if(Ya > Ha) {
            Yscore += 3;
        }else if(Ya < Ha){
            Hscore += 3;
        }else if(Ya == Ha){
            Yscore++;
            Hscore++;
        }
    }
    cout << Yscore << " " << Hscore << endl; 
    return 0;
}


Measured memory_bytes: 3204
import sys
sys.setrecursionlimit(500000)

def allblue(H, W, C):
    for h in range(H):
        for w in range(W):
            if C[h][w] == 1:
                return (h, w)
    return (-1, -1)

directions = [(0, 1), (0, -1), (1, 1), (1, 0), (1, -1), (-1, -1), (-1, 0), (-1, 1)]
def dfs(h, w, C):
    C[h][w] = 0
    for dh, dw in directions:
        if 0 <= h+dh < H and 0 <= w+dw < W and C[h+dh][w+dw] == 1:
            dfs(h+dh, w+dw, C)

while True:
    W, H = map(int, input().split())
    if W == 0 and H == 0:
        exit()
    C = [list(map(int, input().split())) for i in range(H)]

    ans = 0
    while True:
        h, w = allblue(H, W, C)
        if (h, w) == (-1, -1):
            break
        dfs(h, w, C)
        ans += 1

    print(ans)



Measured memory_bytes: 7952
<?php

while ($stdin = fgets(STDIN)) {
    $line[] = trim($stdin);
}
foreach ($line as $key => $value) {
    $data[] = explode(' ', $value);
}

foreach ($data as &$line) {
    $line = array_map(function($val) { return (int)$val; }, $line);
}


$A = $data[0][0];
$B = $data[0][1];
$C = $data[0][2];

$arr = [$A, $B, $C];

sort($arr);

$is = $arr[0] === 5 && $arr[1] === 5 && $arr[2] === 7;
$ans = $is ? 'YES' : 'NO';

printf('%s', $ans);


Measured memory_bytes: 4728
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

bool isprime(int n) { //?´???°????????°true
    for(int i=2; i*i <= n; i++) {
        if(n%i==0) return false;
    }
    return n != 1;
}

vector<ll> OutDivisor(ll n) {
    vector<ll> ret;
    for(ll i=1; i<=sqrt(n); i++) {
        if(n % i == 0) {
            ret.pb(i);
            if(i!=sqrt(n)) ret.pb(n / i);
        }
    }
    return ret;
}

vector<int> solve(int n) {
    vector<int> ans;
    vector<ll> v = OutDivisor(n);
    rep(i,0,v.size()) {
        if(v[i] % 7 != 1 && v[i] % 7 != 6) continue;
        bool ok = true;
        vector<ll> t = OutDivisor(v[i]);
        rep(j,0,t.size()) {
            if(t[j] == 1 || t[j] == v[i]) continue;
            if(t[j] % 7 == 1 || t[j] % 7 == 6) ok = false;
        }
        if(ok && v[i] != 1) ans.pb(v[i]);
    }
    sort(ans.begin(), ans.end());
    return ans;
}

signed main() {
    int n;
    while(cin >> n, n != 1) {
        vector<int> ans = solve(n);
        printf("%lld:", n);
        rep(i,0,ans.size()) {
            printf(" %lld", ans[i]);
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3116
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
	int n,k,ans=1;
	scanf ("%d%d",&n,&k);
	while (n--) {
	    ans+=min(ans,k);
	}
	printf ("%d\n",ans);
	return 0;
}

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

#define MOD 1000000007

typedef long long lli;

lli dp[1001][1001];
lli n, a, b, c, d;
lli fac[1001], inv[1001];

lli pw(lli n, lli x) {
	if(x==0) return 1;
	if(x%2) return n*pw(n,x-1)%MOD;
	else { lli ret=pw(n,x/2); return ret*ret%MOD; }
}

lli f(lli pre, lli n) {
	if(n==0) return 1;
	if((pre+1)*c>n || pre+1>b) return 0;
	if(dp[pre][n]>=0) return dp[pre][n];
	lli res=f(pre+1,n);
	for(lli i=c;i<=d;i++) {
		if((pre+1LL)*i>n) break;
		res+=(f(pre+1,n-(pre+1LL)*i)*pw(inv[pre+1],i)%MOD)*inv[i]%MOD;
		res%=MOD;
	}
	return dp[pre][n]=res;
}

int main() {
	scanf("%lld %lld %lld %lld %lld",&n,&a,&b,&c,&d);
	memset(dp,-1,sizeof(dp));
	fac[0]=inv[0]=1;
	for(lli i=1;i<=1000;i++) {
		fac[i]=fac[i-1]*i%MOD;
		inv[i]=pw(fac[i],MOD-2);
	}
	lli res=f(a-1,n)*fac[n]%MOD;
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 8064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int m = scan.nextInt();
		if( n == m) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}
		
		
	}

}


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

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; }

using ll = long long;
using P = pair<int,int>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

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

int main() {
    int H,W,K;
    cin>>H>>W>>K;
    vector<string> s(H);
    rep(i,H) cin>>s[i];
    vector<int> l(H);
    rep(i,H){
        for(auto x:s[i]){
            if(x == '#') l[i]++;
        }
    }
    vector<vector<int>> ans(H,vector<int>(W));
    int cnt = 0;
    rep(i,H){
        if(l[i]!=0){
                if(s[i][0]=='#') ans[i][0]=1;
                for(int j = 1; j < W; j++){
                    if(s[i][j]=='.') ans[i][j] = ans[i][j-1];
                    else ans[i][j] = ans[i][j-1]+1;
                }
                rep(j,W){
                    if(ans[i][j]==1)ans[i][j]=0;
                    if(ans[i][j]>1) ans[i][j]--;
                }
                rep(j,W){
                    ans[i][j] += cnt+1;
                }
                cnt+=l[i];
        }
    }
    int p = 0;
    rep(i,H){
        p += l[i];
        if(l[i]==0){
            if(p!=0) ans[i]=ans[i-1];
        }
    }
    p = 0;
    for(int i = H-1; i>=0; i--){
        p += l[i];
        if(l[i]==0){
            if(p!=0) ans[i]=ans[i+1];
        }
    }
    rep(i,H){
        rep(j,W) cout<<ans[i][j]<<" ";
        cout<<endl;
    }
}

Measured memory_bytes: 4132
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
#define mp make_pair
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
    ll N;
    cin >> N;
    vl T(N),A(N);
    rep(i,N){
        cin >> T[i];
    }
    rep(i,N){
        cin >> A[i];
    }
    vl MXT(N),MNT(N),MXA(N),MNA(N);
    rep(i,N){
        if(i==0){
            MXT[i]=MNT[i]=T[i];
        }
        else{
            if(T[i]<T[i-1]){
                cout << 0 << endl;
                return 0;
            }
            else if(T[i]>T[i-1]){
                MXT[i]=MNT[i]=T[i];
            }
            else{
                MXT[i]=T[i];
                MNT[i]=1;
            }
        }
    }
    per(i,N-1){
        if(i==N-1){
            MXA[i]=MNA[i]=A[i];
        }
        else{
            if(A[i]<A[i+1]){
                cout << 0 << endl;
                return 0;
            }
            else if(A[i]>A[i+1]){
                MXA[i]=MNA[i]=A[i];
            }
            else{
                MXA[i]=A[i];
                MNA[i]=1;
            }
        }
    }
    ll ans=1;
    rep(i,N){
        ans*=max((ll)0,min(MXA[i],MXT[i])-max(MNA[i],MNT[i])+1);
        ans%=MOD;
    }
    cout << ans << endl;
}


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




typedef long long ll;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
int N;
ll A[101010];
//-----------------------------------------------------------------
ll ans[101010];
map<int, ll> cnt, _cnt;
map<int, int> idx;
vector<int> v;
void sol() {
	rep(i, 0, N) _cnt[A[i]]++;
	ll c = 0;
	for (auto i = _cnt.rbegin(); i != _cnt.rend(); ++i) {
		c += i->second;
		cnt[i->first] = c;
	}
	rrep(i, N - 1, 0) idx[A[i]] = i;
	for (auto p : cnt) v.push_back(p.first);
	sort(v.begin(), v.end(), greater<int>());

	ll allsm = 0;
	rep(i, 0, N) allsm += A[i];

	int j = 101010;
	ll all = 0;
	rep(i, 0, v.size() - 1) {
		ll d = v[i] - v[i + 1];

		j = min(j, idx[v[i]]);
		if (j == 0) {
			ans[0] = allsm - all;
			return;
		}
		ans[j] += d * cnt[v[i]];
		all += d * cnt[v[i]];
	}

	ans[0] = allsm - all;
}
//-----------------------------------------------------------------
int main() {
	cin >> N;
	rep(i, 0, N) scanf("%lld", &A[i]);
	sol();
	rep(i, 0, N) printf("%lld\n", ans[i]);
}

Measured memory_bytes: 20728
import scala.io.StdIn._


object Main {
  def main(args: Array[String]): Unit = {
    val n = readLine.toInt
    println(f"${solve(n)}")
  }


  def solve(n: Int): Long= {
    var ans = 0
    while(ans * ans <= n){
      ans += 1
    }
    (ans-1) * (ans-1)
  }
}


Measured memory_bytes: 25408
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
#define all(v) v.begin(), v.end()
#define rall(x) (x).rbegin(), (x).rend()
#define pll pair<long long, long long>
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define vc vector<char>
#define vvc vector<vc>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
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;}
//snippets:tmp,cl,cvl,cs,co,coy,con,cov,setp

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  if(s[s.size()-1]=='s') cout << s+"es" << endl;
  else cout << s+"s" << endl;
}


Measured memory_bytes: 3664
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
const ll mod = 1e9 + 7 ;
const ll inf =
 1e9 + 5 ;
 //1e18L + 5;
void min_self(ll&a , ll b){a=min(a,b);}
void max_self(ll&a , ll b){a=max(a,b);}
void add_self(ll& a , ll b){a =  (a + b)%mod;}
//#define (x)  get<0>(x) 
//#define (x)  get<1>(x)
//#define (x)  get<2>(x)
const ll nax = 1e5 + 5 ;
vector<bool>visited(nax) ; 
vector<ll>memo(nax,-1);
vector<ll> v[nax];
ll ans =  0;
ll dfs(ll x ){
	// cout<<x<<endl;
	if(memo[x]!=-1)return memo[x];
	assert(!visited[x]);
visited[x] = true;
ll res = 0 ;
for(auto child : v[x]){
	max_self(res , dfs(child));
}
if(v[x].empty())return memo[x] = 0;
max_self(ans,res+1);
return memo[x] = res + 1;



}


signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
ll n , m ; cin>>n>>m ;
for(ll i = 0 ; i< m  ; i++){
	ll AAA , BBB;
	cin>>AAA>>BBB;
	// AAA--;BBB--;
	v[AAA].push_back(BBB);
	// v[BBB].push_back(AAA);
}

for(auto i = 1 ; i <= n ; i++){
	if(!visited[i])dfs(i);
}

cout<<ans;



	
}

Measured memory_bytes: 9984