akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
    int S[13] = {0};
    int H[13] = {0};
    int C[13] = {0};
    int D[13] = {0};
    int n, i, j, rank;
    char mark;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf(" %c", &mark);
        if ('S' == mark)
        {
            scanf(" %d", &rank);
            S[rank - 1] = 1;
        }
        else if ('H' == mark)
        {
            scanf(" %d", &rank);
            H[rank - 1] = 1;
        }
        else if ('C' == mark)
        {
            scanf(" %d", &rank);
            C[rank - 1] = 1;
        }
        else if ('D' == mark)
        {
            scanf(" %d", &rank);
            D[rank - 1] = 1;
        }
        else
        {
            printf("error\n");
        }
    }
    for (j = 0; j <= 12; j++)
    {
        if (S[j] == 0)
        {
            printf("S %d\n", j + 1);
        }
        else
        {
        }
    }
    for (j = 0; j <= 12; j++)
    {
        if (H[j] == 0)
        {
            printf("H %d\n", j + 1);
        }
        else
        {
        }
    }
    for (j = 0; j <= 12; j++)
    {
        if (C[j] == 0)
        {
            printf("C %d\n", j + 1);
        }
        else
        {
        }
    }
    for (j = 0; j <= 12; j++)
    {
        if (D[j] == 0)
        {
            printf("D %d\n", j + 1);
        }
        else
        {
        }
    }

    return 0;
}


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

l=[0,300000,200000,100000]
x,y=map(int,input().split())
ans=0
if x<4:
    ans+=l[x]
if y<4:
    ans+=l[y]
if x==1 and y==1:
    ans+=400000
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<int>> G(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<bool> seen(n,false);
    queue<int> que;
    que.push(0);
    seen[0]=true;
    vector<int> ans(n,0);
    while(!que.empty()){
        int v=que.front();
        que.pop();
        for(auto nv : G[v]){
            if(seen[nv]) continue;
            ans[nv]=v+1;
            seen[nv]=true;
            que.push(nv);
        }
    }

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

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

#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define F first
#define S second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using pii = pair <int, int>;
using pll = pair <ll, ll>;
using ld = long double;
// mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
// const int mod = 998244353;
const ll inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-7;
// const ld PI = acos(-1.0);

const int N = 12, M = 1002;

int a[N][M];

int gr[N], sum[N];

void solve () {
	int n, m, k;
	cin >> n >> m >> k;
	for (int i = 0 ; i < n ; ++ i) {
		for (int j = 0 ; j < m ; ++ j) {
			char c; cin >> c;
			a[i][j] = c - '0';
		}
	}
	int best = inf;
	for (int mask = 0 ; mask < (1 << (n - 1)) ; ++ mask) {
		int cur_ans = __builtin_popcount(mask);
		for (int i = 0, cur_gr = 0 ; i < n ; ++ i) {
			sum[i] = 0;
			gr[i] = cur_gr;
			if (mask & (1 << i))
				cur_gr++;
		}
		bool ok = true;
		for (int j = 0 ; j < m ; ++ j) {
			bool fulled = false;
			for (int i = 0 ; i < n && !fulled ; ++ i) {
				sum[gr[i]] += a[i][j];
				if (sum[gr[i]] > k) fulled = true;
			}
			if (fulled) {
				cur_ans++;
				fulled = false;
				for (int i = 0 ; i < n ; ++ i) {
					sum[i] = 0;
				}
				for (int i = 0 ; i < n ; ++ i) {
					sum[gr[i]] += a[i][j];
					if (sum[gr[i]] > k) ok = false;
				}
			}
		}
		if (ok)
			best = min (best, cur_ans);
	}
	cout << best;
}

int main () {
	ios;
	// double start_time = clock();
	// cout << fixed << setprecision (10);
	int tt = 1;
	// cin >> tt;
	while (tt--) {
		solve();
		cout << "\n";
	}
	// cerr << (clock() - start_time) / CLOCKS_PER_SEC;
}

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

using namespace std;

#define F first
#define S second

using ll = long long;

int main() {
    int n, m;
    cin >> n >> m;
    int freq[31]{};
    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int x;
            cin >> x;
            freq[x]++;
        }
    }
    int ans = 0;
    for (int i = 1; i <= 30; i++) {
        if (freq[i] == n) {
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
input = sys.stdin.readline
n = int(input())
T = [[] for _ in range(n)]
for i in range(n-1):
    ai,bi = map(int, input().split( ))
    ai-=1;bi-=1
    T[ai].append(bi)
    T[bi].append(ai)

c = list(map(int, input().split( )))
c.sort()


#最小の数字は葉に書き込む
#次点は葉あるいは最小頂点除いたら葉な点
#r = 0
Q = deque()
Q.append(0)
P = [-1 for i in range(n)]
P[0] = 0
D = [0]*n
L=[]
while Q:
    v = Q.popleft()
    leaf = True
    for u in T[v]:
        if P[u]<0:
            D[v]+=1
            P[u]=v
            leaf = False
            Q.append(u)
    if leaf:
        L.append(v)

Q =deque(L)

j = 0
A = [0]*n
m = 0
while Q:
    v = Q.popleft()
    A[v] = c[j]
    if v:
        m+=c[j]
    j+=1
    D[P[v]]-=1
    if not D[P[v]] and v:
        Q.append(P[v])
print(m)
print(*A)


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

#define ll long long
#define ld long double
#define FOR(x,y) for(ll i=x;i<=y;i++)
#define pb(x) push_back(x)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define matrix(x) vector<vector<x>>
#define vss vector<string>
#define PI (2*acos(0.0))
#define sqr(x) ((x)*(x))
#define sf(a)   scanf("%d",&a)
#define sfl(a)  scanf("%lld",&a)
#define sff(a,b)    scanf("%d %d",&a,&b)
#define sffl(a,b)   scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)    scanf("%lld %lld %lld",&a,&b,&c)
#define ms(a,b) memset(a, b, sizeof(a))
#define ff  first
#define ss  second
#define lcm(a, b)   ((a)*((b)/__gcd(a,b)))
#define all(a)  a.begin(),a.end()
#define readfile freopen("input.txt","r",stdin);
#define writefile freopen("output.txt","w",stdout);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define gap " "
#define mx 104
#define inf (ll)1e9
#define WHITE 1
#define GRAY 2
#define BLACK 3
#define EMPTY_VALUE -1
#define mod 1000000007
#define MOD(a,b) (a%b + b)%b

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


int main()
{
    //fastio
    ll n,a[200005];
    sfl(n);
    ll ans = 0,maximum=0;
    for(ll i=0;i<n;i++)
    {
        sfl(a[i]);
        maximum = max(maximum,a[i]);
        ans+=maximum-a[i];
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 5220
#include<bits/stdc++.h>
using namespace std;
#define pb push_back

int K, tmp, res = 0;
bool able;
map<int, int> m;

int main(){
    cin >> K;

    tmp = 0;
    while(true){
        if(m.count(tmp)){ able = false; break; }
        m[tmp] = 1;
        ++res;
        tmp = (10*tmp+7)%K;
        if(tmp == 0){ able = true; break; }
    }

    if(able) cout << res << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 50504
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>
#include<atcoder/all>


using namespace std;
using namespace atcoder;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.12f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 1010101;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// mod.m での a の逆元 a^ { -1 } を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x /gcd(x, y) * y );
}

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}


ll dx[8] = { 1,-1,0,0,1,1,-1,-1 };
ll dy[8] = { 0,0,1,-1,1,-1,1,-1 };
char c[2010][2010];
ll dp[101010][20];

ll op(ll a, ll b) {
	return max(a, b);
}

ll e() {
	return 0;
}

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll>a(n);
	rep(i, n)cin >> a[i];
	segtree<ll, op, e>dp(301010);
	rep(i, n) {
		ll x = a[i];
		ll l = x - k, r = x + k + 1;
		l = max(l, (ll)0);
		r = min(r, (ll)301010);
		ll now = dp.prod(l, r) + 1;
		dp.set(x, now);
	}
	ll ans = dp.prod((ll)0, (ll)301010);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 16204
import java.io.PrintWriter;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        long n = sc.nextLong();
        long m = sc.nextLong();

        long ans = (n-2)*(m-2);



        out.print(Math.abs(ans));
        out.flush();
    }
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;

#define rep(i, a, b) for(int i=a; i<=b; i++)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MOD = 1e9+7;

int n, m, a, b;
vi adj[200001];
bool visited[200001];
int ans=0;
int cnt=0;

void dfs(int x){
	if(visited[x]) return;
	visited[x]=true;
	cnt++;
	trav(k, adj[x]){
		if(!visited[k]){
			dfs(k);
		}
	}

}

int main(){
  // freopen("input.txt", "r", stdin); 
  // freopen("output.txt", "w", stdout);
  cin.sync_with_stdio(0); cin.tie();
  cin.exceptions(cin.failbit);

  cin >> n >> m;
  rep(i, 1, n) adj[i].clear();
  rep(i, 0, n) visited[i]=false;
  rep(i, 1, m){
  	cin >> a >> b;
  	adj[a].pb(b);
  	adj[b].pb(a);
  }

  rep(i, 1, n){
  	if(visited[i]) continue;
  	cnt=0; dfs(i);
  	ans=max(ans, cnt);
  }

  cout << ans;
}

Measured memory_bytes: 20960
#include <stdio.h>

int main(void)
{
    char s[3];
    int i,a = 0,b = 0;
    scanf("%s", &s);

    for (i = 0; i < 3; i++){
        if (s[i] == 'A') a++;
        else b++;
    }

    if (a == 3 || b == 3){
      printf("No");
    }else{
      printf("Yes");
    }
    
    return 0;
}


Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int n;
string s[101];
map<string,int> mp;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i],mp[s[i]]++;
        if(mp[s[i]]>1){
            cout<<"No"<<endl;
            return 0;
        }
    }
    for(int i=1;i<n;i++)
        if(s[i][0]!=s[i-1][s[i-1].size()-1]){
            cout<<"No"<<endl;
            return 0;
        }
    cout<<"Yes"<<endl;
    return 0;
}

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

int main() {
    ll N, K;
    cin >> N >> K;

    ll a = N / K;
    if (K % 2 == 0) {
        ll b = 2 * N / K;
        ll c = b - a;
        cout << (ll)(pow(a, 3) + pow(c, 3)) << endl;
    } else {
        cout << (ll)pow(a, 3) << endl;
    }

}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (int i=0; i<N; i++) cin >> H.at(i);
  sort(H.begin(), H.end());
  reverse(H.begin(), H.end());
  for (int i=0; i<min(N, K); i++) H.at(i) = 0;
  int64_t ans = accumulate(H.begin(), H.end(), 0ll);
  cout << ans << endl;
}

Measured memory_bytes: 1024
/*
ID: espr1t
TASK: 
KEYWORDS: 
*/

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
FILE* in = stdin; FILE* out = stdout;

const int MAX = 100001;
const int MOD = 998244353;

int n;
int a[MAX];

long long fastPow(long long num, int pwr) {
    long long ret = 1;
    while (pwr) {
        if (pwr & 1)
            ret = (ret * num) % MOD;
        num = (num * num) % MOD;
        pwr >>= 1;
    }
    return ret;
}

int main(void) {
//	in = fopen("B.in", "rt");
	
	fscanf(in, "%d", &n);
	for (int i = 0; i < n; i++)
	    fscanf(in, "%d", &a[i]);
	
	sort(a + 1, a + n);
	if (a[0] != 0) {
	    fprintf(out, "0\n");
	    return 0;
    }
    if (n > 1 && a[1] == 0) {
	    fprintf(out, "0\n");
	    return 0;
    }

    long long ans = 1;
    int lastLevel = 0, lastCnt = 1;
    for (int i = 1; i < n; i++) {
        if (a[i] != lastLevel + 1) {
            fprintf(out, "0\n");
            return 0;
        }
        int cnt = 1;
        while (i + 1 < n && a[i + 1] == a[i]) {
            cnt++;
            i++;
        }
        ans = (ans * fastPow(lastCnt, cnt)) % MOD;
        lastLevel = a[i], lastCnt = cnt;
    }
    fprintf(out, "%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;

ll e(int a, int n) {
	ll res = 1;
	rep(i,n) {
		res *= a;
		res %= MOD;
	}
	return res;
}
int main() {
	int n;
	cin >> n;
	ll ans = e(10,n)-2*e(9,n)+e(8,n);
	ans %= MOD;
	ans = (ans+MOD) % MOD;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
def enq(a,x)
  b = a[i=-1]
  until b.frozen?
    return a << x  if x >= (a=b)[-1]
    return a.unshift x  if x <= a[0]
    b = a[i = a.bsearch_index{|y| x < (y.frozen? ? y: y[0])}-1]
  end  if b && b=a
  return a.insert i+1, x  unless a[i+2]
  i>0 ? a[i]=[b,x] : enq(a[i+=1].to_a,x)  rescue a[i]=[x,a[i]]
end
def deq(a) r=a.pop; a.push *a.pop if !a[-1].frozen?; r end
NS = 6;  NM = (1<< NS)-1
SS = 30; SM = (1<< SS)-1
F =-> {gets.split.map &:to_i}
N,M,S = F[]
E = Array.new(N) { [] }
M.times {
  u,v,a,b = F[]
  u -= 1; v -= 1
  E[u] << [v,a,b]
  E[v] << [u,a,b]
}
X = N.times.map { F[] }
V = Array.new N
Q,R = [S],[]
while R.size < N
  t = deq Q
  s = SM & t; t >>= SS
  n = NM & t; t >>= NS
  (v = V[n]&.&SM) ? (next if v>=s || v>=2500) : R << [n,t]
  V[n] = (t<<SS) + s
  x = X[n]
  enq Q, (t-x[1]<<NS+SS) + (n<<SS) + s+x[0]
  E[n].each {|n,a,b| enq Q, (t-b<<NS+SS) + (n<<SS) + s-a  if s >= a }
end
puts R.sort![1,N].map{|i,t| -t}

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i = (a-1); i >= (b); --i)
#define RREP(i,n) RFOR(i,n,0)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

struct card {
    char suit;
    int num;
};
using vc = vector<card>;

void selectionSort(vc &a)
{
    REP(i, a.size()) {
        int minj = i;
        FOR(j, i, a.size()) {
            if(a[minj].num > a[j].num) minj = j;
        }
        if(i != minj) {
            swap(a[i], a[minj]);
        }
    }
}

void BubbleSort(vc &a)
{
    REP(i, a.size()) {
        RFOR(j, a.size(), i + 1) {
            if(a[j].num < a[j - 1].num) swap(a[j], a[j - 1]);
        }
    }
}

void printCard(vc a) {
    cout << a[0].suit << a[0].num;
    FOR (i, 1, a.size()) cout << " " << a[i].suit << a[i].num;
    cout << endl;
}

bool isStable(vc bubble, vc a) {
    REP(i, a.size()) {
        if(a[i].suit != bubble[i].suit) return false;
    }
    return true;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    
    int n; cin >> n;
    vc a(n);
    REP(i, n) cin >> a[i].suit >> a[i].num;
    vc b = a;
    selectionSort(a);
    BubbleSort(b);
    printCard(b);
    cout << "Stable" << endl;
    printCard(a);
    if(isStable(b, a)) cout << "Stable" << endl;
    else cout << "Not stable" << endl;

    return 0;
}


Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int result = 0;

    if (a > 2*b) {
      result = a - 2*b;
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 21716
s = input()

lst = ['a', 'b', 'c', 'd', 'e', 'f', 'g',
       'h', 'i', 'j', 'k', 'l', 'm', 'n',
       'o', 'p', 'q', 'r', 's', 't', 'u',
       'v', 'w', 'x', 'y', 'z']

dic = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6,
       'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13,
       'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20,
       'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

if len(s) < 26:
    for x in s:
        lst.remove(x)
    print(s + lst[0])
    
else:
    tmp = ''
    cnt = 0
    cond = False
    for i in range(26):
        cnt_tmp = dic[s[-1]]
        if cnt <= cnt_tmp:
            tmp += s[-1]
            cnt = cnt_tmp
            s = s[:-1]
        else:
            last = s[-1]
            tmp += last
            s = s[:-1]
            cond = True
            break
            
    if cond:
        print(s + sorted(tmp)[sorted(tmp).index(last) + 1])
    else:
        print(-1)

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

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

  int N;
  cin >> N;
  vector<long double> v(N);
  for(int i = 0; i < N; i++){
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());
  for(int i = 0; i < N - 1; i++){
    v.at(0) = (v.at(0) + v.at(i + 1)) / 2.0;
  }
  cout << v.at(0) <<endl;
}


Measured memory_bytes: 256
//souviksn7
//crush pupil

#include<bits/stdc++.h>
//#include <fstream>
#define ll long long
#define int  long long
#include<algorithm>
#include<numeric>
#include<utility>
#include<vector>

#include <string>
//#include <boost/lexical_cast.hpp>// for lexical_cast()
//#define ll long long
#define f0(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define f(i,a,b) for(ll i=a;i<b;i++)
//#define fin0 for(ll i=n;i>0;i--)
#define tc(t) int t; cin >> t; while (t--)
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define rr return
#define vi vector<ll>
#define sz size()
#define endl "\n"
#define ss string
#define pb push_back

//#define beg begin()
//#define end end()
#define all(v) v.begin(),v.end()
#define sp " "

using namespace std;
ll gcd(ll a,int b) {if(b==0) return a; else return gcd(b,a%b); }
ll  mod(ll  a,ll  b) { if(a>b) return (a-b);  else return (b-a);}
double distance(ll  x1, ll  y1, ll  x2, ll  y2){ return sqrt(pow(x2 - x1, 2) +pow(y2 - y1, 2) * 1.0);}
int fact(int n){int res = 1; for (int i = 2; i <= n; i++) res = res * i;  return res;}
int nCr(int n, int r){ return fact(n) / (fact(r) * fact(n - r));}
bool isPerfectSquare(long double x){long double sr = sqrt(x);return ((sr - floor(sr)) == 0);}
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}
int maxSum(int arr[], int n, int k)
{
    // k must be greater
    if (n < k)
    {
       cout << "Invalid";
       return -1;
    }


    int res = 0;
    for (int i=0; i<k; i++)
       res += arr[i];

    int curr_sum = res;
    for (int i=k; i<n; i++)
    {
       curr_sum += arr[i] - arr[i-k];
       res = max(res, curr_sum);
    }

    return res;
}

int maxi=1e5+10;
void pri(int v[],int n, int ind)
{
  for(int i=ind;i<n+ind;i++)
  {
    cout<<v[i%n]<<sp;
  }
}
void maxarray(int a[],int n)
{
  int maxsofar=INT_MIN,maxendinghere=0;
  for(int i=0;i<n;i++)
  {
    maxendinghere=maxendinghere+a[i];
    if(maxsofar<maxendinghere)
      maxsofar=maxendinghere;
    if(maxendinghere<0)
      maxendinghere=0;
  }
  cout<< maxsofar;
}
bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}


signed main()
{
  ss s1, s2;
  cin>>s1>>s2;
  int cnt=0;
  f0(i,s1.sz)
  {
    if(s1[i]!=s2[i])
      cnt++;
  }
  cout<<cnt;
      return 0;
}


Measured memory_bytes: 3980
num,MAX = map(int,input().split())
queue = []
total_time = 0
[queue.append(input().split()) for _ in range(num)]
flag = 1
while flag:
  if len(queue) == 0:
    break
  queue[0][1] = int(queue[0][1])
  total_time += min(MAX,queue[0][1])
  queue[0][1] -= min(MAX,queue[0][1])
  temp = queue[0]
  queue.pop(0)
  if temp[1] == 0:
    print(f"{temp[0]} {total_time}")
    continue
  queue.append(temp)


Measured memory_bytes: 16992
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

ll dp[110][2][4];

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  int k;
  cin >> s >> k;
  dp[0][0][0] = 1;
  rep(i, s.size()) {
    int n = s[i]-'0';
    rep(j, 2) {
      int lim;
      if (j) lim = 9;
      else lim = n;
      rep(l, 4) {
        rep(m, lim+1) {
          int num = l+(m>0);
          if (num > 3)
            continue;
          dp[i+1][j || m < n][num] += dp[i][j][l];
        }
      }
    }
  }
  ll ans = dp[s.size()][0][k]+dp[s.size()][1][k];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*
ID: marik_k1
PROG:
LANG: C++
*/
#include <bits/stdc++.h>

using namespace std;

//ifstream fin ("input.txt");
//ofstream fout ("output.txt");

#define forn(i,n) for(int i = 0; i < n; ++i)
#define mp make_pair
#define pb push_back
#define all(t) t.begin(),t.end()
#define gcd(x,y) __gcd(x,y)

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

const int N = 300000;
const int INF = (int)1e7;
const double eps = 1e-6;
const long long MOD = 1e9 + 7;
const double PI = M_PI;


vector<string> a;
int n,l;
string ans;

int main(){
	std::ios::sync_with_stdio(false);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

	cin >> n >> l;
	for(int i = 0; i < n; ++i){
		string s; cin >> s;
		a.pb(s);
	}
	sort(all(a));
	for(int i = 0; i < n; ++i)
		cout << a[i];
	return 0;
}








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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int h,w;
char s[52][52];

int main(){
  scanf("%d%d",&h,&w);
  REP(i,h)scanf("%s",s[i]);

  REP(i,h)REP(j,w)if(s[i][j]=='#'){
    int deg = 0;
    int d[] = {1,0,-1,0,1};
    REP(dd,4){
      int ni = i+d[dd];
      int nj = j+d[dd+1];
      if(ni<0 || nj<0 || ni>=h || nj>=w)continue;
      if(s[ni][nj]=='#')deg++;
    }
    if(deg==0){
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 256
//Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
template<class T>
void dmp(T a){
	rep(i,a.size()) cout << a[i] << " ";
	cout << endl;
}
template<class T>
bool chmax(T&a, T b){
	if(a < b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
bool chmin(T&a, T b){
	if(a > b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 998244353;
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}
ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}

vector<P>vec;
int n;
int main(){
ios::sync_with_stdio(false);
	cin>>n;
	rep(i, n){
		string s; cin >> s;
		int sum = 0, mn = 0;
		rep(j, s.size()){
			sum += (s[j]=='('?1:-1);
			chmin(mn, sum);
		}
		vec.pb(mp(sum, mn));
	}
	sort(all(vec), [&](const P &a, const P &b){
		if(a.fi >= 0 && b.fi < 0) return true;
		if(a.fi < 0 && b.fi >= 0) return false;
		if(a.fi >= 0 && b.fi >= 0){
			return a.sc > b.sc;
		}
		if(a.fi < 0 && b.fi < 0){
			return a.fi-a.sc > b.fi-b.sc;
		}
	});
	int cur = 0;
	rep(i, vec.size()){
		if(cur+vec[i].sc < 0){
			puts("No"); return 0;
		}
		cur += vec[i].fi;
	}
	if(cur != 0){
		puts("No"); return 0;
	}
	puts("Yes");}


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

int main(void){
   ll H, N;
   cin >> H >> N;
   vector<ll> A(N+1);
   vector<ll> B(N+1);
   for(int i = 1; i <= N; i++){
       cin >> A[i] >> B[i];
   }
   A[0] = 0;
   
   ll x = *max_element(A.begin(), A.end());
   
   vector<ll> dp(H+x+1,100000000);
   dp[0] = 0;
   
   
   for(int i = 1; i < H+x+1; i++){
       for(int n = 1; n <= N; n++){
           if(A.at(n) <= i){
               dp.at(i) = min(dp.at(i), dp.at(i-A.at(n)) + B.at(n));
           }
       }
   }
   
   ll ans = 100000000;
   for(int h = H; h <= H+x; h++){
       ans = min(ans,dp[h]);
   }
   printf("%lld\n", ans);
    
}


Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
const double small = 1e-10;
int main(void) {
  int n, dim;
  cin >> n >> dim;
  vector<vector<int>> x(n, vector<int>(dim));
  rep(i, n) rep(d, dim) cin >> x[i][d];

  int ans = 0;
  rep(i, n) rep(j, n) {
    if(i >= j) continue;
    int sqd = 0;
    rep(d, dim) {
      int dx = x[i][d] - x[j][d];
      sqd += dx * dx;
    }
    int dist = sqrt(sqd) + small;
    if(dist * dist == sqd) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
i = 0
answer = 0
max_tmp = 0
while i < n-1:
  if h[i] >= h[i+1]:
    max_tmp = max_tmp + 1
  else:
    max_tmp = 0
  answer = answer if max_tmp < answer else max_tmp
  i = i + 1
print(answer)

Measured memory_bytes: 15020
# -*- coding: utf-8 -*-
S = input()
# 出力
# 奇数を取得
if (len(S) % 2 == 1):
    print('No')
    exit()
for i in range(0, len(S), 2):
    if (S[i] + S[i + 1] == 'hi'):
        continue
    else:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 2940
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,a,cardA[201],cardB[201];
  while(1){
  for(int i=0;i<201;i++){
    cardA[i]=cardB[i]=0;
  }
  cin >> n;
  if(n==0) break;
  for(int i=0;i<n;i++){
    cin >> a;
    cardA[a]=1;
  }
  for(int i=1;i<=2*n;i++){
    if(cardA[i]==0){
      cardB[i]=1;
    }
  }

  int ban=0,ba=0,Aflg=n,Bflg=n;
  while(1){
    int flg=0;
    if(Aflg==0||Bflg==0) break;
    for(int i=ba+1;i<=2*n;i++){
      if(ban==0 && cardA[i]==1){
	Aflg--; ba=i; flg=1; cardA[i]=0; break;
      }else if(ban==1 && cardB[i]==1){
	Bflg--; ba=i; flg=1; cardB[i]=0; break;
      }
    }
    if(flg==0)  ba=0;
    if(ban==1)ban=0;
    else ban=1;
  }
  cout << Bflg << endl << Aflg << endl;
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 100000000

using namespace std;

int main()
{
    //COMinit();
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<int > p(n,0);
    REP(i,n) cin>>p[i];
    int cnt=0;
    REP(i,n-1)
    {
     if(p[i]!=i+1)  ++cnt;
    }

    string ans="NO";
    if(cnt<3) ans="YES";
    cout<<ans<<endl;
    return  0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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


int main(){
    int n,m;
    cin >> n >> m;
    map<ll,vector<ll>> mp;
    ll p[m],y[m];
    
    rep(i,0,m){
        cin >> p[i] >> y[i];

        mp[p[i]].pb(y[i]);
    }

    for(auto i : mp){
        vsort(mp[i.ft]);
    }

   /* for(auto i : mp){
        cout << i.ft << ": " ; 
        for(auto j : i.sd)PS(j);
        cout << endl;
    }*/
    
    rep(i,0,m){
        printf("%06lld%06lld\n",p[i],vlb(mp[p[i]],y[i])+1);
    }
	return  0;
}

Measured memory_bytes: 13952
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		if(A + B >= C) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long double pi = acos(-1.0); 
typedef long long ll;

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

	int k;
	cin >> k;
	for(int i = 0; i < k; i++) {
		cout << "ACL";
	}
}

Measured memory_bytes: 3600
N, X = map(int, input().split())


def search(level, eat_num):
    if level == 0:
        if eat_num <= 0:
            return 0
        else:
            return 1

    elif eat_num == 1:
        return 0

    elif 1 < eat_num <= pow(2, level + 1) - 2:
        return search(level - 1, eat_num - 1)

    elif eat_num == pow(2, level + 1) - 1:
        return pow(2, level)

    elif pow(2, level + 1) - 1 < eat_num <= pow(2, level + 2):
        return pow(2, level) + search(level - 1, eat_num - (pow(2, level + 1) - 1))

    elif X == pow(2, level + 2) + 1:
        return pow(2, level + 1) - 1

    else:
        return pow(2, level + 1) - 1


print(search(level=N, eat_num=X))

Measured memory_bytes: 3064
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


#include <map>
void solve() {
  int n, m;
  string s;
  cin >> n;
  map<string, int> M;
  loop(i,0,n) {
    cin >> s;
    M[s]++;
  }
  cin >> m;
  loop(i,0,m) {
    cin >> s;
    M[s]--;
  }
  
  int score = 0;
  for (auto&& m: M) {
    if (score<m.second) score = m.second;
  }
  cout << score << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,p,q,ans;
  cin >> A >> B;
  ans=-1;
  for(int i=12; i<=1000; i++){
    p=i*0.08 ; q=i*0.1;
    if(p==A && q==B){ans=i;break;}
  }
  cout << ans <<endl;
}

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

typedef long long ll;

ll check(ll n,ll x){
    if(n<0) return 0;
    return n/x + 1;
}

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

    cout << check(b,x)-check(a-1,x) << endl;

    return 0;
}



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

int main() {
	int a, b;
	string s;
	string num = "0123456789";
	cin >> a >> b >> s;
	int sum = 0;
	for (int i = 0;i < a;i++) {
		for (int j = 0;j < 10;j++) {
			if (s[i] == num[j])
				sum++;
		}
	}
	for (int k = a + 1;k < a + b+1;k++) {
		for (int l = 0;l < 10;l++) {
			if (s[k] == num[l])
				sum++;
		}
	}
	if (sum == a+b and s[a] == '-')
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long R = sc.nextLong();
		long L = sc.nextLong();
		
		long min = Long.MAX_VALUE;
		
		if(L - R > 2019) {
			min = 0;
		} else {
			for(long i = R; i < L; i++) {
				for(long j = L; j > i; j--) {
					min = Math.min(i* j % 2019, min);
				}
			}
		}
		
		
		System.out.println(min);
		sc.close();
	}

}


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

int gcd(int x, int y) {
    if (x < y) {
        swap(x, y);
    }
    if (x % y == 0) {
        return y;
    }
    return gcd(y, x % y);
}

int main() {
    int x, y;
    cin >> x >> y;
    cout << gcd(x, y) << endl;
    return 0;
}


Measured memory_bytes: 3084
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = Integer.parseInt(sc.next());
        int g = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int n = Integer.parseInt(sc.next());
        sc.close();
        int ans = 0;
        for (int i = 0; i <= n; i++) {
            if (i * r > n)
                break;
            for (int j = 0; j <= n; j++) {
                if (i * r + j * g > n)
                    break;
                int c = n - i * r - j * g;
                if (c % b == 0)
                    ans++;
            }
        }
        System.out.println(ans);
    }
}


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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

bool IsPrime(int);

/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  vector<double> v(n);
  REP(i, n) cin >> v[i];
  SORT(v);
  double ans = v[0];
  REPS(i, 1, n) {
    ans = (ans + v[i])/2;
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/

bool IsPrime(int a) {
  if(a <= 1) return false;
  if(a == 2) return true;
  if(a%2 == 0) return false;
  for(int i = 3; i*i <= a; i+=2) {
    if(a%i==0) return false;
  }
  return true;
}

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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int mod = 1e9+7;
const int maxn = 2e3+3;

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    string s;
    while (cin >> s) {
        bool good = true;
        FOR(i,1,s.size()) if (s[i] == s[i-1])
            good = false;
        cout << (good ? "Good" : "Bad") << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
vector <pll> v;
int main(){
	int n;cin>>n;
	ll now=0;
	for (int i=0;i<n;i++){
		ll a,b;
		cin>>a>>b;
		v.push_back(make_pair(b,a));
	}
	sort (v.begin(),v.end());
	for (int i=0;i<n;i++){
		now+=v[i].second;
		if (now>v[i].first){
			cout<<"No";return 0;
		}
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 6560
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <bitset>
# include <sstream>
# include <set>
# include <cmath>
# include <algorithm>
# pragma  comment(linker,"/STACK:102400000,102400000")
using namespace std;
# define LL          long long
# define pr          pair
# define mkp         make_pair
# define lowbit(x)   ((x)&(-x))
# define PI          acos(-1.0)
# define INF         0x3f3f3f3f3f3f3f3f
# define eps         1e-8
# define MOD         1000000007

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
# define MX 10005
/**************************/

int main()
{
    int c;
    scanf("%d",&c);
    bool ok=0;
    while (c)
    {
        if (c%10==9)
            ok=1;
        c/=10;
    }
    if (ok) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long md=1e9+7;
long long ans1,ans2,ans3,n;
int main()
{
	cin>>n;
	ans1=1;
	ans2=1;
	ans3=1;
	for(int i=1;i<=n;i++)
	{
		ans1*=10;
		ans1%=md;
		ans2*=8;
		ans2%=md;
		ans3*=9;
		ans3%=md;
	}
	cout<<(ans1+md*10-ans3*2+ans2)%md<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;
char s[3];
char t[3];
char c;
int ans = 0;


int main()
{
    for (int i=0; i<3; ++i)
    {
        scanf("%c",&c);
        while (c=='\n') scanf("%c",&c);
        s[i] = c;
    }
    for (int i=0; i<3; ++i)
    {
        scanf("%c",&c);
        while (c=='\n') scanf("%c",&c);
        t[i] = c;
    }
    for (int i=0; i<3; ++i)
    {
        ans += (s[i] == t[i]);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
//file_name:ABC68_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);


    ll ans = n;

    rep(i,10){
        if(pow(2,i)<=n){
            ans = pow(2,i);
        }
    }

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



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

int main(){

  string s, ans;

  cin>>s;

  for(int i=0;i<s.length();i++){
    ans+=s[i];
    if(s[i]=='B') ans=ans.substr(0, max(0, (int)ans.length()-2));
  }

  cout<<ans<<endl;

  return 0;
}


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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long x, k, d;
	cin >> x >> k >> d;
	if (x < 0) {
		x = -x;
	}
	if (x/d >= k) {
		cout << x - k * d; 
	} else if (x/d % 2 != k % 2) {
		cout << d - x % d;
	} else {
		cout << x % d;
	}
}



Measured memory_bytes: 3620