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

#define say(obj) (cout << (obj) << endl)
#define endline (cout << endl)
#define all(container) (container).begin(), (container).end()
#define sortall(container) (sort((container).begin(), (container).end()))
#define yn(cond) ((cond) ? (cout << "yes" << endl) : (cout << "no" << endl))
#define Yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to, cost;
	edge_(ll to, ll cost) : to(to), cost(cost) {}
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr int		INF = (int)1e7;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template <typename T>
T getSum(std::vector<T>& v) {
	T ret = 0;
	for (T& x : v) ret += x;
	return ret;
}

template <typename T>
istream& operator >> (istream & is, vector<T> & vec) { for (T& x : vec) is >> x;  return is; }
template <typename S, typename T>
istream& operator >> (istream & is, pair<S, T> & p) { is >> p.first >> p.second; return is; }
istream& operator >> (istream & is, point & p) { is >> p.x >> p.y;          return is; }

template <typename T>
ostream& operator << (ostream & os, const vector<T> & vec) { for (const T& x : vec) os << x << " "; return os; }
template <typename T>
ostream& operator << (ostream & os, const vector<vector<T>> & mat) { for (const vector<T>& m : mat) os << m << endl; return os; }
template <typename S, typename T>
ostream& operator << (ostream & os, const pair<S, T> & p) { os << "{" << p.first << " : " << p.second << "}"; return os; }
template <typename T>
ostream& operator << (ostream & os, const set<T> & s) { for (const T& x : s) os << x << " "; return os; }
ostream& operator << (ostream & os, const edge e) { os << "{to: " << e.to << ", cost: " << e.cost << "}"; return os; }
ostream& operator << (ostream & os, const point & p) { os << "(" << p.x << " " << p.y << ")"; return os; }

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	int A, B;
	cin >> A >> B;

	if (A >= 13)
		say(B);
	else if (A >= 6)
		say(B / 2);
	else
		say(0);

	return 0;
}


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

int main()
{
	priority_queue <int,vector<int>,less<int> >q;
	int n,m;
	cin >> n >> m;
	for(int i = 0;i < n;i++){
		int t;
		scanf("%d",&t);
		q.push(t);
	} 
	for(int i = 0;i < m;i++){
		int t = q.top();
		q.pop();
		t /= 2;
		q.push(t);
	}
	long long sum = 0;
	while(!q.empty()){
		sum += q.top();
		q.pop();
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 892
// i will show you da wae
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fill(x,v) memset(x,v,sizeof(x))
#define FOR(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define N 100050
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

ll dp[N];

ll solve(int k){
    priority_queue<ii,vector<ii>,greater<ii> > pq;
    FOR(i,0,k) dp[i] = LLONG_MAX;
    FOR(i,1,10){
        pq.push(ii(i,i%k));
        dp[i%k] = i;
    }

    while(1){
        ii top = pq.top();
        pq.pop();
        ll sum = top.first, mod = top.second;
        if(mod == 0) return sum;
        FOR(i,0,10){
            ll nmod = (mod*10+i)%k, nsum = sum + i;
            if(dp[nmod] > nsum){
                dp[nmod] = nsum;
                pq.push(ii(nsum,nmod));
            }
        }
    }
    return 0;
}

int main(){
    
    int k;
    cin >> k;
    cout << solve(k) << endl;

    return 0;
}


Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>

using namespace std;

int a, b, c = 0;

int main() {

	cin >> a >> b >> c;
	if (a + b >= c) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	in := input()
	n := parseInt(in)
	slice := inputSlicelnInt(n)
	sort.Sort(sort.Reverse(sort.IntSlice(slice)))
	sum := 0
	for i := 0; i < n; i++ {
		// fmt.Println(slice[i])
		if i == 0 {
			sum += (slice[i] / 2)
		} else {
			sum += slice[i]
		}
	}
	fmt.Print(sum)
	// fmt.Printf("type: %T, value: %v\n", n, n)
	// fmt.Printf("type: %T, value: %v\n", m, m)
	// fmt.Println(m)
}

func input() string {
	sc.Scan()
	return strings.TrimSpace(sc.Text())
}

// func inputSlice() []string {
// 	stdin := bufio.NewScanner(os.Stdin)
// 	stdin.Scan()
// 	text := strings.TrimSpace(stdin.Text())
// 	return strings.Split(text, " ")
// }

func inputSlicelnStr(n int) []string {
	slice := make([]string, 0, n)
	for i := 0; i < n; i++ {
		in := input()
		slice = append(slice, in)
	}
	return slice
}
func inputSlicelnInt(n int) []int {
	slice := make([]int, 0, n)
	for i := 0; i < n; i++ {
		in := input()
		slice = append(slice, parseInt(in))
	}
	return slice
}

func parseInt(s string) int {
	i, _ := strconv.Atoi(s)
	return i
}


Measured memory_bytes: 640
program main
	implicit none
	character(10) :: S
	
	read(*, '(A)') S
	
	if(S(6:7) <= "04" ) then
		write(*, *) "Heisei"
	else if(S(6:7) > "04") then
		write(*, *) "TBD"
	end if
end program main

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long ;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i<(ll)(n); i++)
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<ll> vcl;

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}
ll c2(ll n){
    return n*(n-1)/2;
}

int main(){
char alpha;
cin>>alpha;
if(isupper(alpha)){
    cout<<'A'<<endl;
}
else{cout<<'a'<<endl;}
}



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

#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

struct UF{
    vector<int>par,sz;
    void init(int n){
        par.resize(n);
        sz.resize(n);
        for(int i=0;i<n;i++){
            par[i]=i;
            sz[i]=1;
        }
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return;
        sz[x]+=sz[y];
        par[y]=x;
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return sz[find(x)];
    }
};

int N;
int X[11111],Y[11111];
vpint vec;
int latte[111111];
int L[111111],R[111111];

void dfs(int v,set<int>&s,vint &ord,bool flag){
    s.erase(v);
    int k=vec[v].se^1;
    int u=latte[k];

    while(true){
        auto it=s.lower_bound(L[u]);
        if(it==s.end())break;
        if(*it==u)it++;if(it==s.end())break;

        if(*it>R[u])break;
        dfs(*it,s,ord,flag);
    }

    if(!flag)ord.pb(k);
    else ord.pb(k^1);
}

bool C(int d){
    int idx=0;
    rep(i,N*2){
        while(idx<i&&vec[i].fi-vec[idx].fi>=d)idx++;
        L[i]=idx;
    }
    idx=N*2-1;
    for(int i=N*2-1;i>=0;i--){
        while(i<idx&&vec[idx].fi-vec[i].fi>=d)idx--;
        R[i]=idx;
    }

   set<int>s;
    rep(i,N*2)s.insert(i);
    vint ord;
    while(s.size())dfs(*s.begin(),s,ord,0);

    UF uf;uf.init(N*2);
    rep(i,N*2)s.insert(i);
    reverse(all(ord));


    for(auto v:ord){
        if(s.find(latte[v])==s.end())continue;
        vint lis;
        dfs(latte[v],s,lis,1);
        for(int i=0;i+1<lis.size();i++)uf.unite(lis[i],lis[i+1]);
    }

    rep(i,N)if(uf.same(i*2,i*2+1))return false;
    return true;
}

signed main(){
    scanf("%lld",&N);
    rep(i,N)scanf("%lld%lld",&X[i],&Y[i]);

    rep(i,N){
        vec.pb({X[i],i*2});
        vec.pb({Y[i],i*2+1});
    }
    sort(all(vec));
    rep(i,N*2)latte[vec[i].se]=i;

    int lb=0,ub=1001001001001ll;
    while(ub-lb>1){
        int mid=(ub+lb)/2;
        if(C(mid))lb=mid;
        else ub=mid;
    }
    cout<<lb<<endl;
    return 0;
}


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

#define ankit_2305 cerr<<"\nTime taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<" sec\n";
#define START clock_t
#define TIMER time_p=clock();
#define ll long long

#define MOD 1000000007

using namespace std;

int main(){
    START TIMER
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int a, b;
	cin>>a>>b;
	cout<<a*b;
    ankit_2305
    return 0;
}


Measured memory_bytes: 3792
S=input()
T=""
l=["maerd","remaerd","esare","resare"]
flag=True
for i in range(len(S)):
    T=T+S[len(S)-1-i]
    if T in l:
        T=""
    if len(T)>7:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 39536
import collections

N = int(input())
A = list(map(int, input().split()))

A.sort()
C = collections.Counter(A)

mx = A[-1]
mn = A[0]

flag = True

if mx % 2 == 0:
    if mn != mx // 2:
        flag = False
    if C[mn] != 1:
        flag = False
else:
    if mn != mx // 2 + 1:
        flag = False
    if C[mn] != 2:
        flag = False

for i in range(mn + 1, mx + 1):
    if C[i] < 2:
        flag = False
        break

if flag:
    print("Possible")
else:
    print("Impossible")

Measured memory_bytes: 3828
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	s, _ := r.ReadString('\n')
	s = strings.TrimRight(s, " \t\n")
	N, _ := strconv.Atoi(s)

	if N%2 == 0 {
		fmt.Println(N)
	} else {
		fmt.Println(N * 2)
	}
}


Measured memory_bytes: 1772
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
using namespace std;
int main() {
	int n, ball[10001];
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> ball[i];
		}
		int ans = n;
		for (int i = 1; i < n; i++) {
			for (int j = 1; j <= 3; j++) {
				int on = i - 1, un = i + 1, del = 1, clr = j, dsum = 0;
				while (1) {
					while (on >= 0 && ball[on] == clr) {
						on--;
						del++;
					}
					while (un < n&&ball[un] == clr) {
						un++;
						del++;
					}

					if (del < 4)break;
					if (del >= 4) {
						dsum += del;
						clr = ball[on];
						del = 0;
					}

					
					if (on < 0 || un >= n) break;
					if (n - dsum < 4)break;
				}
				ans = min(ans, n - dsum);
			}
		}
			cout << ans << endl;
	}
		return 0;
}


Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  ll n;
  cin >> n;
  ll ans = 0;
  ll m;
  set<ll> st;
  REP(i,sqrt(n)){
    if(n%(i+1)==0) {
      st.insert(i+1);
      st.insert(n/(i+1));
    }
  }
  st.erase(1);
  for(auto i:st){
    m = i-1;
    if(n%m==n/m) ans += m;
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b;
    cin >> n >> a >> b;

    string ans = "Draw";
    if(n == 2 && a == 1 && b == 2)
    {
        ans = "Borys";
    }
    else
    {       
        int i;
        for (i = 0; i < n; i++)
        {
            if(a + 1 == b)
            {
                break;
            }
            if(i % 2 == 0)
            {
                a++;
            }
            else
            {
                b--;
            }
        }
        if(i % 2 == 1)
        {
            ans = "Alice";
        }
        else
        {
            ans = "Borys";
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int dir = 0;
            int last = in.nextInt();
            int res = 1;
            for (int i = 1; i < n; ++i) {
                int cur = in.nextInt();
                if (cur == last) continue;
                int ndir = cur > last ? 1 : -1;
                if (dir * ndir < 0) {
                    ++res;
                    ndir = 0;
                }
                dir = ndir;
                last = cur;
            }
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 35856
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn main() {
    input! {
        x: i32,
        a: i32,
        b: i32,
    }
    if b <= a {
        println!("delicious");
    } else if a < b && b <= a + x {
        println!("safe");
    } else {
        println!("dangerous");
    }
} 


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

use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let n: usize = read!();
    let mut answers = vec![0; n];

    for x in 1..n {
        if x * x > n {
            break;
        }
        for y in 1..n {
            if y * y > n {
                break;
            }
            for z in 1..n {
                if z * z > n {
                    break;
                }
                let f = x * x + y * y + z * z + x * y + y * z + z * x;
                if (1..=n).contains(&f) {
                    answers[f-1] += 1;
                }
            }
        }
    }

    for answer in answers {
        println!("{}", answer);
    }
}


Measured memory_bytes: 2008
use proconio::{input, fastout};
use std::collections::{HashMap, HashSet, VecDeque};


#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(usize, usize); m],
    }

    let mut map = HashMap::new();

    for &(a, b) in ab.iter() {
        (*map.entry(a).or_insert_with(|| vec![])).push(b);
        (*map.entry(b).or_insert_with(|| vec![])).push(a);
    }

    let ans = bfs(&map, n);
    if let Some(ans) = ans{
        println!("Yes");
        for i in ans.iter() {
            println!("{}", i);
        }
    } else {
        println!("No");
    }
}



fn bfs(map: &HashMap<usize, Vec<usize>>, n: usize) -> Option<Vec<usize>> {
    let mut ans = vec![0; n-1];
    let mut set = HashSet::new();
    for i in 2..=n {
        set.insert(i);
    }
    let mut queue = VecDeque::new();
    queue.push_back(1);
    while let Some(key) = queue.pop_front() {
        if let Some(next) = map.get(&key) {
            for i in next.iter() {
                if set.remove(i) {
                    queue.push_back(*i);
                    ans[*i-2] = key;
                }
            }
        }
    }
    if set.is_empty() {
        Some(ans)
    } else {
        None
    }
}

Measured memory_bytes: 21092
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ncr[105][105];
int main()
{
    ncr[0][0]=1;
    int limcr=100;
    for(int i=1;i<=limcr;i++)
    {
        for(int j=0;j<=limcr;j++)
        {
            if(j>i)
                ncr[i][j]=0;
            else if(j==i||j==0)
                ncr[i][j]=1;
            else
            ncr[i][j]=ncr[i-1][j-1]+ncr[i-1][j];
        }
    }
    int n,m;
    cin>>n>>m;
    cout<<ncr[m][2]+ncr[n][2]<<endl;
    return 0;

    return 0;
}


Measured memory_bytes: 384
l,s = [],[]
for i in range(5):
    num = int(input())
    l.append(num)
    if num%10!=0:
        s.append(num%10)

res = 0

for i in l:
    if i%10!=0:
        res += (i+10)//10*10
    else:
        res += i
else:
    if len(s) != 0:
        tmp = min(s)
    else:
        tmp = 10
    print(res-(10-tmp))

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <string>
#define SIZE 105

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

char str[SIZE];
int A[SIZE];

int main()
{
	scanf("%s",&str);
	int n=strlen(str);
	int ret=n;
	for(int i=0;i<26;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(str[j]-'a'==i) A[j]=0;
			else A[j]=1;
		}
		int sz=n;
		for(int t=0;;t++)
		{
			bool up=true;
			for(int j=0;j<sz;j++) if(A[j]==1) up=false;
			if(up)
			{
				ret=min(ret,t);
				break;
			}
			for(int j=0;j+1<sz;j++) A[j]=min(A[j],A[j+1]);
			sz--;
		}
	}
	printf("%d\n",ret);
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/

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


int main(){
    ll k;cin>>k;
    ll p=k/50,q=k%50;
    ll a[50];for(int i=0;i<=49;i++)a[i]=p+49;
    while(q--){
        ll min=a[0],minx=0;
        for(int i=1;i<=49;i++)if(min>a[i]){min=a[i];minx=i;}
        for(int i=0;i<=49;i++){
            if(i==minx)a[i]+=50;
            else a[i]--;
        }
    }cout<<50<<endl;
    for(int i=0;i<=49;i++)cout<<a[i]<<" ";
    return 0;
}

Measured memory_bytes: 256
import sys
input == sys.stdin.readline

def main():
    """dpをするときのてんぷれコ―ド"""
    #1:初期化
    mod = 10**9+7
    H, W = map(int, input().split())
    a = []
    for _ in range(H):
        a.append(input())
    dp = [[0]*(W) for _ in range(H)]

    #2:初期値
    dp[0][0] = 1
    
    #3:dp実行部(貰うDP)
    for i in range(H):
        for j in range(W):
            if a[i][j] == ".":             
                if i == 0 and j == 0:
                    continue
                elif i == 0 and a[i][j-1] == ".":
                    dp[i][j] += dp[i][j-1]
                elif j == 0 and a[i-1][j] == ".":
                    dp[i][j] += dp[i-1][j]
                else:
                    if a[i][j-1] == ".":
                        dp[i][j] += dp[i][j-1]
                    if a[i-1][j] == ".":
                        dp[i][j] += dp[i-1][j]

    #print(*dp,sep="\n")

    #4:出力
    print(dp[H-1][W-1] % mod)

if __name__ == '__main__':
    main()

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

#define ull unsigned long long

#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

bool isPalindrome(string s) {
    string t(s.rbegin(), s.rend());
    return s == t;
}

int main(void) {
    int X, Y, Z;
    cin >> X >> Y >> Z;
    printf("%d %d %d\n", Z, X, Y);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define MOD 1000000007
using namespace std;

int main(){
    int N;
    cin >> N;
    char S1[N],S2[N];
    int sw = 0;
    for (int i=0;i<N;i++)cin >> S1[i];
    for (int i=0;i<N;i++)cin >> S2[i];
    int cnt=0;
    long x=1;
    if(S1[0] == S2[0]){x=3;sw=0;}
    else{x=6;cnt++;sw=1;}
    cnt++;
    while(cnt<N){
        if(S1[cnt] == S2[cnt]){
            if(sw==0)x*=2;
            else     x*=1;
            sw = 0;
        }else{
            if(sw==0)x*=2;
            else     x*=3;
            sw = 1;
            cnt++;
        }
        cnt++;
    }
    cout << x%MOD << endl;
    return 0;
}


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

using namespace std;
//using namespace std::chrono;

#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vll vector<long long>

typedef long long ll;

void print(vi v){
    cout<<"Contents of vector:\n";
    for(auto x : v) cout<<x<<" ";
    cout<<endl<<endl;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); //cout.tie(nullptr);
    //ifstream cin("lmio_1991_3e1_seka_01.in"); ofstream cout("lmio_1991_3e1_seka_01.out");///cia failai

    //int T; cin>>T;
    int T = 1;

    for(int it = 1; it<=T; it++){
        int n; double d; cin>>n>>d;
        int cnt = 0;
        for(int i = 0; i<n; i++){
            ll x, y; cin>>x>>y;
            double dist = sqrt(x*x + y*y);
            if(dist <= d){
                cnt++;
            }
        }
        cout<<cnt<<endl;

    }
}


Measured memory_bytes: 3864
N = int(input())
D, X = map(int, input().split())
A = [int(input()) for i in range(N)]

choco = X

for i in range(N):
  j = 0
  a = 0
  while a <= D:
    a = j*A[i] + 1
    if a <= D:
      choco += 1
    j += 1
    
print(choco)


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

int main(void){
    string s;
    cin >> s;
    vector<bool> bucket(26,false);

    for(int i=0;i<s.size();i++){
        bucket.at((int)(s.at(i)-'a')) = true;
    }

    for(int i=0;i<bucket.size();i++){
        if(!bucket.at(i)){
            cout << (char)('a'+i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> V;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;

int main() {
    int h,w;
    ll k;
    cin >> h >> w >> k;
    vector<vector<char>> g(h,vector<char>(w));
    rep(i,h){
        rep(j,w){
            cin >> g[i][j];
        }
    }
    ll ans=0;
    for(int bit1 = 0;bit1 < (1<<h);++bit1){
        for(int bit2 = 0;bit2 < (1<<w);++bit2){
            vector<vector<char>> tmp = g;
            rep(i,h) {
                if(bit1 & (1<<i)){
                    rep(j,w) tmp[i][j] = '.';
                }
            }
            rep(j,w) {
                if(bit2 & (1<<j)){
                    rep(i,h) tmp[i][j] = '.';
                }
            }
            ll cnt = 0;
            rep(i,h) {
                rep(j,w) {
                    if(tmp[i][j]=='#') cnt++;
                }
            }
            if(cnt==k) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    int cnt = 1;
    for (int i = 0; i < S.length() - 1; i++) {
      if (S.charAt(i) != S.charAt(i + 1)) {
        cnt++;
      }
    }
    System.out.println(cnt);
  }
}


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

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(a-b==0){
		cout<<c<<endl;
	}
	else{
		if(b-c==0){
			cout<<a<<endl;
		}
		else{
			cout<<b<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
  ll r;
  cin >> r;
  cout << 3*r*r << endl;
}

int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 3656
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <utility>
#include <bitset>

using namespace std;
using ll = long long int;
using vl = vector<ll>;

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

	string n;
	int ans = 0;
	cin >> n;
	for (int i = 0; i < n.size(); i++){
		ans += (int)(n[i] - '0');
	}
	for (int i = 0; i < min((size_t)(18),n.size()); i++) {
		string x = n;
		int kari = 0;
		if (x[i] == '0')continue;
		x[i] = x[i] - 1;
		for (int j = i + 1; j < x.size(); j++) {
			x[j] = '9';
		}
		for (int j = 0; j < x.size(); j++) {
			kari += (int)(x[j] - '0');
		}
		ans = max(kari, ans);
}
	
	cout << ans;
	cin >> ans;
	return 0;
}

Measured memory_bytes: 256
import sys
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
for i in a:
    x -= i
    if x < 0:
        print(count)
        sys.exit(0)
    else:
        count += 1
if x != 0:
    print(count - 1)
else:
    print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6;
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);

  int a,b;cin>>a>>b;
  cout<<max(0,a-2*b)<<endl;

  return 0;
}


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

int main()
{
    int n,k,s;
    cin>>n>>k>>s;
   for(int i=0;i<n;i++)
   {
       if(i<k)cout<<s<<" ";
       else if(i<n-1)
       {
           if(s+1>n)
           {
               cout<<1<<" ";
           }
           else cout<<s+1<<" ";
       }
       else
       {
            if(s+1>n)
           {
               cout<<1<<endl;
           }
           else cout<<s+1<<endl;
       }
   }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> void vdebug(vector<T> v){ cout << "vdebug" << endl; for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], ll n){ cout << "adebug" << endl; reps(i, 0, n){ cout << arr[i] << " "; } cout << endl; }
template<typename T1, typename T2> void mdebug(map<T1, T2> mp){ cout << "mdebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
template<typename T1, typename T2> void mldebug(multimap<T1, T2> mp){ cout << "mldebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
template<typename T1, typename T2> void mdebugr(map<T1, T2, greater<T1>> mp){ cout << "mdebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
template<typename T1, typename T2> void mldebugr(multimap<T1, T2, greater<T1>> mp){ cout << "mldebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


ll mod = 998244353;

ll powpow(ll num1, ll num2){
    ll res = 1;
    while(num2 > 0){
        res *= num1;
        res %= mod;
        num2--;
    }
    return res%mod;
}

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

    ll n, d[100010];
    ll cnt[100010];
    Fill(cnt, 0);
    cin >> n;
    reps(i, 1, n){
        cin >> d[i];
        cnt[d[i]]++;
    }

    if(d[1] != 0 || cnt[0] != 1){
        cout << 0 << endl;
        return 0;
    }

    ll res = 1;
    reps(i, 0, n){
        if(i == 1 || i == 0) continue;
        if(cnt[i-1] == 0 && cnt[i] > 0){
            cout << 0 << endl;
            return 0;
        }
        res *= powpow(cnt[i-1], cnt[i]);
        res %= mod;
    }

    cout << res << endl;

    return 0;
}


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

#define ll long long
#define p_q priority_queue
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define str string
#define s_vec(data,name,vertical,horizontal) vector<vector<(data)>> (name)((vertical),vector<(data)>((horizontal)));




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

    vector<vector<ll>> ab(m,vector<ll>(2));

    for(ll i=0;i<m;i++){
        cin>>ab.at(i).at(1)>>ab.at(i).at(0);
    }

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


    ll co=1;
    ll del=ab.at(0).at(0)-1;
    for(ll i=1;i<m;i++){
        if(del<ab.at(i).at(1)){
            del = ab.at(i).at(0)-1;
            co++;
        }
    }

    cout<<co<<endl;
}




Measured memory_bytes: 5760
package main
 
import (
	"fmt"
)
 
func main() {
	var n int
	var s string
	fmt.Scan(&n)
	fmt.Scan(&s)

	x := 0
  	max := 0
    for i := 0; i < n; i++ {
     	if s[i:i+1] == "I" {
            x++
        }
        if s[i:i+1] == "D" {
            x--
        }
        if x > max {
        	max = x
        }
    }
	fmt.Printf("%d\n", max)
}

Measured memory_bytes: 1840
Q = 10**9+7
N, M = map( int, input().split())
V = [0]*(N+1)
dp = [0]*(N+1)
dp[0] = 1
for _ in range(M):
    a = int( input())
    V[ a] = 1
for i in range(N):
    dp[i] %= Q
    if i == N-1:
        dp[N] += dp[N-1]
        continue
    if V[i+1] == 0:
        dp[i+1] += dp[i]
    if V[i+2] == 0:
        dp[i+2] += dp[i]
print(dp[N]%Q)


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

using namespace std;

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

    int n, k;
    cin >> n >> k;
    int cnt = 0;
    while (n) {
        cnt++; n /= k;
    }
    cout << cnt << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <complex>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

int n;
string s;

string str(string st){
    for(int i=1;i<=n;i++){
        if(s[i]=='o'){
            if(st[i]=='0'){
                st+=st[i-1];
            }
            else if(st[i-1]=='0') st+='1';
            else st+='0';
        }else{
            if(st[i]=='1'){
                st+=st[i-1];
            }
            else if(st[i-1]=='0') st+='1';
            else st+='0';
        }
    }
    if(st[0]==st[n] && (s[0]=='o'&&st[0]=='0'&&st[1]==st[n-1])) return st;
    if(st[0]==st[n] && (s[0]=='o'&&st[0]=='1'&&st[1]!=st[n-1])) return st;
    if(st[0]==st[n] && (s[0]=='x'&&st[0]=='0'&&st[1]!=st[n-1])) return st;
    if(st[0]==st[n] && (s[0]=='x'&&st[0]=='1'&&st[1]==st[n-1])) return st;
    else return "false";
}

int main(){
    cin >> n >> s;
    //0=sheep 1=wolf
    string res1="00",res2="01",res3="10",res4="11";
    if(str(res1)!="false"){
        string ans=str(res1);
        rep(i,n){
            if(ans[i]=='0') cout << 'S';
            else cout << 'W';
        }
        return 0;
    }
    if(str(res2)!="false"){
        string ans=str(res2);
        rep(i,n){
            if(ans[i]=='0') cout << 'S';
            else cout << 'W';
        }
        return 0;
    }
    if(str(res3)!="false"){
        string ans=str(res3);
        rep(i,n){
            if(ans[i]=='0') cout << 'S';
            else cout << 'W';
        }
        return 0;
    }
    if(str(res4)!="false"){
        string ans=str(res4);
        rep(i,n){
            if(ans[i]=='0') cout << 'S';
            else cout << 'W';
        }
        return 0;
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
#define int  long long int
#define fi first
#define se second
#define pb push_back
#define soo(v) sort(v.rbegin(),v.rend())
#define so(v) sort(v.begin(),v.end())
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define endl '\n'
#define dbv(v) cout<<endl;cout<<#v<<"-->> ";for(auto it:v){cout<<it<<" ";}cout<<endl;
#define dbm(m)cout<<endl;cout<<#m<<"-->> ";for(auto it:m){cout<<it.fi<<" "<<it.se<<endl;}
#define dbs(s)cout<<endl;cout<<#s<<"-->> ";for(auto it:s){cout<<it<<" ";}cout<<endl;
#define mod 2019
#define db1(x) cout<<#x<<"="<<x<<endl;
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl;
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<endl;
#define mx 1e18
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v)  *min_element(v.begin(),v.end())
#define double long double
#define re(s) reverse(s.begin(),s.end())
#define io std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
int powe(int x,int n)
{
  if(n==0)return 1;
  if(n%2==0)
    return powe((x%mod*x%mod)%mod,n/2)%mod;
  return (x%mod*powe((x%mod*x%mod)%mod,(n-1)/2))%mod;
}
int gcd(int A,int B)
{
  if(B==0)return A;
  return gcd(B,A%B);
}


int32_t main()
{
  io
int x;
cin>>x;
for(int i=x;;i++)
{
  int p=0;
   for(int j=2;j<=sqrt(i);j++)
   {
    if(i%j==0)
    {
      p=1;break;
    }
   }
   if(p==0)
   {
    cout<<i<<endl;return 0;
   }
}
}

Measured memory_bytes: 3540
#include<iostream>
#include<algorithm>
using namespace std;
int Gcd(int a, int b) {
	int gcd;
	int c = max(a, b);
	int d = min(a, b);
	while (true) {
		if (c % d == 0) {
			gcd = d;
			goto C;
		}
		else {
			c -= d;
			if (c <= d) {
				swap(c, d);
			}
		}
	}
C:
	return gcd;
}
int main() {
	int w, h, c; cin >> w >> h >> c;
	cout << (w / Gcd(w, h))*(h / Gcd(w, h))*c << endl;
}

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


def solve(a: int, b: int, c: int, d: int, e: int, k: int):
    print('Yay!' if e - a <= k else ':(')



# Generated by 1.1.7.1 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()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    c = int(next(tokens))  # type: int
    d = int(next(tokens))  # type: int
    e = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(a, b, c, d, e, k)

if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long ll;
#define endl "\n"
#define int ll
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef unsigned long long ull;

const ll inf = 1e9 + 5;
const long double PI = 3.141592653589793;

/*//MODULAR EXP
l power(ll x, ll y, ll m)  
{  
    ll res = 1;
    x = x % m; 
    if (x == 0) return 0; 
    while (y > 0)  
    {
      if (y & 1)  
        res = (res*x) % m;  
      y = y>>1;
      x = (x*x) % m;  
    }  
    return res;  
} */ 
/*//CUSTOM HASH
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};*/


void solve(){
    return;
}
signed main(){
  fast;
  int n, k;
  cin>>n>>k;
  vector<int> h(n);
  for(int& x:h)cin>>x;
  vector<int> dp(n, inf);
  dp[0]= 0;
  for(int i=0;i<n;i++){
    for(int j = i+1;j<=i+k;j++){
      if(j<n){
        dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
      }
    }
  }
  cout<<dp[n-1];
}
//g++ -std=c++17 -Wshadow -Wall -o a a.cpp -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g

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

int main() { 
    string s;
    cin >> s;
    char signs[3];
    for (int t = 0; t < 8; ++t) {
        int sum = s[0] - '0';
        for (int i = 0; i < 3; ++i) {
            if (t & (1 << i)) {
                signs[i] = '+';
                sum += s[i+1] - '0';
            } else {
                signs[i] = '-';
                sum -= s[i+1] - '0';
            }
        }
        if (sum == 7)
            break;
    }
    cout << s[0] << signs[0] << s[1] << signs[1] << s[2] << signs[2] << s[3] << "=7" << endl;
}


Measured memory_bytes: 256
<?php
// Your code here!

    $n = trim(fgets(STDIN));
    
    $i = 1;
    while($i <= $n) {
        $x = $i;
        if ($x % 3 == 0) {
            echo " " . $i;
        } else {
            while($x) {
                if ($x % 10 == 3) {
                    echo " " . $i;
                    break;
                } else {
                    $x = floor($x / 10);
                }
            }
        }
        $i++;
    }
?>



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

using namespace std;

int main(){
    int n, K;
    cin >> n >> K;
    string s;
    cin >> s;
    vector<int> v;
    v.push_back(0);
    for (int i = 1; i < n; i++)
    {
        if(s[i]!=s[i-1])
        {
            v.push_back(i);
        }
    }
    int maxv = 0;
    for (int k = 0; k < v.size(); k++)
    {
        int x;
        if (s[v[k]] == '0')
        {
            x = (k+2*K<v.size()?v[k + 2 * K]:n) - v[k];
        }
        else
        {
            x = (k+2*K+1<v.size()?v[k + 2 * K + 1]:n) - v[k];
        }
        maxv = max(maxv, x);
    }
    cout << maxv << endl;
    return 0;
}

Measured memory_bytes: 1020
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>

using namespace std;

int main(){
    int h, w, n, ans = 1000000000;
    cin >> h >> w >> n;
    vector<set<int>> st(w + 2);
    for(int i = 0; i < n; i++){
        int x, y;
        cin >> x >> y;
        st[y].insert(x);
    }
    for(int i = 1; i <= w; i++){
        st[i].insert(h + 1);
    }
    int cnt = 0;
    for(int i = 1; i <= w; i++){
        if(i + cnt > h) break;
        ans = min(ans, *st[i].upper_bound(i + cnt) - 1);
        for(auto&& j : st[i + 1]){
            if(i + cnt + 1 > j) continue;
            else if(i + cnt + 1 == j) cnt++;
            else break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 28416
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int mod = 1000000007;
const double pi = 3.141592653589;

/* global variables */

/* function */

/* main */
int main() {

    double x1, x2, y1, y2;
    cin >> x1 >> x2 >> y1 >> y2;

    cout << fixed << setprecision(5) << sqrt(pow(x1 - y1, 2) + pow(x2 - y2, 2)) << '\n';
}



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

using namespace std;
#define BUF (55)

char S[BUF],T[BUF];


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

	int n = strlen(S);
	int k = strlen(T);
	int index=-1;	
	//cout << n << k;


	//No '?'s
	int f=0;
	for(int i=0;i<n;i++){
		if(S[i]=='?') f=1;
	}	
	if(f==0) {
		cout << S << endl;
		return 0;
	}
	
	for(int i=n-k;i>=0;i--){
		int flag = 1;
		for(int j=0;j<k;j++){
			if(S[i+j] == '?' || S[i+j] == T[j] ){
		//		cout << i << j;
			}else{
				flag = 0;
			}
		}
		if(flag){
			 index = i;
			 break;
		}
	}
	
	if(index < 0){
		cout	<< "UNRESTORABLE" << endl;
		return 0;
	}
//	cout << index;
	for(int i=0;i<k;i++) S[index+i] = T[i];

	for(int i=0;i<n;i++)if(S[i]=='?') S[i] = 'a';

	cout << S << endl;


	

	return 0;
}


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

using namespace std;

int main ()
{
	int n,i,a;
	int min = 1000000,max = -1000000;
	double s = 0;
	cin >> n;

	for(i = 0; i < n; i++)
	{
		cin >> a;
		if(min > a){
			min =a;
		}
		if(max <a){
			max = a;
		}
		s = s + (double)a;
    }
	cout << min << " " << max << " " << fixed << setprecision(0) << s << endl;

}

Measured memory_bytes: 3240
s = list(str(input()))

sumw = 0

for i in s:
    if i is 'a':
        sumw += 1
    if i is 'b':
        sumw += 2
    if i is 'c':
        sumw += 4


if sumw is 7:
    print("Yes")

else:
    print("No")


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

using namespace std;

#define sz(c) ((int)c.size())
#define	pb push_back

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;

constexpr int MAX_N = 145'674;
constexpr int SIGMA = 30;
constexpr ll INF = 1'000'000'000LL;
constexpr ll P = 9'982'443'53;
constexpr double PI = 3.14159265359;
constexpr double TO_RAD = PI/180.;
constexpr long double EPS = 1e-6;

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

	string t;
	cin >> t;
	for(auto &c : t){
		if(c == '?') c = 'D';
	}
	cout << t << "\n";
	return 0;
}

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

using namespace std;

const int Mod = 1e9 + 7, Nmax = 303;
typedef long long ll;

int n, m, i, j, x, y, k;
int dp[2][Nmax][Nmax];

void add_to(int &x, int y) { x+=y; if(x>=Mod) x-=Mod; }
int inm(int x, int y) { return (ll)x*y%Mod; }

int main()
{
  //  freopen("input", "r", stdin);
  //  freopen("output", "w", stdout);
    cin.sync_with_stdio(false);

    cin >> n >> m;

    dp[0][1][1] = 1;
    for(i=0, x=0, y=1; i<m; ++i, x^=1, y^=1)
    {
        for(j=1; j<=n; ++j)
            for(k=1; k<=j; ++k)
                dp[y][j][k] = 0;

        for(j=1; j<=n && j<=i+1; ++j)
            for(k=1; k<=j; ++k)
            {
                add_to( dp[y][j][j], inm(dp[x][j][k], k) );
                add_to( dp[y][j][k], inm(dp[x][j][k], j-k) );
                add_to( dp[y][j+1][k], inm(dp[x][j][k], n-j) );
            }
    }

    cout << dp[x][n][n] << '\n';
    return 0;
}


Measured memory_bytes: 1024
X, K, D = gets.split.map(&:to_i)

x = X.abs
k, m = x.divmod(D)

if m == 0
  if k <= K
    if (K - k) % 2 == 0
      puts 0
    else
      puts D
    end
  else
    puts x - K * D
  end
else
  if k < K
    if (K - k) % 2 == 0
      puts x - k * D
    else
      puts (x - (k + 1) * D).abs
    end
  else
    puts x - K * D
  end
end


Measured memory_bytes: 14280
a_card = list(input())
b_card = list(input())
c_card = list(input())
newnum = a_card[0]
a_card.pop(0)
while True:
    if newnum == "a":
        if len(a_card) == 0:
            print("A")
            exit()
        newnum = a_card[0]
        a_card.pop(0)
    elif newnum == "b":
        if len(b_card) == 0:
            print("B")
            exit()
        newnum = b_card[0]
        b_card.pop(0)
    elif newnum == "c":
        if len(c_card) == 0:
            print("C")
            exit()
        newnum = c_card[0]
        c_card.pop(0)

Measured memory_bytes: 3064