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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int n, x;
	cin >> n >> x;
	vector<int> l(n);
	rep(i, n)cin>>l[i];

	int ans = 0;
	vector<int> d(n+1);
	d[0] = 0;
	ans = 1;
	rep(i,n){
		d[i+1] = d[i] + l[i];
		if(d[i+1] <= x) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3564
def check_math_result(m, f, r)
	if(m == -1 || f == -1)
		return "F"
	end	
	# 合計点数で判定
	case (m + f)
	when 80..100
		return "A"
	when 65..79
		return "B"
	when 50..64
		return "C"
	when 30..49
		return (r >= 50) ? "C" : "D"
	else
		return "F"
	end
end

inputs = gets.strip().split(" ").map{|i| i.to_i}
m = inputs[0]
f = inputs[1]
r = inputs[2]

until m == -1 && f == -1 && r == -1
	puts check_math_result(m, f, r)
	inputs = gets.strip().split(" ").map{|i| i.to_i}
	m = inputs[0]
	f = inputs[1]
	r = inputs[2]
end


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

int main(){
  int n;cin >> n;
  vector<int> a(n);rep(i,n)cin >> a[i];
  vector<int> b(n);
  rep(i,n){
    b[a[i]-1] = i+1;
  }
  rep(i,n){
    cout << b[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 1664
#!/usr/bin/env python3
import sys


def solve(N: int, T: int, C: "List[int]", TI: "List[int]"):

    L = []
    for c,t in zip(C,TI):
        L.append((c,t))
    L.sort()
    L = list(filter(lambda x: x[1] <= T,L))

    if len(L) == 0:
        print("TLE")
    else:
        print(L[0][0])

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    c = [int()] * (N)  # type: "List[int]" 
    t = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        c[i] = int(next(tokens))
        t[i] = int(next(tokens))
    solve(N, T, c, t)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int N, K;

signed main(void) {
    cin >> N >> K;
    cout << N-K+1 << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    from collections import deque
    input = sys.stdin.readline

    N = int(input())
    q = deque()
    q.append([0])

    for i in range(N):
        q_new = deque()
        while q:
            A = q.popleft()
            for j in range(1, max(A) + 2):
                A_new = A[:]
                A_new.append(j)
                q_new.append(A_new)
        q = q_new
    while q:
        A = q.popleft()
        ans = [chr(a+96) for a in A[1:]]
        print(''.join(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 78428
package main

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

func main() {
	N := nextInt()

	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}
	sum := int64(0)

	for i := 1; i < N; i++ {
		if A[i-1] > A[i] {
			s := A[i-1] - A[i]
			sum += int64(s)
			A[i] += s
		}
	}
	fmt.Println(sum)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}

func debug(args ...interface{}) {
	fmt.Fprintln(os.Stderr, args)
}


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


int main(){
    long long sum=0;
    long long N;
    cin >> N;
    for(long long i=1;i<N+1;i++){
        if((i%3==0)||(i%5==0)){
            continue;
        }
        sum+=i;
    }


    cout << sum << endl;
}

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

#define ull unsigned long long int
#define ll long long int

const ll M=1e9+7;

ll mod(ll n){
	return (n%M + M)%M;	
}
ll add(ll a, ll b){
	return mod(mod(a)+mod(b));
}
ll mul(ll a, ll b){
	return mod(mod(a)*mod(b));
}
ll modpow(ll x, ll n) 
{ 
	if (n == 0) 
		return 1%M;
	if (n == 1)
		return x%M; 
	ll u = modpow(x,n/2); 
	u = mul(u,u); 
	if (n%2) 
		u = mul(u,x); 
	return u; 
}
ll gcd(ll a,ll b){
	if(b==0)
		return a;
	return gcd(b,a%b);
}
bool isPrime(ll n){
	int end = sqrt(n);
	for(int i=2;i<=end;i++)
		if(n%i==0)
			return false;
	return true;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    
    
    int t=1;

    while(t--){
    	ll a,b,c,d;
    	cin>>a>>b>>c>>d;

    	ll ans;
    	if(a>=0 && c>=0)
    		ans=b*d;
    	else if(a>=0 && c<0){
    		ans=b*d;
    		ans=max(ans,a*d);
    	}
    	else if(a<0 && c>=0){
    		ans=b*d;
    		ans=max(ans,b*c);
    	}
    	else{
    		ans=b*d;
    		ans=max(ans,b*c);
    		ans=max(ans,a*c);
    		ans=max(ans,a*d);
    	}
    	cout<<ans<<endl;
    }

    
    return 0;
}


Measured memory_bytes: 3696
use std::io::Read;
use std::str::SplitWhitespace;
use std::str::FromStr;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse<T> {
    fn parse(&mut self) -> T;
}

impl<'a, T> Parse<T> for SplitWhitespace<'a>
where
    T: FromStr,
{
    fn parse(&mut self) -> T {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let n: usize = iter.parse();
    let m: usize = iter.parse();
    let mut v: Vec<u32> = (0..n).map(|_| iter.parse()).collect();
    v.sort_by(|a, b| b.cmp(a));

    let mut dp = vec![vec![0_u32; m]; 40];

    let mut v2 = v.iter().cloned().collect::<Vec<_>>();
    let mut count = 0;
    while !v2.is_empty() {
        let mut i = 0;
        let mut j = 0;
        for k in 0..m {
            let a = if i < dp[count].len() { dp[count][i] } else { 0 };
            let b = if j < v2.len() { v2[j] - v2[j] / 2 } else { 0 };
            if b < a {
                dp[count + 1][k] = a;
                i += 1;
            } else {
                dp[count + 1][k] = b;
                j += 1;
            }
        }
        v2 = v2.into_iter().map(|x| x / 2).filter(|&x| x > 0).collect();
        count += 1;
    }

    let sum: u64 = v.into_iter().map(u64::from).sum();
    let discount: u64 = dp[count].iter().map(|&x| x as u64).sum();

    println!("{}", sum - discount);
}

Measured memory_bytes: 28924
n, m = map(int, input().split())
v = [list(map(int, input().split())) for i in range(n)]
ans = 0
op = [-1,1]
for i in range(2):
    for j in range(2):
        for k in range(2):
            sx, sy, sz = op[i], op[j], op[k]
            dp = [-float("inf")]*(m+1)
            dp[0] = 0
            for l, (x, y, z) in enumerate(v):
                x *= sx
                y *= sy
                z *= sz
                score = x+y+z
                for h in range(min(m,l+1),0,-1):
                    dp[h] = max(dp[h], dp[h-1]+score)
            ans = max(ans, dp[-1])
print(ans)

Measured memory_bytes: 3368
#include <cstdio>
#include <vector>
#include <queue>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) < int(n); ++(i))
#define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i))
using ll = long long;
using namespace std;
template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

constexpr ll inf = ll(1e18)+9;
int main() {
    // input
    int n; scanf("%d", &n);
    vector<ll> a(3*n); repeat (i,3*n) scanf("%lld", &a[i]);
    // compute
    vector<ll> front(3*n+1); {
        reversed_priority_queue<ll> que;
        repeat (i,3*n) {
            que.push(a[i]);
            ll b = 0;
            if (que.size() == n+1) {
                b = que.top(); que.pop();
            }
            front[i+1] = front[i] + a[i] - b;
        }
    }
    vector<ll> back(3*n+1); {
        priority_queue<ll> que;
        repeat_reverse (i,3*n) {
            que.push(a[i]);
            ll b = 0;
            if (que.size() == n+1) {
                b = que.top(); que.pop();
            }
            back[i] = back[i+1] + a[i] - b;
        }
    }
    ll result = - inf;
    repeat_from (i,n,2*n+1) {
        setmax(result, front[i] - back[i]);
    }
    // output
    printf("%lld\n", result);
    return 0;
}

Measured memory_bytes: 9068
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main() {
  int n;
  double m;
  int sum = 0;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    sum += a.at(i);
  }
  int count = 0;
  double m4 = 1 / (4 * m);
  for (int i = 0; i < n; i++) {
    if (a.at(i) >= sum * m4) count++;
  }
  if (count >= m) {
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<queue>
#include<string.h>
#include<string>
#include<map>
#include<unordered_set>
#include<stack>
#include<vector>
#include<deque>
#define mod 998244353
using namespace std;
struct str {
	int idx, cnt;
};
int n, m, k, arr[300010];
string s, temp;
map<char, int> mp;
bool chk[30];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)scanf("%d", &arr[i]);
	int cnt = 0;
	for (int i = 1; i < n-1; i++) {
		if (arr[i - 1] < arr[i] && arr[i] < arr[i + 1])cnt++;
		else if (arr[i + 1] < arr[i] && arr[i] < arr[i - 1])cnt++;
	}
	printf("%d", cnt);
	return 0;
}

Measured memory_bytes: 256
moji = []
s = raw_input()
for i in s:
    if i == '0':
        moji.append('0')
    if i == '1':
        moji.append('1')
    if i == 'B':
        if len(moji) != 0:
            moji.pop(len(moji)-1)
print ''.join(moji)

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

XYH = []
for _ in range(N):
    x, y, h = map(int, input().split())
    XYH.append((x, y, h))
XYH.sort(key=lambda x: -x[2])

for Cx in range(0, 101):
    for Cy in range(0, 101):
        flg = True

        Ch = XYH[0][2]+abs(XYH[0][0]-Cx)+abs(XYH[0][1]-Cy)

        for x, y, h in XYH:
            if h != max(Ch - abs(x-Cx) - abs(y-Cy), 0):
                flg = False

        if flg:
            print(Cx, Cy, Ch)
            exit()


Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
//struct edge { int to, cost; };

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

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 prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    if (s == "ABC") {
        cout << "ARC" << endl;
    }
    else {
        cout << "ABC" << endl;
    }

    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ii pair <int , int>
#define is pair <int, string>
#define ll long long
#define mx 100000
#define sf scanf
#define sf(n) scanf("%d",&n)
#define pf printf
using namespace std;
vector <int> v;

/*int intConvert(string s){
    int n;
    stringstream geek(s);
    geek >> n;
    return n;
}*/

/*string strConvert(int n){
    string s;
    stringstream ss;
    ss << n;
    s=ss.str();
    return s;
}*/


int main(){
    int h1,m1,h2,m2,k;
    scanf("%d %d %d %d %d",&h1, &m1, &h2, &m2, &k);

    int ans1=(h2-h1)*60;
    int ans2=(m2-m1);
    int ans=ans1+ans2;

    cout<<ans-k<<endl;
    return 0;
}


Measured memory_bytes: 3768
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
#include <queue>
using namespace std;

int main(){
  string w; cin >> w;
  vector<int> cnt(26, 0);
  for(int i = 0; i < w.size(); i++){
    int tmp = w[i] - 'a';
    cnt[tmp]++;
  }
  for(int i = 0; i < 26; i++){
    if(cnt[i] % 2 != 0){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

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

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

const ll mod = 1e9+7;

ll modpow(ll x, ll n){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, M; cin >> N >> M;
    vl S(N); REP(i, N) cin >> S[i];
    vl T(M); REP(i, M) cin >> T[i];
    
    vvl dp(N+1, vl(M+1, 0)); dp[0][0]=1;
    REP(i, N+1) REP(j, M+1){
        if(i>0) dp[i][j] += dp[i-1][j];
        if(j>0) dp[i][j] += dp[i][j-1];
        if(i>0&&j>0&&S[i-1]!=T[j-1]) dp[i][j] = (dp[i][j]-dp[i-1][j-1]+mod)%mod;
        dp[i][j] %= mod;
    }
    cout << dp[N][M] << endstr;
    return 0;
}


Measured memory_bytes: 31616
#include <cstdio>
#include <algorithm>

using namespace std;

const int kMax = 100 + 5;

int n;
int num[kMax];

void print_num() {
    for(int i = 0;i < n;++ i) {
        if(i) printf(" ");
        printf("%d", num[i]);
    }
    printf("\n");
}

void solve() {
    int res = 0;
    for(int i = 0;i < n;++ i) {
        int mini = i;
        for(int j = i + 1;j < n;++ j) {
            if(num[j] < num[mini]) mini = j;
        }
        if(mini != i) swap(num[mini], num[i]), ++ res;
    }
    print_num();
    printf("%d\n", res);
}

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

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

void main_()
{
    ll N, M;
    cin >> N >> M;
    vector<pair<ll, ll>> students;
    for (ll i = 0; i < N; ++i) {
        int a, b;
        cin >> a >> b;
        students.emplace_back(a, b);
    }
    vector<pair<ll, ll>> checkpoints;
    for (ll i = 0; i < M; ++i) {
        int c, d;
        cin >> c >> d;
        checkpoints.emplace_back(c, d);
    }

    auto dist_manhattan = [](auto&& p1, auto&& p2) {
        return abs(p1.first - p2.first) + abs(p1.second - p2.second);
    };

    for (const auto& s : students) {
        ll min_dist = numeric_limits<ll>::max();
        int goal_num = 0;
        int checkpoint_num = 0;
        for (const auto& c : checkpoints) {
            checkpoint_num++;
            auto dist = dist_manhattan(s, c);
            if (dist < min_dist) {
                goal_num = checkpoint_num;
                min_dist = dist;
            }
        }
        cout << goal_num << "\n";
    }
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
NNN = input()

S,T = map(str, input().split())

S_list =list(S)
T_list =list(T)

N = len(S_list)
outstr = []

for n in range(N*2):
    if n%2 == 0:
        outstr.append(S_list[int(n / 2)])
    else:
        outstr.append(T_list[int(n / 2)])

STR = ','.join(outstr)
STR2 = STR.replace(",", "")
print(STR2)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef tuple<int64_t, int64_t, int64_t> T;
const int64_t INF = (1LL << 62);
const int MAXS = 2500, MAXN = 51;
vector<int64_t> C(MAXN), D(MAXN);
vector<T> to[MAXN];
vector<vector<int64_t>> dp(MAXN, vector<int64_t>(MAXS + 1, INF));
int64_t N, M, S;

int main()
{
  cin >> N >> M >> S;
  if (S > MAXS)
  {
    S = MAXS;
  }
  int64_t u, v, a, b;
  for (int i = 0; i < M; i++)
  {
    cin >> u >> v >> a >> b;
    u--, v--;
    to[u].emplace_back(v, a, b);
    to[v].emplace_back(u, a, b);
  }
  for (int i = 0; i < N; i++)
  {
    cin >> C.at(i) >> D.at(i);
  }
  priority_queue<T, vector<T>, greater<T>> que;
  que.emplace(0, 0, S); // time, node, coins
  while (que.size())
  {
    int64_t time, cur, coins;
    tie(time, cur, coins) = que.top();
    que.pop();
    if (dp[cur][coins] < time)
    {
      continue;
    }
    dp[cur][coins] = time;
    if (coins + C.at(cur) <= MAXS)
    {
      int64_t ncoins = coins + C.at(cur), ntime = time + D.at(cur);
      if (dp[cur][ncoins] > ntime)
      {
        dp[cur][ncoins] = ntime;
        que.emplace(ntime, cur, ncoins);
      }
    }
    for (auto e : to[cur])
    {
      int64_t next, ds, dt;
      tie(next, ds, dt) = e;
      if (coins - ds < 0)
      {
        continue;
      }
      if (dp[next][coins - ds] > time + dt)
      {
        dp[next][coins - ds] = time + dt;
        que.emplace(time + dt, next, coins - ds);
      }
    }
  }
  for (int i = 1; i < N; i++)
  {
    int64_t ans = INF;
    for (int j = 0; j <= MAXS; j++)
    {
      ans = min(ans, dp[i][j]);
    }
    cout << ans << endl;
  }
}

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

int main(){
  string s;
  int len;
  std::vector<int> a(3);
  std::cin >> s;
  len=s.length();
  if(len==1){
    std::cout << "YES" << std::endl;
  }else if(len==2){
    if(s.at(0)!=s.at(1))std::cout << "YES" << std::endl;
    else std::cout << "NO" << std::endl;
  }else{
    for (int i = 0; i < len; i++) {
      /* code */
      if(s[i]=='a')a.at(0)++;
      if(s[i]=='b')a.at(1)++;
      if(s[i]=='c')a.at(2)++;
    }
    sort(a.begin(),a.end());
    if(abs(a.at(0)-a.at(2))>=2)std::cout << "NO" << std::endl;
    else std::cout << "YES" << std::endl;
  }
  
  
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;
int main()
{
	ll n, k;
	cin >> n >> k;
	ll res = n % k;
	ll res2 = k - res;
	if (res < res2)	cout << res << endl;
	else {
		cout << res2 << endl;
	}
	return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
void chmax(T1 &a, const T2 &b) {
  if(a < b) a = b;
}

template <typename T1, typename T2>
void chmin(T1 &a, const T2 &b) {
  if(a > b) a = b;
}

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i != (int)(s.size())-1) cout << " ";
  }
  cout << "\n";
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n; cin >> n;

  if(n % 2) {
    cout << 0 << endl;
    return 0;
  }

  n /= 2;

  ll ans = 0;
  while(n) {
    ans += n / 5;
    n /= 5;
  }

  cout << ans << endl;


}


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

int pmod(int n, int mod) { return ((n % mod) + mod) % mod; }

int main() {
  string N;
  while (cin >> N, N != "0") {
    int lN = N.length();
    int rN = 0;
    vector<int> cntmod(11, 0);
    int prevrN = 0;
    int sign = 1;
    int ret = 0;
    for (int i = 0; i < lN; i++) {
      rN = rN + sign * (N[i] - '0');
      rN = pmod(rN, 11);
      if (rN != prevrN) cntmod[prevrN]++;
      ret += cntmod[rN];
      prevrN = rN;
      sign *= -1;
    }
    cout << ret << endl;
  }
  return 0;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()

struct UnionFind {
  vector<int> par;
  vector<int> sizes;

  UnionFind(int N) : par(N), sizes(N, 1) {
    for(int i = 0; i < N; i++) par.at(i) = i;
  }

  int find(int x) { 
    if (par.at(x) == x) return x;
    return par.at(x) = find(par.at(x));
  }

  void unite(int x, int y) {
    int rx = find(x); 
    int ry = find(y); 
    if (rx == ry) return; 
    if (sizes.at(rx) < sizes.at(ry)) swap(rx,ry);
    par.at(ry) = rx;
    sizes.at(rx) += sizes.at(ry);    
  }

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

  int size(int x){
    return sizes.at(find(x));
  }

  int num_of_connected_components(){
    int ret = 0;
    for(int i = 0; i < par.size(); i++){
      if(find(i) == i) ret++;
    }
    return ret;
  }
};

int main(){
  ll n,m; cin >> n >> m;
  UnionFind uft(n);
  vector<vector<ll>> lang(m);
  REP(i,n){
    ll k; cin >> k;
    REP(j,k){
      ll l; cin >> l;
      l--;
      lang[l].push_back(i);
    }
  }
  REP(i,m){
    ll s = lang[i].size();
    if(s<2) continue;
    FOR(j,1,s){
      uft.unite(lang[i][0], lang[i][j]);
    }
  }
  if(uft.num_of_connected_components()==1) cout << "YES" << endl;
  else cout << "NO" << endl;
}



Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define l_ength size
using ll = long long;
const ll infll = (1ll<<60);
const int mod = 1000000007;
using namespace std;

struct edge{
	int from;
	int to;
	ll cost;
};

vector<edge> graph;

int main(){
	int n, m; cin >> n >> m;
	const int s = 0, g = n-1;
	for( int i = 0; i < m; ++i ){
		int a, b, c; cin >> a >> b >> c;
		--a; --b;
		graph.push_back( (edge){a, b, -c} );
	}
	vector<ll> d(n);
	fill_n( d.begin(), n, infll );
	// スタート地点を 0 にしておく
	d[s] = 0;
	int k = n-1;
	while( k-- ){
		for( auto e : graph ){
			d[e.to] = min(d[e.to], d[e.from]+e.cost);
		}
	}
	bool negativ[n];
	fill_n( negativ, n, false );
	k = n;
	while( k-- ){
		for( auto e : graph ){
			if( d[e.to] > d[e.from]+e.cost ){
				d[e.to] = d[e.from]+e.cost;
				negativ[e.to] = true;
			}
			// if( negativ[e.from] ) negativ[e.to] = true;
		}
	}
	if( negativ[g] ) cout << "inf" << endl;
	else cout << -d[g] << endl;
	return 0;
}

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

#define reb(i,b,n) for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n) reb(i,0,n)
#define rreb(i,b,n) for(int i = b-1; i >= n; i--)
#define rrep(i,n) reb(i,n,0)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define reach(it,v) for(__typeof((v).rbegin()) it=(v).rbegin();it!=(v).rend();it++)
#define vall(x) (x).begin(), (x).end()
#define rvall(x) (x).rbegin(), (x).rend()
#define vsort(v) sort(vall(v))
#define rvsort(v) sort(rvall(v))
#define len(array) (sizeof (array) / sizeof *(array))
#define aall(x) x, x+len(x)
#define asort(x) sort(aall(x))
#define rasort(a, type) sort(aall(a), greater<type>())
#define afill(a, v) fill(aall(a), v)
#define afill2(a, v, type) fill((type *)a, (type *)(a + len(a)), v)
#define sz(x) (int)(x).size()
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define pb push_back
#define _USE_MATH_DEFINES
#define priArr(table, n) rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define priAr2(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = ["<<(x)<<"]"<<endl;

using namespace std;
using std::stringstream;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline std::string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class F, class T> inline void convert(const F &f, T &t){stringstream ss;ss<<f;ss>>t;}
template<class T> inline T sqr(T x) {return x*x;}

typedef long long ll; typedef unsigned long long ull;
typedef pair <int, int> P; typedef pair <int, P> PP;
typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<string> vs;
typedef vector<ll> vl; typedef vector<P > vP; typedef vector<char> vc;
typedef long double ld;

const static int INF = 0x3f3f3f3f;
const static ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const static double EPS = 1e-9;
const static ll MOD = 1000000007LL;

int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};
/* -------------------------------------------------------------------------- */

int main(int argc, char *argv[])
{
    ll N;
    cin >> N;

    ll ans = 0;

    reb(i, 1, N+1) {
        const bool div3 = ((i % 3) == 0);
        const bool div5 = ((i % 5) == 0);
        if (!(div3 && div5) && !div3 && !div5) {
            ans += i;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define INF 1e9+7
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long int lo;
lo n,k;
double arr[200005];
double pre[200005];
double maxim = -INF;
int main(){
    cin >> n >> k;
    pre[0] = 0;
    for(lo i = 1;i <= n;i++){
        lo a;
        scanf("%lld",&a);
        arr[i] = (double)(a * (a+1) /2)/a;
        pre[i] = pre[i-1] + arr[i]; 
    }
    for(lo i = 1;i <= n-k+1;i++){
        double ans = pre[i+k-1] - pre[i-1];
        maxim = max(maxim,ans);
    }
    printf("%.12f",maxim);
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=101;
const ll maxv=1e3+1;
const ll inf=1e18;
ll n,w,wt[maxn],v[maxn],dp[maxn][maxn*maxv];
int main()
{
	cin>>n>>w;
	for(int i=1;i<=n;i++)cin>>wt[i]>>v[i];
	for(int i=0;i<maxn;i++)for(int j=0;j<maxn*maxv;j++)dp[i][j]=inf;
	dp[0][0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<maxv*maxn;j++)
		{
			if(j==0)dp[i][j]=0;
			else if(v[i]>j)dp[i][j]=dp[i-1][j];
			else dp[i][j]=min(dp[i-1][j],wt[i]+dp[i-1][j-v[i]]);
		}
	}
	ll ans=0;
	for(int i=0;i<=n;i++)
	for(int j=0;j<maxv*maxn;j++)
	{
		if(dp[i][j]<=w)
		ans=max(ans,(ll)j);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 80000
#include<bits/stdc++.h>
using namespace std;
 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define eb emplace_back
#define ll long long
#define nl '\n'
#define in() ( { int a ; scanf("%d",&a); a; } )
 
const int N = 3e5 + 9;
const int mod = 1e9 + 7;
//int dx[]={1,0,-1,0,1,-1,-1,1};
//int dy[]={0,1,0,-1,1,1,-1,-1};

char s[7][7];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    ll n, m, k, i, j, r, c, ans = 0;
    cin >> n >> m >> k;
    for(i = 0; i < n ; i++){
        for(j = 0; j < m; j++){
            cin >> s[i][j];
        }
    }
    for(r = 0; r < (1 << n); r++){
        for(c = 0; c < (1 << m); c++){
            ll cnt = 0;
            for(i = 0; i < n; i++){
                for(j = 0; j < m; j++){
                    if(r&(1<<i) || c&(1<<j)) continue;
                    if(s[i][j] == '#'){
                        cnt++;
                    }
                }
            }
            if(cnt == k){
                ans++;
            }
        }
    }
    cout << ans << nl;
}

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

int N, M, X, Y, x = -1e9, y = 1e9, a;

int main() {
    cin >> N >> M >> X >> Y;
    rep(i, N) cin >> a, x = max(a, x);
    rep(i, M) cin >> a, y = min(a, y);
    string ans = "War";
    REP(Z, x+1, y+1) {
        if (X < Z && Z <= Y) ans = "No War";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

hit = [[0] * 3 for _ in range(3)]

for e in b:
    for i in range(3):
        for j in range(3):
            if a[i][j] == e:
                hit[i][j] = 1

bl = False
for i in range(3):
    if hit[i][0] and hit[i][1] and hit[i][2]:
        bl = True

    if hit[0][i] and hit[1][i] and hit[2][i]:
        bl = True

if hit[0][0] and hit[1][1] and hit[2][2]:
    bl = True

if hit[0][2] and hit[1][1] and hit[2][0]:
    bl = True

print("Yes" if bl else "No")


Measured memory_bytes: 3064
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)      x.begin(), x.end()
#define SIZE(x)     static_cast<i64>(x.size())
#define rep(i,n)    for (i64 i = 0, i ## _limit = (n); i < i ## _limit; ++i)
#define reps(i,s,t) for (i64 i = (s), i ## _limit = (t); i <= i ## _limit; ++i)
#define repr(i,s,t) for (i64 i = (s), i ## _limit = (t); i >= i ## _limit; --i)

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a && (a=b, true);}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a && (a=b, true);}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

template<class T, class U>
ostream& operator<< (ostream &os, const pair<T, U> &p) {
    return os << p.first << ' ' << p.second;
}

template<class Itr>
ostream& printContainer(Itr begin, Itr end, const string &separator = " ", ostream &os = cout) {
    const auto rbegin = std::prev(end);
    for (; begin != rbegin; ++begin) os << *begin << separator;
    os << *rbegin;
    return os;
}

ostream& operator<< (ostream &os, ostream&) {
    return os;
}

template <class T>
void _trace(const char *s, T&& x) {
    clog << '{';
    while(*s != '\0') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail) {
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}} End Header

signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);
    int N;
    cin >> N;

    int cnt4 = 0;
    int cnt2 = 0;
    int cnt1 = 0;

    rep(i, N) {
        i64 a; cin >> a;
        if (a % 4 == 0) {
            ++cnt4;
        } else if (a % 2 == 0) {
            cnt2 += 1;
        } else {
            ++cnt1;
        }
    }

    if (cnt2 > 0) ++cnt1;

    cout << ((cnt4 + 1 >= cnt1) ? "Yes" : "No") << "\n";

    return 0;
}


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

import math

# rad = a / 180 * math.pi

s = 0.5*a*b*math.sin(math.radians(c))

ab = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(c)))

h = 2*s/a

print("{:.12f}".format(s))
print("{:.12f}".format(ab+a+b))
print("{:.12f}".format(h))


Measured memory_bytes: 5716
#include <bits/stdc++.h>
using namespace std;
using ipair = pair<int, int>;
using P = pair<int, int>;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

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

const double PI=3.14159265358979323846;

const int mod = 1e9+7;

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

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

  ll all = 0;
  int prev=0;
  rep(i, N){
    all += abs(A[i] - prev);
    prev = A[i];
  }
  all += abs(0 - A[N-1]);


  rep(i, N){
    int increase;
    int decrease;
    if(i==0){
      increase = abs(A[1]-0);
      decrease = abs(A[0]-0) + abs(A[1]-A[0]);
    }else if(i==N-1){
      increase = abs(0 - A[i-1]);
      decrease = abs(A[i] - A[i-1]) + abs(0 - A[i]);
    }else{
      increase = abs(A[i+1] - A[i-1]);
      decrease = abs(A[i]-A[i-1])+abs(A[i+1]-A[i]);
    }

    cout << all+increase-decrease << endl;

  }
  return 0;
}


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> c(h + 2);
  string s;
  for (int i = 0; i < w; i++) {
    s += '.';
  }
  c[0] = s;
  for (int i = 1; i <= h; i++) {
    cin >> c[i];
    c[i] = '.' + c[i] + '.';
  }
  c[h + 1] = s;
  vector<int> dx = {1, 0, -1, 0};
  vector<int> dy = {0, -1, 0, 1};
  for (int i = 1; i < h; i++) {
    for (int j = 1; j < w; j++) {
      if (c[i][j] == '.') continue;
      bool flag = false;

      for (int k = 0; k < 4; k++) {
        if (c[i + dx[k]][j + dy[k]] == '#') {
          flag = true;
        }
      }

      if (flag == false) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
n,x = list(map(int,input().split()))
l = list(map(int,input().split()))

d = 0
count = 0

for i in range(len(l)):
  if d <= x:
  	d = d + l[i]
  	count = count + 1
  
if d <= x:
  count += 1
  
print(count)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<queue>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define INF 1000000007
#define MOD 1000000007
#define ARRAY_MAX 100005


int main(){

    int n;
    cin >> n;
    vector<int> a(ARRAY_MAX,0);
    vector<int> dp(ARRAY_MAX,INF);
    REP(i,n){
        cin >> a[i];
    }
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    for(int i = 2;i < n;i++){
        dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2] + abs(a[i]-a[i-2]));
    }
    cout << dp[n-1] << endl;

    return 0;
}

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

int main() {
	string s;
	cin >> s;
	set<int> se;
	for (int i = 0;i < s.size();i++) {
		se.insert(s[i]-'a');
	}
	if (s == "zyxwvutsrqponmlkjihgfedcba") {cout << -1 << endl;return 0;}
	else if (s.size() == 26) {
		int mi = s[25] - 'a';
		set<int> sse;
		sse.insert(s[25]-'a');
		for (int i = 24;i >= 0;i--) {
			if (s[i] < s[i+1]) {
				for (int j = s[i]-'a';j < 26;j++) {
					if (sse.find(j) != sse.end()) {
						s = s.substr(0,i) + char(j + 'a');
						cout << s << endl;
						return 0;
					}
				}
			} else {
				sse.insert(s[i]-'a');
			}
		}
	}
	else {
		for (int i = 0;i < 26;i++) {
			if (se.find(i) == se.end()) {s += (char)(i + 'a');break;}
		}
	}
	cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
#define n_max 10000
#define INF 10001000

#define rep(i, a, n) for(int i = a; i < n; i++)
#define rep2(i, a, n) for(int i = a; i <= n; i++)
#define rrep(i, a, n) for(int i = a; i > n; i--)
#define rrep2(i, a, n) for(int i = a; i >= n; i--)
#define lrep(i, a, n) for(long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;


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

    if(N%(2*D+1)) {
        cout << N/(2*D+1)+1 << endl;
    } else {
        cout << N/(2*D+1) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <cmath>

using namespace std;

using ll = long long;
using vl = vector<long long>;
using vi = vector<int>;
using vvl = vector<vl>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using pll = pair<long long, long long>;

int main()
{
    int n, k;
    cin >> n >> k;
    vi h(n), dp(n, numeric_limits<int>::max());
    for (auto &e : h)
        cin >> e;
    dp[0] = 0;
    for (int i = 1; i < n; i++)
        for (int j = 1; j <= k; j++)
            dp[i] = min(dp[i], (i - j >= 0 ? dp[i - j] + abs(h[i] - h[i - j]) : dp[i]));
    cout << dp[n - 1];
    return 0;
}

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

#define NAME "U - Grouping"
#define show(x) cout << (#x) << " is " << (x) << endl
#define ll long long
#define ms(arr,val) memset(arr,val,sizeof(arr))
#define len length()

const int maxn = 2e5;
int mx[16][16];
ll pre[(1<<16)];
ll dp[(1<<16)];

int n;

ll cal(int x){
    if(dp[x]!=-1) return dp[x];
    if (__builtin_popcount(x)<=1) return dp[x] =  0;

    ll val = pre[x];
    int subs = x;
    int opps;
    while(1){
        subs = (subs-1)&x;
        if (subs<=0) break;

        val = max(val,cal(subs) + cal( x^subs ));
    }

    return dp[x] = val;
}
int main(){
    //fstream cin(NAME".inp");
    //ofstream cout(NAME".out");
    cin>>n;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++) cin>>mx[i][j];
    vector<int> id;
    ll tmp;
    int subs;
    for(int i = 0;i<(1<<n);i++){
        for(int j = 0;j<n;j++)
            if(i>>j&1) id.emplace_back( j );
        tmp = 0;
        for(int j = 0; j<id.size() ; j++){
            for(int k = j+1;k<id.size();k++)
                tmp+= mx[ id[j] ][ id[k] ];
        }
        pre[i] = tmp;
        id.clear();
    }

    ms(dp,-1);

    cout<<cal( (1<<n) -1 )<<endl;
}


Measured memory_bytes: 4656
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;
string s;

int main() {
  int n;cin >> n;
  int cnt2=0;
  int cnt4=0;
  for (int i=0;i<n;++i){
    int t;cin>>t;
    if(t%4==0){
      ++cnt4;
    } else if(t%2==0){
      ++cnt2;
    }
  }
  if(cnt2+2*cnt4>=(n/2)*2){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(...)
#include <complex.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H , W;
    cin >> H >> W;
    vector<string>grid(H);
    for(string & s : grid)
        cin >> s;
    bool maybe = true;
    const int inf = 10;
    auto Count = [&](int Row , int Col){
        int cnt0 = inf , cnt1 = inf;
        for(int i = Col + 1; i < W; i++){
            if(grid[Row][i] == '#'){
                cnt0 = i;break;
            }
        }
        for(int i = Row + 1; i < H; i++){
            if(grid[i][Col] == '#'){
                cnt1 = i;
                break;
            }
        }
        return make_pair(cnt0 , cnt1); /// right , down
    };

     auto BOUND = [&](int i , int j){ return i >= 0 && i < H && j >= 0 && j < W; };
     int D = 0 , R = 0;
     int cnt = 0;
     vector<vector<bool>> visited(H , vector<bool> (W , false));
     while(BOUND(D , R)){
        int a, b;
        tie(a , b) = Count(D , R);
        if(BOUND(D , R)){
            visited[D][R] = true;
        }
        if(a != b){
            if(a < b)R++;
            else D++;
        }
        else if(a== b && a != inf && a- 1 == R && b - 1 == D){
            maybe = false;
            break;
        }

        else if(a == b && a== inf){
            D++ , R++;
        }
        else{
            maybe = false;
            break;
        }
        cnt++;
        if(cnt >= H * W){
            maybe = false;
            break;
        }
     }
     for(int i = 0; i < H; ++i)for(int j = 0; j < W; j++)if(grid[i][j] == '#')maybe &= (visited[i][j] == true);
     cout << (maybe && BOUND(D - 1 , R - 1) ? "Possible" : "Impossible") << '\n';



    return 0;
}














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

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  string s;
  cin >> s;
  int N = s.size();
  REP(i, N) cout << 'x';
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0; i<(n); ++i)

int main(){
    int n,m; std::cin >> n >> m;
    std::vector<bool> ac(n+1,false);
    std::vector<int> wa_cnt(n+1,0);
    rep(i,m){
        int p;
        std::string s;
        std::cin >> p >> s;
        if(ac[p]) continue;
        if(s == "WA")
            ++wa_cnt[p];
        else
            ac[p] = true;
    }
    int AC=0, WA=0;
    for(int i=1; i<n+1; ++i){
        if(ac[i]){
            ++AC;
            WA += wa_cnt[i];
        }
    }
    std::cout << AC << ' ' << WA << std::endl;
    return 0;
}

Measured memory_bytes: 3668