akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define FAST_IO                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cerr.tie(NULL);

#define dbg(x) cerr << #x << " = " << x << ",  ";
#define vw(v)                        \
    cerr << endl                     \
         << endl                     \
         << (#v) << " is: " << endl; \
    for (int B : (v))                \
    {                                \
        cerr << B << " ";            \
    }                                \
    cerr << endl
#define check(x) cerr << "here " << (x) << "?" << endl

#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define per(i, a) for (long long i = (a - 1); i >= 0; i--)

#define all(x) (x).begin(), (x).end()
#define rv(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
ll const INF = 1147483647, R_INF = 9223372036854775807, MOD = 1e9 + 7;

//const int N =

int main()
{
    FAST_IO
    int n, k;
    cin >> n >> k;
    vector<int> v(n + 1);
    rep(i, 1, n + 1)
    {
        cin >> v[i];
    }
    vector<int> DP(n + 2, INF);
    DP[1] = 0;
    rep(i, 2, n + 1)
        rep(j, 1, k + 1)
            if (i - j > 0)
                DP[i] = min(DP[i], DP[i - j] + abs(v[i] - v[i - j]));
    
    cout << DP[n];
}

Measured memory_bytes: 1024
// input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        k: usize,
        a: usize,
        b: usize,
    }

    let mul = (b / k) * k;
    if a <= mul {
        println!("OK");
    } else {
        println!("NG");
    }
}


Measured memory_bytes: 2148
NK = list(map(int, input().split()))
a = [0]*NK[0]
for i in range(len(a)):
    a[i] = int(input())
a.sort()
N = NK[0]
K = NK[1]

minimum = a[N-1]
for i in range(N-K+1):
    offset = a[i+K-1] - a[i]
    if minimum > offset:
        minimum = offset

print(minimum)


Measured memory_bytes: 7472
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define rrep(i , n) for ( int i = n-1; i >=0 ; i--)

#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	ull size_; 
	std::vector<ull> par, rank, count;

public:
	UnionFind() : size_(0), par(std::vector<ull>()), rank(std::vector<ull>()), count(std::vector<ull>()) {};
	UnionFind(ull size__) : size_(size__) {
		par.resize(size_); rank.resize(size_); count.resize(size__);
		for (ull i = 0; i < size_; i++) par[i] = i, rank[i] = 0, count[i] = 1;
	}
	ull size() { return size_; }
	// ull root(ull x) { return par[x] == x ? x : par[x] = root(par[x]); }
	
	ull root(ull x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	
	bool same(ull x, ull y) { return root(x) == root(y); }

	void unite(ull x, ull y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y, count[y]+=count[x], count[x]=0;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++, count[x]+=count[y], count[y]=0;
		else par[y] = x, count[x] += count[y], count[y] = 0;
	}

	ull size__(ull x)
	{
		return count[root(x)];
	}

	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};
/*
maybe sth wrong 
got wa in one problem
*/
ll modpow(ll a, ll b)
{
	if (b == 0)
	{
		return 1;
	}

	if (b % 2)
	{
		return a * modpow(a, b-1) % MOD;
	}
	else
	{
		ll halfB = b / 2;
		ll half = modpow(a, halfB);
		return half * half % MOD;
	}
}

ll calcComb(ll n, ll m)
{
	if (m > n-m)
	{
		return calcComb(n, n-m);
	}

	ll ansMul = 1;
	ll ansDiv = 1;

	rep(i, m)
	{
		ansMul *= (n-i);
		ansDiv *= (i+1);
		ansMul %= MOD;
		ansDiv %= MOD;
	}

	return ansMul * modpow(ansDiv, MOD - 2) % MOD;
}

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


int main()
{
	ll N, K;
	
	cin >> N >> K;

	double p[N];

	double s[N+1];
	s[0] = 0;
	rep(i, N)
	{
		double tmp ;
		cin >> tmp;

		p[i] = (1+tmp) / 2.0;
		s[i+1] = s[i] + p[i];
	}

	double max_ = 0.0;

	
	for(int i = K; i <= N; i++)
	{
		max_ = max(max_, s[i] - s[i-K]);
	}
	
	//cout << max_ << endl;
	printf("%lf\n", max_);
	
	return 0;
}


Measured memory_bytes: 3456
from collections import deque
q = deque()

n = int(input())
C = [deque() for _ in range(n+1)]

for i in range(n):
    tmp = list(map(int,input().split()))
    for j in range(tmp[1]):
        C[tmp[0]].append(tmp[2+j])

visited = [False]*(n+1)
d = [0]*(n+1)
f = [0]*(n+1)
t = 0

def stack(i):
    global t
    if visited[i] == False:
        q.append(i)
    while q:
        #ノードの探索開始
        node = q[-1]
        if d[node] == 0:
            t += 1
            d[node] = t
        visited[node] = True
        for _ in range(len(C[node])):
            tmp = C[node].popleft()
            if visited[tmp] == False:
                next_node = tmp
                q.append(next_node)    #未探索の接続ノード
                break
        
        #未探索接続ノードがなければそのノードは探索終了
        else:
            t += 1
            f[q.pop()] = t

for i in range(1,n+1):
    stack(i)

for i in range(1,n+1):
    print("{} {} {}".format(i,d[i],f[i]))


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

int main(){
  char a[21],b[21]={};
  int i,j=0,count=0;

  scanf("%s",a);

  for(i=0;i<strlen(a);i++){
    if(a[i]=='A'|| a[i]=='Z'){
      b[j]=a[i];
    j++;
    }
  }

  for(i=0;i<j;i++){
    if(b[i]=='A'){
      if(b[i+1]=='Z'){
	printf("%c%c",b[i],b[i+1]);
	count=1;
      }
    }
  }
  if(count==0) printf("-1");
 printf("\n");

  return 0;
}

Measured memory_bytes: 540
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;

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

	int sum = 0;
	for (int i = 0; i < S.length(); ++i)
	{
		sum += (int)(S[i] - '0');
	}

	if (sum % 9 == 0) cout << "Yes";
	else cout << "No";

	return 0;
}


Measured memory_bytes: 3752
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	int x,ans=0;
	cin >> x;
	for (int i = 1; i < 1000;i++) {
		for (int j = 2; j < 20;j++) {
			if (pow(i,j)<=x&&ans<pow(i,j)) {
				ans = pow(i,j);
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    string s;
    cin >> s;
    string k = s;
    int n = s.length();
    string key = "keyence";
    rep(i,n){
        rep(j,n){
            if(s.erase(i,j) == key){
                cout << "YES" << endl;
                return 0;
            }
            s = k;
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
using namespace std;



int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  int count = 0;

  rep(i, m) {
    cin >> a.at(i);
    count += a.at(i);
  }


  if (count > n) {
    cout << -1 << endl;
  }
  else {
    cout << n - count << endl;
  }

}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, C, D, N, ans=0, left, right;
    vector<int> V(3);
    char tmp, tmp2;
    string S, S2;
    bool flag=true;
    cin >> S;
    // ans = 24 + (24-A);
    // ans = (A-B)%C;
  
    // cout << ans << endl;

    // if(left <right )
    // 	cout << "Right" <<endl;
    // else if(left > right)
    // 	cout << "Left" <<endl;
    // else
    // 	cout << "Balanced" <<endl;


    // string S;
    // cin >>S;
    // cout << S + "pp"<<endl;
    if(S[0]==S[1] ||S[1]==S[2] ||S[2]==S[3] )
    	puts("Bad");
    else
    	puts("Good");
}


Measured memory_bytes: 256
a, b, k = map(int, input().split())
if (a == 1 or b == 1):
    print(1)
    exit(0)
div = []
ans = 0
for i in range(1, max(a, b) + 1):
    if (a % i == 0 and b % i == 0):
        div.append(i)
div.reverse()
print(div[k - 1])


Measured memory_bytes: 3060
n,m=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(n)]
C=[list(map(int,input().split())) for _ in range(m)]
for i in A:
  D=[abs(i[0]-j[0])+abs(i[1]-j[1]) for j in C]
  print(D.index(min(D))+1)


Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#define N 1000
#define max(a,b) ((a)>=(b)?(a):(b))

void lcs(char x[N+1], char y[N+1]){
  int c[N+1][N+1],m,n,i,j;
  m=strlen(x);
  n=strlen(y);

  for(i=0;i<=m;i++) c[i][0]=0;
  for(j=0;j<=n;j++) c[0][j]=0;

  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(x[i-1]==y[j-1]) c[i][j]=c[i-1][j-1]+1;
      else c[i][j]=max(c[i-1][j],c[i][j-1]);
    }
  }
  printf("%d\n",c[m][n]);
}

int main(){
  int n,i;
  char c1[N+1],c2[N+1];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%s", c1,c2);
    lcs(c1,c2);
  }


  return 0;
}


Measured memory_bytes: 5680
#include <iostream>

using namespace std;

int main() {
 long n,m;
 long sum = 0;
  long cnt = 0;
 long *ret;
 long i, flag, a;

cin >> n>>m;
    
    ret = (long*)calloc(n,sizeof(long)); 

 for (i=0;i<n;i++){
     cin >> ret[i];
     sum += ret[i];
 }
  
  a= sum/4/m;
  if ((sum%(4*m)) != 0) {
      a++;
  }
  for (i=0;i<n;i++) {
      if (ret[i] >= a ) {
          cnt ++;
      }
  }

  if (cnt>=m) {
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
program number_of_amidakuji
  implicit none
  integer(8), parameter   :: d = 10**9 + 7
  integer(8)              :: h, w, k, ans
  integer(8)              :: i, j
  integer(8), allocatable :: a(:,:), f(:)
  read(*,*) h, w, k
  allocate(a(0:h,0:w+1))
  allocate(f(-1:w))
  call fibonacci(f,w)
  a = 0
  a(0,1) = 1
  do i = 1, h
     do j = 1, w
        a(i,j) = mod(f(j-2)*f(w-j)*a(i-1,j-1),d) + mod(f(j-1)*f(w-j)*a(i-1,j),d) + mod(f(j-1)*f(w-j-1)*a(i-1,j+1),d)
        a(i,j) = mod(a(i,j),d)
     end do
  end do
  ans = a(h,k)
  deallocate(a,f)
  write(*,'(i0)') ans
  stop
contains
  subroutine fibonacci(f,n)
    implicit none
    integer(8), intent(in)    :: n
    integer(8), intent(inout) :: f(-1:n)
    integer(8)                :: i
    f = 0
    f(-1) = 0
    f(0) = 1
    f(1) = 1
    if (n .gt. 1) then
       do i = 2, n
          f(i) = f(i-1) + f(i-2)
       end do
    end if
    return
  end subroutine fibonacci
end program number_of_amidakuji

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

int main(){
    ll n;
    cin >> n;
    ll ans = n*(n-1)/2;
    cout << ans << endl;
    return 0;
}

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

int a[100010];

int main()
{
    int n; cin>>n;
    long res=0;
    int c=0, mina=2e9;
    for(int i=0; i<n; ++i) {
        cin>>a[i];
        res+=abs(a[i]);
        c+=a[i]<0;
        mina=min(mina, abs(a[i]));
    }
    if (c%2) res-=2*mina;
    cout<<res<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <iterator>
#include <vector>
#include <unordered_map>
#include <algorithm>

struct pair_hash {
	template <class T1, class T2>
	std::size_t operator() (const std::pair<T1, T2> &pair) const {
		return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
	}
};

int main()
{
  int N;
  std::cin >> N;
  int m[N];
  int res = 0;
  int max = 0;
  for (int i=0; i<N; i++) {
    std::cin >> m[i];
    if (max <= m[i]) {
      res++;
      max = m[i];
    }
  }

  std::cout << res;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0130
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = RInt();

            for (int lCnt = 0 ; lCnt < n ; lCnt++)
            {
                string line = RSt();
                line = line.Replace("->", "0");
                line = line.Replace("<-", "1");

                LinkedList<char> ans = new LinkedList<char>();
                HashSet<char> registration = new HashSet<char>();

                bool isFront = false;
                for (int i = 0 ; i < line.Length ; i++)
                {
                    if (i % 2 == 0)
                    {
                        if (!registration.Contains(line[i]))
                        {
                            if (isFront) ans.AddFirst(line[i]);
                            else ans.AddLast(line[i]);
                            registration.Add(line[i]);
                        }
                    }
                    else
                    {
                        isFront = (line[i] == '1');
                    }
                }
                Console.WriteLine(WAr(ans, ""));
            }         
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 14732
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
using namespace std;

int main() {
	string a, b,c;
	cin >> a >> b >> c;
	cout << a[0] << b[0] << c[0] << endl;
	return 0;



}


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

bool solve() {
    string S;
    cin >> S;
    if ( S[2]==S[3] && S[4] == S[5]) return true;
    return false;
}

int main() {
    string ans = solve() ? "Yes" : "No";
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  string s;cin>>s;
  int a=0,b=0;
  for(char p:s){
    if(p=='A'||p=='C'||p=='T'||p=='G'){a++;b=max(a,b);}
    else a=0;
  }
  cout<<b<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int min(int a, int b){
	if(a>b) return b;
	else return a;
}

int main(void){
	int N;
	int B[100];
	int i;
	int sum;

	scanf("%d",&N);
	for(i=0; i<N-1; i++) scanf("%d",&B[i]);

	sum=0;
	sum += B[0];
	for(i=0; i<N-2; i++){
		int data = min(B[i],B[i+1]);
		sum += data;
	}
	sum += B[N-2];

	printf("%d\n",sum );
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N; cin >> N;
  if(N<=999) cout << "ABC" << endl;
  else cout << "ABD" << endl;
  return 0;
}


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


int main() {
  int a,b;
  cin >> a >>b;
  string s(a,'0'+b),t(b,'0'+a);
  string ans = min(s,t);
  cout << ans << endl;
  
}


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

int main(){
int N;
cin>>N;
vector<int>a(N);
vector<int>b(N-1);
for(int i=0;i<N-1;i++){
cin>>b[i];
}
a[0]=b[0];
a[N-1]=b[N-2];
for(int i=1;i<=N-2;i++){
   a[i]=min(b[i-1],b[i]);
}
int x=0;
for(int i=0;i<N;i++){
   x+=a[i];
}
cout<<x<<endl;
return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> C(8,0);
  int x=0,R=0;
  for(int i=0;i<N;i++){
    cin >> x;
    x /=400;
    if(x>7){
      R++;
    }else{
      C[x] ++;
    }
  }
  int count=0;
  for(int i=0;i<8;i++){
    if(C[i]>0){
      count ++;
    }
  }
  cout << max(count,1) << " " << count + R << endl;
}

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

using namespace std;

typedef long long ll;

int main(){
    ll n,a,b,c,d,e;
    cin>>n>>a>>b>>c>>d>>e;

    ll mi = min({a,b,c,d,e});

    if(n%mi==0)
        cout<<n/mi+4;
    else
        cout<<n/mi+5;
}


Measured memory_bytes: 256
a,b = map(int,input().split())

if((a<=0)and(0<=b)):
  ans = 'Zero'
elif((a>=0)and(b>=0)):
  ans = 'Positive'
elif((a<0)and(b<0)):
  if((b-a)%2 == 1):
    ans = 'Positive'
  else:
    ans = 'Negative'
print(ans)   

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}
using namespace std;
//using namespace __gnu_pbds;
#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
double PI=3.1415926535897932384626;
//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
#define bip(n) __builtin_popcount(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctz(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clz(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffs(n)//index of first one bit!!
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;

//#define fi1 ifstream fin("input.txt")
//#define of1 ofstream fout("output.txt")
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

#define fi first
#define se second

int main()
{
	int x,y,z,k;
	scanf("%d %d %d %d",&x,&y,&z,&k);
	vector<ll>xx,yy,zz,ans;
	for(int i=0;i<x;i++)
	{
		ll tmp;
		scanf("%lld",&tmp);
		xx.eb(tmp);
	}
	for(int i=0;i<y;i++)
	{
		ll tmp;
		scanf("%lld",&tmp);
		yy.eb(tmp);
	}
	for(int i=0;i<z;i++)
	{
		ll tmp;
		scanf("%lld",&tmp);
		zz.eb(tmp);
	}
	sort(xx.rbegin(),xx.rend());
	sort(yy.rbegin(),yy.rend());
	sort(zz.rbegin(),zz.rend());
	for(int i=0;i<x;i++)
	{
		for(int j=0;j<y;j++)
		{
			for(int m=0;m<z;m++)
			{
				if( ((i+1)*(j+1)*(m+1))>k )
					break;
				ans.eb(xx[i]+yy[j]+zz[m]);
			}
		}
	}
    sort(ans.rbegin(),ans.rend());
    int index=0;
	while(index<ans.size() && k>0)
	{
		printf("%lld\n",ans[index]);
		k--;
		index++;
	}
    return 0;
}


Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

//bit全探索
//引数は処理に応じて適宜追加
void bit_search(ll n, vll &a, vector<vector<vll>> &testim, priority_queue<ll> &cnt) {
  vll bits(0);
  for (ll i = 0; i < n; i++) bits.push_back(0);
  for (ll i = 0; i < pow(2, n); i++) {
    ll right = 0;
    for (ll j = 0; j < n; j++) {
      if (bits.at(j) == 1) {
        for (ll k = 0; k < a.at(j); k++) {
          ll x = testim.at(j).at(k).at(0), y = testim.at(j).at(k).at(1);
          if (bits.at(x - 1) != y) {
            right = 1;
            break;
          }
        }
      }
      if (right == 1) break;
      if (j == n - 1) {
        ll honest = 0;
        for (ll k = 0; k < n; k++)
          if (bits.at(k) == 1) honest++;
        cnt.push(honest);
      }
    }
    if (i == pow(2, n) - 1) return;
    ll x = 0;
    while (bits.at(n - 1 - x) == 1) {
      bits.at(n - 1 - x) = 0;
      x++;
    }
    bits.at(n - 1 - x) = 1;
  }
}

int main() {
  ll n;
  cin >> n;
  vll a(n);
  vector<vector<vll>> testim(n);
  for (ll i = 0; i < n; i++) {
    cin >> a.at(i);
    for (ll j = 0; j < a.at(i); j++) {
      ll x, y;
      cin >> x >> y;
      testim.at(i).push_back({x, y});
    }
  }
  priority_queue<ll> cnt;
  bit_search(n, a, testim, cnt);
  cout << cnt.top() << endl;
}

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

int main(){

  string S;
  cin >> S;

  if((S[0]==S[1]&&S[1]!=S[2]&&S[2]==S[3])||(S[0]==S[2]&&S[2]!=S[1]&&S[1]==S[3])||(S[0]==S[3]&&S[3]!=S[1]&&S[1]==S[2])){
    cout << "Yes" << endl;
  }
  else
    cout << "No" << endl;

  return 0;
}

    


Measured memory_bytes: 384
N = int(input())
X = input()

x_num = int(X, 2)
cnt1 = X.count('1')

p_zero = x_num % (cnt1 + 1)
p_one = (x_num % (cnt1 - 1) if cnt1 - 1 > 0 else 1)


def f(cnt):
    if (cnt > 0):
        pcount = p_count(cnt)
        return f(cnt % pcount) + 1
    else:
        return 0


def p_count(x):
    cnt = 0
    while (x > 0):
        if x % 2 != 0:
            cnt += 1
        x //= 2
    return cnt


def f1(x):
    cnt = 0
    while (x > 0):
        x %= bin(x).count('1')
        cnt += 1
    return cnt


for i, x in enumerate(list(X)):
    if (x == '1'):
        #x_num = int(''.join(X), 2)
        if cnt1 - 1 > 0:
            xxx = (p_one - pow(2, (N - (i + 1)), cnt1 - 1)) % (cnt1 - 1)
            xxx += cnt1 - 1 if xxx < 0 else 0
            print(f(xxx) + 1)
        else:
            print(0)
    else:
        #x_num = int(''.join(X), 2)
        xxx = (p_zero + pow(2, (N - (i + 1)), cnt1 + 1)) % (cnt1 + 1)
        xxx += cnt1 + 1 if xxx < 0 else 0
        print(f(xxx) + 1)

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j;
  //ll n; cin>>n;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //ll a,b,c,d,e,f; cin>>a>>b>>c;
  ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  ll buf = 0;
  ll buf2 = 0;
  ll buf3 = 0;
  bool judge = true;
  //cout<<<<endl;
  if(a+b>c+d)cout<<"Left"<<endl;
  else if(a+b==c+d)cout<<"Balanced"<<endl;
  else if(a+b<c+d)cout<<"Right"<<endl;

  /*
  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  for(i=0;i<n;i++){

  }
  */

  return 0;
}

Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC096
{
    public class QuestionC
    {
        public static void Main(string[] args)
        {
            var hw = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var h = hw[0];
            var w = hw[1];
            var s = Enumerable.Range(0, h).Select(i => Console.ReadLine().ToCharArray()).ToArray();

            var adjacents = new (int dx, int dy)[]
            {
                (0, -1),
                (-1, 0), (1, 0),
                (0, 1)
            };

            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if (s[i][j] == '.') continue;

                    var isOK = false;
                    foreach (var adjacent in adjacents)
                    {
                        var x = i + adjacent.dx;
                        if (x < 0 || h <= x) continue;
                        var y = j + adjacent.dy;
                        if (y < 0 || w <= y) continue;

                        if (s[x][y] == '#')
                        {
                            isOK = true;
                            break;
                        }
                    }

                    if (!isOK)
                    {
                        Console.WriteLine("No");
                        return;
                    }
                }
            }

            Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 28164
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    Map<String, Integer> map = new HashMap<>();
    String S = sc.next();
    String[] s = S.split("");
    for(int i=0; i<s.length; i++) {
        if(map.containsKey(s[i])) {
            map.put(s[i], map.get(s[i])+1);
        }else {
            map.put(s[i], 1);
        }
    }
    Map<String, Integer> mmap = new TreeMap<>();
    ArrayList<String> delete = new ArrayList<>();
    
    for(int x=1; x<n; x++) {
        S = sc.next();
        s = S.split("");
        mmap = new HashMap<>();
        for(int i=0; i<s.length; i++) {
            if(mmap.containsKey(s[i])) {
                mmap.put(s[i], mmap.get(s[i])+1);
            }else {
                mmap.put(s[i], 1);
            }
        }
        
        
        for(String key : map.keySet()) {
            if(mmap.containsKey(key)) {
                map.put(key, Math.min(map.get(key), mmap.get(key)));
            }else {
                delete.add(key);
            }
        }
    }
    
    if(delete.size() > 0) {
        for(String str : delete) {
            map.remove(str);
        }
    }
    
    String ans = "";
    for(String key : map.keySet()) {
        for(int i=0; i<map.get(key); i++) {
            ans += key;
        }
    }
    System.out.println(ans);
  }
}

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


int func(int x, int a) {
    if (x < a) {
        return 0;
    } else {
        return 10;
    }
}

int main() {
    int X, A;
    cin>>X>>A;
    cout << func(X, A) << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn usize() -> usize {
    read()
}

fn vec_usize(n: usize) -> Vec<usize> {
    let mut vec = Vec::new();
    for _ in 0..n {
        vec.push(usize())
    }
    vec
}

fn main() {
    let abc = vec_usize(3);
    let mut a = abc[0];
    let mut b = abc[1];
    let mut c = abc[2];

    let mut count = 0;
    while !(a == b && b == c) {
        if a < b && a < c {
            a += 2;
            count += 1;
            continue;
        }
        if b < a && b < c {
            b += 2;
            count += 1;
            continue;
        }
        if c < a && c < b {
            c += 2;
            count += 1;
            continue;
        }
        if a == b {
            a += 1;
            b += 1;
            count += 1;
            continue;
        }
        if b == c {
            b += 1;
            c += 1;
            count += 1;
            continue;
        }
        if c == a {
            c += 1;
            a += 1;
            count += 1;
            continue;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 2112
#include <stdio.h>
#define K 10001
#define N 2000001

void CountingSort(short *A, short *B, int n){
    int i;
    int Count[K];

    for(i=0; i<K; i++) Count[i] = 0;
    for(i=1; i<=n; i++) Count[A[i]]++;

    for(i=1; i<=K; i++) Count[i] += Count[i-1];
    for(i=n; i>0; i--){
        B[Count[A[i]]] = A[i];
        Count[A[i]]--;
    }
} 

int main(){
    int i,n;
    short A[N],B[N];

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

    CountingSort(A,B,n);

    for(i=1; i<=n; i++){
        printf("%d",B[i]);
        if(n-i) printf(" "); 
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 9592
# encoding:utf-8
import copy
import numpy as np
import random
# import pandas as pd
# import torch


s = list(str(input()))


count = [0,0]
for i in range(len(s)):
    count[int(s[i])] += 1

ans = 2*min(count[0],count[1])
#
print(ans)
# escape = False
# begin = len(s)
#
# def rem(s):
#     for i in range(1,len(s)):
#         # print(s)
#         if s[i-1] != s[i]:
#             s.pop(i)
#             s.pop(i-1)
#             break
#     return s
#
#
# pre = len(s)
# proceed = 0
# while proceed != pre:
#     pre = len(s)
#     s = rem(s)
#     after = len(s)
#
# end = len(s)
# print(begin-end)


Measured memory_bytes: 14760
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n):
    a+=list(input().split())
for i in range(m):
    b+=list(input().split())
for i in range(n):
    c=0
    for j in range(m):
        c+=int(a[(i*m+j)])*int(b[j])
    print(c)


Measured memory_bytes: 6076
n = int(input())
h = list(map(int, input().split()))

h.reverse()
c = [0] * n
for i in range(n - 1):
  if h[i] <= h[i + 1]:
    c[i + 1] = c[i] + 1
  else:
    c[i + 1] = 0

print(max(c))


Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>

using namespace std;

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

int main() {
    int N;
    cin >> N;
    vector<int> x(N + 1);
    vector<int> y(N + 1);
    vector<int> t(N + 1);

    x[0] = 0;
    y[0] = 0;
    t[0] = 0;
    rep(i, N) {
        cin >> t[i + 1] >> x[i + 1] >> y[i + 1];
    }

    int l;
    int _t;
    rep(i, N) {
        l = abs(x[i + 1] - x[i] + y[i + 1] - y[i]);
        _t = t[i + 1] - t[i];

        if (_t < l || _t % 2 != l % 2) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
  int a,b,c,d;cin>>a>>b>>c>>d;
  cout<<max(a*b,c*d)<<endl;
    return 0;
}

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

int main() {
 int n;
  cin>>n;
  double ans;
  double c=n;
  ans=((n+1)/2)/c;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>; 

ll fact(ll n){
    if(n == 0){
        return 1;
    }
    return n*fact(n-1);
}

int main() {
    ll N;
    cin >> N;
    vector<double> x(N), y(N);
    rep(i, N){
        cin >> x[i] >> y[i];
    }
    double sum = 0;

    vector<int> perm(N);
    iota(perm.begin(), perm.end(), 0);
    do{
        rep(i, N-1){
            sum += sqrt( (x[perm[i]]-x[perm[i+1]])*(x[perm[i]]-x[perm[i+1]]) + (y[perm[i]]-y[perm[i+1]])*(y[perm[i]]-y[perm[i+1]]) );
        }
    }while(next_permutation(perm.begin(), perm.end()));

    cout << fixed << setprecision(10);
    cout << sum / fact(N) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
const ll mod = 1000000007;
#define MAX_N 2200000
ll f[MAX_N+1];
ll invf[MAX_N+1];
ll modpow(ll  a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll nCm(ll n,ll m){return ((f[n]*invf[m])%mod)*invf[n-m]%mod;  }
signed main(){
    int n,a,b;cin >> n >> a >> b;
    int res = 1;
    int ans = modpow(2,n,mod) - 1;
    for(int shita = 1,ue = n-a+1;shita<=a;ue++,shita++){
        res = (res*ue)%mod;
        res = (res*modpow(shita,mod-2,mod))%mod;

    }
    ans -= res;
    res = 1;
    for(int shita = 1,ue = n-b+1;shita<=b;ue++,shita++){
        res = (res*ue)%mod;
        res = (res*modpow(shita,mod-2,mod))%mod;

    }
    ans -= res;
    cout << ((ans%mod)+mod)%mod << endl;



    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
// #define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 305;
ll arr[MAXN];
ld dp[MAXN][MAXN][MAXN];
ll n; 

ld rec(ll cnt1,ll cnt2,ll cnt3){
    if(cnt1 < 0 || cnt2 < 0 || cnt3 < 0) return 0;
    if(cnt1 == 0 && cnt2 == 0 && cnt3 == 0) return 0;

    ld &ans = dp[cnt1][cnt2][cnt3]; 
    if(ans >= 0) return ans;
    
    ans = 1.0 + cnt1*1.0*rec(cnt1-1,cnt2,cnt3)/n  + cnt2*1.0*rec(cnt1+1,cnt2-1,cnt3)/n + cnt3*1.0*rec(cnt1,cnt2+1,cnt3-1)/n;
    ans = ans * n*1.0/(cnt1+cnt2+cnt3);

    return ans;
}   

void solve(){
    cin>>n;

    FOR(i,0,n) FOR(j,0,n) FOR(k,0,n) dp[i][j][k] = -1;
    ll cnt1 = 0,cnt2 = 0,cnt3 = 0;
    FOR(i,1,n){
        cin>>arr[i];
        if(arr[i] == 1) cnt1++;
        else if(arr[i] == 2) cnt2++;
        else cnt3++;
    }

    ld ans = rec(cnt1,cnt2,cnt3);
    cout<<fixed<<setprecision(10)<<ans<<endl;
}

signed main(){


    ll t;
    t = 1; 
    // cin>>t;
    FOR(tt,1,t){
        solve();
    }
    
}

Measured memory_bytes: 219392
#include <iostream>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

ll a, b, c;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b >> c;
if(c - a - b <= 0){
	cout << "No" << endl;
	return 0;
}
if(4LL * a * b < (c - a - b) * (c - a - b)){
	cout << "Yes" << endl;
}
else{
	cout << "No" << endl;
}

return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define ALL(a) (a).begin(),(a).end()
#define EACH(e,v) for(auto& e:v)
#define SORT(v) sort(ALL(v))
#define PERM(v) SORT(v);for(bool c##p=1;c##p;c##p=next_permutation(ALL(v)))
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = 1000'000'007;

map<int,int> zip;
int unzip[112345678];

vector<int> vec[112345];
int compress(vector<int> &x) {
    sort(x.begin(), x.end());
    x.erase(unique(x.begin(),x.end()),x.end());
    for(int i = 0; i < x.size(); i++){
        zip[x[i]] = i;
        unzip[i] = x[i];
    }
    return x.size();
}
int pa[112345],ya[112345];
signed main(){
    int n,m;
    cin>>n>>m;
    rep(i,m){
        int p,y;
        cin>>p>>y;
        pa[i]=p,ya[i]=y;
        vec[p].push_back(y);
    }

    rep(i,112345){
        compress(vec[i]);
    }

    rep(i,m){
        printf("%06d",pa[i]);
        printf("%06d\n",zip[ya[i]]+1);
    }

 
}

Measured memory_bytes: 13312
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n, m := nextInt(), nextInt()
	if n == m {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
string s,tempa,tempb;
string code[51];
int n,maxcode;
bool flag;
int main(){
	while(1){
		maxcode=0;
		cin >>n;
		if(n==0)break;
		for(int i=0;i<n;i++){
			cin >>s;
			code[i]+=s[0];
			for(int j=0;j<s.size()-1;j++){
				if(s[j]=='a'||s[j]=='i'||s[j]=='u'||s[j]=='e'||s[j]=='o'){
					code[i]+=s[j+1];
				}
			}
			if(maxcode<code[i].size())maxcode=code[i].size();
		}
		int k=0;
		while(1){
			k++;
			flag=false;
			if(k>maxcode){
				k=-1;
				break;
			}
			for(int i=0;i<n-1;i++){
				for(int j=i+1;j<n;j++){
					tempa=code[i].substr(0,k);
					tempb=code[j].substr(0,k);
					if(tempa==tempb)flag=true;
				}
			}
			if(!flag)break;
		}
		cout<< k<<endl;
		for(int i=0;i<n;i++){
			code[i].clear();
		}
	}
}

Measured memory_bytes: 3120
#include <iostream>

using namespace std;

int main(void){
  int d;
  
  cin >> d;
  
  if(d == 25) cout << "Christmas" << endl;
  else if(d == 24) cout << "Christmas Eve" << endl;
  else if(d == 23) cout << "Christmas Eve Eve" << endl;
  else if(d == 22) cout << "Christmas Eve Eve Eve" << endl;
  
  return 0;
}

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

using namespace std;

int main(){
	string s;
	cin >> s;
	int a=0,b=0;
	
	for(int i = 0;i < s.length();i++){
		if(s[i] == '0'){
			a++;
		}else{
			b++;
		}
	}
	
	if(a > b){
		cout << b*2 << endl;
	}else{
		cout << a*2 << endl;
	}
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


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

	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());

	if (s<t) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n= sc.nextInt(); 
    int x = sc.nextInt(); 

    int[] nums = new int[n];

    for(int i = 0; i < n; i++){
        nums[i] = sc.nextInt();
    }

    Arrays.sort(nums);

    int ans = 0;

    for(int i = 0; i < n; i++){
        if(x < nums[i]){
            break;
        }
        ans++;
        x -= nums[i];
    }
    if(ans == n && x > 0){
        ans--;
    }

    System.out.println(ans);

    
   
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

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

int main() {
    int a, b;
    cin >> a >> b;
    cout << max({a+b, a-b, a*b}) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
int main()
{
    string s; cin>>s;
    int c[100010];
    int n=s.size();
    c[0]=0;
    for(int i=0; i<n; i++){
        if(s[i]=='a') c[i+1]=(c[i]+1)%3;
        else c[i+1]=(c[i]+2)%3;
    }
    int nx[2][100010];
    int p[3][100010];
    for(int j=0; j<3; j++) p[j][n]=n;
    int mn[100010];
    mn[n]=n+1;
    for(int i=n-1; i>=0; i--){
        for(int j=0; j<3; j++) p[j][i]=p[j][i+1];
        p[c[i]][i]=i;
        mn[i]=mn[i+1];
        if(i<n-1 && s[i]==s[i+1]) mn[i]=i+2;
        if(s[i]=='a'){
            nx[0][i]=i+1;
            if(mn[i]<=n) nx[1][i]=p[(c[i]+2)%3][mn[i]];
            else nx[1][i]=n+1;
        }else{
            nx[1][i]=i+1;
            if(mn[i]<=n) nx[0][i]=p[(c[i]+1)%3][mn[i]];
            else nx[0][i]=n+1;
        }
    }
    ll dp[2][100010]={};
    dp[0][0]=1;
    ll ans=0;
    for(int i=0; i<n; i++){
        //cout<<nx[0][i]<<" "<<nx[1][i]<<endl;
        int x=(c[n]-c[i]+3)%3;
      if(x!=0) (ans+=dp[1][i])%=MOD;
      if(x!=0 && (i==n-1 || mn[i]<=n)) (ans+=dp[0][i])%=MOD;
      else if(mn[i]>n && i>0 && s[i]==s[i-1]) (ans+=(n-i-1)/2)%=MOD;
      //cerr<<mn[i]<<endl;
      //cerr<<dp[0][i]<<endl;
        if(nx[0][i]<n){
          if(nx[0][i]==i+1){
            (dp[0][nx[0][i]]+=dp[0][i])%=MOD;
            (dp[1][nx[0][i]]+=dp[1][i])%=MOD;
          }else{
            (dp[1][nx[0][i]]+=dp[0][i])%=MOD;
            (dp[1][nx[0][i]]+=dp[1][i])%=MOD;
          }
        }
        if(nx[1][i]<n){
          if(nx[1][i]==i+1){
            (dp[0][nx[1][i]]+=dp[0][i])%=MOD;
            (dp[1][nx[1][i]]+=dp[1][i])%=MOD;
          }else{
            (dp[1][nx[1][i]]+=dp[0][i])%=MOD;
            (dp[1][nx[1][i]]+=dp[1][i])%=MOD;
          }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
              divisors.append(n//i)
    divisors.sort()
    return divisors
  
ans=0
count=1
factor=make_divisors(N)

#print(factor)
factor.remove(N)
for f in factor:
  if f==N%((N-f)//f):
    ans+=(N-f)//f
print(ans)

Measured memory_bytes: 3296
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 998244353;

ll powmod(ll n, ll k) {
    ll r = 1, t = n % P;
    for (; k != 0; k /= 2) {
        if (k & 1) r = r * t % P;
        t = t * t % P;
    }
    return r;
}
ll modinv(ll n) {
    return powmod(n, P - 2);
}

vector<int> f0, f1;
void init(int n) {
    f0.resize(n + 1);
    f0[0] = 1;
    for (int i = 1; i <= n; i++) {
        f0[i] = (ll)f0[i - 1] * i % P;
    }
    f1.resize(n + 1);
    f1[n] = modinv(f0[n]);
    for (int i = n; i > 0; i--) {
        f1[i - 1] = (ll)f1[i] * i % P;
    }
}
ll fact(int k) {
    return f0[k];
}
ll comb(int n, int k) {
    if (n < k || k < 0) return 0;
    return (ll)f0[n] * f1[k] % P * f1[n - k] % P;
}

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

    init(n);

    ll r = 0;
    for (int i = 0; i <= k; i++) {
        r += comb(n - 1, i) * powmod(m - 1, n - 1 - i) % P;
    }

    cout << r % P * m % P << endl;

    return 0;
}

Measured memory_bytes: 4756
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;

int main(){
    
    double r; // Need to be double or one with higher precision. 'int' does not work because r is a real number (not an integer).
             // float may not work for every case.
    cin >> r;
    
    cout << fixed << setprecision(6);
    cout << r*r*M_PI << " " << 2*M_PI*r;
    
    return 0;
    
}


Measured memory_bytes: 3264