akhauriyash/Code-Regression huggingface dataset:
#include<iostream> 
#include<cstdio> 
using namespace std; 
int main()
{
    int a,b,d,r;
    double f;
    cin >>a >>b;
    d=a/b;
    r=a%b;
    f=(double)a/b;
    printf("%d %d %.6lf",d ,r ,f);
    
    return 0;
}

    


Measured memory_bytes: 3200
#include<stdio.h>

int main()
{
	char a[25];
	scanf("%s", a);
	for(int i = 0; i < 5; i++)
		printf("%c", a[i]);
	printf(" ");
	
	for(int i = 6; i < 13; i++)
		printf("%c", a[i]);
	printf(" ");
	
	for(int i = 14; i < 19; i++)
		printf("%c", a[i]);
	printf(" ");
	
	return 0;
}

Measured memory_bytes: 128
#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

vector<ll> d, f;

void dfs(Graph &graph, ll u, ll pre, ll &c) {
    d[u] = c;
    c++;
    sort(graph[u].begin(), graph[u].end());
    for (ll v : graph[u]) {
        if (d[v] == 0) {
            dfs(graph, v, u, c);
            c++;
        }
    }
    f[u] = c;
}

void Main() {
    ll N;
    cin >> N;
    Graph graph(N);
    d.assign(N, 0);
    f.assign(N, 0);
    rep(i, N) {
        ll u, k;
        cin >> u >> k;
        u--;
        rep(j, k) {
            ll v;
            cin >> v;
            v--;
            graph[u].push_back(v);
        }
    }
    ll v = 1;
    rep(i, N) {
        if (d[i] == 0) {
            dfs(graph, i, -1, v);
            v++;
        }
    }
    rep(i, N) {
        cout << i + 1 << ' ';
        cout << d[i] << ' ';
        cout << f[i] << '\n';
    }
}

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



Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
using lli=long long int;

int N;
vector< int >arr;
int K;

int INF=1e9;

vector< int >MEMO;

int min_cost(int index)
{
	int i;
	if(index >= N)
		return INF;
	else if(index==(N-1))
		return 0;
	if(MEMO[index]!=-1)
		return MEMO[index];

	MEMO[index]=min_cost(index+1)+abs(arr[index+1]-arr[index]);

	for(i=2;i<=K;i++)
		MEMO[index]=min( MEMO[index] , min_cost(index+i)+abs(arr[index+i]-arr[index]) );

	return(MEMO[index]);
}


int main()
{
	cin>>N>>K;
	int i,temp;
	MEMO.assign(N,-1);
	for(i=0;i<N;i++)
	{
		cin>>temp;
		arr.emplace_back(temp);
	}
	for(i=0;i<K;i++)
	{
	    arr.emplace_back(0);
	}
	cout<<min_cost(0);
	return 0;

}

Measured memory_bytes: 5880
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

class Procon {
    static void Main (string[] agrs) {
        int N = Int();
        int[] A = Ints();

        List<Tuple<int, int>> pair = new List<Tuple<int, int>>();

        for (int i = 0; i< N; i++) {
            pair.Add(Tuple.Create(i+1, A[i]));
        }

        pair.Sort((a, b) => a.Item2 - b.Item2);

        for (int i=0; i<N; i++) {
            Console.Write("{0} ", pair[i].Item1);
        }
        Console.WriteLine("");
    }

    static string String () => Scanner.nextString ();
    static int Int () => int.Parse (Scanner.nextString ());
    static long Long () => long.Parse (Scanner.nextString ());
    static double Double () => double.Parse (Scanner.nextString ());
    static char[] Chars () => String ().ToCharArray ();
    static string[] Strings () => Console.ReadLine ().Split (' ');
    static int[] Ints () => Strings ().Select (v => int.Parse (v)).ToArray ();
    static long[] Longs () => Strings ().Select (v => long.Parse (v)).ToArray ();
    static double[] Doubles () => Strings ().Select (v => double.Parse (v)).ToArray ();
    const int M = 1000000007;
}

class PriorityQueue<T> where T : IComparable<T> {
    public T[] heap;
    public int size;
    public int sign;
    public PriorityQueue (int N, bool descend = false) {
        heap = new T[N];
        sign = 1;
        if (descend) sign = -1;
    }
    public int Compare (T x, T y) {
        return x.CompareTo (y) * sign;
    }
    public void Push (T x) {
        int i = size++;
        while (i > 0) {
            int p = (i - 1) / 2;
            if (Compare (x, heap[p]) >= 0) {
                break;
            }
            heap[i] = heap[p];
            i = p;
        }
        heap[i] = x;
    }
    public T Pop () {
        T ret = heap[0];
        T x = heap[--size];
        int i = 0;
        while (i * 2 + 1 < size) {
            int a = i * 2 + 1;
            int b = i * 2 + 2;
            if (b < size && Compare (heap[a], heap[b]) > 0) {
                a = b;
            }
            if (Compare (heap[a], x) >= 0) {
                break;
            }
            heap[i] = heap[a];
            i = a;
        }
        heap[i] = x;
        return ret;
    }
    public int Count () {
        return size;
    }
}

class Scanner {
    static string[] s = new string[0];
    static int i = 0;
    static int max_i = 0;
    static public string nextString () {
        if (i >= s.Length) {
            s = Console.ReadLine ().Split (' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0) {
                return "";
            }
            return s[i++];
        }
        return s[i++];
    }
}

Measured memory_bytes: 30164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const int N = 1e4 + 7;
const ll mod = 1e9 + 7;


string s;
int d;

ll dp[N][107][2];

ll solve(int idx, int sum, bool good) {
	if (idx == s.size()) {
		return (sum % d == 0);
	}

	if (dp[idx][sum][good] != -1) {
		return dp[idx][sum][good];
	}

	ll ans = 0;
	if (good) {
		for (int i = 0; i < 10; i++) {
			ans += solve(idx+1, (sum + i) % d, good);
			ans %= mod;
		}
	}
	else {
		for (int i = 0; i < (s[idx] - '0'); i++) {
			ans += solve(idx + 1, (sum + i) % d, 1);
			ans %= mod;
		}
		ans += solve(idx + 1, (sum + s[idx] - '0') % d, 0);
		ans %= mod;
	}

	return dp[idx][sum][good] = ans;
}







int main() {
	cin >> s >> d;
	memset(dp, -1, sizeof dp);
	cout << (solve(0, 0, 0) - 1 + mod) % mod;

}

Measured memory_bytes: 17792
def d_patisserie_abc():
    N, M = [int(i) for i in input().split()]
    Cake = [[int(i) for i in input().split()] for j in range(N)]
    # 変数の意味は、左から順に、 綺麗さ, おいしさ, 人気度 をそれぞれ
    # 正の方向(p)に最大化する場合と負の方向(m)に最大化する場合である。
    # なお、mmm, mmp, mpm, mpp は、ppp, ppm, pmp, pmm を
    # 逆順ソートすることで得られる。
    ppp, ppm, pmp, pmm = [], [], [], []
    for x, y, z in Cake:
        ppp.append(x + y + z)
        ppm.append(x + y - z)
        pmp.append(x - y + z)
        pmm.append(x - y - z)
    ppp.sort()
    ppm.sort()
    pmp.sort()
    pmm.sort()

    # 値が大きなものをM個取って足して絶対値をとる
    pts = (
        abs(sum(ppp[:M])),
        abs(sum(ppm[:M])),
        abs(sum(pmp[:M])),
        abs(sum(pmm[:M])),
        abs(sum(ppp[::-1][:M])),
        abs(sum(ppm[::-1][:M])),
        abs(sum(pmp[::-1][:M])),
        abs(sum(pmm[::-1][:M])),
    )
    return max(pts)

print(d_patisserie_abc())

Measured memory_bytes: 3444
import re
ptn = re.compile(r"(A|C|G|T)*")

S = input()

ans = 0
for i in range(len(S)):
  for j in range(len(S)):
    x = ptn.match(S[i:i+j+1]).group(0)
    if(x):
      ans = max(ans, len(x))
print(ans)

Measured memory_bytes: 3188
N,M = gets.chomp.split.map(&:to_i)

A = gets.chomp.split.map(&:to_i)

h = Hash.new(0)
A.each do |a|
  h[a] += 1
end

M.times do
  b, c = gets.chomp.split.map(&:to_i)
  h[c] += b
end


ans = 0
i = 0
n = A.length

h.sort_by{|k,v| k}.reverse.each do |key,value|
  break if i == n

  cnt = [value, n-i].min
  ans += key * cnt
  i += cnt
end

p ans




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

int main(){
	while(1){
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;
		if(m==0&&nmin==0&&nmax==0){
			break;
		}
		int P[200];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		int gap=-1;
		int n=-1;
		for(int i=nmin;i<=nmax;i++){
			int g=P[i-1]-P[i];
			if(gap<=g){
				gap=g;
				n=i;
			}
		}
		cout<<n<<endl;
	}
	return 0;
}


Measured memory_bytes: 3088
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using Graph=vector<vector<int>>;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
int roundup(int a,int b){return	(a-1)/b+1;}
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}

signed main(){
	int n;cin>>n;
	vector<int> a(n);
	rep(i,n){
		cin>>a[i];
		a[i]-=i+1;
	}
	sort(All(a));
	int l=a[0],r=a[n-1];
	auto f=[&](int x){
		int res=0;
		rep(i,n) res+=abs(a[i]-x);
		return res;
	};
	while(l+2<r){
		int ml=l+(r-l)/3,mr=r-(r-l)/3;
		int fl=f(ml),fr=f(mr);
		if(fl>fr) l=ml;
		else if(fl<fr) r=mr;
		else l=ml,r=mr;
	}
	cout<<min({f(l),f((l+r)/2),f(r)})<<endl;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

signed main(){
    int H, N;
    cin >> H >> N;
    vector<int> skills(N);
    collect(skills, N);
    rep(i,N){
        H -= skills[i];
    }
    cout << (H <= 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1024
N, K = gets.split.map(&:to_i)
ps = gets.split.map(&:to_f)

def kitaichi(f)
  result = (f * (f + 1) / 2) / f
  return result
end

def saidai(ary)
  result = 0
  dp = Array.new(ary.size + 1, 0)
  dp[0] = ary[0, K].inject(:+)
  for i in 1..(N - K) do
    dp[i] = ary[i + K - 1] - ary[i - 1] + dp[i - 1]
  end
  return dp.find_index(dp.max)
end

ans = 0

max_i = saidai(ps)

ps[max_i, K].each do |e|
  ans += kitaichi(e)
end

puts ans


Measured memory_bytes: 16524
#include <iostream>

using namespace std;

int main(){
    int A,B;
    cin>>A>>B;
    int sum=A*B;
    if(sum*1%2==1||sum*3%2==1){
        cout <<"Yes";
        return 0;
    }else {
        cout <<"No";
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
# define fills(x,y) memset(x,y,sizeof x)
# define ALL(v) (v).begin(), (v).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define INF (int)1e9
# define EPS 1e-9
# define rep(i,n) for(int i=0;i<n;++i)
# define REP(i,k,n) for(int i=k;i<=n;++i)
# define mod 1000000007

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef vector<ll> Vl;
typedef vector<Vl> VVl;
typedef vector<string> VS;
typedef vector<Pll> Vll;
typedef map<ll,ll> Mll;
typedef set<ll> SETl;


int		main()
{
	int N; cin >> N;
	ll res = 0;
	int i = 1;
	while (i <= N)
	{
		if (i % 15 == 0 || i % 3 == 0 || i % 5 == 0)
		{
			i++;	
			continue;
		}
		res += i;
		i++;
	}
	cout << res << endl;
}



Measured memory_bytes: 3596
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> inline void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> inline void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }
TPL<TNM T> inline void UNIQUE(vector<T>& vec) { sort(ALL(vec)); vec.erase(unique(ALL(vec)), vec.end()); }
inline bool range2d(int x, int y, int W, int H) { return (x >= 0) && (y >= 0) && (W > x) && (H > y); }

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

int main(void) {
	int H, W;
	cin >> H >> W;
	vec<string> S(H);
	REP(i, H) {
		cin >> S[i];
	}
	string ans = "Yes";
	REP(y, H) {
		REP(x, W) {
			if (S[y][x] == '.')continue;
			int cnt = 0;
			REP(i, 4) {
				int nx = x + dx[i];
				int ny = y + dy[i];
				if (!range2d(nx, ny, W, H))continue;
				if (S[ny][nx] == '#')++cnt;
			}
			if (cnt == 0)ans = "No";
		}
	}
	OUT(ans);
	return 0;
}

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

int main() {
	int n, k;
	cin >> n >> k;
	int p[n];
	for (int i = 0; i < n; i++) cin >> p[i];
	sort(p, p+n);
	int ans = 0;
	for (int i = 0; i < k; i++) ans += p[i];
	cout << ans << endl;
}

Measured memory_bytes: 3564
// I'm a f*cking looser
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fasino ios_base::sync_with_stdio(false); cin.tie(0);
#define asc(A) sort(A.begin(),A.end())
#define dsc(A) sort(A.begin(),A.end(),greater<ll>())
#define input(A,N) for(ll i=0;i<N;i++) cin>>A[i];
int main()
{
    fasino
    #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin); 
    #endif
    string a, b;
    cin>>a>>b;
    if(b.size()==a.size()+1){
        for(int i=0;i<a.size();i++){
            if(a[i]!=b[i])
            {
                cout<<"No";
                return 0;
            }
        }
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define int long long
#define P(x) {if (debug) cout << x << endl;}
#define H(x) P(#x << ": " << (x))
#define FR(i,a,b) for (int i=(a); i<(b); i++)
#define F(i,n) FR(i,0,n)
#define DR(i,a,b) for (int i=(b); i-->(a);)
#define D(i,n) DR(i,0,n)
#define S(s) (int)(s).size()
#define ALL(v) v.begin(), v.end()
#define MI(a,v) a = min(a,v)
#define MA(a,v) a = max(a,v)
#define V vector
#define pb push_back
#define mt make_tuple
using namespace std;
template<class T> ostream &operator<<(ostream &os, V<T> v) {
    F(i,S(v)) os<<(i?" ":"")<<v[i];
    return os;
}
const bool debug = 1;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin>>n;
    V<int> a(n), b(n);
    F(i,n) cin>>a[i];
    F(i,n) cin>>b[i];
    int toAdd = 0, numChanges = 0;
    priority_queue<int> pq;
    F(i,n) {
        if (a[i] < b[i]) {
            toAdd += b[i]-a[i];
            numChanges++;
        } else {
            pq.push(a[i]-b[i]);
        }
    }
    while (toAdd > 0 && S(pq)) {
        toAdd -= pq.top(); pq.pop();
        numChanges++;
    }
    if (toAdd > 0) cout<<"-1\n";
    else cout<<numChanges<<"\n";
}

Measured memory_bytes: 2936
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long

void solve() {
	int n; cin >> n;
	vector<ll> a(n), b(n);
	priority_queue<pair<ll, int>> pque;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		cin >> b[i];
		if(b[i] != a[i]) pque.push(make_pair(b[i], i));
	}
	ll cnt = 0;
	while(pque.size()) {
		pair<ll, int> p = pque.top(); pque.pop();
		int pos = p.second;
		ll minus = b[(pos - 1 + n) % n] + b[(pos + 1) % n];
		ll c = (b[pos] - a[pos]) / minus;
		if(c == 0) {
			cout << -1 << endl;
			return;
		}
		b[pos] -= minus * c; //b[pos] %= minus;
		cnt += c;
		if(b[pos] > a[pos]) pque.push(make_pair(b[pos], pos));
	}
	cout << cnt << endl;
}
 
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 9456
#include<bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef long long ll;
typedef pair<ll,ll> P;
const int INF=INT_MAX / 3;
const ll LINF=LLONG_MAX / 3LL;
#define CONST 1000000007
#define EPS (1e-8)
#define PB push_back
#define MP make_pair
#define sz(a) ((int)(a).size())
#define reps(i,n,m) for(int i=(n);i<int(m);i++)
#define rep(i,n) reps(i,0,n)
#define SORT(a) sort((a).begin(),(a).end())
ll mod(ll a,ll m){return (a%m+m)%m;}
int dx[9]={0,1,0,-1,1,1,-1,-1,0},dy[9]={1,0,-1,0,1,-1,1,-1,0};
ll n,m;
int main(){
  string s;
  cin>>s;
  rep(i,4){
    cout<<s[i];
  }
  cout<<" ";
  reps(i,4,12){
    cout<<s[i];
  }
  cout<<endl;

  return 0;
}


Measured memory_bytes: 256
# ARC093C - Traveling Plan
N = int(input())
A = [0] + list(map(int, input().rstrip().split())) + [0]
S = 0
for i in range(1, N + 2):
    S += abs(A[i - 1] - A[i])

for i in range(1, N + 1):
    ans = S + abs(A[i - 1] - A[i + 1]) - (abs(A[i - 1] - A[i]) + abs(A[i] - A[i + 1]))
    print(ans)

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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

int main() {
    i32 n, m;
    cin >> n >> m;
    i32 a = 0;
    for (i32 i = 0; i < m; i++) {
        i32 t;
        cin >> t;
        a += t;
    }

    cout << (n-a < 0 ? -1 : n-a) << endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, M;
	
	cin>>N>>M;
	
	if(M > N) swap(N, M);
	
	if(N - M >= 2) cout<<0<<endl;
	else if(N - M == 1) {
		int ans = 1;
		
		for(int i = 1; i <= M; i++){
			ans *= i;
			ans %= MOD;
		}
		for(int i = 1; i <= N; i++){
			ans *= i;
			ans %= MOD;
		}
		cout<<ans<<endl;
	} else {
		int ans = 1;
		
		for(int i = 1; i <= M; i++){
			ans *= i;
			ans %= MOD;
		}
		for(int i = 1; i <= N; i++){
			ans *= i;
			ans %= MOD;
		}
		
		ans *= 2;
		ans %= MOD;
		cout<<ans<<endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 256
def input_from_console():
    r, d, x2000 = map(int, input().split())
    return r, d, x2000


def solve(r, d, x2000):
    x_prev = x2000
    x_list = []
    for i in range(10):
        x = r * x_prev - d
        x_list.append(x)
        x_prev = x
    return x_list


def main():
    r, d, x2000 = input_from_console()
    x_list = solve(r, d, x2000)
    print('\n'.join(map(str, x_list)))

if __name__ == "__main__":
    DEBUG = False
    if not DEBUG:
        main()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> z(n+1);
    vector<ll> x(m+1);
    for (int i = 0; i < n; i++) {
        cin >> z[i+1];
    }
    for (int i = 0; i < m; i++) {
        cin >> x[i+1];
    }
    for (int i = 1; i < n+1; i++) {
        z[i] += z[i - 1];
    }
    for (int i = 1; i < m+1; i++) {
        x[i] += x[i - 1];
    }
    ll ans = 0;
    for (int i = 0; i < n+1; i++) {
        ll ok = -1;
        ll ng = m + 1;
        while (ng - ok > 1) {
            ll mid = (ok + ng)/2;
            if (z[i] + x[mid] <= k)ok = mid;
            else ng = mid;
        }
        if (ok < 0)continue;
        ans = max(ans, ok + i);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 6424
#include<stdio.h>
#include<string.h>
#include <time.h>
#include <cstdio>

int main(){
  int y,m,d;
  scanf("%d/%d/%d", &y, &m, &d);
  
  if( y>2019 || y == 2019 && m >= 5){
    printf("TBD");
  }else{
    printf("Heisei");
  }
  return 0;
}

Measured memory_bytes: 128
n = int(input())
Taro_ans = 0
Hanako_ans = 0
for i in range(n) :
    a, b = list(input().split())
    Taro = list(a)
    Hanako = list(b)
    length = min(len(Taro), len(Hanako))
    for i in range(length) :
        if ord(Taro[i]) > ord(Hanako[i]) :
            Taro_ans += 3
            break
        elif ord(Taro[i]) < ord(Hanako[i]) :
            Hanako_ans += 3
            break
        if i == length -1 :
            if len(Taro) > length :
                Taro_ans += 3
            elif len(Hanako) > length :
                Hanako_ans += 3
            else :
                Taro_ans += 1
                Hanako_ans += 1
print(Taro_ans, Hanako_ans)


Measured memory_bytes: 5596
using System;
using System.Collections.Generic;
using System.Linq;

class A
{
    static void Main()
    {
#if DEBUG
        string exampleInput =
        @"7
500 600
";
        Console.SetIn(new System.IO.StringReader(exampleInput));
#endif

        var K = int.Parse(Console.ReadLine());
        var AB = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        Console.WriteLine(Enumerable.Range(AB[0], AB[1] - AB[0] + 1).Any(i => i % K == 0) ? "OK" : "NG");
        Console.Out.Flush();
    }
}

Measured memory_bytes: 28360
#include <iostream>
#include <cstdio>
#define int long long
using namespace std;

signed main(){
	int n, s;
	int ans = 0;
	
	cin >> n;
	while( cin >> s ){
		for( int x = 1; x * x <= s; x++ ){
			if( (s - x) % (2*x + 1) == 0 && (s - x) >= (2*x + 1) ){
				ans++;
				break;
			}
		}
	}
	ans = n - ans;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    ll n, k, s;
    cin >> n >> k >> s;

    rep(i, 0, k){
        cout << s;
        cout << " ";
    }
    rep(i, k, n){
        ll tmp = 1000000000;
        if(s == 1000000000){
            tmp = 1;
        }
        cout << tmp;
        cout << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1280
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

	int h, w;
	cin >> h >> w;

	vector<vector<int>> c(10, vector<int>(10));
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> c[i][j];
		}
	}

	vector<vector<int>> a(h, vector<int>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}

	vector<vector<int>> dist = c;
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}

	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			int v = a[i][j];
			if (v == -1) {
				continue;
			}

			ans += dist[v][1];
		}
	}

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


Measured memory_bytes: 384
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>

//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// ;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
constexpr long long DINF = 1000000000000;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>g;
vector<edge>ed;
vector<Pll>pv;
map<LL, LL>ma;
set<LL>st;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
LL n, m, k, p, q, w, h, s, t, ans, cnt, sum,a[210000],b[210000];
string str;
bool f[110000];
//char c;
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	ans = INF;
	rep(i, n) {
		cnt += a[i];
		ans = min(ans, abs(sum - cnt * 2));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
A, B, M = map(int, input().split())
la = list(map(int, input().split()))
lb = list(map(int, input().split()))

prm_min = min(la) + min(lb)

lcost = list()
for i in range(M):
    x, y, c = map(int, input().split())
    lcost.append(la[x-1] + lb[y-1] - c)

print(min(min(lcost), prm_min))

Measured memory_bytes: 18736
let list_of_str s = let rec f i = if i >= String.length s then [] else s.[i] :: f (i+1) in f 0
let () =
  Scanf.scanf "%s" (fun s ->
    s.[0] = 'A' &&
    1 = List.length (List.filter ((=) 'C') @@ list_of_str (String.sub s 2 (String.length s - 3))) &&
    2 = List.length (List.filter (fun x -> 'A' <= x && x <= 'Z') (list_of_str s))
  ) |> fun b -> print_endline @@ if b then "AC" else "WA"

Measured memory_bytes: 384
// luogu-judger-enable-o2
#include<bits/stdc++.h>
std::string s;
int main(){
    std::cin>>s;
    int l=s.size();
    for(int i=0;i<l;i++)
        if(s[i]=='C')
            for(int j=i+1;j<l;j++)
                if(s[j]=='F'){
                    puts("Yes");
                    return 0;
                }
    puts("No");
}

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>;
 
int main() {
    //和が偶数。奇数＋奇数と偶数と偶数
    int n,m;
    cin >> n >> m;
    //nC2+mC2
    int ansN,ansM;
    ansN = n*(n-1)/2;
    ansM = m*(m-1)/2;
    cout << ansN + ansM << endl;
return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
class Program
 {
  static void Main(string[] args){
    var values =  Console.In.ReadToEnd().TrimEnd()
            .Split()
            .Select(n => int.Parse(n))
            .ToArray();
      int coin = 0;
      for(int i = 0; i < 2; i++){
          if(values[0] < values[1]){
              coin += values[1];
              values[1]--;
          }
          else{
              coin += values[0];
              values[0]--;
          }
      }
      Console.WriteLine(coin);
  }
 }

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

/* define const */

/* end up defineing const */

string s;

int main()
{
  cin >> s;

  int s_len = s.length();
  bool same = false; // 両端が一致..true
  if (s[0] == s[s_len-1]) same = true;
  bool even = false; // 文字列の長さが偶数..true
  if (s_len%2 == 0) even = true;

  
  if (same && even) {
    cout << "First" << endl;
  }
  else if (!same && even) {
    cout << "Second" << endl;
  }
  else if (same && !even) {
    cout << "Second" << endl;
  }
  else if (!same && !even) {
    cout << "First" << endl;
  }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const ll INF = ll(1e15)+10;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;

using Graph = vector<vector<P>>;

int main() {
	ll N, K; cin >> N >> K;
	Vll C(N+1);
	rep(i, N) {
		ll a;
		cin >> a;
		C[i+1] = (C[i] + a - 1) % K;
	}

	map<ll, V> cnt;
	rep(i, N+1) {
		cnt[C[i]].push_back(i);
	}

	ll ans = 0;
	for (auto x : cnt) {
		auto vec = x.second;
		rep(i, vec.size()) {
			ans += upper_bound(ALL(vec), vec[i]+K-1) - (vec.begin()+i) - 1;
		}
	}
  cout << ans << endl;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e5+9;
const ll M=1e9+7;
ll K[maxn][13];
char s[maxn];
ll solve(char s[]){
    int len=strlen(s+1);
//    s='#'+s;
//    reverse(s.begin(),s.end());'
    
    int r,i;
    K[0][0]=1;
    for(r=1;r<13;++r)
        K[0][r]=0;
    for(i=1;i<=len;++i){
        char x=s[i],bx,ex;
        if(x=='?'){
            bx='0';ex='9';
        }else{
            bx=ex=x;
//            for(r=0;r<13;++r)
//                K[i][(r*10+x-'0')%13]=K[i-1][r];
        }
        for(x=bx;x<=ex;++x)
            for(r=0;r<13;++r)
                K[i][(r*10+x-'0')%13]+=K[i-1][r];
        for(r=0;r<13;++r)
            K[i][r]%=M;
    }
    return K[len][5];
}
int main() {
    cin>>s+1;
    cout<<solve(s)<<"\n";
    return 0;
}

Measured memory_bytes: 10496
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
ll Abs(ll x,ll y){
    if(x>=y)return x-y;
    else return y-x;
}

int check(string u){
    set<char>k;
    for(int i=0;i<u.length();i++)k.insert(u[i]);
    return k.size();
}
set<string>w[11];

int main(void){
    int n;
    map<int,char>m;
    for(char x = 'a';x<='z';x++)m[x-'a']=x;
    cin>>n;
    if(n==1){
        cout<<"a"<<endl;
        return 0;
    }
    w[1].insert("a");
    for(int i=2;i<=n;i++){
        for(auto itr =w[i-1].begin();itr!=w[i-1].end();++itr){
            string u = (*itr);
            int siz = check(u);
            //cout<<u<<" "<<siz<<endl;
            for(int j=0;j<=siz;j++){
                string k = u;
                k.push_back(m[j]);
                w[i].insert(k);
            }
        }
    }
    for(auto itr =w[n].begin();itr!=w[n].end();++itr){
        cout<<(*itr)<<endl;
    }
    return 0;
}



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

long long n,ans,a,b=1;
string s;

long long P(long long a,long long b){
    for(long long i=2;i<=b;i++){
        a*=i;
        a%=1000000007;
    }
    return a;
} 

int main(){
    cin>>n>>s;
    for(long long i=0;i<2*n;i++){
        if(s[i]=='W'){
            if(a%2==1){
                a++;
            }
            else{
                b*=a;
                b%=1000000007;
                a--;
                if(a<0){
                    cout<<0<<endl;
                    return 0;
                }
            }
        }
        else{
            if(a%2==0){
                a++;
            }
            else{
                b*=a;
                b%=1000000007;
                a--;
                if(a<0){
                    cout<<0<<endl;
                    return 0;
                }
            }
        }
    }
    if(a){
        cout<<0<<endl;
        return 0;
    }
    cout<<P(b,n)<<endl;
}

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

int main(){
    int n; cin >> n;
    string s;cin >> s;
    int ans = 0;
    for (int i = 0; i < n-2; i++)
    {
        if(s.at(i)=='A'&&s.at(i+1)=='B'&&s.at(i+2)=='C')ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    string s;
    cin >> s;

    ll ans = 0;
    rep(i, 4) {
        if(s[i] == '+') {
            ans++;
        }
        else {
            ans--;
        }
    }
    
    out(ans);
    re0;
}

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

using namespace std;

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)x.size()
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define debug(x) cerr << "  - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << "  - " << #x << ": " << x << "\t\t" << #y << ": " << y << endl;
#define debugv(v, n) cerr << #v << " : " << " "; for(int i = 0; i < n; i++) cerr << "\t" << #v << "[" <<  i <<  "]" <<  " : " << v[i] << "\n"; cerr << endl;
#define sep() cerr << "--------------------" << endl;

typedef long long ll;
const ll mod = 1e9 + 7;
const int N = 1234;

int a[N];

int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt = 1;
	for(int i = 1; i < sz(s); i++) {
		if(s[i] != s[i - 1]) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 512
import sys

s=input()
t=input()
N=len(s)

for i in range(N):
    j=0
    for j in range(N):
        if t[-i+j]!=s[j]: break
        elif j==N-1:
            print("Yes")
            sys.exit()
    
    if i==N-1:
        print("No")
        sys.exit()

Measured memory_bytes: 3060
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////


///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	int n;
	string s;
	cin >> n;
	cin >> s;
	
	char znak;
	int licznik = 0;
	for(int i = 0; i < n; i++){
		if(i == 0){
			znak = s[i];
			licznik++;
		}
		else{
			if(s[i] != znak){
				licznik++;
				znak = s[i];
			}
			else{
				continue;
			}
		}
	}

	cout << licznik << endl;

	return 0;
}


Measured memory_bytes: 512
N, Q = list(map(int, input().split()))
S = list(input())
li = []
for i in range(Q):
    li.append(list(map(int, input().split())))

AC_li = [0]
cnt = 0

for i in range(N-1):
    if S[i] + S[i+1] == "AC":
        cnt += 1
    AC_li.append(cnt)
    
for r,l in li:
    print(AC_li[l-1]-AC_li[r-1])
        
    

Measured memory_bytes: 31392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, R;
    cin >> N >> R;
    cout << R + 100 * max(0, 10 - N);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <list>
#include <vector>
#include <algorithm>
#include <numeric>

int main(){

  int N, M, Q;
  std::cin >> N >> M >> Q;

  std::vector<int> a;
  for(int i=0; i<M; i++){
    int tmp;
    std::cin >> tmp;
    a.push_back(tmp);
  }

  std::vector<int> q;
  for(int i=0; i<Q; i++){
    int tmp;
    std::cin >> tmp;
    q.push_back(tmp);
  }

  std::list<int> list(N);
  std::iota(list.begin(), list.end(), 0);

  auto current = list.begin();
  auto move = [&](int dist){
    if(dist>0){
      for(int i=0; i<dist; i++){
        current++;
        if(current == list.end()) current = list.begin();
      }
    }else if(dist<0){
      for(int i=0; i<(-dist); i++){
        if(current == list.begin()) current = list.end();
        current--;
      }
    }
    return;
  };

  for(int i=0; i<M; i++){
    if(a[i]%2==0) move(a[i]); //even
    else move(-a[i]); //odd
    current = list.erase(current);
    if(current == list.end()) current = list.begin();
  }

  std::vector<int> finalist(list.size());
  for(auto i : list){
    finalist.push_back(i);
  }
  for(int i=0; i<Q; i++){
    std::cout << [&](){
      if(binary_search(list.begin(), list.end(), q[i])) return 1;
      else return 0;
    }() << std::endl;
  }

  return EXIT_SUCCESS;
}


Measured memory_bytes: 9892
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> vec(3*N);
    REP(i,3*N)cin >> vec.at(i);
    sort(vec.begin(),vec.end());
    ll ans=0;
    for(size_t j=N;j<3*N;j+=2)ans+=vec.at(j);
    cout << ans << endl;
    }

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,j,sum=0;
    cin>>n;
    cin.ignore();
    string a;
    cin>>a;

    for(i=0;i<=n-3;i++)
    {

            if(a[i]=='A')
            {
                if(a[i+1]=='B')
                {
                    if(a[i+2]=='C'){
                        sum++;
                    }
                }
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            
            String N = br.readLine();
            //int N = Integer.parseInt(br.readLine());
            char charN[] = N.toCharArray();
            
            int sum = 0;
            for(int i=0; i<charN.length; i++){
                sum = sum + Character.getNumericValue(charN[i]);
            }
            
            if(sum%9 == 0){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
            
        }catch(Exception e){
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 37040
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
const int INF = 1e9;
const int MXN = 0;
const int MXV = 0;
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FOR(i, L, R) for (int i = L; i != (int)R; ++i)
#define FORD(i, L, R) for (int i = L; i != (int)R; --i)
#define IOS                                                                    \
    cin.tie(nullptr);                                                          \
    cout.tie(nullptr);                                                         \
    ios_base::sync_with_stdio(false);
LL n, d, a;
vector<int> sum;
vector<PLL> monsters; // (x, h)

LL sol()
{
    LL ans = 0;
    FOR(i, 0, n)
    {
        if (i)
        {
            sum[i] += sum[i - 1];
        }
        monsters[i].S += sum[i];
        if (monsters[i].S <= 0)
        {
            continue;
        }
        int L = i, R = n, R2 = i, M;
        while (L <= R)
        {
            M = (L + R) >> 1;
            if (monsters[i].F + 2 * d >= monsters[M].F)
            {
                R2 = M;
                L = M + 1;
            }
            else
            {
                R = M - 1;
            }
        }
        LL tmp = (monsters[i].S / a);
        if (monsters[i].S % a > 0)
        {
            ++tmp;
        }
        ans += tmp;
        sum[i] -= tmp * a;
        sum[R2 + 1] += tmp * a;
    }
    return ans;
}

int main()
{
    // IOS;
    cin >> n >> d >> a;
    monsters.resize(n);
    sum.resize(n + 5, 0);
    FOR(i, 0, n) { cin >> monsters[i].F >> monsters[i].S; }
    sort(monsters.begin(), monsters.end());
    cout << sol() << '\n';
}


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

int main(){
  ll A,B,C; cin>>A>>B>>C;
  if(A%2==0||B%2==0||C%2==0) cout<<0<<endl;
  else cout<<(A+B+C-max({A,B,C})-min({A,B,C}))*min({A,B,C});
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << endl;
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << endl;
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  if(abs(a-c) <= d){
    cout << "Yes" << endl;
    return 0;
  }
  if(abs(a-b) <= d && abs(b-c) <= d){
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
n,k,s = map(int,input().split())
ans = [0]*n
for i in range(n):
  if k > 0:
    ans[i] = s
    k -= 1
  else:
    if s == 10**9:
      ans[i] = s-1
    else:
      ans[i]= s+1
print(" ".join(list(map(str,ans))))

Measured memory_bytes: 56940