akhauriyash/Code-Regression huggingface dataset:
#include <climits>
#include <cstring>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_set>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <fstream>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define f first
#define s second

#define MM INT_MAX/5
#define MIM INT_MIN/2

int di[] = { 1,-1,0,0 };
int dj[] = { 0,0,1,-1 };

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define v vector
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

#define MAX 3000

int N;
double dp[MAX][MAX];

int main()
{
	cin >> N;
	vector<double> coinsH(N);
	vector<double> coinsT(N);
	double h1;
	for (int i = 0; i < N; i++)
	{
		cin >> h1;
		coinsH[i] = h1;
		coinsT[i] = 1 - h1;
	}
	dp[0][0] = 1;
	for (int i = 0; i < N; i++)
		for (int j = 0; j <= i; j++)
		{
			dp[i + 1][j] += dp[i][j] * coinsT[i];
			dp[i + 1][j + 1] += dp[i][j] * coinsH[i];
		}
	int mini = ceil((double)N/2);
	double ans = 0;
	for (int i = mini; i <= N; i++)
		ans += dp[N][i];
	cout << fixed;
	cout << setprecision(9);
	cout << ans;
}


Measured memory_bytes: 68992
#include <iostream>
using namespace std;
int main()
{
	int t;


	while(true){
		int n,s,f;
		int sum=0;

		cin >> t;

		if(t==0)
			break;

	
		cin >> n;
		for(int i=0 ;i<n ;i++){
			cin >> s >> f;
			
			sum += f-s;

		}

		if(sum >= t)
			cout << "OK" << endl;

		else if(sum < t)
			cout << t - sum << endl;

	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define pb emplace_back
#define ll long long
#define mp make_pair
#define PI acos(-1)
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll i,j,k,x,y,z,m,t,n,b,c,d,a,l,r;
    cin>>n>>m;
    ll cnt=0;
    while(n)
    {
        cnt++;
        n/=m;
    }
    cout<<cnt<<'\n';
}














Measured memory_bytes: 3556
use std::io::*;
use std::str::*;
use std::collections::*;

fn read<'a, T: FromStr>(stdin: &mut BufReader<StdinLock<'a>>) -> Option<T> {
    let s: String = stdin
        .bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    if s.is_empty() {
        None
    } else {
        s.parse::<T>().ok()
    }
}

fn main() {
    let stdin = stdin();
    let mut stdin = BufReader::new(stdin.lock());
    while let Some(x) = read(&mut stdin) {
        let y: usize = read(&mut stdin).unwrap();
        let z: usize = read(&mut stdin).unwrap();
        let n = x + y + z;

        let mut v: Vec<(i64, i64, i64)> = (0..n).map(|_| {
            (read(&mut stdin).unwrap(),
             read(&mut stdin).unwrap(),
             read(&mut stdin).unwrap())
        }).collect();
        v.sort_by_key(|&(a, b, _)| b - a);

        let a = v.iter().map(|&(a, _, _)| a).collect::<Vec<_>>();
        let b = v.iter().map(|&(_, b, _)| b).collect::<Vec<_>>();
        let c = v.iter().map(|&(_, _, c)| c).collect::<Vec<_>>();

        let mut opt_l = vec![i64::min_value() / 10; n];
        let mut opt_r = vec![i64::min_value() / 10; n];

        let mut q = BinaryHeap::new(); // q に含まれる <-> a を選んでる
        let mut sum = 0;
        for i in 0..n {
            q.push((c[i] - a[i], i));
            sum += a[i];
            if q.len() > x {
                let (_, i) = q.pop().unwrap();
                sum -= a[i];
                sum += c[i];
            }
            if q.len() == x {
                opt_l[i] = sum;
            }
        }

        let mut q = BinaryHeap::new();
        let mut sum = 0;
        for i in (0..n).rev() {
            q.push((c[i] - b[i], i));
            sum += b[i];
            if q.len() > y {
                let (_, i) = q.pop().unwrap();
                sum -= b[i];
                sum += c[i];
            }
            if q.len() == y {
                opt_r[i] = sum;
            }
        }

        // println!("{:?}", v);
        // println!("{:?}", opt_l);
        // println!("{:?}", opt_r);

        let opt = (0..n-1).map(|i| {
            opt_l[i] + opt_r[i + 1]
        }).max().unwrap();

        println!("{}", opt);
    }
}


Measured memory_bytes: 16636
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.EducationalDP
{
    class F
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string s = Read();
            string t = Read();
            int[,] dp = new int[s.Length, t.Length];
            if (s[0] == t[0]) dp[0, 0] = 1;
            for(int i = 1; i < s.Length; i++)
            {
                if (s[i] == t[0]) dp[i, 0] = 1;
                else dp[i, 0] = dp[i - 1, 0];
            }
            for (int i = 1; i < t.Length; i++)
            {
                if (s[0] == t[i]) dp[0, i] = 1;
                else dp[0, i] = dp[0, i - 1];
            }
            for (int i = 1; i < s.Length; i++)
            {
                for(int j = 1; j < t.Length; j++)
                {
                    if (s[i] == t[j]) dp[i, j] = dp[i - 1, j - 1] + 1;
                    else dp[i, j] = Math.Max(dp[i, j - 1], dp[i - 1, j]);
                }
            }
            /*for(int i = 0; i < s.Length; i++)
            {
                for(int j = 0; j < t.Length; j++)
                {
                    Console.Write(dp[i, j]);
                }
                Console.WriteLine();
            }*/
            Console.WriteLine(GetLCS(s, t, dp, s.Length - 1, t.Length - 1));
            //Console.WriteLine(GetLCS(s, t, dp, s.Length - 1, t.Length - 1));
        }

        static char[] GetLCS(string s, string t, int[,] dp, int i, int j)
        {
            List<char> str = new List<char>();
            while (i >= 0 && j >= 0)
            {
                if (j > 0 && dp[i, j] == dp[i, j - 1])
                {
                    j--;
                }
                else if (i > 0 && dp[i, j] == dp[i - 1, j])
                {
                    i--;
                }
                else
                {
                    if (dp[i, j] > 0) str.Add(s[i]);
                    i--;
                    j--;
                }
            }
            str.Reverse();
            return str.ToArray();
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int main() {
  int n,m,x; cin >> n >> m >> x;
  int c[12],a[12][12];
  for(int i = 0;i < n;i++) {
    cin >> c[i];
    for(int j = 0;j < m;j++) { cin >> a[i][j]; }
  }

  vector< vector<int> > mat(1,vector<int>(n,0));
  int ans = 0, check = 0, r, sum = 0;

  vector<int> vec(m,0);
  for(int i = 0;i < n;i++) {
    for(int j = 0;j < m;j++) { vec[j] += a[i][j]; }
    ans += c[i];
  } // for each book

  for(int i = 0;i < m;i++) {
    if(vec[i] < x) { cout << -1 << endl; return 0; }
  }

  for(int i = 0;i < n;i++) {
    int msize = (int)mat.size();
    for(int j = 0;j < msize;j++) {
      vector<int> vec0 = mat[j];
      vec0[i] = 1;
      mat.push_back(vec0);
    } // for all matrix
  }

  for(int i = 0;i < (int)mat.size();i++) {
    check = 1;
    for(int j = 0;j < m;j++) {
      r = 0;
      for(int k = 0;k < n;k++) { r += mat[i][k] * a[k][j]; } // for all books
      if(r < x) { check = -1; break; }
    } // for all elements

    if(check == -1) { continue; }

    if(check == 1) {
      sum = 0;
      for(int j = 0;j < n;j++) { sum += mat[i][j] * c[j]; }
    }

    if(ans > sum) { ans = sum; }
  } // for all combination

  cout << ans << endl; 

  return 0;
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int a, b;
    cin >> a >> b;
    if (a + b == 15){
        cout << "+" << endl;
    }
    else if(a * b == 15){
        cout << "*" << endl;
    }
    else {
        cout << "x" << endl;
    }
}


Measured memory_bytes: 256
S = input()
N = len(S)

from collections import Counter
chars = [chr(i) for i in range(ord('a'), ord('z')+1)]

def check(arr):
    e = arr[0]
    return len(arr) == arr.count(e)


ans = float('inf')
for c in chars:
    cnt = 0
    t = S
    while not check(t):
        u = ''
        for i in range(len(t)-1):
            if t[i] == c or t[i+1] == c:
                u += c
            else:
                u += t[i]
        cnt += 1
        t = u
    ans = min(ans, cnt)

print(ans)

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

typedef long long ll;
int h[100005][3], dp[100005][4], N;

int calc(int lvl, int prev) {
    if(lvl == N) return 0;
    if(dp[lvl][prev] != 0) return dp[lvl][prev];
    
    for(int i = 0; i < 3; i++) {
        if(i == prev) continue;
        dp[lvl][prev] = max(dp[lvl][prev], calc(lvl + 1, i) + h[lvl][i]);
    }

    return dp[lvl][prev];
}

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

    for(int i = 0; i < N; i++)
        cin >> h[i][0] >> h[i][1] >> h[i][2];

    cout << calc(0, 3) << "\n";

    return 0;
}


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

int main() {
  
  int N;
  cin >> N;
  vector<double> A(N);
  double K;
  double num = 0.0;
  
  for(int i = 0;i < N;++i){
    cin >> A[i];
  }
  
  for(int i = 0;i < N;++i){
    K = 1 / A[i];
    num = num + K;
  }

  cout << 1 / num << endl;
}


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

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

map<int,pair<int,int>> A;
int calcMagic(int a,int b,int c,int d){
  int cnt=abs(a-c)+abs(b-d);
  return cnt;
}

/*int magic(int p,int q, int r){
  if(p==q)return 0;
  int a,b,c,d;
  a=A[p].first;
  b=A[p].second;
  c=A[p+r].first;
  d=A[p+r].second;
  return calcMagic(a,b,c,d)+magic(p+r,q,r);
}*/

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int H,W,D;
  cin >> H >> W >> D;

  int a;
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cin >> a;
      A[a]=make_pair(i,j);
      //cout << A[a].first << " " << A[a].second << endl;
    }
  }
  int dp[900100]={0};
  dp[0]=0;
  for(int i=0;i<=H*W;i++){
    dp[i+D]=dp[i]+calcMagic(A[i].first,A[i].second,A[i+D].first,A[i+D].second);
  }

  int Q;
  cin >> Q;
  for(int i=1;i<=Q;i++){
    int l,r;
    cin >> l >> r;
    int ans=dp[r]-dp[l];
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 15232
a, b, c = map(int, input().split())
d = 0 + abs(b - a) + abs(c - b)
e = 0 + abs(c - a) + abs(b - c)
f = 0 + abs(a - b) + abs(c - a)
g = 0 + abs(c - b) + abs(a - c)
h = 0 + abs(a - c) + abs(b - a)
i = 0 + abs(b - c) + abs(a - b)
print(min(d, e, f, g, h, i))

Measured memory_bytes: 3064
#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>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#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>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#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>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
// const ll mod = 1000000007;
const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

bool solve(){
  ll a,b,c;cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<" "<<b<<" "<<c<<endl;
  return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(30);
  solve();
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

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

		// 入力
		int n = sc.nextInt();// N

		ArrayList<Integer> numList = new ArrayList<Integer>();
		for(int i = 0; i < n; i++){
			numList.add(sc.nextInt());
		}

		// ソート（降順）
		Collections.sort(numList, Collections.reverseOrder());

		// 奇数回ならAliceに加点。偶数回ならBobに加点
		int alice = 0;
		int bob = 0;

		for(int i = 0; i < n; i++){
			int point = numList.get(i);
			if(i%2 == 0){
				alice = alice + point; //奇数回 i = 0,2,4,・・・
				//System.out.println("aliceに" + point + "加算");
			}else{
				bob = bob + point; //偶数回 i = 1,3,5,・・・
				//System.out.println("bobに" + point + "加算");
			}
		}

		// 出力
		System.out.println(alice - bob);
	}
}




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

object Main extends App {

  val n = readInt()
  val A = readLine().split(" ").map(_.toInt)

  def solve() = {
    var curMoney = 1000L
    for(i <- 0 until n-1) {
      if(A(i) < A(i+1)) {
        val stock = curMoney / A(i)
        curMoney %= A(i)
        curMoney += stock * A(i+1)
      }
    }
    curMoney
  }


  println(solve())

}



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

int main() {
  int K;
  cin >> K;

  ll s = 7;
  ll digit = 1;
  ll cnt = 1;
  set<ll> mem;
  for (int i = 0; i < 100000000; i++) {
    if (s % K == 0) {
      cout << cnt << endl;
      return 0;
    }
    digit *= 10;
    digit %= K;
    s += digit * 7;
    s %= K;
    cnt++;
    if (mem.count(s) != 0) {
      cout << -1 << endl;
      return 0;
    }
    mem.insert(s);
  }
}


Measured memory_bytes: 50500
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>

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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int main()
{
    string S;
    cin >> S;
    vector<int> rl;
    vector<int> ans(S.length(), 0);

    rep(i, S.length() - 1) {
        if(S[i] == 'R' && S[i + 1] == 'L') {
            rl.push_back(i);
            IFD cout << i << " ";
        }
    }
    IFD cout << endl;

    rep(i, S.length()) {
        int idx = lower_bound(rl.begin(), rl.end(), i) - rl.begin();
        if(S[i] == 'L') {
            idx--;
        }
        int v = rl[idx];
        IFD cout << S[i] << v << " ";
        if(abs(i - v) % 2 == 0) {
            IFD cout << "(v) ";
            ans[v] += 1;
        } else {
            IFD cout << "(v+1) ";
            ans[v + 1] += 1;
        }
    }
    IFD cout << endl;

    rep(i, S.length()) {
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1280
n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)
res = 10 ** 10
tmp_sum = 0
for i in range(n - 1):
    tmp_sum += a[i]
    res = min(res, abs(tmp_sum - (sum_a - tmp_sum)))

print(res)


Measured memory_bytes: 30688
#include <stdio.h>

int main(void) {
    int a, b;
    int max;

    scanf("%d %d", &a, &b);

    max = a+b;
    if (max < a-b) {
        max = a-b;
    }
    if (max < a*b) {
        max = a*b;
    }

    printf("%d\n", max);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2

ll gcd(ll a, ll b) {
	if (a == 0 || b == 0)return 0;
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	if (a == 0 || b == 0) return 0;
	ll g = gcd(a, b);
	return (a / g) * b;
}
int main() {
	ll A, B, C, D;
	cin >> A >> B >> C >> D;
	ll nC = (B / C) - ((A - 1) / C);
	ll nD = (B / D) - ((A - 1) / D);
	ll nCD = (B / lcm(C, D)) - ((A - 1) / lcm(C, D));
	ll tot = B - A + 1;
	cout << tot - (nC + nD - nCD) << endl;

	return 0;
}


Measured memory_bytes: 256
h, w = gets.split.map(&:to_i)
s = Array.new(h) { Array.new(w) }
(0..h-1).each do |i|
  s[i] = gets.chomp.split("")
end

$h = h
$w = w
$s = s

def is_black?(a, b)
  unless a >= 0 && a < $h
    return false
  end

  unless b >= 0 && b < $w
    return false
  end

  if $s[a][b] == "."
     return false
  end

  true
end

answer = true
(0..h-1).each do |i|
  unless answer
    break
  end
  (0..w-1).each do |j|
    if s[i][j] == "#"
      unless is_black?(i-1,j) || is_black?(i+1, j) || is_black?(i, j-1) || is_black?(i, j+1)
        answer = false
        break
      end
    end
  end
end

puts answer ? "Yes" : "No"

Measured memory_bytes: 2044
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////

int main() {
  string s, t; cin >> s >> t;
  cout << (s == t.substr(0, t.size()-1)? "Yes": "No") << endl;
  return 0;
}

// EOF


Measured memory_bytes: 3616
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;

int main() {
	int x, glad = 0;
	cin >> x;
	while (x >= 500) {
		glad += 1000;
		x -= 500;
	}
	while (x >= 5) {
		glad += 5;
		x -= 5;
	}
	cout << glad << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		while (reader.hasNextInt()) {
			list.add(reader.nextInt());
		}
		String result = "No";

		if (!(list.size() != n || n < 3 || 10 < n)) {
			int largest = list.get(0);
			int index = 0;
			for (int i = 1; i < list.size(); i++) {
				if (largest < list.get(i)) {
					largest = list.get(i);
					index = i;
				}
			}
			int sum = 0;
			for (int j = 0; j < list.size(); j++) {
				if (index != j) {
					sum += list.get(j);
				}
			}
			if (largest < sum) {
				result = "Yes";
			}
		}

		System.out.print(result);
		reader.close();
	}
}


Measured memory_bytes: 23252
#include <iostream>
#include <cstdio>
#define ll long long
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
const int N = 310;
int n,k,mod;
ll C[N][N],f[N][N],sf[N][N];
int main()
{
	n = read(); k = read(); mod = read();
	for(int i = 0;i <= n;i ++)
	{
		C[i][0] = 1;
		for(int j = 1;j <= i;j ++) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
	}
	for(int j = 0;j <= k;j ++) f[1][j] = 1,sf[1][j] = k - j + 1;
	for(int i = 2;i <= n + 1;i ++)
	{
		for(int j = 0;j <= k;j ++) 
			for(int siz = 1;siz <= i - 1;siz ++) 
				f[i][j] = (f[i][j] + f[i - siz][j] * sf[siz][j + 1] % mod * C[i - 2][siz - 1] % mod) % mod;
		sf[i][k] = f[i][k];
		for(int j = k - 1;j >= 1;j --) sf[i][j] = (sf[i][j + 1] + f[i][j]) % mod;
	}
	cout << f[n + 1][0] << "\n"; return 0;
}

Measured memory_bytes: 2432
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
    List<int> numsList = new List<int>();
		int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
    int[] answers = new int[n];
    bool answerExist = false;

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

    for(int i = 0; i < n; i++)
    {
      answerExist = false;
      for(int j = n-1-i; j >= 0; j--)
      {
        if(numsList[j] == j+1)
        {
          answers[n-1-i] = j+1;
          //Console.WriteLine(j+1);
          answerExist = true;
          numsList.RemoveAt(j);
          break;
        }
      }
      if(!answerExist)
      {
        break;
      }
    }

    if(answerExist)
    {
      var answerText = new StringBuilder();
      for(long i = 0; i < answers.Length; i++)
      {
        answerText.AppendLine(answers[i].ToString());
      }
      Console.Write(answerText);
    }else Console.Write(-1);
    
	}
}

Measured memory_bytes: 13140
#include<stdio.h>
#include<string.h>
int main(void){
int A,B,C,D,E,N,M,x,y,cou=0,cou2,v[1000000],w[1000000],min_i,en=0;
    char S[20],W[100],s[10],X,Y;
   scanf("%d %d %d",&A,&B,&C);
   if(A==C){
       cou++;
   }
   if(A==B){
       cou++;
   }
   if(B==C){
       cou++;
   }
   if(cou==1){
       printf("2");
   }else if((cou==2)||(cou==3)){
       printf("1");
   }else{
       printf("3");
   }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 998244353
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;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
struct edge{//グラフに使うヤツ
    ll from,to,cost;
};
typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main(){
    ll x,y;
    cin >> x >> y;
    if (y%2==1){
        cout << "No" << endl;
    }else{
        if (x*2<=y and x*4>=y){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

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

int arr[100010][3] = {0};
int dp[100010][3] = {0};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	while(t != 0) {
	    int n;
        cin >> n;
        for(int i = 1; i <= n; i++) {
            cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
        }
        dp[1][0] = arr[1][0];
        dp[1][1] = arr[1][1];
        dp[1][2] = arr[1][2];

        for(int i = 2; i <= n; i++) {
            dp[i][0] = arr[i][0] + max(dp[i-1][1], dp[i-1][2]);
            dp[i][1] = arr[i][1] + max(dp[i-1][0], dp[i-1][2]);
            dp[i][2] = arr[i][2] + max(dp[i-1][0], dp[i-1][1]);
        }
        // for(int i = 1; i <= n; i++) {
        //     for(int j = 0; j <= 2; j++) {
        //         cout << dp[i][j] << " ";
        //     }
        //     cout << "\n";
        // }
        cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << "\n";
	    t--;
	}
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file
#else

#endif


const int MAXN = 1e6+10;
const int INF = 1e6;


int H, W;
vector<int> aa[MAXN];
vector<int> pp[MAXN];


bool isinside(int i, int j) {
    if (i < 0 or i >= H) return false;
    if (j < 0 or j >= W) return false;
    return true;
}


int tonum(int i, int j) {
    return i*W + j;
}

void amica(int u, int v, int p) {
    aa[u].push_back(v);
    pp[u].push_back(p);
    aa[v].push_back(u);
    pp[v].push_back(p);
}


vector<pair<int,int>> dd = {{0,1}, {0,-1}, {1,0}, {-1,0}};



int bfs(int start, int end) {
    //~ cout << start << " " << end << endl;
    vector<int> dist(H*W, INF);
    vector<bool> done(H*W, false);
    priority_queue<pair<int,int>> bfs;
    bfs.push({0,start});
    dist[start] = 0;
    while (!bfs.empty()) {
        int u = bfs.top().second;
        bfs.pop();
        if (done[u]) continue;
        done[u] = true;
        //~ cout << u << " " << dist[u] << endl;
        for (int i = 0; i < (int)aa[u].size(); i++) {
            int a = aa[u][i], p = pp[u][i];
            //~ cout << u << " " << a << " " << p << endl;
            if (dist[a] > dist[u] + p) {
                dist[a] = dist[u]+p;
                bfs.push({-dist[a], a});
            }
        }
    }
    if (dist[end] == INF) return -1;
    return dist[end];
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Togliere nei problemi con query online

    cin >> H >> W;
    int Cx, Cy, Dx, Dy;
    cin >> Cx >> Cy >> Dx >> Dy;
    Cx--, Cy--, Dx--, Dy--;
    vector<vector<char>> grid(H,vector<char>(W));
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> grid[i][j];
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (grid[i][j] == '#') continue;
            int u = tonum(i, j);
            for (auto pp : dd) {
                int di = pp.first, dj = pp.second;
                if (!isinside(i+di, j+dj)) continue;
                if (grid[i+di][j+dj] == '#') continue;
                int v = tonum(i+di, j+dj);
                amica(u,v,0);
            }
            for (int di = -2; di <= 2; di++) for (int dj = -2; dj <=2; dj++) {
                if (di == 0) if (dj == 1 or dj == -1) continue;
                if (dj == 0) if (di == 1 or di == -1) continue;
                if (!isinside(i+di, j+dj)) continue;
                if (grid[i+di][j+dj] == '#') continue;
                int v = tonum(i+di, j+dj);
                amica(u,v,1);
            }
        }
    }
    cout << bfs(tonum(Cx,Cy), tonum(Dx,Dy)) << "\n";
}



Measured memory_bytes: 203112
module Memoizable
	def memoize(name)
		original = "__original_#{name}__"
		([Class, Module].include?(self.class) ? self : self.class).class_eval {
			alias_method(original, name)
			private(original)
			cache = {}
			define_method(name){|*args|
				cache[args] ||= send(original, *args)
			}
		}
	end 
end
include Memoizable 

def f(x, y, z, carry, i)
	if i > x.size
		return carry == 0 ? 1 : 0
	end

	a = (x[-i] == ?? ? (0..9).to_a : [x[-i].to_i])
	a.delete(0) if i == x.size
	b = (y[-i] == ?? ? (0..9).to_a : [y[-i].to_i])
	b.delete(0) if i == y.size
	c = (z[-i] == ?? ? (0..9).to_a : [z[-i].to_i])
	c.delete(0) if i == z.size

	sum = 0
	a.each do |u|
		b.each do |v|
			c.each do |w|
				o = u + v - w + carry
				next if o % 10 > 0
				sum += f(x, y, z, o / 10, i + 1)
			end
		end
	end

	sum % 1_000_000_007
end

memoize :f

loop do
	x = gets.chomp
	break if x == "0"
	y = gets.chomp
	z = gets.chomp
	p f(x, y, z, 0, 1)
end

Measured memory_bytes: 9404
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int a,b,s;
	scanf("%d %d",&a,&b);
	if(a>b)
	{s=a;a--;}
	else
	{s=b;b--;}
	if(a>b)
	{s=s+a;a--;}
	else
	{s=s+b;b--;}
	printf("%d\n",s);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
Int powmod(Int x, Int y) {
    if (y == 0) return 1;
    if (y % 2 == 0) return powmod(x*x%MOD, y/2);
    return x*powmod(x*x%MOD, y/2)%MOD;
}
int main()
{
    COMinit();
    int N, A, B, C; cin >> N >> A >> B >> C;
    Int E = 0;
    Int A_AB = A * inv[A+B] % MOD;
    Int B_AB = B * inv[A+B] % MOD;
    Int A_AB_N = powmod(A_AB, N);
    Int B_AB_N = powmod(B_AB, N);
    Int A_AB_i = 1;
    Int B_AB_i = 1;
    for (int i = 0; i < N; i++) {
        // E += (N + i) * COM(N + i, N) * (A / (A + B))^N * (B / (A + B))^i;
        // E += (N + i) * COM(N + i, N) * (A / (A + B))^i * (B / (A + B))^N;
        E += (N + i) * COM(N + i - 1, N - 1) % MOD * A_AB_N % MOD * B_AB_i % MOD;
        E += (N + i) * COM(N + i - 1, N - 1) % MOD * A_AB_i % MOD * B_AB_N % MOD;
        E %= MOD;
        A_AB_i = A_AB_i * A_AB % MOD;
        B_AB_i = B_AB_i * B_AB % MOD;
    }
    cout << E * 100 % MOD * inv[100 - C] % MOD << '\n';
    return 0;
}

Measured memory_bytes: 12160
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <stdlib.h>
#include <tuple>
#include <iomanip>
#include <iterator>
#include <stdio.h>
#include <fstream>
#include <time.h>
using namespace std;
const double PI = 3.14159265358979323846;
const long long int MOD = 1000000000 + 7;

struct UnionFind {
    vector<int> parent;

    UnionFind(int N) : parent(N) {
        for (int i = 0; i < N; i++) {
            parent[i] = -1;
        }
    }

    int root(int i) {
        if (parent[i] < 0) {
            return i;
        }
        return (parent[i] = root(parent[i]));
    }

    bool unite(int from, int to) {
        int rx = root(from);
        int ry = root(to);
        if (rx != ry) {
            parent[ry] += parent[rx];
            parent[rx] = ry;

            return true;
        }
        else {
            return false;
        }
    }

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

    int treeSize(int x) {


        return -parent[root(x)];
    }
};

long long int modpow(long long int base, long long int pow, long long int mod) {
    if (pow == 1) {
        return base;
    }
    else if (pow == 0) {
        return 1;
    }

    if (pow % 2 == 0) {
        auto temp = modpow(base, pow / 2, mod);
        return (temp * temp) % mod;
    }
    else {
        return base * modpow(base, pow - 1, mod) % mod;
    }
}

long long int moddiv(long long int X, long long int Y, long long int mod) {
    auto fermatDiv = modpow(Y, mod - 2, mod);

    return (X * fermatDiv) % mod;
}

long long modCombination(long long left, long long right, long long int mod) {
    long long answer = 1;
    for (long long i = 0; i < right; i++) {
        answer = (answer * (left - i)) % mod;
        answer = moddiv(answer, (i + 1), mod);
    }

    return answer;
}

bool IsPrime(long long N) {
    if (N == 1) {
        return false;
    }
    for (long long i = 2; i * i <= N; i++) {
        if (N % i == 0) {
            return false;
        }
    }

    return true;
}



vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({ a, ex });
    }

    // 最後に残った数について
    if (N != 1) res.push_back({ N, 1 });
    return res;
}

long long euclid(long long a, long long b) {
    if (a > b) {
        long long temp = b;
        b = a;
        a = temp;
    }
    if (b % a == 0) {
        return a;
    }
    else {
        return euclid(a, b - a);
    }
}


int main() {
    int X, Y;
    cin >> X >> Y;
    if (Y % 2 != 0) {
        cout << "No" << endl;
    }
    else {
        if (Y >= X * 2 && Y <= X * 4) {
            cout << "Yes" << endl;
        }
        else {
           cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  ll N,K,S;
  cin >> N >> K >> S;
  if(S>=10000000)
  {
    rep(i,K)
    {
      cout << S << " ";
    }
    rep(i,N-K)
    {
      if(i!=N-K-1)
      {
        cout << 1  << " ";
      }
      else
      {
        cout << 1;
      }  
    }
    cout << endl;
  }
  else
  {
    rep(i,K)
    {
      cout << S << " ";
    }
    rep(i,N-K)
    {
      if(i!=N-K-1)
      {
        cout << 10000000  << " ";
      }
      else
      {
        cout << 10000000;
      }   
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#define inf 1e9+7
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl;
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;

const ll N=52;
 
ll n,k;
ll v[N];

ll lsum[N],rsum[N];

vector<ll> lminus[N];
vector<ll> rminus[N];

void lvec(){
    for(ll i=0;i<=n;i++){//左からiこ
        for(ll j=1;j<=i;j++){
            if(v[j]<0) lminus[i].pb(v[j]);
        }
        sort(lminus[i].begin(),lminus[i].end());
    }
}

void rvec(){//右からiこ
    for(ll i=n+1;i>0;i--){
        for(ll j=n;j>=i;j--){
            if(v[j]<0) rminus[i].pb(v[j]);
        }
        sort(rminus[i].begin(),rminus[i].end());
    }
}

vector<ll> mi[N][N];

void keisan(){
    for(ll i=0;i<=n;i++){
        for(ll j=n+1;j>i;j--){
            for(auto itr=lminus[i].begin();itr!=lminus[i].end();itr++){
                mi[i][j].pb(*itr);
            }
            for(auto itr=rminus[j].begin();itr!=rminus[j].end();itr++){
                mi[i][j].pb(*itr);
            }
            sort(mi[i][j].begin(),mi[i][j].end());
        }
    }
}

void lcount(){
    rep(i,N) lsum[i]=0;
    lsum[0]=0;
    lsum[1]=v[1];
    for(ll i=2;i<=n;i++){
        lsum[i]=lsum[i-1]+v[i];
    }
}
void rcount(){
    rep(i,N) rsum[i]=0;
    rsum[n+1]=0;
    rsum[n]=v[n];
    for(ll i=n-1;i>0;i--){
        rsum[i]=rsum[i+1]+v[i];
    }
}

void solve(){
    ll ans=0;
    for(ll a=0;a<=k;a++){
        for(ll b=0;b<=k && a+b<=min(n,k);b++){
          ll score=0;
            for(ll c=0;c<k-a-b && c<mi[a][n+1-b].size() ;c++){
               score-=mi[a][n+1-b][c];
            }
            score+=lsum[a];
            score+=rsum[n+1-b];
            ans=max(ans,score);
        }
    }
    kaku(ans);
}

int main(){
    cin >> n >>k;
    rep(i,n) cin >> v[i+1];
    lvec();
  rvec();
  keisan();
  lcount();
  rcount();
  solve();
}






Measured memory_bytes: 896
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <array>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(void) {
	string N;
	cin >> N;
	if (N[0] == N[2]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#pragma region Preparation
/* competitive programming */
#include "bits/stdc++.h"
using namespace std;

/* using */
// long
using ll = long long;
using ld = long double;
// vector
using vi = vector<int>;
using vd = vector<double>;
using vll = vector<ll>;
using vld = vector<ld>;
using vs = vector<string>;
using vi2 = vector<vector<int>>;
using vll2 = vector<vector<ll>>;

/* define */
// array
#define ari(x) array<int, x>
#define ard(x) array<double, x>
#define arll(x) array<ll, x>
#define arld(x) array<ld, x>
#define ars(x) array<string, x>
#define ari2(x, y) array<array<int, y>, x>
#define arll2(x, y) array<array<ll, y>, x>
// int -> ll
#define int ll // int -> ll
// push_back系
#define pb(x) push_back(x)    // push_back
#define eb(x) emplace_back(x) // emplace_back
// all range
#define all(x) x.begin(), x.end() // all_range
// gcd, lcm
#define gcd(x, y) __gcd(x, y)         // gcd
#define lcm(x, y) (x / gcd(x, y) * y) // lcm
// PI
#define PI M_PI // PI
// 大文字・小文字変換
#define cup(x) toupper(x)                                              // char_toupper
#define clow(x) tolower(x)                                             // char_tolower
#define strup(x) *transform(x.begin(), x.end(), x.begin(), ToUpper())  // string_toupper
#define strlow(x) *transform(x.begin(), x.end(), x.begin(), ToLower()) // string_tolower
// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

// 大文字・小文字変換
struct ToUpper
{
    char operator()(char c) { return toupper(c); }
};
struct ToLower
{
    char operator()(char c) { return tolower(c); }
};
#pragma endregion

#pragma region External variables
/* A・B問題用外部変数 */
ll a, b, c, d, x, y; // 基本変数
ll n, k;             // 範囲・長さ・整数用
ll L, R;             // 左、右
string s;            // 文字列用
#pragma endregion

/* main */
void Main(void)
{
    cin >> a >> b;
    if (a >= 13)
    {
        cout << b << endl;
    }
    else if (a >= 6)
    {
        cout << b / 2 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}

#pragma region main
signed main(void)
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0LL;
}
#pragma endregion


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

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



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

#define ll long long
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define MAX 1000000

vector<bool>prime(MAX, true);
vector<ll>fact(MAX);
vector<ll>factinv(MAX);

ll  fastpower(ll a, ll n)
{
	ll res = 1;
	while(n > 0)
	{
		if(n % 2 != 0)
		{
			res = (res * a) % MOD;
		}
		n /= 2;
		a=(a * a) % MOD;
	}
	return res;
}

void getprime()
{
	for(ll i = 2;i < MAX; i++)
	{
		if(prime[i-1])
		{
			for(ll j = i*i; j < MAX; j += i)
				prime[j-1] = false;
		}
	}
}

void getfact()
{
	fact[0] = 1;
	factinv[0] = 1;
	
	for(ll i = 1; i < MAX; i++)
		fact[i] = (fact[i-1] * i)%MOD;
	
	for(ll i = 1; i < MAX; i++)
		factinv[i] = (factinv[i-1] * fastpower(i, MOD -2) )%MOD;

}

int main()
{
  string s;
  cin>>s;
  if(s[0]=='7' || s[1]=='7' || s[2]=='7')
    cout<<"Yes";
  else
    cout<<"No";
	return 0;
}

Measured memory_bytes: 18864
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
  string s;
  ll tmp = 0;
  while (cin >> s) {
    if (tmp != 0) {
      cout << ' ';
      tmp++;
    } else {
      tmp++;
    }
    rep(i, s.size()) {
      ll n = s.at(i)-'A', m = s.at(i)-'a';
      if (0<=n && n<26) {
        char c = n+'a';
        cout << c;
      } else if (0<=m && m<26) {
        char c = m+'A';
        cout << c;
      } else {
        cout << s.at(i);
      }
    }
  }
  cout << endl;
}


Measured memory_bytes: 3212
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		int[] L = new int[N];
		for (int i = 0; i < N; i++) {
			L[i] = sc.nextInt();
		}
		sc.close();

		int cnt = 0; // 1回目は必ず含む
		int x = 0;
		while (true) {
			if (cnt >= N) {
				break;
			}

			if (x + L[cnt] <= X) {
				x = x + L[cnt];
				cnt++;
			} else {
				break;
			}
		}
		System.out.println(cnt + 1);
	}
}


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

int main(){
	int n;
	cin >> n;
	vector <int> A(n + 1, 0);
	vector <int> num(n + 1);
	for (int i = 1; i < n + 1; i++) {
		cin >> A[i];
	}
	for (int i = 1; i < n + 1; i++) {
		num[A[i]] = i;
	}
	for (int i = 1; i < n + 1; i++) {
		cout << num[i] << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
main()
{
  int A,B,C,D;
  cin>>A>>B>>C>>D;
 for(int i=0;i>=0;i++)
 {
 	C=C-B;
 	if(C<=0)
 	{
 		cout<<"Yes";
 		break;
	 }
	 A=A-D;
	 if(A<=0)
	 {
	 	cout<<"No";
	 	break;
	 }
  } 
}

Measured memory_bytes: 3588
import java.util.Scanner;



public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        while (x != 0 || y != 0) {
            if (x < y) {
                System.out.println(x + " " + y);
            } else {
                System.out.println(y + " " + x);
            }
            x = sc.nextInt();
            y = sc.nextInt();
        }

    }

}


Measured memory_bytes: 33872
N, A, B = map(int, input().split())
d = A - B if A > B else B - A
d2 = d // 2
d3 = d % 2
if d3 == 0:
  ans = d2
else:
  bigger = B
  smaller = A
  if A > B:
    bigger = A
    smaller = B
  shortest = smaller if N - bigger + 1 > smaller else N - bigger + 1
  ans = shortest + d2
  
  

print(ans)

Measured memory_bytes: 3060