akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	int x,now;
	string s;
	vector<string> box;
	getline(cin,s);
		now=0;
		for(int i=0;i<s.size();i++){
			if(s[i]!=' '&&s[i]!='.'&&s[i]!=','){
				now++;
			}
			else{
				if(now>=3&&now<=6)
				box.push_back(s.substr(i-now,now));
				now=0;
			}
		}
		for(int i=0;i<box.size();i++){
			cout<<box[i];
			cout<<(box.size()-1!=i?' ':'\n');
		}
	return 0;
}

Measured memory_bytes: 0
#![allow(unused_imports)]
#![allow(dead_code)]

use std::thread;
use std::io::{ self, Read };
use std::fmt;
use std::iter::Iterator;
use std::cmp::*;
use std::collections::*;
use std::str::*;

#[derive(Default)]
struct Input {
    buf: Vec<String>
}

impl Input {
    fn new() -> Input {
        Input { buf: Vec::new() }
    }

    fn read<T: FromStr>(&mut self) -> T 
    where <T as FromStr>::Err: fmt::Debug {
        self.next().unwrap().parse::<T>().unwrap()
    }

    fn read_bytes(&mut self) -> Vec<u8> {
        self.next().unwrap().into_bytes()
    }

    fn read_n<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where <T as FromStr>::Err: fmt::Debug {
        let mut v = Vec::new();
        for _ in 0..n { v.push(self.read::<T>()); }
        v
    }
}

impl Iterator for Input {
    type Item = String;
    fn next(&mut self) -> Option<String> {
        while self.buf.is_empty() {
            let mut s = String::new();
            let _res = io::stdin().read_line(&mut s);
            self.buf = s.split_whitespace().map(|s| s.to_owned()).collect::<Vec<_>>();
            self.buf.reverse();
        }
        self.buf.pop()
    }
}

fn run() {
    let mut ip = Input::new();
    let mut s = ip.read_bytes();
    let mut p = b'*';
    let mut f = 0;
    for c in s {
        if c != p { f += 1; }
        p = c;
    }
    println!("{}", f - 1);
}

fn main() {
    let _ = thread::Builder::new()
        .stack_size(10 * 1024 * 1024)
        .spawn(run).unwrap()
        .join();
}

Measured memory_bytes: 8572
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
A = LI()


class BIT:
    def __init__(self, size):
        self.bit = [0] * size
        self.size = size

    def add(self, i, w):
        x = i + 1
        while x <= self.size:
            self.bit[x - 1] += w
            x += x & -x
        return

    def sum(self, i):
        res = 0
        x = i + 1
        while x > 0:
            res += self.bit[x - 1]
            x -= x & -x
        return res



def D(L):
    n = len(L)
    bit = BIT(2 * n + 1)
    ans = 0
    for i in range(n - 1, -1, -1):
        bit.add(L[i] + n, 1)
        ans += bit.sum(L[i] + n - 1)
    return ans



ALL = (n + 1) * n // 2
A2 = sorted(A)
# 求めるのは、1より-1の方が多かった区間の数
ng, ok = n, 0
while ng > ok + 1:
    mid = (ok + ng) // 2
    L = [0] + list(accumulate([1 if i >= A2[mid] else -1 for i in A]))
    if D(L) >= ALL // 2 + 1:
        ng = mid
    else:
        ok = mid


print(A2[ok])






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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n, W;
  cin >> n >> W;
  vector<int> v(n), w(n);
  REP(i, n) cin >> v[i] >> w[i];
  int dp[101][10001] = {};
  dp[0][0] = 0;
  REP(i, n) {
    for (int j = 0; j <= W; ++j) {
      dp[i + 1][j] = dp[i][j];
      if (w[i] <= j) {
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
      }
    }
  }
  cout << dp[n][W] << endl;
  return 0;
}


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

int main() {
  int h, w;
  string c;
  cin >> h >> w;
  REP(i, h) {
    cin >> c;
    cout << c << endl << c << endl;
  }
  return 0;
}

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

using namespace std;

int main() {
    string a, b;
    cin >> a >> b;

    int v = stoi(a += b);

    if (v == int(sqrt(v)) * int(sqrt(v))){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) 
using namespace std;
 
int main() {
  int N, D;
  cin >> N >> D;
  int a[11][11];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      cin >> a[i][j];
    }
  }
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      int x = 0;
      for (int k = 0; k < D; k++) {
        x += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
      }
      double y = sqrt(x);
      if (ceil(y) == floor(y)) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a[4],b[4],i,j;
	int hit,blow;
	
	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF)
	{
		scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
		hit=0;
		blow=0;
		
		for(i=0;i<4;i++)
		{
			for(j=0;j<4;j++)
			{
				if(i==j)
				{
					if(a[i]==b[j])
					{
						hit++;
					}
				}
				else
				{
					if(a[i]==b[j])
					{
						blow++;
					}
				}
			}
		}
		
		printf("%d %d\n",hit,blow);
	}
	
	return 0;
}

Measured memory_bytes: 596
void main(){
	long n = _scan!long();
	long cnt;
	foreach(i; 1..n+1){
		if(i%3==0 || i%5==0)continue;
		else cnt += i;
	}
	cnt.writeln();
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math, std.regex;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


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

using namespace std;

int n;
vector<int> cnt(4);
vector<vector<vector<double>>> dp;

int main(){
    cin>>n;
    dp.resize(n + 1, vector<vector<double>>(n + 1, vector<double>(n + 1)));
    for(int i = 0; i < n; i++){
        int tmp; cin>>tmp;
        cnt[tmp]++;
    }
    dp[0][0][0] = 0.0;
    for(int k = 0; k <= n; k++){
        for(int j = 0; j <= n; j++){
            for(int i = 0; i <= n; i++){
                double kk = i + j + k;
                if(kk == 0 || n < kk) continue;
                dp[i][j][k] = (n/kk) + (1/kk) * ((i ? i*dp[i-1][j][k] : 0) + (j ? j*dp[i+1][j-1][k] : 0) + (k ? k*dp[i][j+1][k-1] : 0));
            }
        }
    }
    auto res = dp[cnt[1]][cnt[2]][cnt[3]];
    cout<<setprecision(20)<<res<<endl;
    return 0;
}

Measured memory_bytes: 216832
def main():
    n, m = [int(e) for e in input().split()]

    if n < 2 and m < 2:
        print(0)
        exit()

    if n < 2:
        print(m*(m - 1)//2)
        exit()

    if m < 2:
        print(n*(n - 1)//2)
        exit()

    print(n*(n - 1)//2 + m*(m - 1)//2)

if __name__ == "__main__":
    main()


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

using namespace std;

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

const int N = 1e5 + 5;

int n,k,h[N],dp[N];

int f(int cur) {
  if (cur == n)
    return 0;
  int &res = dp[cur];
  if (res != -1)
    return res;
  res = 1e9;
  for (int i = cur ; i <= min(n,cur + k) ; i++)
    res = min(res,f(i) + abs(h[i] - h[cur]));
  return res;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> n >> k;
  for (int i = 1 ; i <= n ; i++)
    cin >> h[i];
  memset(dp,-1,sizeof dp);
  cout << f(1) << '\n';
}

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

#define int long long
const int INF = 1e18;

signed main(){
  const int num = 53;
  while(true){

    int k = -1;
    int n ,maximum = 0;
    vector<vector<int>> hoge;

    cin>>n;

    if(!n) break;

    hoge.resize(n, vector<int>(num+2, 26));

    for(int i = 0; i < n; i++){
      //cout<<"i = "<<i<<endl;
      string s;

      cin>>s;

      hoge[i][0] = s[0] - 'a';
      maximum = max(maximum, (long long)s.size());

      for(int j = 1, k = 1; j < s.size(); j++){
        if(s[j-1] == 'a' || s[j-1] == 'u' || s[j-1] == 'e' ||
           s[j-1] == 'i' || s[j-1] == 'o'){
          hoge[i][k] = s[j] - 'a';
          k++;
          // cout<<s[j];
        }
      }
      // cout<<endl;
      //  cout<<hoge.size()<<endl;
      // cout<<endl;
      // for(int j = 0; j < hoge[0].size(); j++){

        //if(hoge[i][j] == 26) break;
        // cout<<(char)(hoge[i][j] + 'a');
      // }
      //  cout<<endl;
    }

    for(int i = 1; i < num; i++){
      set<string> s;
      for(int j = 0; j < n; j++){
        string x;
        for(int k = 0; k < i; k++){
          x += hoge[j][k];
        }
        s.insert(x);
      }

      if(s.size() == n){
        k = i;
        break;
      }
    }


    cout<<k<<endl;
  }
}



Measured memory_bytes: 3192
[r,c]=map(int,input().split())
matrix=[[]for i in range(r)]
r_total=[0 for i in range(r)]
c_total=[0 for i in range(c)]
total=0

for i in range(r):
    matrix[i]=list(map(int,input().split()))
    for j in range(c):
        r_total[i]+=matrix[i][j]
        c_total[j]+=matrix[i][j]
        total+=matrix[i][j]
for i in range(r):
    for j in range(c):
        print(matrix[i][j],end = " ")
    print(r_total[i])
for i in range(c):
    print(c_total[i],end=" ")
print(total)



Measured memory_bytes: 6240
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
using namespace std;
int p = 998244353;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<pin,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
#define rev(s) reverse(s.begin(),s.end())
#define end_pr(s) cout << s <<endl;return 0
#define itn int
#define bs bitset<5001>

int kai_size = 2600001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
int RE() {
	vel v(3, 2);
	return v.at(4);
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, kai_size - 1) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, 1000001) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
vel dis(int mid1, vvel &way) {
	int n = way.size();
	vel dist(n, -1); dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front(); q.pop();
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) {
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
	return dist;
}
pin most_far(int now, int n, vvel &way) {
	vel dist1 = dis(now, way);
	pin ans = mkp(-1, 0);
	rep(i, n) {
		if (dist1[i] > ans.first) { ans = mkp(dist1[i], i); }
	}
	return ans;
}

int per(int a, int b) {
	int ans = a % b;
	if (ans < 0) { ans += b; }
	return ans;
}
V<pin> uni(V<pin> &v) {
	sor(v);
	V<pin> ans(1, v[0]);
	for (int i = 1; i < v.size(); i++) {
		if (v[i] != v[i - 1]) { ans.push_back(v[i]); }
	}
	v = ans;
	return v;
}
int s_gcd(int a, int b) {
	if (b == 0) { return a; }
	return s_gcd(b, a%b);
}
int gcd(int a, int b) {
	if (a < b) { swap(a, b); }
	return s_gcd(a, b);
}
signed main() {
	int n, m; cin >> n >> m; int sum = 3 * m;
	make_kai();
	int inv1 = inv(kai[sum]);
	int qans = kai[sum+n-1];
	qans *= ink[n - 1]; qans %= p;
	qans *= inv1; qans %= p;
	int mi1 = 0;
	for (int b = 0; b < m; b++) {
		int plus = com(b + n - 2, n - 2);
		mi1 += plus;
	}
	mi1 %= p;
	mi1 *= n; mi1 %= p;
	int mi2 = 0;
	for (int a = m + 2; a <= n; a+=2) {
		int maru = (3 * m) - a; maru /= 2;
		if (maru >= 0) {
			int plus = com(maru + n - 1, n - 1);
			int mul = com(n, a);
			plus *= mul; plus %= p;
			mi2 += plus;
		}
	}
	mi2 %= p;
	int ans = qans + 2 * p - mi1 - mi2;
	cout << ans % p << endl;
	return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cout << #x << " = " << (x) << "\n";

void solve() {
	long long n; cin >> n;
	vi v;
	while (n > 1) {
		if (!(n & 1)) {
			v.pb(1);
			n--;
		}
		else {
			v.pb(0);
			n = n - 1 >> 1;
		}
	}
	reverse(all(v));
	vector<int> ans;
	ans.pb(1), ans.pb(1);
	int st = 2, mid = 1;
	FOR(i, 0, sz(v)) {
		if (!v[i]) {
			ans.insert(ans.begin() + mid, st);
			ans.insert(ans.begin(), st);
			mid++, st++;
		}
		else {
			ans.insert(ans.begin() + mid, st);
			ans.insert(ans.begin() + mid, st);
			mid++, st++;
		}
	}
	cout << sz(ans) << "\n";
	FOR(i, 0, sz(ans)) cout << ans[i] << " \n"[i == sz(ans) - 1];
}

int main() {
	ios_base::sync_with_stdio(0); //cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int a, b;
	string op;
	for(;;){
		cin >> a;
		cin >> op;
		cin >> b;
		if(op == "?"){
			break;
		} else if (op == "+"){
			cout << a + b << endl;
		} else if (op == "-"){
			cout << a - b << endl;
		} else if (op == "*"){
			cout << a * b << endl;
		} else if (op == "/"){
			cout << a / b << endl;
		}
	}
	return 0;
}

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

using namespace std;

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

const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1000000000000000000L;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int ddx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int ddy[] = {0, 1, 1, 1, 0, -1, -1, -1};

unordered_map<int, int> p_div;

int main() {
    int n;
    cin >> n;
    
    for(int i = 2; i <= n; i++) {
        int x = i;
        for(int j = 2; x > 1; j++) {
            if(x % j == 0) {
                int tmp = 0;
                while(x % j == 0) {
                    x /= j;
                    tmp++;
                }
                if(p_div.find(j) == p_div.end()) p_div[j] = 0;
                p_div[j] = (p_div[j] + tmp) % MOD;
            }
        }
    }

    int ans = 1;
    for(P p : p_div) {
        ans = (int)((ll)ans * (p.second + 1) % MOD);
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
R,G,B,N = [int(x) for x in input().split()]

ans = 0

for i in range(N//R+1):
    for j in range((N-R*i)//G+1):
    #    print(i,j)
        if (N-R*i-G*j) % B == 0:
            ans += 1

print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

unordered_map<int, bool> prime_used;
vector<int> divisors;
int num_cnt;
vector<int> nums;
int max_num;

bool is_pairwise(void);
long long calc_gcd(long long a, long long b);

int main(void)
{
    cin >> num_cnt;

    max_num = 0;
    for(int i = 0; i < num_cnt; i++){
        int n;
        cin >> n;
        if(n > max_num){
            max_num = n;
        }

        nums.push_back(n);
    }

    divisors.resize(max_num + 1);
    for(int i = 0; i <= max_num; i++){
        divisors[i] = i;
    }

    divisors[2] = 2;
    for(int i = 2; i <= max_num; i++){
        if(divisors[i] == i){
            for(int mul = 2; mul * i <= max_num; mul += 1){
                if(divisors[mul * i] == mul * i){
                    divisors[mul * i] = i;
                }
            }
        }
    }

    if(is_pairwise()){
        cout << "pairwise coprime" << endl;
        return 0;
    }

    int current_gcd = nums[0]; 
    for(int i = 1; i < num_cnt; i++){
        current_gcd = calc_gcd(current_gcd, nums[i]);
    }

    if(current_gcd == 1){
        cout << "setwise coprime" << endl;
        return 0;
    }

    cout << "not coprime" << endl;


    return 0;
}

bool is_pairwise(void)
{
    for(int i = 0; i < num_cnt; i++){
        int num_cp = nums[i];
        while(num_cp != 1){
            int divisor = divisors[num_cp];

            while(num_cp % divisor == 0){
                num_cp /= divisor;
            }
            if(prime_used.find(divisor) == prime_used.end()){
                prime_used[divisor] == true;
            }else{
                return false;
            }
        }
    }

    return true;
}

long long calc_gcd(long long a, long long b)
{
    long long c = a % b;

    if(c == 0){
        return b;
    }

    return calc_gcd(b, c);
}

Measured memory_bytes: 10924
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<int(b);i++)
using namespace std;
int main()
{
    int n, k;
    cin >> n;
    map<int, int> m;
    REP(i, 0, n) {
        cin >> k;
        if (m.count(k)) {
            m[k]++;
        } else {
            m[k] = 1;
        }
    }
    long long ans = 0;
    for (auto p: m) {
        if (p.first < p.second) {
            ans += p.second - p.first;
        } else if (p.first > p.second) {
            ans += p.second;
        }
    }
    cout << ans << endl;
}


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

vector<int> forintinput(int n) {
	vector<int> x(100000);
	for(int i = 0;i < n;i++) cin >> x[i];
	return x;
}
int main(){
	int h,n;
	cin >> h >> n;
	vector<int> a(n);
	a = forintinput(n);
	int sumA = 0;
	for(int i = 0;i < n;i++){
		sumA += a[i];
	}
	if(sumA >= h){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
long n,r,l=-1,m,c,s,i,N,a[1<<17];
main(){
	for(cin>>n;cin>>m;r=r<m?m:r)a[i++]=m;
	for(;r-l>1;(c>n*(n+1)/4?r:l)=m){
		int b[2*n]={};
		m=l+r>>1;
		b[s=n]=1;
		for(N=c=i=0;i<n;b[s]++,c+=N)N+=a[i++]>m?-b[++s]:b[s--];
	}
	cout<<r;
}

Measured memory_bytes: 1792
#include "cstdio"
#include <vector>
#include <iostream>

using namespace std;

inline vector<int> shuffle(vector<int> stock) {
	vector<int> result;
	int n = stock.size() / 2;
	for (int i = 0; i < n; i++) {
		result.push_back(stock[i]);
		result.push_back(stock[i + n]);
	}
	return result;
}
inline vector<int> cut(vector<int> stock, int k) {
	vector<int> result;
	for (int i = k; i < stock.size(); i++)
		result.push_back(stock[i]);
	for (int i = 0; i < k; i++)
		result.push_back(stock[i]);
	return result;
}
int main() {
	int n, m;
	cin >> n;
	cin >> m;
	vector<int> stock(2 * n);
	for (int i = 0; i < 2 * n; i++)
		stock[i] = i + 1;
	for (int i = 0; i < m; i++) {
		int k;
		cin >> k;
		if (k == 0) {
			stock = shuffle(stock);
		}
		else {
			stock = cut(stock, k);
		}

	}
	for (int i = 0; i<stock.size(); i++){
		printf("%d\n", stock[i]);
	}
	return 0;


}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    vector<int> c1(26,0),c2(26,0);
    for(int i = 0; i < s.size(); i++){
        c1[s[i]-'a']++;
        c2[t[i]-'a']++;
    }
    sort(c1.begin(),c1.end());
    sort(c2.begin(),c2.end());
    if(c1==c2)
        cout<<"Yes";
    else
        cout<<"No";
}

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

int main(){
    int n;
    cin>>n;
    vector<int> x(n);
    for(auto &p:x) cin>>p;
    int m=n/2;
    vector<int> y=x;
    sort(y.begin(),y.end());
    int p,r;
    p=y.at(m);
    r=y.at(m-1);
    for(int i=0;i<n;i++){
        if(x.at(i)<=r) cout<<p;
        else cout<<r;
        cout<<endl;
    }

}

Measured memory_bytes: 3712
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)



int main() {
	ll r, d, x;
	in(r);
	in(d);
	in(x);

	repeq(i, 2001, 2010) {
		x = r * x - d;
		outn(x);
	}
	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{	char a[1010],b[1010];
	scanf("%s %s",a,b);
	int lena=strlen(a);
	int lenb=strlen(b);
	int max=0,count;
	for(int i=0;i<=lena-lenb;i++)
	{	count=0;
			for(int j=0;j<lenb;j++)
	{ 	if(a[i+j]==b[j])count++;
	}
	if(max<count)max=count;
	}
	cout<<lenb-max<<endl;
return 0;
}


Measured memory_bytes: 3764
def main():
    from collections import defaultdict, deque

    N, K = map(int, input().split())
    a = map(int, input().split())

    def accumulate(a, mod):
        s = 0
        yield s
        for x in a:
            s = (s + x - 1) % mod
            yield s

    acc = accumulate(a, mod=K)

    d = defaultdict(int)
    dq = deque()
    ans = 0
    for x in acc:
        ans += d[x]
        d[x] += 1
        dq.append(x)
        if len(dq) >= K:
            r = dq.popleft()
            d[r] -= 1
    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())


Measured memory_bytes: 45320
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}


int main(){
   lint N;
   lint count=0;
   cin>>N;
   pair<lint,lint> x[N];
   rep(i,N){
       lint k,l;
       cin>>k>>l;
       x[i]=make_pair(k,l);
   }

   repm(i,N){
        lint o,p;
        tie(o,p)=x[i];
     if((o+count)%p!=0){
         count+=p-((o+count)%p);
     }
   }
   cout<<count;

}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


ll gcd(ll a,ll b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll h, w, k;
    cin>>h>>w>>k;
    vector<string> s(h);
    for(ll i=0;i<h;++i){
        cin>>s[i];
    }

    ll ans = 0;
    for(ll bit=0;bit<(1<<h);++bit){
        for(ll mask=0;mask<(1<<w);++mask){
            ll count = 0;
            for(ll i=0;i<h;++i){
                for(ll j=0;j<w;++j){
                    if(bit & (1 << i) or mask & (1 << j)){
                        continue;
                    }else{
                        if(s[i][j] == '#'){
                            count++;
                        }
                    }
                }
            }
            if(count == k){
                ans++;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0) break;
           
            for(int i = 0; i < H; i++){
            	for(int j = 0; j < W; j++){
            		if(i % 2 == 0 && j % 2 == 0 || i % 2 == 1 && j % 2 == 1) 
            			System.out.print("#");
            		else System.out.print(".");
            	}
            	System.out.println("");
            }
            System.out.println("");
        }
    }
}


Measured memory_bytes: 33744
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x,d=0,cnt=1;
    cin >> n >> x;
    vector<int> l(n);
    for(int i=0;i<n;i++) cin >> l[i];

    for(int i=0;i<n;i++){
        d += l[i];
        if(d <= x)
            cnt++;
        else 
            break;
    }
    cout << cnt << endl;
}



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

int main() {
    long long a, b, c;
    cin >> a >> b >> c;
    long long left = 4 * a * b;
    long long right = (c - a - b) * (c - a - b);

    if(left < right && c - a - b >= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define int long long
using namespace std;
 
int keta(int n){
	int ret = 0;
	while(n){
		ret++;
		n /= 2;
	}
	return ret;
}
 
int calc(int a,int b){
	if(!a && !b) return 1;
	if(keta(a) == keta(b)) return calc(a - (1ll << (keta(a) - 1)),b - (1ll << (keta(a) - 1)));
	else {
		int aa = (1ll << (keta(b) - 1)) - a;
		return min(calc(1ll << (keta(b) - 1),b) + aa,1ll << (keta(b) - 1)) + aa;
	}
}
signed main(){
	int a,b;
	cin >> a >> b;
	cout << calc(a,b) << endl;
	return 0;
}

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

mi=min(x,y)

pr=0

if c*2<=a+b :
    pr+=c*2*mi
    x-=mi
    y-=mi

#print(pr)

if c*2<a :
    pr+=c*2*x
else :
    pr+=a*x

if c*2<b :
    pr+=c*2*y
else :
    pr+=b*y

print(pr)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
int a, b, c, d, e[500000][5], n, cnt;
    while (true) {
        cin >> n; cnt = 0; if (!n) { break; }
        for (int i = 0; i < n; i++) {
            cin >> e[i][0] >> e[i][1] >> e[i][2] >> e[i][3];
            e[i][4] = e[i][1] * 4 + e[i][2] * 9 + e[i][3] * 4;
        }
        cin >> a >> b >> c >> d;
        for (int i = 0; i < n; i++){
            if (a >= e[i][1] && b >= e[i][2] && c >= e[i][3] && d >= e[i][4]) {
                cout << e[i][0] << endl; cnt++;
            }
        }
        if (cnt == 0) { cout << "NA" << endl; }
    }
} 




Measured memory_bytes: 3124
#include<cstdio>

long int plus(long int a){
    if(a<0) a = -1 * a;
    return a;
}

int main(){
    long int X, K, D;
    scanf("%ld %ld %ld", &X, &K, &D);
    X = plus(X);
    long int q = (X / D) % 2;
    long int k_q = K % 2;
    long int R = X % D;
    long int ans;
    if(q == k_q) ans = R;
    else ans = D - R;

    if(X / D > K){
        ans = X - K*D;
    }
    printf("%ld", ans);
    return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

using ull = unsigned long long;
using ld = long double;
const ld PI = 3.1415926535897932384626433;

struct Vector2
{
	ld x;
	ld y;

	static ld GetLength(Vector2 a, Vector2 b)
	{
		return sqrtl((a.x-b.x)*(a.x - b.x) +(a.y-b.y)*(a.y - b.y));
	}
};

Vector2 GetPos(ld len, ld angle)
{
	Vector2 ret;
	
	ret.x = sinl(angle)*len;
	ret.y = cosl(angle)*len;
	return ret;
}


ld GetAngleH(int h, int m)
{
	return ((h / 12.0) + (m / 60.0 / 12.0))*2.0*PI;

}
ld GetAngleM(int m)
{
	return (m / 60.0)*2.0*PI;

}

int main()
{
	int a, b, h, m;
	cin >> a >> b >> h >> m;

	Vector2 vh = GetPos(a, GetAngleH(h, m));
	
	Vector2 vm = GetPos(b, GetAngleM(m));


	ld len = Vector2::GetLength(vh, vm);
	cout << fixed << setprecision(20);
	cout << len;

}

Measured memory_bytes: 4164
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdlib>
#include <algorithm>
#define NMAX 10
#define MMAX 29
//コメントアウトするとdebug()を実行しない
#define DEBUG
 
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	std::fill( (T*)array, (T*)(array+N), val );
}
 
typedef pair<int ,int > P;
vector<int > land[NMAX];
vector<int > rest;
int A[MMAX],B[MMAX],C,N,M,W,H,ans = 0,dp[NMAX][NMAX] = {},flag[NMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
dy[8] = {1,1,0,-1,-1,-1,0,1};
void dfs(int a){
	if(rest.empty()){
		ans++;
	}
	// printf("%d :",a);
	for (int i = 0; i < land[a].size(); ++i)
	{
		// printf("%d\n",land[a][i]);
		if(find(rest.begin(), rest.end(),land[a][i]) != rest.end()){
			rest.erase(find(rest.begin(), rest.end(),land[a][i]));
			// printf("%d::::\n",land[a][i]);
			dfs(land[a][i]);
			rest.push_back(land[a][i]);
		}
	}
 
}
 
void solve(){
	
}
 
void debug(){
 
}
 
void answer(){
	cout << ans << "\n";
}
 
int main(){
	ios::sync_with_stdio(false);
	Fill(flag,1);
	cin >> N >> M;
	for (int i = 1; i < N; ++i)
	{
		rest.push_back(i+1);
	}
	for (int i = 0; i < M; ++i)
	{
		scanf("%d%d",&A[i],&B[i]);
		land[A[i]].push_back(B[i]);
		land[B[i]].push_back(A[i]);
	}
	// for (int i = 0; i < N; ++i)
	// {
	// 	for (int j = 0; j < land[i].size(); ++j)
	// 	{
	// 		printf("%d ",land[i+1][j]);
	// 	}
	// 	printf("\n");
	// }
	solve();
	#ifdef DEBUG
	debug();
	#endif
	dfs(1);
	answer();
 
	return 0;
}

Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
int main()
{
    unsigned long long a, b, x;
    scanf("%lld %lld %lld", &a, &b, &x);
    b = (unsigned long long)(b / x);
    if (!(a % x))
    {
        a = (unsigned long long)(a / x);
        a--;
    }
    else
    {
        a = (unsigned long long)(a / x);
    }
    printf("%lld\n", b - a);
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include <iomanip>
using namespace std;

int main(void){
  int size;
  while(true){
    cin>>size;
    if(size==0) break;
    double sum=0.0,mean=0.0,variance=0.0;
    vector<double> vec(size);

    for(int i=0;i<size;i++){
      cin>>vec.at(i);
      sum+=vec.at(i);
    }
    mean=sum/size;
    for(int i=0;i<size;i++){
      variance+=(vec.at(i)-mean)*(vec.at(i)-mean);
    }
    variance/=size;
    variance=sqrt(variance);
    cout<<variance<<endl;
  }
  return 0;
}



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

#ifdef DEBUG
    #include "debug.h"
    #define DEB
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define DEB if (false)
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//////////////////

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

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (a>b) { a=b; return 1; } return 0; }

//*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)

vector<pair<int, int> > prime_factorize(int n) {
    vector<pair<int, int> > res;
    for (int p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

void solve(){
    int N;
    cin >> N;
    auto ps = prime_factorize(N);
    int ans = 0;
    for(P p : ps){
        int n = p.second;
        int k=0;
        rep(i,1000) if((i+1)*(i+2)/2 > n){ k=i; break;}
        dump(n,k);
        ans += k;
    }
    cout << ans << endl;
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 3632
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>


#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;

using namespace std;

int main()   {
    cout.precision(17);
    ll modd = 1000 * 1000 * 1000 + 7;
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
    ll infinit = 10000000000000000;

//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readstring(s);
        for(char c : s) {
            if (c == '?') { cout << 'D'; } else { cout << c;  }
        }
        cout << endl;

    }
    return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,k;
    cin>>n>>k;
    int ar[n+1],vis[n+1];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        ar[i]-=1;
        vis[i]=-1;
    }
    int cur=0,cnt=0;
    while(true)
    {
        if(vis[cur]!=-1)
            break;
        vis[cur]=cnt;
        cnt+=1;
        
        cur=ar[cur];

        if(cnt==k)
        {
            cout<<cur+1<<"\n";
            return 0;
        }
    }
    k=k-vis[cur];
  
    k%=(cnt-vis[cur]);
    while(k--)
    {
        cur=ar[cur];
    }
    cout<<cur+1<<"\n";
    return 0;
}

Measured memory_bytes: 5184
#include<bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;

ll N, ans;

bool is753(string s)
{
    vector<int> c(3, 0);
    REP(i, s.length())
    {
        if(s[i] == '7') c[0]++;
        else if(s[i] == '5') c[1]++;
        else if(s[i] == '3') c[2]++;
    }
    if(c[0] > 0 && c[1] > 0 && c[2] > 0) return true;
    return false;
}

int dfs(string s)
{
    ll res = 0;
    if(stoll(s) > N) return 0;
    if(is753(s)) res++;
    res += dfs(s + "7");
    res += dfs(s + "5");
    res += dfs(s + "3");
    return res;
}

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    cin >> N;
    ans += dfs("7");
    ans += dfs("5");
    ans += dfs("3");
    cout << ans << endl;
}

Measured memory_bytes: 256
n=gets.to_i
tmp=[]

ca="a"[0].ord
c0="0"[0].ord

d=1

loop do
    if n <= (26**d)
        #p d
        b=[ca]*d
        n-=1
        r = n.to_s(26).chars.map{|c|  c.match?(/\d/) ? c.to_i : c[0].ord-ca+10 }
        r.each_with_index.each{|x,i| b[b.size-r.size+i]+=x }
        print b.map(&:chr).join
        exit
    end
    n-=(26**d)
    d+=1

end


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

int main() {
  string s, t;
  cin >> s >> t;
  sort (s.begin(), s.end());
  sort (t.begin(), t.end());
  reverse (t.begin(), t.end());
  
  if (s<t) cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mn=2e5+7;
ll t[mn];

int main(){
	ll N,T;cin>>N>>T;
	ll ret=0;
	for(ll a=0;a<N;++a){
		cin>>t[a];
	}
	ret+=T;
	for(ll a=1;a<N;++a){
		if(t[a]-t[a-1]<T){ret+=t[a]-t[a-1];continue;}
		ret+=T;
	}
	cout<<ret<<endl;
}


Measured memory_bytes: 1792
import java.util.*;

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

        for (int i=0; i<nums.length; i++){
            nums[i] = sc.nextInt();
            if(nums[i]==0){
                System.out.print(i+1);
                return;
            }
        }
    }
}

Measured memory_bytes: 35708
import sys
readline = sys.stdin.buffer.readline
n,a,b = map(int,readline().split())
x = list(map(int,readline().split()))

ans = 0

for i in range(1,n):
    if a*(x[i]-x[i-1]) > b:
        ans += b
    else:
        ans += a*(x[i]-x[i-1])

print(ans)

Measured memory_bytes: 57072
// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e15 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const int N = 1e5 + 2;

int dp[102][N], pre[102][N];

void solve() {
   int n, k; cin >> n >> k;
   
   int data[n+5];
   for(int i = 1; i <= n; i++) cin >> data[i];
   
   for(int i = 0; i <= k; i++) pre[0][i] = 1;

   for(int i = 1; i <= n; i++) {
       for(int j = 0; j <= k; j++) {
         dp[i][j] = (pre[i-1][j] - pre[i-1][max(0ll, j-data[i]-1)] + mod) % mod;
         if(j - data[i] <= 0) dp[i][j] += pre[i-1][0];
         dp[i][j] %= mod;
         pre[i][j] += pre[i][j-1];
         pre[i][j] += dp[i][j];
         pre[i][j] %= mod;
       }
    }
   cout << dp[n][k] << '\n';
}

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

    /*#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif*/
    int t = 1; // cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }
}    


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

int abs(int a){
    if(a>0)return a;
    if(a<0)return -a;
    return 0;
}

int man(int a,int b,int c,int d){
    return abs(a-c)+abs(b-d);
}

int main(){
    int n,m;
    int a[55],b[55],c[55],d[55];
    int ans[55];
    int min=0,dis=0;
    for(int i=0;i<55;i++){
        a[i]=0;
        b[i]=0;
        c[i]=0;
        d[i]=0;
        ans[i]=0;
    }
    cin >> n >> m;
    for(int i=1;i<=n;i++){
        cin >> a[i] >> b[i];
    }
    for(int i=1;i<=m;i++){
        cin >> c[i] >> d[i];
    }

    for(int i=1;i<=n;i++){
        min=1000000000;
        for(int j=m;j>=1;j--){
            dis=man(a[i],b[i],c[j],d[j]);
            if(dis<=min){
                min=dis;
                ans[i]=j;
            }
        }
    }

    for(int i=1;i<=n;i++){
        cout << ans[i] << endl;
    }
    return 0;
}

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

int main() {
  string a;
  cin >> a;
  string x = "Yes";
  int N = a.size();
  for (int i = 0;i < (N - 1) / 2;i++) {
    if(a.at(i) != a.at(N - 1 - i)) {
      x = "No";
      break;
    }
  }
  for(int i = 0;i < ((N - 1) / 2) / 2;i++){
    if (a.at(i) != a.at((N - 3) / 2 - i)) {
      x = "No";
      break;
    }
  }
  cout << x << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<int> a(2 * n);
    for (int i = 0; i < 2 * n; ++i)
        cin >> a[i];

    sort(a.begin(), a.end());

    int answer = 0;
    for (int i = 0; i < 2 * n; i += 2)
        answer += a[i];

    cout << answer << endl;

    return 0;
}

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

using namespace std;

int main()
{
    int n, max, ans;
    int a[100001];

    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];

    sort(a, a + n);

    max = -1;
    ans = 0;

    for (int i = 0; i < n - 1; i++)
    {
        int tmp = a[i];
        if (a[n - 1] - a[i] < a[i])
        {
            tmp = a[n - 1] - a[i];
        }

        if (tmp > max)
        {
            max = tmp;
            ans = a[i];
        }
    }

    cout << a[n - 1] << " " << ans << endl;

    return 0;
}

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

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

	float hour = S / (float)3600;
	int hour2 = floor(hour);

	float min = S % 3600 / 60;
	int min2 = floor(min);

	int second = S % 3600 % 60;
	printf("%d:%d:%d\n", hour2, min2, second);
	return 0;
}


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

int n,k,ans=0;
int tot=0,h[100005],a[100005];
struct Edge{
    int x,next;
}e[200005];

inline void add_edge(int x,int y){
    e[++tot].x=y;
    e[tot].next=h[x],h[x]=tot;
}

int dfs(int x,int deep){
    int ret=deep;
    for(int i=h[x];i;i=e[i].next)
        ret=max(ret,dfs(e[i].x,deep+1));
    if(a[x]!=1&&ret-deep==k-1)return ans++,0;
    else return ret;
}

int main(){
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)scanf("%d",a+i);
    if(a[1]!=1)ans=a[1]=1;
    for(int i=2;i<=n;i++)add_edge(a[i],i);
    dfs(1,0),printf("%d",ans);
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

template <class T>
class SegmentTree {
    public:
        int N;
        vector<T> dat;
        T def;
        std::function<T(T, T)> operation;

        SegmentTree(int _n, T _def=1001001001, function<T(T, T)> _operation=[](T a, T b){return min(a, b);});
        T query(int a, int b, int k=0, int l=0, int r=-1);
        void update(int k, T a);
};

template <class T>
SegmentTree<T>::SegmentTree(int _n, T _def, function<T(T, T)> _operation):
    def(_def), operation(_operation) {
    N = 1;
    while (N < _n) N *= 2;
    dat = vector<T>(2*N-1, def);
}

template <class T>
T SegmentTree<T>::query(int a, int b, int k, int l, int r) {
    if (r < 0) r = N;

    if (r <= a || b <= l) return def;
    if (a <= l && r <= b) return dat[k];
    T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return operation(vl, vr);
}

template <class T>
void SegmentTree<T>::update(int k, T a) {
    k += N - 1;
    dat[k] = a;

    while (0 < k) {
        k = (k - 1) / 2;
        dat[k] = operation(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}

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

    vector<int> A(N);
    rep(i, N) cin >> A[i];

    SegmentTree<int> st(N);
    rep(i, N) st.update(i, A[i]);

    vector<ll> dp(N);
    rep(i, N) {
        int l = -1, r = i;
        while (r - l > 1) {
            int mid = (l + r) / 2;
            if (st.query(mid, i + 1) == A[i]) r = mid;
            else l = mid; 
        }
        dp[i] = (l >= 0 ? dp[l] : 0) + (ll)A[i] * (i - l);
    }

    ll ans = 0;
    rep(i, N) ans += dp[i];
    cout << ans << endl;
}

Measured memory_bytes: 4736
#C問題
N,x=map(int,input().split())
cand=list(map(int,input().split()))
count=0
for i in range(N-1):
    if cand[i]+cand[i+1]<=x:
        pass
    else:
        sa=x-cand[i]
        if sa >= 0:
            count+=(cand[i+1]-sa)
            cand[i+1]=sa
        else:
            count=(cand[i]+cand[i+1]-x)
            cand[i+1]=0
        
print(count)

Measured memory_bytes: 14052