akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#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 all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int h, n;
    cin >> h >> n;
    rep(i, n) {
        int a;
        cin >> a;
        h -= a;
    }
    cout << (h <= 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << " = " << x << ".\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define print(xx) cout << (xx) << endl
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vint;
const int INF = ((1LL << 30) + (1LL << 29));
const ll MOD = 1000000007;

/* 
*/
//================== INPUT ========================
string S;
//=================================================
//=================================================
void input()
{
    cin >> S;
}
//=================================================

void solve()
{
    // dp[i][j] : i番目まで & あまりがj
    vector<vector<int>> dp(100003, vector<int>(13, 0));
    int N = S.size();
    dp[0][0] = 1;
    for (int i = 0; i < N; ++i)
    {
        int num = ((S[i] == '?') ? (-1LL) : (S[i] - '0'));

        if (num == -1)
        {
            // S[i] : '?' の場合
            for (int j = 0; j < 10; ++j)
            {
                for (int k = 0; k < 13; ++k)
                {
                    dp[i][k] %= MOD;
                    dp[i + 1][(10 * k + j) % 13] += dp[i][k];
                }
            }
        }
        else
        {
            // S[i] : num の場合
            for (int k = 0; k < 13; ++k)
            {
                dp[i][k] %= MOD;
                dp[i + 1][(10 * k + num) % 13] += dp[i][k];
            }
        }
    }
    cout << (dp[N][5] % MOD) << endl;
}

//=================================================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 13568
# coding: utf-8


def main():
    N, K = map(int, input().split())
    H = sorted([int(input()) for _ in range(N)])
    ans = min([H[i + K - 1] - H[i] for i in range(N - K + 1)])

    print(ans)

if __name__ == "__main__":
    main()


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

int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main() {
	int a, b;
	string s;
	int cnt = 0;
	cin >> a >> b >> s;
	rep(i, s.size()) if(s[i] == '-') cnt++;
	if(cnt >= 2) cout << "No" << endl;
	else if(s.size() == a+b+1 && s[a] == '-') cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define f(i,a,b) for(int i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		//ret %= 1000000007;
	}
	return ret;
}

#pragma endregion 

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

	int n;
	cin >> n;
	vector<double> x(n);
	vs u(n);
	const double b = 380000.0;
	double ans = 0;
	f(i, 0, n) {
		cin >> x[i] >> u[i];
		if (u[i] == "BTC") {
			x[i] *= b;
		}
		ans += x[i];
	}
	cout << fixed << setprecision(6) << ans;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"
 
int32_t main()
{
	fast;
	int n;
	cin>>n;
	cout<<n*n*n<<endl;
	return 0;
}

Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  int64_t result = 0;
  int64_t top = 0;
  for (int64_t i = 0; i < N; ++i) {
    int64_t h;
    cin >> h;
    if (h > top) {
      result += h - top;
    }
    top = h;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3656
use std::io::BufRead;
use std::str::FromStr;
use std::fmt::Debug;

struct Scanner<R: BufRead> {
    buf_reader: R,
}

impl<R: BufRead> Scanner<R> {
    fn new(buf_reader: R) -> Self {
        Scanner {buf_reader: buf_reader}
    }
    fn read_line<T>(&mut self) -> Vec<T> where T: FromStr, <T as FromStr>::Err: Debug {
        let mut line = String::new();
        self.buf_reader.read_line(&mut line).unwrap();
        line.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()
    }
    fn read_single_value<T>(&mut self) -> T where T: FromStr, <T as FromStr>::Err: Debug {
        let mut line = String::new();
        self.buf_reader.read_line(&mut line).unwrap();
        let sv: Vec<&str> = line.trim().split_whitespace().collect();
        sv[0].parse::<T>().unwrap()
    }
    fn read_line0(&mut self) -> Vec<String> {
        let mut line: String = String::new();
        self.buf_reader.read_line(&mut line).unwrap();
        line.trim().split_whitespace().map(|c| c.to_string()).collect()
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut scanner = Scanner::new(stdin.lock());

    work(&mut scanner);
}

/* ================================================ */

fn work<R: BufRead>(scanner: &mut Scanner<R>) {
    let polish: Vec<String> = scanner.read_line0();
    let mut stack: Vec<i32> = vec![];

    for s in polish {
        let v = match s.parse::<i32>() {
            Ok(v) => v,
            Err(_err) => op(s.chars().next().unwrap(), &mut stack)
        };
        stack.push(v);
    }
    println!("{}", stack.pop().unwrap());
}

fn op(c: char, st: &mut Vec<i32>) -> i32 {
    return match c {
        '+' => add(st),
        '-' => sub(st),
        '*' => mul(st),
        '/' => div(st),
        _   => 0
    };
}

fn add(st: &mut Vec<i32>) -> i32 {
    let a = st.pop().unwrap();
    let b = st.pop().unwrap();
    b + a
}
fn sub(st: &mut Vec<i32>) -> i32 {
    let a = st.pop().unwrap();
    let b = st.pop().unwrap();
    b - a
}
fn mul(st: &mut Vec<i32>) -> i32 {
    let a = st.pop().unwrap();
    let b = st.pop().unwrap();
    b * a
}
fn div(st: &mut Vec<i32>) -> i32 {
    let a = st.pop().unwrap();
    let b = st.pop().unwrap();
    b / a
}


Measured memory_bytes: 5048
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=Integer.valueOf(sc.next());
		int min=Integer.valueOf(sc.next());
		int dmax=Integer.MIN_VALUE;
		
		for(int i=1;i<n;i++){
			int next=Integer.valueOf(sc.next());
			int d=next-min;
			if(d>dmax)dmax=d;
			if(next<min)min=next;
		}
		System.out.println(dmax);
	}
}

Measured memory_bytes: 70436
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
#define dump(x) cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template <typename T> void print(const vector<T> &x) {
    int n = x.size();
    rep(i, n) {
        cout << x[i];
        if(i != n - 1)
            cout << " ";
        else
            cout << endl;
    }
}

template <typename T> void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i, n) {
        rep(j, x[i].size()) { cout << x[i][j] << " "; }
        cout << endl;
    }
}

template <typename T> void print(const vector<T> &x, int n) {
    rep(i, n) {
        cout << x[i];
        if(i != n - 1)
            cout << " ";
        else
            cout << endl;
    }
}

template <typename T> void print(const vector<vector<T>> &x, int n, int m) {
    rep(i, n) {
        rep(j, m) { cout << x[i][j] << " "; }
        cout << endl;
    }
}

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;
}

void input_init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n, t;
    cin >> n >> t;
    vector<int> a(n), b(n);
    rep(i, n) cin >> b[i] >> a[i];
    vector<vector<int>> dp1(n + 1, vector<int>(10010, 0));
    rep(i, n) {
        rep(j, t + 1) {
            chmax(dp1[i + 1][j], dp1[i][j]);
            if(a[i] + j <= t) {
                chmax(dp1[i + 1][a[i] + j], dp1[i][j] + b[i]);
            }
        }
    }
    cout << dp1[n][t] << endl;
    return 0;
}


Measured memory_bytes: 6848
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 99999999999999999;


long long int N,M,K,res,sum=0;
int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    for(long long int i=1;i<=N;i++){
        sum+=i;
        if(sum>=N){
            cout<<i<<endl;
            return 0;
        }
    }
    
}


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



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

    string ans="";
    if(a>=b){
        rep(i, a-'0') ans+=b;
    }else{
        rep(i, b-'0') ans+=a;
    }

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

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(1,n-1):
    if a[i-1] == a[i] == a[i+1]:
        a[i] = 101
        cnt += 1

for i in range(n-1):
    if a[i] == a[i+1]:
        a[i+1] == 102
        cnt += 1

print(cnt)

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

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

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    // cout << fixed << setprecision(5);

    int n;
    cin >> n;
    vi x(n);
    rep(i, n) cin >> x[i];
    int l = 100, r = 1;
    rep(i, n) {
        l = min(l, x[i]);
        r = max(r, x[i]);
    }
    int ans = 1001001001;
    for (int p=l; p<=r; p++) {
        int now = 0;
        rep(j, n) now += (x[j] - p) * (x[j] - p);
        ans = min(ans, now);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int dig(long long x){
  int count=1;
  while(x/10>=1){
    x/=10;
    count++;
  }
  return count;
}
int one(long long x){
	while(x/10>=1)x/=10;
	return x;
	return x+1;
}
int sum(long long x){
	int sum = 0;
	while(x/=10>=1){
		sum+=x%10;
		x/=10;
	}
	return sum;
}
int main(){
  long long n;
  cin >> n;
  cout << max(sum(n),9*(dig(n)-1)+one(n)-1) << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline  # 改行コード「\n」を呼んでしまうため、文字数など、注意！！

n = int(input().replace("\n",""))

anslist = []

for i in range(1, n+1):
    # print(i)
    if i % 15 == 0:
        continue
        # print('FizzBuzz', end=' ')
    elif i % 3 == 0:
        continue
        # print('Fizz', end=' ')
    elif i % 5 == 0:
        continue
        # print('Buzz', end=' ')
    else:
        anslist.append(i)
        # print(i, end=' ')

print(sum(anslist))

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

int main(){
    string n;
    cin >> n;
    bool flag = false;
    if(n[0] == '7' || n[1] == '7' || n[2] == '7') flag = true;
    cout << (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3600
#include<stdio.h>
int main(void)
{
  long long n,k,q,a[100010]={},cnt[100010]={};
  scanf("%lld%lld%lld",&n,&k,&q);
  for(long long i=0;i<q;i++){
    scanf("%lld",&a[i]);
    cnt[a[i]]++;
  }
  for(int i=1;i<=n;i++){
    if(q-cnt[i]>=k){
      puts("No");
    }else{
      puts("Yes");
    }
  }
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int a, b; cin >> a >> b;
    if (a%3 == 0 || b%3 == 0 || (a+b)%3 == 0) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>
#include <iomanip>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int r;
	std::cin >> r;
	std::cout << std::fixed << std::setprecision(10) << acos(-1) * r * 2 << std::endl;
}

Measured memory_bytes: 3788
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
int main()
{
	int n, h[101] = {0};
	int ans = 1, i;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> h[i];
	}
	int max = h[0];

	for (i = 1; i < n; i++) {
		if (h[i] >= max ) {
			ans++;
			max = h[i];
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
	int n;
	cin>>n;
	int a=0,w=0,t=0,r=0;
	char var[5];
	while(n--)
	{
		cin>>var;
		if(strcmp(var,"AC")==0)
			a++;
		else if(strcmp(var,"WA")==0)
			w++;
		else if(strcmp(var,"TLE")==0)
			t++;
		else if(strcmp(var,"RE")==0)
			r++;
	}
	cout<<"AC x "<<a<<"\n";
		cout<<"WA x "<<w<<"\n";
			cout<<"TLE x "<<t<<"\n";
				cout<<"RE x "<<r<<"\n";
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(x) for(auto it=(x).begin();it!=(x).end();it++) 
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
 
using namespace std;

vector<string> split(string s, char c){
    if(s[s.size()-1]!=c)s.push_back(c);
    
    vector<string> v;
    int pos=0;
    for(int i=0;i<s.size();i++){
        if(s[i]==c){
            v.push_back(s.substr(pos,i-pos));
            pos=i+1;
        }
    }
    return v;
}

int main(){
    string s,t;
    while(getline(cin,s)){
        if(s==".")break;
        getline(cin,t);
        if(s==t){
            cout<<"IDENTICAL"<<endl;
            continue;
        }
    
        vector<string> ss=split(s,'"'), tt=split(t,'"');
        if(ss.size()!=tt.size()){
            cout<<"DIFFERENT"<<endl;
            continue;
        }
        int count=0;
        rep(i,0,ss.size()){
            if(ss[i]!=tt[i]){
                if(i%2==0){
                    cout<<"DIFFERENT"<<endl;
                    goto AWAY;
                }else {
                    count++;
                }
            }
        }
        if(count>1)cout<<"DIFFERENT"<<endl;
        else cout<<"CLOSE"<<endl;
        AWAY:;
    
    }
    return 0;
}



Measured memory_bytes: 3232
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

using namespace std;
using ll = long long;

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int a[30], b[30];
int perm[30];

int main() {
    int n, m, a, b, res = 0;
    cin >> n >> m;
    vector<vector<int>> graph(n, vector<int>());
    rep (i, m) {
        cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    rep (i, n)
        perm[i] = i;

    do {
        rep (i, n) {
            if (i == n - 1) res++;
            if (count(graph[perm[i]].begin(), graph[perm[i]].end(), perm[i+1]) == 0)
                break;
        }
    } while (next_permutation(perm + 1, perm + n));
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(x) (int)x.size() 
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)


/****************************** CODE IS HERE ****************************************/
const int N = 2e5 + 7;
vector <int> tree[N];
int A[N];
vector <vector <int> > seq;
bitset<N> used;
vector <int> ans(N);

int bi_search(int x){
    int lo = 0, hi = sz(seq)-1;
    if(hi < 0) return 0;
    while(lo < hi){
      int mid = (lo + hi + 1) >> 1;
      if(seq[mid].back() <= x)
        lo = mid;
      else hi = mid-1;
    }
    return (seq[lo].back() >= x ? lo: lo+1);
}


void dfs(int u = 1, int p = 0){
  int idx = bi_search(A[u]);
  if(idx >= sz(seq)){
    seq.push_back({A[u]});
  }
  else seq[idx].push_back(A[u]);
  ans[u] = sz(seq);
  
  for (int v: tree[u]){
    if(v == p) continue;
    dfs(v, u);
  }
  seq[idx].pop_back();
  if(sz(seq[idx]) == 0)
    seq.pop_back();
}

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

    int n; cin >> n;
    for (int i = 1; i <= n; ++i)
      cin >> A[i];
    for (int i = 1, x, y; i < n; ++i){
      cin >> x >> y;
      tree[x].push_back(y);
      tree[y].push_back(x);
    }

    dfs();
    for (int i = 1; i <= n; ++i)
      cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 36928
sx, sy, tx, ty = gets.split.map(&:to_i)
x, y = (tx - sx), (ty - sy)
a  = "U" * y + "R" * x
a += "D" * y + "L" * x
a += "L" + "U" * (y + 1) + "R" * (x + 1) + "D"
a += "R" + "D" * (y + 1) + "L" * (x + 1) + "U"
puts a


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

typedef long int32;
typedef unsigned long uint32;
typedef long long int64;
typedef unsigned long long uint64;
typedef pair<int,int> pii;

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<vi> graph;

#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rFOR(i,a,b) for(int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x,n) FOR(i,0,n) cout << x[i] << " "; cout << endl

#define PI 3.14159265359

// Custom global variable



// ----------------------

auto main() -> int
{
  #ifdef DEBUG
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
  #endif
  // Fast I/O
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  // Code starts here ----


  map<string,int64> E;

  int n;
  cin >> n;
  FOR(i,0,n) {
    string s;
    cin >> s;
    sort(all(s));
    E[s]++;
  }

  int64 res = 0;

  for(auto it = E.begin(); it != E.end(); it++) {
    if(it->nd > 1) {
      res += (it->nd * (it->nd-1))/2;
    }
  }
  cout << res;


  // ---------------------
  #ifdef DEBUG
    cerr << endl << "Time:" << double(clock())/CLOCKS_PER_SEC << " secs" << endl;
  #endif
}


Measured memory_bytes: 11264
def count_bomb(y,x):
    ans=0
    for i in range(y-1,y+2):
        for j in range(x-1,x+2):
            if i>=0 and i<h and j>=0 and j<w:
                if s[i][j]=="#":
                    ans+=1
    return ans
h,w=map(int,input().split())
s = [list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            s[i][j]=count_bomb(i,j)
for i in range(h):
    print(*s[i],sep="")

Measured memory_bytes: 3444
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

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

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

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

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

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

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n;
    cin>>n;
    VL h(n);
    REP(i,n)cin>>h[i];

    VL dp(n);
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);
    FOR(i, 2, n){
        dp[i] = min(
            dp[i-2] + abs(h[i-2] - h[i]),
            dp[i-1] + abs(h[i-1] - h[i]));
    }

    PUTS(dp[n-1]);
}

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

int main()
{
    int a,b,res;
    scanf("%d %d",&a,&b);
    res=max(a,b);
    if(res==a)a--;
    else b--;
    res+=max(a,b);
    printf("%d\n",res);
   
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef unsigned long long ll;


int main()
{
	int n,k;
	cin>>n>>k;
	ll ans = k;
	for(int i = 1; i < n; i++){
		ans = ans * (k-1);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N="0";
  cin >> N;
  
  if (N[0] == N[1]) {
    if (N[1] == N[2]) {
      cout << "Yes";
    }
    
    else {
      cout << "No";
    }
  }
  
  else {
    if (N[1] == N[2]) {
      if (N[2] == N[3]) {
        cout << "Yes";
      }
      
      else {
        cout << "No";
      }
    }
    
    else {
      cout << "No";
    }
  }
}

Measured memory_bytes: 256
from sys import exit
N = int(input())
B = list(map(int, input().split()))
ctr = 0
ans = []
for _ in range(N):
    ctr = 0
    for i, b in enumerate(B, 1):
        if i == b:
            ctr = i
    ans.append(ctr)
    if ctr == 0:
        print(-1)
        exit()
    B = B[:ctr-1] + B[ctr:]
print('\n'.join([str(s) for s in ans][::-1]))

Measured memory_bytes: 39024
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <ostream& out = cout, class... T> void prints(T&&...){ }
template <ostream& out = cout, class... T> void printd(T&&...){ }
template <ostream& out = cout, class... T> void printb(T&&...){ }
template <ostream& out = cout, class... T> void printArr(T&&...){ }
#endif

int main(){
    int r, c, n;
    cin >> r >> c >> n;
    struct Elem{
        int lst, beg, color;
        bool operator < (const Elem& e) const{
            return lst != e.lst ? lst < e.lst : beg != e.beg ? beg < e.beg : color < e.color;
        }
        bool operator == (const Elem& e) const{
            return lst == e.lst && beg == e.beg && color == e.color;
        }
    };
    int cnt = 0;
    set<Elem> ve = {{r + r + c + c, 0, -1}};
    vector<pair<int, int>> v;
    for(int i = 0; i < n; i++){
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if((x1 != 0 && x1 != r && y1 != 0 && y1 != c) ||
           (x2 != 0 && x2 != r && y2 != 0 && y2 != c)){
            continue;
        }
        int pos1, pos2;
        if(x1 == 0){ pos1 = y1; }else if(x1 == r){ pos1 = c + r + c - y1; }else if(y1 == 0){ pos1 = c + r + c + r - x1; }else{ pos1 = c + x1; }
        if(x2 == 0){ pos2 = y2; }else if(x2 == r){ pos2 = c + r + c - y2; }else if(y2 == 0){ pos2 = c + r + c + r - x2; }else{ pos2 = c + x2; }
        v.emplace_back(pos1, cnt);
        v.emplace_back(pos2, cnt++);
        // if(pos1 > pos2){
        //     swap(pos1, pos2);
        // }
        // // auto e1 = lower_bound(ve.begin(), ve.end(), Elem{pos1, -1, 0});
        // // auto e2 = lower_bound(ve.begin(), ve.end(), Elem{pos2, -1, 0});
        // auto e1 = ve.lower_bound(Elem{pos1, -1, 0});
        // auto e2 = ve.lower_bound(Elem{pos2, -1, 0});
        // if(e1->color != e2->color){
        //     cout << "NO" << '\n';
        //     return 0;
        // }
        // int color = cnt++;
        // if(*e1 == *e2){
        //     ve.insert({e1->lst, pos2, e1->color});
        //     ve.insert({pos2, pos1, color});
        //     ve.insert({pos1, e1->beg, e1->color});
        //     ve.erase(*e1);
        // }else{
        //     ve.insert({e2->lst, pos2, e1->color});
        //     ve.insert({pos2, e2->beg, color});
        //     ve.insert({e1->lst, pos1, color});
        //     ve.insert({pos1, e1->beg, e1->color});
        //     ve.erase(*e1);
        //     ve.erase(*e2);
        // }
    }
    sort(v.begin(), v.end());
    vector<int> st;
    for(auto p : v){
        int i = p.second;
        if(st.size() && st.back() == i){
            st.pop_back();
        }else{
            st.push_back(i);
        }
    }
    cout << (st.empty() ? "YES" : "NO") << '\n';
    return 0;
}


Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <utility>
#include <numeric>
using namespace std; 

int rec(int a, int b){
	if(b == 0) return a;
	return rec(b, a%b);
}

int main() {
    int N; cin >> N;
	vector<int> A(N);
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}

	int ans = A[0];
	for(int i = 1; i < N; i++) ans = rec(ans, A[i]);
	
	cout << ans << endl;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define all(x) x.begin(),x.end() 
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define per(i,a,b) for(ri i=(a);i>=(b);--i)
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
#define db(x) cout << "#x:" << x << endl
#define dd() cout << "Out put!\n"
const int mod=1e9+7,maxn=100010;
const double eps=1e-8,pi=acos(-1.0);
const int inf=0x7f7f7f7f7f7f7f7f;
using namespace std;
int a[maxn],b[maxn],v[maxn];
string s; 
signed main()
{
	ios::sync_with_stdio(0);
	int t=1;
//	cin >> t; 
	while(t--)
	{
		int n;
		cin >> n;
		vector<char> ans;
		while(n>26)
		{
			if(n%26==0)
			{
				ans.pb('z');
				n/=26;
				n--;
				continue;
			}
			ans.pb(n%26==0?26:n%26+'a'-1);
			n/=26;
		}
		ans.pb(n+'a'-1);
		int len = ans.size()-1;
		per(i,len,0)
			cout << ans[i];
	} 
	return 0;
}

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

int main(void) {
  string s; cin >> s;
  bool easy = true;
  for (int i = 0; i < s.length(); i++)
  {
    if (i%2 == 0 && s[i] == 'L') {
      easy = false;
      break;
    } else if (i % 2 == 1 && s[i] == 'R') {
      easy = false;
      break;
    }
  }

  if (easy) cout << "Yes\n";
  else cout << "No\n";
}

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

int N,K;
int H[100005];
int DP[100005];

int main(){
	cin>>N>>K;
	for(int i=0;i<N;i++)
		cin>>H[i];
	for(int i=1;i<N;i++){
		DP[i]=1e9;
		for(int j=1;j<min(i+1,K+1);j++)
			DP[i]=min(DP[i],DP[i-j]+abs(H[i]-H[i-j]));
	}

	cout<<DP[N-1];
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    string S;
    cin >> S;
    map<char, ll> cnt;
    rep(i, N) {
        cnt[S[i]]++;
    }
    ll ans = 1;
    for (auto p : cnt) {
        ans *= p.second + 1;
        ans %= MOD;
    }
    cout << ans - 1 << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
  string S, T; cin >> S >> T;
  int num = S.size();
  bool ok = true;
  rep(i, num){
    if(!(S.at(i) == T.at(i))) {
      ok = false;
    }
  }
  if(ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int H, W;
    static bool[][] G; 
    static void INPUT()
    {
        H = NextInt();
        W = NextInt();
        G = new bool[H + 2][];
        for (int i = 0; i < H + 2; i++)
        {
            G[i] = new bool[W + 2];
        }
        for (int i = 1; i <= H; i++)
        {
            var ii = 1;
            foreach (var a in NextString().ToCharArray().Select(__ => __ == '.').ToArray())
                G[i][ii++] = a;
        }
    }

    static void OUT()
    {
        var w = new int[H + 2][];
        var h = new int[H + 2][];
        for (int i = 0; i < H + 2; i++)
        {
            w[i] = new int[W + 2];
            h[i] = new int[W + 2];
        }

        for (int i = 1; i <= H; i++)
        {
            for (int j = 1; j <= W; j++)
            {
                if (!G[i][j]) continue;
                if (w[i][j - 1] > 0)
                    w[i][j] = w[i][j - 1];
                else
                {
                    var jj = 0;
                    while (G[i][j + ++jj]);
                    w[i][j] = jj;
                }
            }
        }

        var max = 0;
        for (int j = 1; j <= W; j++)
        {
            for (int i = 1; i <= H; i++)
            {
                if (!G[i][j]) continue;
                if (h[i - 1][j] > 0)
                {
                    h[i][j] = h[i - 1][j];
                }
                else
                {
                    var ii = 0;
                    while (G[i + ++ii][j]) ;
                    h[i][j] = ii;
                }

                max = Math.Max(max, w[i][j] + h[i][j] - 1);
            }
        }
        Console.WriteLine(max);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{

}




Measured memory_bytes: 56448
import math 
N,M=map(int,input().split())
a=M//N
ans=0
for i in range(1,int(math.sqrt(M))+1):
    if M%i==0:
        if i<=a and i>ans:ans=i
        if M//i<=a and M//i>ans:ans=M//i
print(ans)

Measured memory_bytes: 3060
N = int(input())
s = []

for i in range(N):
	s.append(int(input()))
s.sort()

max = sum(s)
for i in range(N):
	if(max % 10 != 0):
		print(max)
		exit(0)
	elif((max-s[i]) % 10 != 0):
		print(max-s[i])
		exit(0)
print("0")


Measured memory_bytes: 3060
fun main(args: Array<String>){
    val (n, m) = readLine()!!.split(" ").map{it.toInt()}
    val elemens = readLine()!!.split(" ").map{it.toDouble()}

    val sum = elemens.reduce{e1, e2 -> e1 + e2}

    val limit = sum / (4 * m)
    val canChoose = elemens.filter{ it >= limit }
    if(canChoose.size >= m){
        println("Yes")
        return
    }
    println("No")
}

Measured memory_bytes: 37868
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int x = in.nextInt();
		int a = in.nextInt();
		
		if(x < a)System.out.println(0);
		else System.out.println(10);
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;


void output(vector<int> & V);

int main()
{
    vector<int> V;

    int n;
    cin >> n;

    for (int i = 1; i <= n; i++)
    {
        V.push_back(i);
    }

    do
    {
        output(V);
    } while (next_permutation(V.begin(), V.end()));
    

}


void output(vector<int> & V)
{
    vector<int>::iterator it = V.begin();
    cout << *it++;
    while (it != V.end())
    {
        
        cout << ' ' << *it;
        it++;
    }
    cout << endl;
}


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

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

    vector<long long> A(N);
    long long total = 0;
    for (long long &a : A)
    {
        cin >> a;
        total += a;
    }

    long long ans = LONG_LONG_MAX;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        sum += A[i];
        ans = min(ans, abs(total - 2 * sum));
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
typedef long long ll;
set<int> se;
struct node{
    int a,b,c;
};
node Anx[N];
bool check(int n,int k){
    ll x1=1ll*(k+k+n-1)*n/2;
    ll x2=1ll*(k+n+k+2*n-1)*n/2;
    ll x3=1ll*(k+2*n+k+3*n-1)*n/2;
    return x1+x2>x3;
}
int main(){
    int n,k;
    scanf("%d %d",&n,&k);
    if(check(n,k)){
        puts("-1");
        return 0;
    }
    for(int i=n;i<=2*n-1;++i){
        se.insert(i+k);
    }
    for(int i=1;i<=n;++i){
        Anx[i].c=k+2*n+i-1;
    }
    for(int i=1,j=k;i<=n;++i){
        Anx[i].a=j;
        j+=2;
        if(j>k+n-1) j=k+1;
    }
    for(int i=1;i<=n;++i){
        int bb=Anx[i].c-Anx[i].a;
        auto pos=se.lower_bound(bb+1);
        if(pos==se.begin()){
            puts("-1");
            return 0;
        }
        pos--;
        Anx[i].b=*pos;
        se.erase(pos);
    }
    for(int i=1;i<=n;++i){
        printf("%d %d %d\n",Anx[i].a,Anx[i].b,Anx[i].c);
    }
}


Measured memory_bytes: 8064
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

const int MAX_D = 10;
const int MAX_N = 10;
const int MAX_S = 100;
int memo[MAX_D + 1][MAX_N + 1][MAX_S + 1];

int sum_of_integers(int d, int n, int s)
{
	if (memo[d + 1][n][s] != -1) return memo[d + 1][n][s];
	if (n == 0) return s == 0;
	if (s < 0) return 0;
	int res = 0;
	for (int i = d + 1; i <= 9; i++) res += sum_of_integers(i, n - 1, s - i);
	return memo[d + 1][n][s] = res;
}

int main(){
	memset(memo, -1, sizeof(memo));
	int n, s;
	while (cin >> n >> s, n || s){
		cout << sum_of_integers(-1, n, s) << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define int long long int
#define mod 998244353 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output1.txt","w", stdout);
    #endif
    IOS;
    int d,t,s;
    cin>>d>>t>>s;
    double ta;
    ta=(double)d/(double)s;
    if (ta<=(double)t)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    #ifndef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}       

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

n = 0
while (a > 0) & (c > 0):
    n += 1
    if n % 2 == 1:
        c -= b
    else:
        a -= d

if n % 2 == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 61884
#include<iostream>
using namespace std;
int main()
{
  int k, t = 0;
  cin >> k;
  for(int i = 1; i <= k; i++)
  {
    for(int j = i; j <= k; j++)
      if(i % 2 == 1)
      {
        if(j % 2 == 0)
          t++;
      }
       else if(i % 2 == 0)
      {
        if(j % 2 == 1)
          t++;
      }
  }
  cout << t;
  return 0;
}

Measured memory_bytes: 256
H, W, A, B = [int(hwab) for hwab in input().split()]

for h in range(H):
  if 0 <= h < B:
    row = "1"*A + "0"*(W - A)
  else: # B <= h < H:
    row = "0"*A + "1"*(W - A)
  
  print(row)

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

using namespace std;

int main(){
	int n, a[50];
	cin >> n;

	int maxv = -1000000, maxi = 0;
	int minv = 1000000, mini = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if (a[i] > maxv){
			maxv = a[i];
			maxi = i;
		}
		if (a[i] < minv){
			minv = a[i];
			mini = i;
		}
	}
	if (minv >= 0){
		cout << n-1 << endl;
		for (int i = 1; i <= n-1; i++){
			cout << i << ' ' << i+1 << endl;
		}
	}
	else if (maxv < 0){
		cout << n-1 << endl;
		for (int i = n; i >= 2; i--){
			cout << i << ' ' << i-1 << endl;
		}
	}
	else if (abs(maxv) >= abs(minv)){
		int cnt = 0;
		vector<int> is;
		for (int i = 0; i < n; i++){
			if (a[i] < 0){
				is.push_back(i);
			}
		}
		cout << is.size() + n - 1 << endl;
		for (int i = 0; i < is.size(); i++){
			cout << maxi+1 << ' ' << is[i]+1 << endl;
		}
		for (int i = 1; i <= n-1; i++){
			cout << i << ' ' << i+1 << endl;
		}
	}
	else if (abs(maxv) < abs(minv)){
		int cnt = 0;
		vector<int> is;
		for (int i = 0; i < n; i++){
			if (a[i] >= 0){
				is.push_back(i);
			}
		}
		cout << is.size() + n - 1 << endl;
		for (int i = 0; i < is.size(); i++){
			cout << mini+1 << ' ' << is[i]+1 << endl;
		}
		for (int i = n; i >= 2; i--){
			cout << i << ' ' << i-1 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ALucky7 {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        string s;
        cin >> s;
        if (s[0] == '7' || s[1] == '7' || s[2] == '7') {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ALucky7 solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

struct Dish_t{
	int a;
	int b;
};

bool mysort(const Dish_t &left, const Dish_t &right) {
	return  left.a + left.b > right.a + right.b;
}

int main(void) {

	// TODO: submit前にprintf-debugの削除確認！
	int N;
	//long long N, M;
	//double d, e;
	//string A, B, C;
	//vector<pair<int, int>> pl;
	vector<Dish_t> dish;

	//while() {}
	//for(int i=0; i<N; i++) {}
	
	cin >> N;
	for(int i=0; i<N; i++) {
		int a, b;
		cin >> a >> b;
		Dish_t d;
		d.a = a;
		d.b = b;
		dish.push_back(d);
	}
	sort(dish.begin(), dish.end(), mysort);

	long long ans=0;
	bool flip = true;
	for(int i=0; i<N; i++) {
		// cout << dish[i].a << ' ' << dish[i].b << ' '<< endl;
		if(flip) {
			ans += dish[i].a;
		}else{
			ans -= dish[i].b;
		}
		flip = !flip;
	}

	cout << ans;
	// cout << "[deb: val ]" << val <<endl;
	return 0;
}



Measured memory_bytes: 1400