akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on

int alphabet[26];
string S;

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

  for (int i = 0; i < S.size(); i++) {
    if ('a' <= S[i] && S[i] <= 'z') alphabet[S[i] - 'a']++;
  }

  bool f = true;
  for (int i = 0; i < 26; i++) {
    if (alphabet[i] == 0) {
      printf("%c", 'a' + i), f = false;
      break;
    }
  }
  if (f) cout << "None" << endl;

  return 0;
}


Measured memory_bytes: 512
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

// 無向グラフ
//人をグルーピングする。これが連結関係を表す。
//UNIONFIND. unite(a,b)でa,bのグループを結合する。大きいグループに小さいグループをくっつける。
//find(a)でaの根を求める。a自身が根の場合、-aとする。

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();
		UnionFind uf = new UnionFind(n);

		int[] deg = new int[100005];
		List<Integer>[] to = new List[n];
		for (int i = 0; i < n; i++) {
			to[i] = new ArrayList<>();
		}

		for (int i = 0; i < m; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			a--;
			b--;
			deg[a]++;
			deg[b]++;
			uf.unite(a, b);
		}

		for (int i = 0; i < k; i++) {
			int c = sc.nextInt();
			int d = sc.nextInt();
			c--;
			d--;
			to[c].add(d);
			to[d].add(c);

		}

		for (int i = 0; i < n; i++) {
			int ans = uf.size(i) - 1 - deg[i]; //友達は絶対に同じグループに属する
			for (int u : to[i]) {
				if (uf.same(i, u))
					ans--;
			}
			System.out.println(ans + " ");
		}
		return;

	}
}

class UnionFind {

	static int[] d;

	UnionFind(int n) {
		d = new int[n];
		Arrays.fill(d, -1);
	}

	public int find(int x) {
		if (d[x] < 0)
			return x;
		return d[x] = find(d[x]);
	}

	public boolean unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)
			return false;
		if (d[x] > d[y]) {
			d[x] += d[y];
			d[y] = x;
			return true;
		}
		d[y] += d[x];
		d[x] = y;
		return true;
	}

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

	public int size(int x) {
		return -d[find(x)];
	}

}


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


void bubbleSort(int *a, int n){
	int count = 0;
	for(int i = 0; i < n - 1; i++) {
		for(int j = 0; j < n - i - 1; j++) {
			if(a[j] > a[j+1]) {
				swap(a[j], a[j+1]);
				count++;
			}
		}
	}
	for(int i = 0; i < n - 1; i++)
		printf("%d ", a[i]);
	printf("%d\n", a[n-1]);
	printf("%d\n", count);
}

int main(){
	int n;
	scanf("%d", &n);
	int a[110] = {0};
	for(int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	bubbleSort(a, n);
}



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

int main(){
	int r, c, t, u;
	cin >> r >> c;
	int s[c+1];
	for(int i = 0; i < c+1; i++){
		s[i] = 0;
	}
	for(int i = 0; i < r; i++){
		t = 0;
		for(int j = 0; j < c; j++){
			cin >> u;
			t += u;
			s[j] += u;
			cout << u << " ";
		}
		cout << t << endl;
		s[c] += t;
	}
	for(int i = 0; i < c; i++){
		cout << s[i] << " ";
	}
	cout << s[c] << endl;
	return 0;
}

Measured memory_bytes: 3072
def charachange(ch, n):
    point =(ord(ch))
    point = point + n
    if point > 90:
        point = 64 + (point - 90)
    return chr(point)

N = int(input())
S = input()
result = ""
for i in range(len(S)):
    result += charachange(S[i], N)

print(result)    

Measured memory_bytes: 3060
// https://atcoder.jp/contests/abc140/tasks/abc140_a
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

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

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: i32
    };
    println!("{}", n*n*n);
}


Measured memory_bytes: 4352
import java.io.*;
import java.util.*;
class    Main    {
	public static void main(String[] args) 
	{
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		Scanner sc = new Scanner(System.in);
		//int n = in.nextInt();
		String s=sc.next();
		System.out.print(s.charAt(0));
		System.out.print(s.length()-2);
		System.out.println(s.charAt(s.length()-1));
		//System.out.println(s.charAt(0)+s.length()-2+s.charAt(s.length()-1));
		//w.println(n);
		w.close();
		sc.close();
	}
	static class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		public InputReader(InputStream st) {
			this.stream = st;
		}
		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
		
		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
		
	}
	
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
//#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

map<ll,ll> mp;
/*
void calc(ll keta, ll num, string s){
    keta--;

    if(keta == 0){
        ll tmp = stol(s);
        mp[tmp]++;
        return;
    }

    if(num == 0){
        calc(keta, 0, s + "0");
        calc(keta, 1, s + "1");
    }else if(num == 9){
        calc(keta, 8, s + "8");
        calc(keta, 9, s + "9");

    }else{
        calc(keta, num-1, s + to_string(num-1));
        calc(keta, num, s + to_string(num));
        calc(keta, num+1, s + to_string(num+1));
    }
}
*/


void calc2(ll keta, ll num, string s){
    
    ll tmp = stol(s);
    mp[tmp]++;
    
    keta++;

    if(keta == 10){
        return;
    }

    if(num == 0){
        calc2(keta, 0, s + "0");
        calc2(keta, 1, s + "1");
    }else if(num == 9){
        calc2(keta, 8, s + "8");
        calc2(keta, 9, s + "9");
    }else{
        calc2(keta, num-1, s + to_string(num-1));
        calc2(keta, num, s + to_string(num));
        calc2(keta, num+1, s + to_string(num+1));
    }
}


int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll K;
    cin >> K;

    ll keta = 0;

    calc2(0, 1, "1");
    calc2(0, 2, "2");
    calc2(0, 3, "3");
    calc2(0, 4, "4");
    calc2(0, 5, "5");
    calc2(0, 6, "6");
    calc2(0, 7, "7");
    calc2(0, 8, "8");
    calc2(0, 9, "9");

    ll count = 0;
    for(auto i: mp){
        count++;
        if(count == K){
            cout << i.first << endl;
            break;
        }
    }

}

Measured memory_bytes: 12672
#include<bits/stdc++.h>
using namespace std;
#define m 1000000007
main(){
long n,k;
long long value=0;
cin>>n>>k;
long arr[n];
for(int i=0;i<n;i++){
    cin>>arr[i];
}
for(int i=0;i<n;i++){
    for(int j=1;j<=n;j++){
        if(j<(n-i)){
        if(arr[i]>arr[(i+j)%n]){
            value=(value+((k%m)*((k+1)%m)/2))%m;
        }
        }
        else
        {
            if(arr[i]>arr[(i+j)%n]){
                value=(value+((k%m)*((k-1)%m)/2))%m;
            }
        }
    }
    
}
cout<<value%m;

}

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

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pi;
typedef long double ld;
typedef pair<long double, long double> pld;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll i, j, k, l;

    ll H, W, M;
    cin >> H >> W >> M;
    set<pair<ll, ll>> S;
    vll X(H, 0), Y(W, 0);
    for(i = 0; i < M; i++) {
        ll h, w;
        cin >> h >> w;
        h--, w--;
        X[h]++;
        Y[w]++;
        S.insert(pair<ll, ll>(h, w));
    }
    ll xmax = 0;
    ll ymax = 0;
    for(i = 0; i < H; i++) {
        xmax = max(xmax, X[i]);
    }
    for(i = 0; i < W; i++) {
        ymax = max(ymax, Y[i]);
    }
    vll vx(0), vy(0);
    for(i = 0; i < H; i++) {
        if(X[i] == xmax)
            vx.push_back(i);
    }
    for(i = 0; i < W; i++) {
        if(Y[i] == ymax)
            vy.push_back(i);
    }
    for(auto x : vx) {
        for(auto y : vy) {
            pair<ll, ll> t = pair<ll, ll>(x, y);
            auto itr = S.find(t);
            if(itr == S.end()) {
                cout << xmax + ymax << endl;
                return 0;
            }
        }
    }
    cout << xmax + ymax - 1 << endl;

    return 0;
}


Measured memory_bytes: 35016
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Sun Jan 27 17:47:15 2019
//
package main

import "fmt"

type pair struct {
	x, y int
}

func main() {
	var H, W int
	fmt.Scan(&H, &W)

	board := make([]string, H)
	for i := range board {
		fmt.Scan(&board[i])
	}

	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if board[i][j] == '#' {
				valid := false
				for _, p := range []pair{{0, -1}, {0, 1}, {-1, 0}, {1, 0}} {
					x, y := i+p.x, j+p.y
					if 0 <= x && x < H && 0 <= y && y < W {
						if board[x][y] == '#' {
							valid = true
						}
					}
				}
				if !valid {
					fmt.Println("No")
					return
				}
			}
		}
	}

	fmt.Println("Yes")
}


Measured memory_bytes: 512
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 ]) => {
        (1..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

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

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

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

fn main() {
    input!(
    s: String
    );
    let words = ["dream", "dreamer", "erase", "eraser"];
    let mut tmp: &str = &s;
    loop {
        for word in words.iter() {
            if tmp.ends_with(word) {
                let n = tmp.rfind(word).unwrap();
                tmp = &tmp[..n];
                break;
            }
            if *word == "eraser" {
                println!("NO");
                return;
            }
        }
        if tmp == "" {
            println!("YES");
            return;
        }
    }
}


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

using namespace std;

int main()
{
  int N;
  int ans[100000];
  char s[100001];
  
  scanf("%s", s);
  N = strlen(s);
  fill(ans, ans + N, 0);
  
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == 'R') {
      cnt++;
    }
    else {
      ans[i - 1] += (cnt + 1) / 2;
      ans[i] += cnt / 2;
      cnt = 0;
    }
  }
  
  for (int i = N - 1; i >= 0; i--) {
    if (s[i] == 'L') {
      cnt++;
    }
    else {
      ans[i + 1] += (cnt + 1) / 2;
      ans[i] += cnt / 2;
      cnt = 0;
    }
  }
  
  for (int i = 0; i < N; i++) {
    printf("%d%c", ans[i], " \n"[i + 1 == N]);
  }
  
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k,n;
    double sum=0;
    cin>>n>>k;
    vector<double> p(n+1); 
    for(int i=1;i<=n;i++){
        double a;
        cin>>a;
        a=(a+1)/2;
        sum+=a;
        p[i]=sum;
    }
    double ans=0;
    for(int i=0;i<n-k+1;i++)
    {
        ans=max(ans,p[i+k]-p[i]);
    }
    printf("%.10f",ans);
    return 0;
}

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

typedef long long ll;
vector<int>v,p,vct;
int one,two;
void display(vector<int>a, int n,int i)
{
    if(a==v)
    {
        one=i;
    }
    else if(a==p)
    {
        two=i;
    }
}
void findPermutations(vector<int>b, int n)
{
	sort(b.begin(),b.end());
	int i=1;
	do {
		display(b, n,i);
		i++;
	} while (next_permutation(b.begin(),b.end()));
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,in,i,n;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>in;
        v.push_back(in);
    }
    vct=v;
    for(i=0;i<n;i++)
    {
        cin>>in;
        p.push_back(in);
    }
    findPermutations(vct,n);
    if(v==p)
    {
        cout<<0<<endl;
    }
    else
    {
        cout<<abs(one-two)<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
using static M;
using static System.Math;
using System;

class M
{
    private const int MOD = 1000000007;
    private readonly int[] _f;
    public int Mul(int a, int b) => (int)(BigMul(a, b) % MOD);
    public M(int n)
    {
        _f = new int[n + 1];
        _f[0] = 1;
        for (int i = 1; i <= n; ++i)
            _f[i] = Mul(_f[i - 1], i);
    }
    public int Fac(int n) => _f[n];
    public int Pow(int a, int m)
    {
        if (m == 0) return 1;
        else if (m == 1) return a;
        var p1 = Pow(a, m / 2);
        var p2 = Mul(p1, p1);
        return ((m % 2) == 0) ? p2 : Mul(p2, a);
    }
    public int Div(int a, int b) => Mul(a, Pow(b, MOD - 2));
    public int Ncr(int n, int r)
    {
        if (n < r) return 0;
        if (n == r) return 1;
        var res = Fac(n);
        res = Div(res, Fac(r));
        res = Div(res, Fac(n - r));
        return res;
    }
}

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        var md = new M(n + k);
        if (k - 1 < 0) { Console.WriteLine(0); goto exit; }
        var ans = md.Ncr(n + k - 1, n);
        Console.WriteLine(ans);
        exit:;
    }
}


Measured memory_bytes: 18012
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=n-1;i > m;i--)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl;
#define Vecpr vector<pair<lli,lli>>
#define mod 1000000007;
int main(){
  lli A,B,C=INF,D=0,E=0,F=INF,G=INF,H=0,N,M;
  cin >> A >> B >> C;
  D=max(A,max(B,C));
  D*=3;
  E=A+B+C;
  E=D-E;
  if(E%2!=0)E=(E+3)/2;
  else E/=2;
  Out(E);
}

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

void solve(){
   int a,b,c,d;
   cin >> a >> b >> c >> d;
   int ok = 1;
   while(a > 0 && c > 0){
      if(ok){
         c -= b;
      }
      else{
         a -= d;
      }
      ok ^= 1;
   }
   if(c <= 0){
      cout << "Yes";
   }
   else{
      cout << "No";
   }
}

int32_t main(){
   fast;
   int t = 1;
//   cin >> t;
   while(t--)  solve();   
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll a,b,k;
	cin>>a>>b>>k;
	ll K=k-a;
	a=max(ll(0),a-k);
	if(K>0){
		b=max(ll(0),b-K);
	}
	cout << a<<" "<<b;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
const int maxn=2e5+100;
const int mod=1e9+7;
int a[maxn];
int l[maxn];//记录左边比i要小的数 的个数 
int r[maxn];//记录右边比i要小的数 的个数
int main()
{
	int n,k;
	ll ans;
	ll sam;
	scanf("%d%d",&n,&k); 
	sam=(ll)(k+1)*k/2;//总和时要算右边比i小的次数 
	sam-=k; //总和时要算左边比i小的次数 
	sam=(sam+mod)%mod;
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<i;j++)
			if(a[j]<a[i])
				l[i]++;
		for(int j=i+1;j<n;j++)
			if(a[j]<a[i])
				r[i]++;		 
	}
	ans=0; 
	for(int i=0;i<n;i++)
	{
		ans+=(l[i]*sam);
		ans%=mod;
		ans+=(r[i]*(sam+k));
		ans%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
  ll n;
  cin >> n;
  vector<ll>time(13);
  vector<bool>ampm(24,false);
  time[0]++;
  ampm[0]=true;
  ampm[24]=true;
  for(int i=0; i<n; i++){
    ll d;
    cin >> d;
    time[d]++;
    if(time[d]>2){
      cout << 0 << endl;
      return 0;
    }
    if(d==12 && time[d]>1){
      cout << 0 << endl;
      return 0;
    }
    if(d==0 && time[d]>1){
      cout << 0 << endl;
      return 0;
    }
  }
  if(time[12]==1) ampm[12]=true;
  for(int i=1; i<12; i++){
    if(time[i]==2){
      ampm[i]=true;
      ampm[24-i]=true;
    }
  }
  
  ll ans=0;
  for(ll i=0; i< 1<<11; i++){
    ll x = i;
    ll count=0;
    for(int j=0; j<12; j++){
      count++;
      if(time[count]==2 || time[count]==0)continue;
      if(i>>j & 1){
        ampm[count]=true;
        ampm[24-count]=false;
      }
      else{
        ampm[count]=false;
        ampm[24-count]=true;
      }
    }
      
    ll MIN = 10e6;
    ll count2=1;
    for(int i=1; i<=24; i++){
      if(ampm[i]){
        MIN=min(MIN,count2);
        //cout << i << " " << count2 << endl;
        count2=0;
      }
      count2++;
    }
    ans = max(ans,MIN);
  }
  cout << ans << endl;
  
}
  
  
  
  


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

int main() {
   int n;
    cin >> n;
    string s;
    cin >> s;
    
     bool a = true;
    
    if(n % 2 != 0) {
        cout << "No";
    }
    
   else {
   rep(i, n / 2) {
   if(s.at(i) != s.at(n / 2 + i)){
   a = false;
   }
   }
       if(a == false) {
       cout << "No";
       }
       else {
       cout << "Yes";
       }
   }
}

Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif 


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

    ll N, C; cin >> N >> C;
    vl X(N + 2, 0), V(N + 2, 0);
    FOR(i, 1, N + 1) cin >> X[i] >> V[i];
    X[N + 1] = C;

    // clockwise
    vl dpR(N + 2, 0);
    // dpR[i] := max cal to get from [0,i] 
    ll sum = 0;
    FOR(i, 1, N + 1) {
        sum += V[i];
        sum -= abs(X[i] - X[i - 1]);
        dpR[i] = max(dpR[i - 1], sum);
    }

    // counter clockwise
    // dpL[i] := max cal to get from [N,i] 
    vl dpL(N + 2, 0);
    sum = 0;
    for (int i = N; i >= 1; i--) {
        sum += V[i];
        sum -= abs(X[i] - X[i + 1]);
        dpL[i] = max(dpL[i + 1], sum);
    }

    ll ans = 0;
    FOR(i, 0, N + 1) {
        ans = max(ans, dpR[i] - X[i] + dpL[i + 1]);
        ans = max(ans, dpL[i + 1] - (C - X[i + 1]) + dpR[i]);
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  int a,b,c,r=0,l=0;
  while(scanf("%d%*c%d%*c%d",&a,&b,&c)==3) {
    if(a*a+b*b==c*c) r++;
    else if(a==b) l++;
  }
  cout << r << endl << l << endl;
  return 0;
}


Measured memory_bytes: 1212
def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    S = input()
    dp = [0]*N
    dp[0] = S[1:].count('W')
    for i in range(1, N):
        dp[i] = dp[i-1]
        if S[i-1] == 'E':
            dp[i] += 1
        if S[i] == 'W':
            dp[i] -= 1
    print(N-1-max(dp)) 
    


if __name__ == '__main__':
    main()


Measured memory_bytes: 70932
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
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; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

int main() {
	double ans=0;
	SS(int,n,k);
	for(ll i=1;i<=n;i++){
		ll temp=i;
		ll tri=0;
		while(temp<k){
			temp*=2;
			tri++;
		}
		ans+=1.0/(n*pow(2,tri));
	}
	p(ans);
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	m := make([][]int, 10)
	for i := 0; i <= 9; i++ {
		m[i] = make([]int, 10)
	}
	for i := 1; i <= N; i++ {
		v := i
		last := i % 10
		first := v % 10
		for v/10 != 0 {
			v /= 10
			first = v % 10
		}
		m[first][last]++
	}
	count := 0
	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			count += m[i][j] * m[j][i]
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 1776
import java.util.Arrays;
import java.util.Scanner;

class Main{



	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int l = sc.nextInt();
		String[] data = new String[n];
		
		for(int i= 0;i < n;i++){
			data[i] = sc.next();
		}
		Arrays.sort(data);
		String ans = "";
		for(int i = 0;i < n;i++){
			ans += data[i];
		}
		System.out.println(ans);
		
	}
}

Measured memory_bytes: 26196
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()

for i in range(1,10):
    for j in range(1,10):
        if N == i*j:
            print('Yes')
            exit()

print('No')

Measured memory_bytes: 61932
import java.util.*;
import java.io.*;

public class Main{
    static int answer(int[] A, int n, int k){
        int[] dp = new int[n];
        dp[n-1] = 0;
        dp[n-2] = Math.abs(A[n-1] - A[n-2]);
        for(int i=n-3;i>=0;i--){
            int min = dp[i+1]+Math.abs(A[i+1]-A[i]);
            for(int j=2;j<=k;j++){
                if(i+j < n){
                    min = Math.min(dp[i+j]+Math.abs(A[i+j]-A[i]),min);
                }
                else{
                    break;                
                }            
            } 
            dp[i] = min;
        }
        // for(Integer i:dp){
        //     System.out.print(i+" ");
        // }
        return dp[0];
    }
    public static void main(String[] args) throws IOException{ 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        int[] A = new int[n];
        st = new StringTokenizer(br.readLine());
        for(int i = 0;i<n;i++){
                A[i] = Integer.parseInt(st.nextToken());
        }
        System.out.println(answer(A,n,k));
    }
}


Measured memory_bytes: 34284
#include<iostream>
#include<cstdio>
#include<cctype>
 
using namespace std;
int main(){
    char ch;
    int cnt[26]={};
     
    while(cin >> ch){
        ch = tolower(ch);
        if(isalpha(ch)){
            cnt[ch-'a']++;
        }
    }
     
    for(int i = 0;i<26;i++){
        printf("%c : %d\n",i+'a',cnt[i]);
    }
     
    return 0;
}

Measured memory_bytes: 1124
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
//#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;

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

    ll a,b,c,n,f=0,mini=INF;
    ll sum=0,maxi=0;
    string str,sub;
    ll h,w;
    ll m,k,d;
    cin>>a>>b>>c>>d;
    if(a>b) swap(a,b); 
    n=c*d/__gcd(c,d);
    h=b-a+1;
    //cout<<(b/c-(a-1)/c)<<" "<<(b/d-(a-1)/d)<<" "<<(b/n-(a-1)/n)<<endl;

    cout<<h-(b/c-(a-1)/c)-(b/d-(a-1)/d)+(b/n-(a-1)/n)<<endl;
    //rep(i,n) cin>>a;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
    ll N;
    cin >> N;
    vector<ll> A, is_input(1000005);
    REP(i, N) {
        ll a;
        cin >> a;
        if(is_input[a] == 0) A.push_back(a);
        is_input[a]++;
    }
    sort(ALL(A));

    int ans = 0;
    N = A.size();
    if(N > 1 && is_input[A[0]] == 1 ) ans = 1;
    else if(N == 1 && is_input[A[0]] == 1) ans = 1;
    FOR(i, 1, N-1) {
        if(is_input[A[i]] > 1) continue;
        vector<ll> divs = divisor(A[i]);
        bool flag = true;
        for(ll x: divs)
            if(is_input[x] >= 1 && x < A[i]) flag = false;

        if(flag) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 13180
import math
n=int(input())
a=input()
al=[int(i) for i in a.split()]
al.sort(reverse=True)
ans=al[0]
for i in range(math.floor((n-2)/2)):
    ans+=al[i+1]*2
if round((n-2)/2)-(n-2)/2!=0:
    ans+=al[math.floor((n-2)/2)+1]
print(ans)

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

using namespace std;

#define int long long

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

    vector<int> va, vb;
    int ans = 100000000;

    int mina = 100000000, minb = 100000000;

    int a, s, d;

    cin >> a >> s >> d;
    va.resize(a);
    vb.resize(s);

    for (int i = 0; i < a; ++i)
    {
        int in;
        cin >> in;

        mina = min(mina, in);
        va[i] = in;
    }

    for (int i = 0; i < s; ++i)
    {
        int in;
        cin >> in;

        minb = min(minb, in);
        vb[i] = in;
    }

    ans = mina + minb;

    for (int i = 0; i < d; ++i)
    {
        int z, x, c;
        cin >> z >> x >> c;

        int ans2 = va[z - 1] + vb[x - 1];
        ans2 -= c;
        // cout << "ans2:" << ans2 << endl;

        ans = min(ans, ans2);
    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<bool> mlt(n, 0);
  for (int i = 0; i < 2 * m; i++) {
    int tmp;
    cin >> tmp;
    tmp--;
    mlt[tmp] = !mlt[tmp];
  }
  bool flag = false;
  for (int i = 0; i < n; i++) {
    if (mlt[i]) {
      flag = true;
      break;
    }
  }
  if (!flag) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <map>

using namespace std;

int main() {
    int n, cnt = 0, a;
    map<int, int> d;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a);
        ++d[a];
    }
    for (auto i = d.begin(); i != d.end(); ++i) {
        if ((*i).first <= (*i).second) cnt += (*i).second - (*i).first;
        else cnt += (*i).second;
    }
    printf("%d\n", cnt);
    return 0;
}


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

using namespace std;

int solve(const int n, const int capacity, const vector<int>& w, const vector<int>& v, 
        const vector<int>& m) {
        vector<int> dp(capacity + 1, 0);

        for (int i = 0; i < n; i++) {
            int size = w[i];
            int value = v[i];
            int count = m[i];
            int num = count;
            for (int k = 1; num > 0; k = k << 1) {
                int mult = min(k, num);
                for (int j = capacity; j >= mult * size; j--) {
                    dp[j] = max(dp[j], dp[j - mult * size] + mult * value);
                }
                num -= mult;
            }
        }
        return dp[capacity];
    }


int main() {
    int n, c;
    cin >> n >> c;
    
    vector<int> v(n), w(n), m(n);
    
    for (int i = 0; i < n; i++) {
        cin >> v[i] >> w[i] >> m[i];
    }
    
    int ans = solve(n, c, w, v, m);
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3144
#include <iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>

using namespace std;

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		
		int total = 0;
		for(int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
			total += a[i];
		}
		
		n -= total;
		
		if(n >= 0) {
			System.out.print(n);
		}else {
			System.out.print(-1);
		}
		

	}

}


Measured memory_bytes: 46200
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from functools import reduce, lru_cache
import collections, heapq, itertools, bisect
import math, fractions
import sys, copy

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline().rstrip())
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline().rstrip())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )

    def inverse(self):
        return pow(self.x, MOD - 2, MOD)

def main():
    N = I()
    A = LI()

    C0, C1 = [0] * 60, [0] * 60

    for d in range(60):
        for ai in A:
            C0[d] += (ai >> d & 1) == 0
            C1[d] += (ai >> d & 1) == 1

    ans = ModInt(0)
    for (d, (a, b)) in enumerate(zip(C0, C1)):
        ans += a * b * (1 << d)
    print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 123912
#include <iostream>
    using namespace std;
     
    int main() {
        //入力を受け取る
        int D, T, S;
        cin >> D >> T >> S;
     
        //高橋君の移動時間を計算する
        double time = (double)D / S;
     
        //Tとtimeの大小関係に応じて出力をする
        if (T >= time) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }

Measured memory_bytes: 3624
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // int T;cin>>T;while(T--) 
    {
        ll n;
        cin>>n;
        ld x = (n/3.0);
        ld ans = x*x*x;
        cout<<setprecision(9)<<fixed;
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

char T[202020];
int N;

int main()
{
	scanf("%s", T);
	N = strlen(T);
	for (int i = 0; i < N; ++i) {
		if (T[i] == '?') T[i] = 'D';
	}
	puts(T);
	return 0;
}


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

int main() {
  int n, l;
  cin >> n >> l;
  
  vector<string> str(n);
  for (int i = 0; i < n; i++) {
    cin >> str.at(i);
  }
  
  sort(str.begin(), str.end());
  
  for (int i = 0; i < n; i++) {
    cout << str.at(i);
  }
  cout << endl;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int x, y, z;
  cin >> x >> y >> z;
  int n = x + y + z;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i] >> c[i];
  }
  auto f = [&](int penalty) {
    vector<int> ord(n);
    iota(begin(ord), end(ord), 0);
    sort(begin(ord), end(ord), [&](int i, int j) {
      return a[i] - max(b[i], c[i] - penalty) > a[j] - max(b[j], c[j] - penalty);
    });
    long long sum = 0;
    int cnt = 0;
    for (int k = 0; k < n; ++k) {
      int i = ord[k];
      if (k < x) {
        sum += a[i];
      } else {
        sum += max(b[i], c[i] - penalty);
        cnt += c[i] - penalty > b[i];
      }
    }
    return make_pair(sum, cnt);
  };
  int ng = -inf<int>, ok = inf<int>;
  while (ok - ng > 1) {
    int mid = (ng + ok) / 2;
    (f(mid).second <= z ? ok : ng) = mid;
  }
  auto [sum, cnt] = f(ok);
  cout << sum + (long long)ok * cnt << '\n';
}


Measured memory_bytes: 4780
s = int(input())
numbers = []
for i in range(s+1):
    if (i % 3 == 0 or "3" in str(i)) and i != 0:
        numbers.append(i)

for p in numbers:
    if len(numbers) == 1:
        print("",p)
    else:
        if p == numbers[0]:
            print("",p,end=" ")
        elif p == numbers[-1]:
            print(p)
        else:
            print(p,end=" ")


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int N,M; cin >> N >> M;
    vector<string> S(N);
    REP(i,N) cin >> S[i];

    mf_graph<int> G(N*M + 2);
    int s = N*M;
    int t = N*M+1;
    REP(n,N){
        REP(m,M){
            if(S[n][m] == '#') continue;
            int v = n*M + m;
            if((n+m)%2 == 0){
                G.add_edge(s,v,1);
            }else{
                G.add_edge(v,t,1);
            }
        }
    }

    REP(n,N){
        REP(m,M){
            if((n+m)%2==1 || S[n][m]=='#') continue;

            int v_from = n*M + m;
            int v_to;
            if(n>0 && S[n-1][m]=='.'){
                v_to = (n-1)*M + m;
                G.add_edge(v_from, v_to, 1);
            }

            if(n<N-1 && S[n+1][m]=='.'){
                v_to = (n+1)*M + m;
                G.add_edge(v_from, v_to, 1);
            }

            if(m>0 && S[n][m-1]=='.'){
                v_to = n*M + m-1;
                G.add_edge(v_from, v_to, 1);
            }

            if(m<M-1 && S[n][m+1]=='.'){
                v_to = n*M + m+1;
                G.add_edge(v_from, v_to, 1);
            }
        }
    }

    cout << G.flow(s,t) << endl;

    auto edges = G.edges();
    for(auto e: edges){
        if(e.from==s || e.to ==t || e.flow==0) continue;
        
        int x0 = e.from/M;
        int y0 = e.from%M;
        int x1 = e.to/M;
        int y1 = e.to%M;

        if(y0+1 == y1){
            S[x0][y0] = '>';
            S[x1][y1] = '<';
        }else if(x0-1 == x1){
            S[x0][y0] = '^';
            S[x1][y1] = 'v';
        }else if(y0-1 == y1){
            S[x0][y0] = '<';
            S[x1][y1] = '>';
        }else if(x0+1 == x1){
            S[x0][y0] = 'v';
            S[x1][y1] = '^';
        }
        
    }

    REP(i,N) cout << S[i] << endl;

    return 0;
}

Measured memory_bytes: 5612
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

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<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;

ll H, W,ans,cnt;
string s[401];
pair<ll, ll>WB[200000];



void dfs(int n,int x,int y,bool flag) {//flag:false-white
	s[y][x] = 'E';

	FOR(dx, -1, 2) {
		FOR(dy, -1, 2) {
			if (dx*dy != 0)continue;
			int nx = dx + x; int ny = dy + y;
			if (nx >= 0 && nx < W&&ny >= 0 && ny < H&&s[ny][nx] != 'E') {
				
				if (flag == false && s[ny][nx] == '#') { dfs(n, nx, ny, true); WB[n].second++; }
				if (flag == true && s[ny][nx] == '.') {  dfs(n, nx, ny, false); WB[n].first++; }

			}
		}
	}

	return;
}



int main() {
	cin >> H >> W;
	FOR(i, 0, H) {
		cin >> s[i];
	}
	FOR(i, 0, H)FOR(j, 0, W) {

		if (s[i][j] != 'E') {
			bool flg = false;
			if (s[i][j] == '#') {
				flg = true; WB[cnt].second++;
			}
			else WB[cnt].first++;
			dfs(cnt, j, i,flg);
			cnt++;

			}
		}
	FOR(i, 0, cnt) {

		ans += WB[i].first*WB[i].second;
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 17920