akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>

using namespace std;

int main()
{
    int A, B, C, D;
    if (scanf("%d%d%d%d", &A, &B, &C, &D) < 4) return 0;

    printf("%s\n", A + B < C + D ? "Right" : C + D < A + B ? "Left" : "Balanced");
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int A,B,C,ans;
  scanf("%d",&A);
  scanf("%d",&B);
  scanf("%d",&C);
  ans = A-B;
  if(ans < C){
    printf("%d\n",C-ans);
  }else{
    printf("%d\n",0);
  }
  return 0;
}
  

Measured memory_bytes: 128
n     = gets.to_i # 山の数（奇数)
rains = gets.split.map(&:to_i) # 溜まった雨の量
# nが奇数であるとき　x = A5 - A4 + A3 - A2 + A1 - xが成り立つ。
# 移項すると 2x = A5 - A4 + A3 - A2 + A1
# 偶数のときに足して、奇数のときに引く。
# xを求められたらあとは数珠つなぎに各点の降水量を求められる。
x2    = 0
(0 .. n - 1).each { |i| i.even? ? x2 += rains[i] : x2 -= rains[i] }
ans = Array.new(n)
ans[0] = x2 / 2
(0...n-1).each { |i| ans[i+1] = rains[i] - ans[i] }
ans.map! { |i| i *= 2}
puts ans.join(' ')

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

int main(){
    int N,K;
    cin >> N >> K;
    int ans=1;

    bool flag=true;

    while(flag){
        if(N>=K){
            N/=K;
        
            ans++;
        }
        else{
            flag=false;
        }
    }

    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N,K; cin>>N>>K;
    string s; cin>>s;

    int score=0;
    for(int i=0;i<N-1;i++){
        if(s[i]==s[i+1]) score++;
    }
    cout<<min(N-1,score+2*K)<<endl;

    return 0;
}

Measured memory_bytes: 512
n, m, l = map(int, input().split())
a = []
for _ in range(0,n):
    row = []
    row[:] = map(int, input().split())
    a.append(row)
#print(a)

b = []
for _ in range(0,m):
    row = []
    row[:] = map(int, input().split())
    b.append(row)
#print(b)

c = []
for i in range(0, n):
    row = []
    for j in range(0,l):
        cij = 0
        for k in range(0,m):
            #print(i,j,k)
            cij+=a[i][k]*b[k][j]
        row.append(cij)
    c.append(row)
    print(' '.join(map(str,row)))



Measured memory_bytes: 6924
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <inttypes.h>

int main(void){
	int k;
	char s[100]={'\0'};
	int len;
	int i;

	scanf("%d\n",&k);
	scanf("%s",s);
	len=strlen(s);
	if(len>k){
		for(i=0;i<k;i++){
			printf("%c",s[i]);
		}
		printf("...");
	}else{
		printf("%s",s);
	}
	return 0;
}


Measured memory_bytes: 1736
N = int(input())
A = input()
B = input()
C = input()

def howManyDiff(a, b, c):
    if (a == b == c):
        return 0
    elif (a == b):
        return 1
    elif (b == c):
        return 1
    elif (a == c):
        return 1
    else:
        return 2

totalDiff = 0
for i in range(N):
    totalDiff += howManyDiff(A[i], B[i], C[i])

print(totalDiff)
    

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

using namespace std;

int main()
{
  int A[200010];
  int K,N;
  int count=0;
  cin>>N>>K;
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  for(int i=0;i<(N-K);i++){
    if(A[i]<A[i+K])cout<<"Yes\n";
    else cout<<"No\n";
  }
  return 0;
}





Measured memory_bytes: 4412
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define dump(x) cerr << #x << "=" << x << endl

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<string> vs;

int main(void) {
    ll a, b, k;
    cin >> a >> b >> k;

    if( k >= (b-a)/2+1 ) {
        for(int i=a; i<=b; i++) {
            cout << i << endl;
        }
    } else {
        for(int i=a; i<a+k; i++) {
            cout << i << endl;
        }
        for(int i=b-k+1; i<=b; i++) {
            cout << i << endl;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
void sub_self(int& a, int b) {
    a -= b;
    if(a < 0) {
        a += mod;
    }
}

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int> dp(k + 1);
    // dp[i] - the number of ways such that we used i candies so far
    dp[0] = 1;
    for(int child = 0; child < n; ++child) {
        int up_to;
        scanf("%d", &up_to);
        vector<int> fake(k + 1);
        for(int used = k; used >= 0; --used) {
            int tmp = dp[used];
            int L = used + 1;
            int R = used + min(up_to, k - used);
            if(L <= R) {
                add_self(fake[L], tmp);
                if(R + 1 <= k) {
                    sub_self(fake[R+1], tmp);
                }
            }
            //~ for(int i = L; i <= R; ++i) {
                //~ add_self(dp[i], tmp);
            //~ }
        }
        int prefix_sum = 0;
        for(int i = 0; i <= k; ++i) {
            add_self(prefix_sum, fake[i]);
            add_self(dp[i], prefix_sum);
        }
    }
    printf("%d\n", dp[k]);
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
bool cmp(int x,int y){
	return x>y;	
}
int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3,cmp);
	/*for(int i=0; i<3; ++i)cout<<a[i];
	cout<<endl;
	*/	
	cout<<abs(a[1]-a[0]) + abs(a[2]-a[1]);

	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
  int main(){
    lint N; cin>>N; vector<lint> M; vector<lint> L;lint sum1=0,sum2=0;
    rep(i,N){
      lint a;
      cin >>a;
      M.push_back(a);
      if(i%2==1)sum1+=a;
      else sum2+=a;
    
    }

     rep(i,N){
       lint g,f;
    if(i==0){
      g=sum2-sum1;
      cout<<g<<" ";
    }else{
      f=2*M[i-1]-g;
      cout<<f<<" ";
      g=f;
    }


    }
    

  }

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

using namespace std;

int main()
{
	int n, x = 0, m = 0;
	string s;
	cin >> n >> s;
	
	for (int i=0; i<n; ++i) {
		if (s[i] == 'I') ++x;
		if (s[i] == 'D') --x;
		m = max(m, x);
	}
	
	cout << m;
	return 0;
}



Measured memory_bytes: 256
n,k=map(int,input().split())
P=[(int(i)+1)/2 for i in input().split()]
S=[P[0]]
for i in range(n-1):
    S.append(S[i]+P[i+1])
ans=0
S.insert(0,0)
for i in range(n-k+1):
    ans=max(ans,S[i+k]-S[i])
print(ans)

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

using namespace std;
const int mod = 1e9 + 7;

long long qmi(long long b, long long p){
    //快速幂求 b^p mod 1e9 + 7
    long long res = 1;
    while(p){
        if(p & 1) res = res * b % mod;
        p = p >> 1;
        b = b * b % mod;
    }
    return res % mod;
}

long long inv(long long b){
    //求 x，使得 xb = 1 (mod 1e9 + 7)
    return qmi(b, mod - 2) % mod;
}

long long mfact(long long x){
    //返回的是 x！mod 1e9 + 7
    long long res = 1;
    for(long long i = 1; i <= x; i ++){
        res = res * i % mod;
    }
    return res;
}

long long combine(long long a, long long b){
    //返回的是 aCb mod 1e9 + 7；
    return mfact(a) * inv(mfact(b) * mfact(a - b) % mod) % mod;
}

int main(){
    int x, y;
    cin >> x >> y;
    if ((x + y) % 3 != 0) {
        cout << 0 << endl;
    } else {
        long long m, n;
        m = x - (x + y) / 3; // 解方程
        n = y - (x + y) / 3; 
        if( (m < 0) || (n < 0) ) cout << 0 << endl;
        else cout << combine(m + n, m) << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int a, b;
    cin >> a >> b;
    if(a >= b) {
        for (int i = 0; i < a; ++i)
            cout << b;
    } else {
        for (int i =0; i < b; ++i)
            cout << a;
    }
}

Measured memory_bytes: 256
N, M = map(int, input().split())
num = [1]*(N+1)
red = [0]*(N+1)
red[1] = 1

for _ in range(1,M+1):
    x, y = map(int, input().split())
    if red[x]:
        red[y] = 1   
    num[x] = num[x]-1
    num[y] = num[y]+1
    if num[x]==0:
        red[x] = 0

ans = 0
for i in range(1,N+1):
    if red[i] == 1:
        ans+=1
print(ans)

Measured memory_bytes: 4596
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
        dp[i] = min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1024
def depth_search(i, adj, d, f, t):
    if d[i - 1]:
        return t
    d[i - 1] = t
    t += 1
    for v in adj[i - 1]:
        t = depth_search(v, adj, d, f, t)
    f[i - 1] = t
    t += 1
    return t
n = int(input())
adj = [list(map(int, input().split()))[2:] for _ in range(n)]

d = [0] * n
f = [0] * n

t = 1
for i in range(n):
    if d[i] == 0:
        t = depth_search(i + 1, adj, d, f, t)

for i, df in enumerate(zip(d, f)):
    print(i + 1, *df)   

Measured memory_bytes: 6728
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void){
	char temp[32];
	scanf("%s",temp),scanf("%s",temp+strlen(temp));
    int n;
    sscanf(temp,"%d",&n);
    if((int)sqrt(n)*(int)sqrt(n)==n)
    	printf("Yes");
    else
    	printf("No");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    int x1,y1,x2,y2;
    std::cin >> x1>>y1>>x2>>y2;
    int dx,dy;
    dx = x2-x1;
    dy = y2-y1;
    std::cout << x2-dy<<" "<<y2+dx<<" "<<x2-dy-dx<<" "<<y2+dx-dy << std::endl;
}


Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,x,n) for(int i=x;i<n;i++)
#define exrep(x,vec) for(auto&& x : vec);
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

int main(void) {

	int N; cin >> N;
	vector<pair<int, int>> p(N);
	rep(i, N) {
		cin >> p[i].first;
		p[i].second = i;
	}

	sort(p.begin(), p.end());
	
	rep(i, N) {
		cout << p[i].second + 1 << " ";
	}
	cout << endl;
	return 0;
}


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

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

using namespace std;

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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d[i];

  sort(d.begin(), d.end(), greater<>());

  int result = d[n / 2 - 1] - d[n / 2];

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 640
// ABC067_A.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && a == c) {
		cout << 1 << endl;
	}
	else if (a == b || a == c || b == c) {
		cout << 2 << endl;
	}
	else {
		cout << 3 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
while gets do
  a, b, c, d, e, f = $_.split(/\s/).map(&:to_f)
  z = (b*d - a*e)
  y = (c*d - a*f)/z + 0.000
  x = (b*f - c*e)/z + 0.000
  puts sprintf("%.3f\s%.3f", x, y)
end

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

int main() {
	int a,b;
	cin>>a>>b;
	if(a>b){
		cout<<"a > b"<<endl;
	}
	if(a<b){
		cout<<"a < b"<<endl;
	}
	if(a==b){
		cout<<"a == b"<<endl;
	}
}

Measured memory_bytes: 1156
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	ans := "None"
	for i := 97; i < 97+26; i++ {
		f := false
		for _, r := range s {
			if rune(i) == r {
				f = true
				break
			}
		}
		if !f {
			ans = string(rune(i))
			break
		}
	}
	fmt.Println(ans)
}


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

struct edge{int to, cost;};
typedef pair<int, int> P;
const int INF = 1e9;
const int MAX_V = 3*1e5+1;

vector<edge> G[MAX_V];
int d[MAX_V];
int V;

void dijkstra(int s){
  priority_queue<P, vector<P>, greater<P>> que;
  rep(i, V+1) d[i] = INF;
  d[s] = 0;
  que.push(P(0, s));
  while(!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    rep(i, G[v].size()){
      edge e = G[v][i];
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

int main(){
  int M, S, T;
  cin >> V >> M;
  V *= 3;
  rep(i, M){
    int u, v;
    cin >> u >> v;
    G[3*u].push_back({3*v-1, 1});
    G[3*u-1].push_back({3*v-2, 1});
    G[3*u-2].push_back({3*v, 1});
  }
  cin >> S >> T;
  dijkstra(3*S);
  if(d[3*T] == INF) cout << "-1" << endl;
  else cout << d[3*T]/3 << endl;
  return 0;
}


Measured memory_bytes: 17792
#include<iostream>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int main(void){
    int n,S,ans=0;
    cin>>n;
    while(n--){
        cin>>S;
        bool ok=true;
        for(int i=1;i*i<=S;i++){
            if((S-i)%(2*i+1)==0){
                ok=false; break;
            }
        }
        if(ok) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double x;
		x = sc.nextDouble();
		double numA = Math.pow(x, 3);
		int numB = (int) numA;
		System.out.println(numB);
		sc.close();
	}
}


Measured memory_bytes: 27980
import java.util.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        double[] A = new double[N];
        for(int i = 0; i < N; i++){
            A[i]  = sc.nextInt();
        }
        sc.close();
        double sum = 1;
        for(int i = 0; i < N; i++)
            sum *= A[i];
        double[] dp = new double[N];
        for(int i = 0; i < N; i++){
            dp[i] = sum / A[i];
        }
        double sum_dp = 0;
        for(int i = 0; i < N; i++){
            sum_dp += dp[i];
        }
        System.out.println(sum/ sum_dp);
    }
}

Measured memory_bytes: 23252
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i,a,b;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>a>>b;
  std::vector<int> v(n);
  rep(i,n) cin>>v[i];
  ll left = 1,right = 1e9;
  while(left != right){
    ll mid = (left+right) / 2;
    ll num = 0;
    rep(i,n){
      int need = mmax(0,v[i]-b*mid);
      num += need/(a-b) + bool(need%(b-a));
    }
    if(num <= mid) right = mid;
    else left = mid + 1 ;
  }
  cout<<left<<endl;
  
}

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


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

int main(){
  int N, i;
  double x[10],sum;
  string u[10];
  
  cin >> N;
  for(i = 0; i < N; i++){
    cin >> x[i] >> u[i];
  }
  
  sum = 0;
  
  for(i = 0; i < N; i++){
    if(u[i] == "JPY"){
      sum += x[i];
    }
    else{
      sum += x[i]*380000;
    }
  }
  cout << sum <<endl;

  
  return 0;
}

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

int main()
{
    long long int a, b, x;
    cin >> a >> b >> x;
    long long int ans=0;
    if(a%x==0){
        ans=(b-a)/x+1;
    }else{
        ans=b/x-a/x;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
*/

ll a,b,c;

int main(void){
	cin>>a>>b>>c;
	if(c-a-b<0){
		cout<<"No"<<endl;
		return 0;
	}
	if(4*a*b < (c-a-b)*(c-a-b)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
import java.math.*;

public class Main {
    private static Scanner sc;

    public static void main(final String[] args) {
        final Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null)
                br.close();
        }

        public String next() throws IOException {
            if (i < s.length)
                return s[i++];
            String st = br.readLine();
            while (st == "")
                st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }

        public long[] nextLongArray(int n) throws NumberFormatException, IOException {
            long[] ret = new long[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextLong();
            }
            return ret;
        }

        public int[] nextIntArray(int n) throws NumberFormatException, IOException {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextInt();
            }
            return ret;
        }
    }

    private void solve() {
        try {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int p[] = sc.nextIntArray(n);
            Arrays.sort(p);

            int sum = 0;
            for (int i = k - 1; i >= 0; i--) {
                sum += p[i];
            }
            System.out.println(sum);

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}


Measured memory_bytes: 32952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(void)
{
    ll x,t;
    cin >> x >> t;
    cout << max(0ll, x - t) << endl;
    return 0;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * 1357.cc: Squeeze the Cylinders
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 500;

/* typedef */

/* global variables */

int rs[MAX_N];
double xs[MAX_N];

/* subroutines */

inline void setmax(double &a, double b) { if (a < b) a = b; }

/* main */

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

  for (int i = 0; i < n; i++) scanf("%d", rs + i);

  double sum = 0.0;
  for (int i = 0; i < n; i++) {
    xs[i] = rs[i];
    for (int j = i - 1; j >= 0; j--) {
      int p = rs[i] + rs[j], m = rs[i] - rs[j];
      double x = xs[j] + sqrt((double)(p * p - m * m));
      setmax(xs[i], x);
    }
    setmax(sum, xs[i] + rs[i]);
  }

  printf("%.8lf\n", sum);
  return 0;
}



Measured memory_bytes: 3236
#include <iostream>
    #include <math.h>
    #include <vector>
    #include <string>
    using namespace std;
    int main() {
        int d;
        cin >> d ;
        if(d == 25) cout << "Christmas" << endl;
        else if (d==24) cout << "Christmas Eve" << endl;
        else if (d==23) cout << "Christmas Eve Eve" << endl;
        else cout << "Christmas Eve Eve Eve" << endl;
        return 0;
    }

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

int main() {
  int A,B,C,ans;
  cin >> A >> B >> C;
  
  if((A-B)>=C){
    ans=0;
  }else if((A-B)<C){
  	ans=C-A+B;
  }
  
  cout<<ans<<endl;

}

Measured memory_bytes: 256
import math
N = int(input())
town = []
for i in range(N):
    x, y = map(int, input().split())
    town.append((x, y))
    

def dfs(current, dist, already):
    if len(already) == N:
        return dist
    d = 0
    for i in range(N):
        if i in already:
            continue
        d += dfs(i, dist + math.sqrt((town[current][0] - town[i][0]) ** 2 + (town[current][1] - town[i][1]) ** 2), already | set([i]))
    return d
answer = 0
for i in range(N):
    answer += dfs(i, 0, set([i]))
print(answer / math.factorial(N))

Measured memory_bytes: 9152
// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;

// Please name your class Main
class Main {
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner input = new Scanner(System.in);
	    int n = input.nextInt();
	    String s = "";
	    for(int i=1;i<=n;i++)
	        s+=Integer.toString(i);
	    String s1 = "";
	    for(int i=1;i<=n;i++)
	    {
	        int a = input.nextInt();
	        s1+=Integer.toString(a);
	    }
	    String s2 = "";
	    for(int i=1;i<=n;i++)
	    {
	        int a = input.nextInt();
	        s2+=Integer.toString(a);
	    }
	    List<String> list = new ArrayList<>();
	    list = permutations(s);
	    Collections.sort(list);
	    System.out.println(Math.abs(list.indexOf(s1)-list.indexOf(s2)));
	}
	
	
	
	public static List<String> permutations(String s)
	{
		List<String> partial = new ArrayList<>();
		partial.add(String.valueOf(s.charAt(0)));
		for (int i = 1; i < s.length(); i++)
		{
			for (int j = partial.size() - 1; j >= 0 ; j--)
			{
				// remove current partial permutation from the ArrayList
				String str = partial.remove(j);
				for (int k = 0; k <= str.length(); k++)
				{
					partial.add(str.substring(0, k) + s.charAt(i) + 
								str.substring(k));
				}
			}
		}

		return partial;
	}
}

Measured memory_bytes: 33208
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,A[N][N];
int color[N],d[N],f[N],m;

void DFS2(int u){
  int v;
  color[u] = GRAY;
  m++;
  d[u] = m;
  for ( v=0 ; v<n ; v++ ){
    if ( A[u][v] == 0 ) continue;
    if ( color[v] == WHITE )
      DFS2(v);
  }
  color[u] = BLACK;
  f[u] = ++m;
}

void DFS(){
  int i, u;
  for ( i=0 ; i<n ; i++ )
    color[i] = WHITE;
  m = 0;
  for ( u=0 ; u<n ; u++ ){
    if ( color[u] == WHITE )
      DFS2(u);
  }
  for ( i=0 ; i<n ; i++ )
    printf("%d %d %d\n",i+1,d[i],f[i]);
}

main(){
  int u, k, v; 
  int i, j;

  scanf("%d",&n);

  for ( i=0 ; i<n ; i++ ){
    for ( j=0 ; j<n ; j++ )
      A[i][j] = 0;
  }
  
  for ( i=0 ; i<n ; i++ ){
    scanf("%d %d",&u,&k);
    u--;
    for ( j=0 ; j<k ; j++ ){
      scanf("%d",&v);
      v--;
      A[u][v] = 1;
    }
  }
  
  DFS();

  return 0;
}



Measured memory_bytes: 2056
#include <bits/stdc++.h>
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 mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

ll mod_pow(ll x, ll n) {
  if (n == 0) return 1;
  ll res = mod_pow(x * x % MOD, n / 2);
  if (n & 1) res = res * x % MOD;
  return res;
}

ll modsubtraction(ll a, ll b) {
  ll ans = (a - b) % MOD;
  if (ans < 0)
    ans += MOD;
  return ans;
}

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

  int N, K;
  ll s = mod_pow(10, 100);
  cin >> N >> K;
  ll sum1 = 0;
  ll sum2 = 0;
  vector<P> A(N+2);
  for (int i = 1; i <= N+1; i++) {
    sum1 += (i-1+s)%MOD;
    sum2 += (N+1-i+s)%MOD;
    sum1 %= MOD;
    sum2 %= MOD;
    if (i >= K) {
      A[i]._1 = sum1;
      A[i]._2 = sum2;
    }
  }
  ll ans = 0;
  for (int i = K; i <= N+1; i++) {
    // cout << modsubtraction(A[i]._2, A[i]._1) << endl;
    ans += modsubtraction(A[i]._2, A[i]._1)+1;
    ans %= MOD;
  }
  // for (int i = K; i <= N+1; i++) {
  //   cout << A[i]._1 << ' ' << A[i]._2 << endl;
  // }
  // sort(all(A));
  // ll ans = 0;
  // sum1 = A[K]._1;
  // sum2 = A[K]._2;
  // for (int i = K; i <= N+1; i++) {
  //   if (sum2 < A[i]._1) {
  //     ans += sum2-sum1+1;
  //     sum1 = A[i]._1;
  //     sum2 = A[i]._2;
  //   }
  //   else {
  //     sum2 = A[i]._2;
  //   }
  // }
  // ans += sum2-sum1+1;
  cout << ans << endl;
}


Measured memory_bytes: 4720
import java.util.*;
import java.lang.*;
public class Main {
	public static boolean checkPalindrome(char[] arr, int a, int b){
		for(int i=a;i<b-a;i++){
			if(arr[i]!=arr[b-a-i-1]){
				return false;
			}
		}
		return true;

	}
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		char[] s=sc.nextLine().toCharArray();
		int n=s.length;
		if(checkPalindrome(s,0,n)&&checkPalindrome(s,0,(n-1)/2)&&checkPalindrome(s,(n+3)/2,n)){
			System.out.print("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<int> a(N);
  unordered_map<int, int> num;
  for(int i=0; i<N; i++){
    cin >> a[i];
    if (num.find(a[i]) == num.end()) num.emplace(a[i], 0);
    ++num[a[i]];
  }
  
  long long totalNum = 0;
  for(auto &elem : num){
    totalNum += (long long)elem.second*(elem.second-1)/2; 
  }
  
  for(int i=0; i<N; i++){
    long long curNum = num[a[i]];
    long long ret = totalNum;
    if (curNum != 1){
      ret += (long long)(curNum-1)*(curNum-2)/2 - (long long)curNum*(curNum-1)/2;
    }
    cout << ret << endl;
  }
  
  return 0;
}

Measured memory_bytes: 8392
N = int(input())

B = list(map(int, input().split()))
A = [B[0]]


for i in range(1, N-1):
  c = min(B[i-1], B[i])
  A.append(c)
  
A.append(B[N-2])

ans = 0

for j in range(N):
  ans += A[j]
  
print(ans)
  

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

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

    long long n, k;
    cin >> n >> k;

    long long ans = min(n % k, (n + k - 1) / k * k - n);
    cout << ans << endl;

    return 0;
}

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

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

typedef unsigned ul;
using namespace std;

void init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
}

bool check(char tmp){
    switch(tmp){
        case 'A':
            return true;
        case 'C':
            return true;
        case 'G':
            return true;
        case 'T':
            return true;
        default:
            return false;
    }
}

auto main() -> int{
    init();

    string S;
    cin >> S;
    int result = 0;
    for(int i = 0; i < S.length(); i++){
        int count = 0;
        for(int t = i; t < S.length(); t++){
            if(check(S.at(t))){
                count++;
            }
            else{
                break;
            }
        }
        result = max(result, count);
    }
    cout << result << endl;
}

Measured memory_bytes: 256
package main

import (
	"math/rand"
	"time"
	"os"
	"bufio"
	"fmt"
	"strconv"
	"strings"
)

var(
	sc = bufio.NewScanner(os.Stdin)
	stdin = bufio.NewReader(os.Stdin)
	mod = 1000000007
	mod9 = 1000000009
)

func init()  {
	rand.Seed(time.Now().UnixNano())
	buf := make([]byte, 0) //ここのサイズは何でもよさそう
	sc.Buffer(buf, 1000000009)
}


//||||||||||||||||||||||||||入力|||||||||||||||||||||||||||||||||||||||\
//数字一文字入力
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

//文字列を一行入力
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

//空白区切りの文字列の入力
func spaceLine() []string {
	sc.Scan()
	return strings.Split(sc.Text()," ")
}

//数字を一行入力
func intLine() []int {
	str := spaceLine()
	buf := make([]int,len(str))
	for i,s:=range str{
		buf[i],_ = strconv.Atoi(s)
	}
	return buf
}

//次のスペースか改行まで読み込む
func gostring() string {
	byte_ls := make([]byte,0)
	for  {
		b, _ := stdin.ReadByte()
		if b == 32 || b == 10 || b == 0{
			return string(byte_ls)
		} else if b == 13 {
			continue
		} else {
			byte_ls = append(byte_ls,b)
		}
	}
}

//上の関数のintバージョン
func goint() int {
	n,_ := strconv.Atoi(gostring())
	return n
}

//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

//ソートする
//sは最初のインデックス fは最後のインデックス
func Sort(ls []int,l int,r int)  {
	if r - l <= 0{return}
	pipot := l + rand.Intn(r-l+1)
	ls[r],ls[pipot] = ls[pipot],ls[r]
	i := l
	for j:=l;j<r;j++{
		if ls[j] < ls[r]{
			ls[i],ls[j] = ls[j],ls[i]
			i ++
		}
	}
	ls[i],ls[r] = ls[r],ls[i]
	Sort(ls,l,i-1)
	Sort(ls,i+1,r)
}

//配列の大小を指定した要素で比較
//a < bならtrue
func sizeCheck(a []int,b []int,ls []int) bool {
	for _,i:= range ls{
		if a[i] < b[i]{
			return true
		} else if a[i] > b[i] {
			return false
		}
	}
	return false
}

//二次元配列のソート
func Sort2D(ls [][]int,l int,r int,index ...int)  {
	if r - l <= 0{return}
	pipot := l + rand.Intn(r-l+1)
	ls[r],ls[pipot] = ls[pipot],ls[r]
	i := l
	for j:=l;j<r;j++{
		if sizeCheck(ls[j],ls[r],index){
			ls[i],ls[j] = ls[j],ls[i]
			i ++
		}
	}
	ls[i],ls[r] = ls[r],ls[i]
	Sort2D(ls,l,i-1,index ...)
	Sort2D(ls,i+1,r,index ...)
}

func main() {
	n := goint()
	ls := make([]int,n)
	for i:=0;i<n;i++{
		ls[i] = goint()
	}
	Sort(ls,0,len(ls)-1)
	c := (float64(ls[0]) + float64(ls[1])) / 2.0
	for i:=2;i<n;i++{
		c = (c + float64(ls[i])) / 2.0
	}
	fmt.Println(c)
}

func min(a ...int) int {
	ans := a[0]
	for i:=1;i<len(a);i++{
		if ans > a[i]{
			ans = a[i]
		}
	}
	return ans
}

Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    seika n;
    cin >> n;
    for (char c : n)
    {
        if (c == '7')
        {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}

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


Measured memory_bytes: 3636
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [r, g, b] = input[0];

  return Number(`${r}${g}${b}`) % 4 === 0 ? "YES" : "NO";
};

console.log(main(read()));


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

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

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }


const long long INF = 1LL<<60;
 
int N, M;
vector<long long> a, b;
vector<int> c;
 
 
long long dp[1100][5000];
 
int main() {
    int N, M; cin >> N >> M;
    vector<long long> a(M), b(M), c(M, 0); // c はビットで表す
    for (int i = 0; i < M; ++i) {
        cin >> a[i] >> b[i];
        for (int j = 0; j < b[i]; ++j){
            int t; cin >> t; --t;
            c[i] |= (1<<t);
        }
    }
 
    for (int i = 0; i < 1100; ++i) for (int j = 0; j < 5000; ++j) dp[i][j] = INF;
    dp[0][0] = 0;
    
    for (int i = 0; i < M; ++i) {
        for (int j = 0; j < (1<<N); ++j) {
            chmin(dp[i+1][j], dp[i][j]);
            
            int nj = j | c[i];
            chmin(dp[i+1][j | c[i]], dp[i][j] + a[i]);
        }
    }
 
    cout << (dp[M][(1<<N)-1] < INF ? dp[M][(1<<N)-1] : -1) << endl;               
}

Measured memory_bytes: 43264
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int n;
int m;
P a[100005];
vector<int>edge[100005];
bool flag[100005];

int par[100005],ran[100005];
void init(){ for(int i=0;i<100005;i++) par[i] = i; }
int find(int x){ if(x == par[x]) return x; else return par[x] = find(par[x]); }
void unite(int x,int y){
	x = find(x); y = find(y); if(x==y) return;
	if(ran[x] < ran[y]) par[x] = y;
	else{
		par[y] = x;
		if(ran[x] == ran[y]) ran[x]++;
	}
}
bool same(int x,int y){ return find(x) == find(y); }
map<P,int>M;
vector<int>ans;
bool dfs(int v,int u){
	bool cur = a[v].sc;
	rep(i,edge[v].size()){
		if(edge[v][i] == u) continue;
		bool f = dfs(edge[v][i],v);
		
		if(f){
			cur ^= f;
			int p = min(v,edge[v][i]);
			int q = max(v,edge[v][i]);
			ans.pb(M[mp(p,q)]);
		}
	}
	return cur;
}
int main(){
	scanf("%d%d",&n,&m);
	repn(i,n){
		int x,y;
		scanf("%d%d",&x,&y);
		a[i] = mp(x,y);
	}
	sort(a+1,a+n+1);
	a[n+1] = mp(mod,0);
	init();
	rep(i,m){
		int x,y; scanf("%d%d",&x,&y);
		x = lower_bound(a+1,a+n+1,mp(x,-1))-a;
		y = lower_bound(a+1,a+n+1,mp(y+1,-1))-a; y--;
		
		if(same(x,y+1) == false){
			edge[x].pb(y+1);
			edge[y+1].pb(x);
			M[mp( min(x,y+1), max(x,y+1) )] = i;
			unite(x,y+1);
		}
	}
	
	for(int i=n+1;i>=2;i--) a[i].sc ^= a[i-1].sc;
	repn(i,n+1){
		flag[find(i)] ^= a[i].sc;
	}
	repn(i,n+1){
		if(flag[i]){
			puts("-1"); return 0;
		}
	}
	repn(i,n+1){
		if(find(i) != i) continue;
		dfs(i,-1);
	}
	printf("%d\n",ans.size());
	SORT(ans);
	rep(i,ans.size()) printf("%d\n",ans[i]+1);
}

Measured memory_bytes: 14204
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e18;
const ll MOD = 1000000007;  // 1e9 + 7

map<ll,ll> mp; // dp map
ll n,a,b,c,d;
vector<ll> costs;
vector<ll> nums = { 2, 3, 5 };

ll dfs(ll n) {
  if (n == 0) { return 0; }
  if (n == 1) { return d; }
  if (mp.find(n) != mp.end()) {
    return mp[n];
  }

  // Here, we skip
  ll res = INF;
  // try D(+/- 1)
  if (n < res/d) { // n*d < res
    chmin(res, n*d);
  }
  // try A,B,C
  rep(i,3) {
    ll cost = costs[i];
    ll num  = nums[i];
    {
      // floor
      ll t = n/num; // target
      ll now = dfs(t) + cost;
      now += abs(n-(num*t))*d;
      chmin(res,now);
    }
    {
      // ceil
      ll t = (n+num-1)/num; // target
      ll now = dfs(t) + cost;
      now += abs(n-(num*t))*d;
      chmin(res,now);
    }
  }
  return mp[n] = res;
}

void solve() {
  cin >> n >> a >> b >> c >> d;
  costs = { a, b, c };
  mp.clear();
  // printvec(costs);
  // printvec(nums);
  // printmap(mp);
  cout << dfs(n) << endl;
}

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll t;
  cin >> t;
  rep(i,t) {
    solve();
  }
}


Measured memory_bytes: 4412
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

template <class T> istream& operator>>(istream& input, vector<T>& v);
template <class T> ostream& operator<<(ostream& output, const vector<T>& v);

int main() {
    ll cnt = 0;
    vector<ll> A(3);
    cin >> A;
    if (all_of(A.begin(), A.end(), [A](ll a){ return a == A[0] && !(a & 1); })) cout << -1 << endl;
    else {
        while (all_of(A.begin(), A.end(), [](ll a) { return !(a & 1); })) {
            vector<ll> tmp({(A[1] + A[2]) / 2, (A[0] + A[2]) / 2, (A[0] + A[1]) / 2});
            A.swap(tmp);
            cnt++;
        }
        cout << cnt << endl;
    }
}


template <class T>
istream& operator>>(istream& input, vector<T>& v) {
    for (T& i : v) input >> i;
    return input;
}
template <class T>
ostream& operator<<(ostream& output, const vector<T>& v) {
    output << "[";
    for (auto itr = v.begin(); itr != v.end() - 1; ++itr) output << *itr << ", ";
    output << v.back() << "]";
    return output;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(void){
    int num_try=0,num_win=0;;
    char result[16];
    int i=0;

    scanf("%s",result);
    while(result[i]!='\0'){
        num_try++;
        if(result[i]=='o'){
            num_win++;
        }
        i++;
    }
    if(15-num_try>=8-num_win){
        printf("YES");
    }
    else{
        printf("NO");
    }
    return 0;
}

Measured memory_bytes: 128
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){
    int N;
    int z=1000;
    int m=1000,n=0;
    cin>>N;

    for(int i=0;i<N;i++){
        int A;
        cin>>A;
        int sell=n*A;
        z=max(z,sell+m);
        int buy=z/A;
        int nok=z%A;
        if(n<buy||(n==buy&&nok>m)){
            n=buy;
            m=nok;
        }
    }
    cout<<z<<endl;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
template <typename TYPE> inline void chkmax(TYPE &x,TYPE y){x<y?x=y:0;}
template <typename TYPE> inline void chkmin(TYPE &x,TYPE y){y<x?x=y:0;}
template <typename TYPE> void readint(TYPE &x)
{
    x=0;int f=1;char c;
    for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
    for(;isdigit(c);c=getchar())x=x*10+c-'0';
    x*=f;
}
const int MAXN=200005,MOD=2019;

int n;
char a[MAXN];
int f[MAXN],cnt[MAXN];

int main()
{
	scanf("%s",a+1);
	n=strlen(a+1);
	ll ans=0;
	int cur=1;
	++cnt[0];
	for(int i=n;i;--i)
	{
		f[i]=(f[i+1]+(a[i]-'0')*cur)%MOD,cur=cur*10%MOD;
		ans+=cnt[f[i]];
		++cnt[f[i]];
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;
string s;
int main(){
	
	cin>>s;
	int len=s.length();
	if(s[0]==s[len-1]){
		if(len%2!=0) {
			printf("Second");
			return 0;
		}
		else{
			printf("First");
			return 0;
		}
	}
	else{
		if(len%2==0) {
			printf("Second");
			return 0;
		}
		else{
			printf("First");
			return 0;
		}
	}
	return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  char c[h][w+1];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> c[i][j];
    }
    c[i][w] = '\0';
  }
  for (int i = 0; i < h; i++) {
    cout << c[i] << endl << c[i] << endl;;
  }
}

Measured memory_bytes: 256