akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  cout << fixed << setprecision(10);
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  if(k<=a){
    cout << k << endl;
  }else if(k<=a+b){
    cout << a << endl;
  }else{
    cout << 2*a-k+b << endl;
  }
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

const pair<ll, ll> dir[] = {{1, 0}, {0, 1}};

int main(void) {
    ll H, W;
    vector<string> S;
    vector<vector<ll>> dp;
    cin >> H >> W;
    S.resize(H);
    dp.resize(H, vector<ll>(W, numeric_limits<ll>::max() - 1));
    rep(h, H) cin >> S[h];
    if(S[0][0] == '#') dp[0][0] = 1LL;
    else dp[0][0] = 0LL;
    rep(h, H) rep(w, W) {
        rep(i, 2) {
            ll x = w + dir[i].first;
            ll y = h + dir[i].second;
            if(x >= W || y >= H) continue;
            dp[y][x] = min(dp[y][x], dp[h][w] + (S[y][x] == '#' && S[h][w] == '.' ? 1LL : 0LL));
        }
    }
    cout << dp[H - 1][W - 1] << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
         
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007  
const int N = 100001; 

// int fexp(int a, int b,int m){int ans = 1;while(b){if(b&1)ans=ans*a%m; b/=2;a=a*a%m;}return ans;}
// int inverse(int a, int p){return fexp(a, p-2,mod);} 

// int fac[2000001];

// int nCrModPFermat(int n, int r,int p) { 
//     if (r==0) return 1; 
//     return (fac[n]*inverse(fac[r],p)%p*inverse(fac[n-r],p)%p)%p; 
// }
 

void solve(){
    int a,b,c,d;cin>>a>>b>>c>>d;
    cout<<max(max(a*c,a*d),max(b*c,b*d));

    return;
}
         
signed main(){
        IOS;    
        

        int t=1;
        // cin>>t;
        // fac[0] = 1; 
        // for (int i=1 ; i<=2000001; i++) fac[i] = fac[i-1]*i%mod; 
        rep(i,0,t){
            // cout<<"Case #"<<i+1<<": ";
            solve();
            cout<<"\n";
        }
    //    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define mp make_pair
#define p(x) cout<< x << " ";
#define pe(x) cout<< x << endl ;
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define el endl
#define M 998244353 
#define int long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROR(i,a,b) for(int i=a;i>=b;i--)
const int N = 1e5 + 5;

int32_t main() 
{ 
    int n,k;
    cin>>n>>k;
    int a[n];
    FOR(i,0,n)
    cin>>a[i];
    int dp[n]={0};
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    FOR(i,2,n)
    {
        int mi=1e9;
        for(int j=i-1;j>=i-k;j--)
        if(j>=0)
        mi=min(dp[j]+abs(a[i]-a[j]),mi);
        dp[i]=mi;
    }
    cout<<dp[n-1];
    
    
    
} 

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static bool Solve(string s)
        {
            int N = s.Length;
            return (s.Length % 2 == 0) == (s.First() == s.Last());
        }
        static void Main(string[] args)
        {
            Console.WriteLine(Solve(Read()) ? "First" : "Second");
        }
    }
}


Measured memory_bytes: 13244
#if defined(__GNUC__)
#include <bits/stdc++.h>
#define __int32 __int32_t
// __GNUC__
#else
#include "bits/stdc++.h"
#endif
using namespace std;

#define int long long

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); ++(i))
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); ++(i))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) std::sort(ALL(x))
#define RSORT(x) std::sort(ALL(x), greater<decltype(x)::value_type>())
#define RSORT2(x, T) std::sort(ALL(x), greater<T>())
#define REVERCE(x) std::reverce(ALL(x))
#define ACM(x, y) std::accumulate(ALL(x), y)

#define INT_POW(x, y) [](int a, int b) -> int {int c = a; REP(i, b - 1){c *= a;} return c;}(x, y)
#define INT_POWM(x, y, m) [](int a, int b, int m) -> int {int c = a; REP(i, b - 1){c *= a; c %= m;} return c;}(x, y, m)
#define FCT(x) [](int a) -> int {int r = 1; REP(i, a){r *= i;} return r;}(x)

itn main() {
	std::ios::sync_with_stdio(false);

	int n;

	cin >> n;

	int max = (int)1e5, min = 1, mid;

	while (max != min + 1) {
		mid = (max + min) / 2;
		int mid2 = mid * mid;

		if (mid2 == n) {
			cout << n;
			return 0;
		}
		else if (mid2 > n) {
			max = mid;
		}
		else {
			min = mid;
		}
	}

	cout << min * min;

	return 0;
}


Measured memory_bytes: 256
/*
                            Author: Ankit Kaul
*******Code Belongs to Respective Author Only*************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
/*freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
        {   if(n % 2 ==1)
            result=(result * x)%M;
            x=(x*x)%M;
            n=n/2;
        }
    return result%M;
}
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 inv(int a,int m)
{   return power(a,m-2);
}   
int lcm(int a,int b)
{   return a*b/(gcd(a,b));
}
signed main()
{   jaldi
    int n,x,t;
    cin>>n>>x>>t;
    if(n<=x)
    cout<<t<<endl;
    else
    cout<<t*(n/x)+t*(n%x!=0);
}


Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s,ans; cin>>s;
  int n=s.length();
  for(int i=0;i<n;i++){
    if(s[i]=='B'){
		if(!ans.empty()) ans.pop_back();
    }
    else ans+=s[i];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
arr = Array.new(4){ Array.new(3){ Array.new(10, 0) }}
gets.to_i.times{
  b, f, r, v = gets.split.map(&:to_i)
  arr[b-1][f-1][r-1] += v
}

4.times{|b|
  puts "####################" if b != 0
  3.times{|f|
    puts " " + arr[b][f]*" "
  }
}



Measured memory_bytes: 8888
X,N = map(int,input().split())
N_list =  list(map(int, input().split()))
A = []
for x in range(-100,200):
    A.append(x)
for x in N_list:
    A[x+100] = 1000
m = 200
s = 0
for x in A:
    if abs(X-x) < m:
        m = abs(X-x)
        s = x
print(s)

Measured memory_bytes: 9128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
//#define mod 998244353ll
#define flagcount __builtin_popcount
#define flag(x) (1ll << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1ll << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return -1;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
template <typename T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b; // aをbで更新
        return true;
    }
    return false;
}
template <typename T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b; // aをbで更新
        return true;
    }
    return false;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));
bool check(ll N, ll K, vector<ll> A, ll X)
{
    ll count = 0;
    loop(i, N)
    {
        count += ((A[i] + X - 1) / X) - 1;
    }
    if (count <= K)
        return true;
    else
        return false;
}
int main()
{
    cout << fixed << setprecision(30);
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    loop(i, N) cin >> A[i];
    ll ok = 2000000010, ng = 0;
    loop(i, 1000)
    {
        ll mid = (ok + ng + 1) / 2;

        if (check(N, K, A, mid))
            ok = mid;
        else
            ng = mid;
    }
    putout(ok);
    return 0;
}


Measured memory_bytes: 6380
#include<bits/stdc++.h>
#define mx 100007
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

vector<int>adj[mx];
int deg[mx], lvl[mx];
int ans= 1;
bool vis[mx];
int dp[mx];

int dfs( int u )
{
    if( vis[u] )
        return dp[u];

    dp[u]= 0;

    for( auto v: adj[u] )
        dp[u]= max( dp[u], dfs(v)+1);

    vis[u]= 1;

    return dp[u];
}

int main()
{
    FAST

    int n,m;
    cin>>n>>m;

    for( int i=0;i<m;i++ )
    {
        int p,q;
        cin>>p>>q;

        adj[p].push_back(q);
        deg[q]++;
    }

    for( int i=1;i<=n;i++ )
        if( !deg[i] )
            ans= max( ans, dfs(i) );

    cout<<ans<<endl;
}


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

int main(){
	char s;
	cin>>s;
	if(s=='a'||s=='i'||s=='u'||s=='e'||s=='o'){
		cout<<"vowel"<<endl;
	}else{
		cout<<"consonant"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
while True:
    count = 0
    n, x = map(int, input().split())
    #終了条件
    if n == 0 and x == 0:
        break
    #小さい順にa, b, cとし, 全通り確認する
    for a in range(1, n-1):
        for b in range(a+1, n):
            c = x - a - b
            if b < c <= n:
                count += 1           
    print(count)


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

using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long

int main()
{
  IOS;
  int a, b;
  cin >> a >> b;
  if (a==b)
    {
      for (int i=0; i<a; i++)
	{
	  cout << a;
	}
    }
  else if (a>b)
    {
      for (int i=0; i<a; i++)
	{
	  cout << b;
	}
    }
  else
    {
      for (int i=0; i<b; i++)
	{
	  cout << a;
	}
    }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3552
n, x = map(int, input().split())
a = list(map(int, input().split()))
if n == 1:
    print(abs(x-a[0]))
    exit()
else:
    a.append(x)
    a.sort()
    box = [a[i+1]-a[i] for i in range(n)]
    b = min(box)
    for i in range(1,b+1):
        for j in range(n-1):
            if box[j]%i:
                break
            if j == n-2:
                ans = i
    print(ans)


Measured memory_bytes: 14252
import sys
sys.setrecursionlimit(pow(10, 9))

N = int(input())
G = [[] for _ in range(N)]

def dfs(v, dist):
  for nv, e_dist in G[v]:
    if ans[nv] == -1:
      ans[nv] = (dist + e_dist) % 2
      dfs(nv, dist + e_dist)

for i in range(N-1):
  u, v, w = map(int, input().split())
  G[u-1].append([v-1, w])
  G[v-1].append([u-1, w])

ans = [-1] * N
dfs(0, 0)

print(*ans, sep="\n")

Measured memory_bytes: 87092
#include<iostream>
#include<cstdlib>
#include<vector>
using namespace std;

class union_find{
    vector<int> set;
public:
    union_find(int size){ for(int i=0; i<size; i++)set.push_back(i); }
    int find(int x);
    void unite(int x, int y);
    void printV();
};

int main()
{
    int n, q;
    cin >> n >> q;

    union_find uf(n);

    int com, x, y;
    for(int i=0; i<q; i++){
        cin >> com >> x >> y;

        switch(com){
        case 0 :
            uf.unite(x, y);
            break; 
        case 1 :
            uf.find(x) == uf.find(y) ? cout << "1" : cout << "0";
            cout << endl;
            break;
        }
        // printV(&set);
    }
    
    return 0;
}

int union_find::find(int x)
{
    //if( !(x >= 0 && x < set.size()) ) exit(1);

    while( set.at(x) != x ){
        x = set.at(x);
    }
    return x;
}

void union_find::unite(int x, int y)
{
    int rootX, rootY;
    rootX = find(x);
    rootY = find(y);

    ///if( rootX == rootY ) return;
    //if( !( (rootX>=0 && rootX<set.size()) && (rootY>=0 && rootY<set.size()) ) ) return;

    set.at(rootX) = rootY;
}

void union_find::printV()
{
    for(int i=0; i<set.size(); i++) cout << set.at(i) << " ";
    cout << endl;
}

Measured memory_bytes: 1316
#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 INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
vector<long long> fact, fact_inv, inv;
 
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
void init_nCk(int SIZE) {
    fact.resize(SIZE + 5);
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}
 
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int n, int k) {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    return fact[n] * (fact_inv[k] * fact_inv[n - k] % MOD) % MOD;
}

int main()
{
  ll K;
  cin >> K;
  string S;
  cin >> S;

  mint ans2 = 0;
  vector<mint> vec(K+1);
  vector<mint> vec2(K+1);
  mint x=1,y=1;
  REP(i,K+1){
    vec.at(i)=x;
    x*=25;
  }
  REP(i,K+1){
    vec2.at(i)=y;
    y*=26;
  }
  init_nCk(S.size()+K);
  vector<ll> vec3(S.size()+K);
  FOR(i,S.size()-1,S.size()+K){
    vec3.at(i)=nCk(i,S.size()-1);
  }
  FOR(i,S.size()-1,S.size()+K){
    mint ans = 1;
    int j = i-S.size()+1;
    ans*=vec.at(j)*vec2.at(K-j);
    ans*=vec3.at(i);
    ans2+=ans;
  }

  cout << ans2 << endl;
}

Measured memory_bytes: 82640
L,R = map(int,input().split())
l = L % 2019
r = R % 2019
ans = 2019
if R-L < 2019 and l < r:
	for i in range(l,r):
		for j in range(i+1,r+1):
			m_ij = (i*j) % 2019
			if ans > m_ij:
				ans = m_ij
else:
	ans = 0
print(ans)


Measured memory_bytes: 3064
import java.util.*;
class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt(),l=(int)(Math.sqrt(n*4)),a=l*(l+1)/2;
		BitSet b=new BitSet(l);
		b.set(1,l+1);
		for(int i=l;i>0;--i){
			if(a-i>=n){
				a-=i;
				b.clear(i);
			}
		}
		b.stream().forEach(System.out::println);
	}
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  while (true) {
    int n, m, p; cin >> n >> m >> p;
    if (n == 0) return;
    vi32 x(n); cin >> x;
    int sum = accumulate(all(x), 0);
    if (x[m - 1] == 0) {
      cout << 0 << '\n';
    } else {
      cout << sum * (100 - p) / x[m - 1] << '\n';
    }
  }
}



Measured memory_bytes: 3156
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#include <unordered_set>

#define _USE_MATH_DEFINES
#include <math.h>


#include <vector>
#include <list>

#include <set>
#include <map>

#include <unordered_map>

#include <queue>
#include <stack>

#include <string>

#include <vector>

#define sqr(x) (x) * (x)

#include <algorithm>
#include <functional>

#include <bitset>

#include <functional>

#include <chrono>

typedef unsigned int u32;
typedef int i32;

typedef unsigned long long int u64;
typedef long long int i64;

typedef uint16_t u16;
typedef int16_t i16;

typedef uint8_t u8;
typedef int8_t i8;


using namespace std;
using namespace std::chrono;

struct less_key
{
    bool operator() (pair<i64, i64> p1, pair<i64, i64> p2)
    {
        return p1.first > p2.first || (p1.first == p2.first && p1.second < p2.second);
    }
};

struct pair_hash {
public:
    std::size_t operator()(const std::pair<u64, u64> &x) const
    {
        return std::hash<u64>()(x.first) ^ std::hash<u64>()(x.second);
    }
};
#include <random>

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

// del

const i64 MAXN = 100005;

i64 n;
vector<string> a;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;

    for (i64 i = 0; i < n; i++) {
        string t;
        cin >> t;
        a.push_back(t);
    }

    i64 R = 0;
    i64 ba = 0;
    i64 ca = 0;
    i64 bc = 0;

    for (i64 i = 0; i < n; i++) {
        for (i64 j = 0; j < a[i].size() - 1; j++) {
            if (a[i][j] == 'A' && a[i][j + 1] == 'B') {
                R++;
            }
        }
        if (a[i][0] == 'B' && a[i].back() == 'A') {
            ba++;
        }
        else if (a[i][0] == 'B') {
            bc++;
        }
        else if (a[i].back() == 'A') {
            ca++;
        }
    }

    R += max(0ll, ba - 1);

    if (ba > 0) {
        if (ca > 0) {
            R++;
            ca--;
        }
        if (bc > 0) {
            R++;
            bc--;
        }
    }

    R += min(ca, bc);

    cout << R;
    return 0;
}

Measured memory_bytes: 768
#include <stdio.h>

int
main(void)
{
	char s[1600];

	for (;;) {
		int n = 0;
		scanf("%s", s);

		if (s[0] == '0' && s[1] == '\0')
			break;

		for (char *c = s; *c != '\0'; c++)
			n += *c - '0';
		printf("%d\n", n);
	}

	return 0;
}



Measured memory_bytes: 2052
n,k=gets.split.map &:to_i;a=$<.map{|e|e.split.map &:to_i};q=0
p (0..31).map{|i|
	l=k>>i<<i|q;q+=1<<i-1;i>0&&k[i-1]<1?0:a.select{|x,y|x|l==l}.map(&:last).reduce(0,:+)
}.max

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

using i64 = long long int;

int main(){
    int n, s;
    while(cin >> n >> s, n != 0){
        int ans = 0;
        for(int i=0;i<(1<<10);++i){
            int sum = 0, bit = 0;
            for(int j=0;j<10;++j){
                if((i>>j)&1){
                    sum += j;
                    bit++;
                }
            }
            if(bit == n && sum == s)ans++;
        }
        cout << ans << endl;
    }

    return 0;
}



Measured memory_bytes: 3048
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map> 
#include <stack>
#include <sstream>
#include <set>
#pragma GCC optimize(2)

//#define int long long
#define mm(i,v) memset(i,v,sizeof i);
#define mp(a, b) make_pair(a, b)
#define pi acos(-1)
#define fi first
#define se second
//你冷静一点，确认思路再敲！！！ 

using namespace std;
typedef long long ll;
typedef pair<int, int > PII;
priority_queue< PII, vector<PII>, greater<PII> > que;
stringstream ssin; //  ssin << string   while ( ssin >> int)

const int N = 1e5 + 5, M = 2e5 + 5, mod = 1e9 + 9, INF = 0x3f3f3f3f;
char s[N];
int k;

inline int read(){
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1; c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0'; c=getchar();}
    return x*f;
}

int main()
{
    scanf("%s", s + 1);
    if (s[3] == s[4] && s[5] == s[6]) puts("Yes");
    else puts("No");
    // system("pause");
    return 0;
}
/*
niuniu
1
abca
2
abcabc
2
*/

Measured memory_bytes: 3680
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    double T = sc.nextInt();
    double A = sc.nextInt();
    double f = 12000;
    int result = 0;
    for(int i=0; i<N; i++){
      double H = sc.nextInt();
      double avg = T - H*0.006;
      if(f > Math.abs(A - avg)){
        f = Math.abs(A - avg);
        result = i;
      }
    }
    System.out.println(result + 1);
  }
}

Measured memory_bytes: 22868
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for(int i=1; i>0; i++) {
			int x = sc.nextInt();
			if (x==0) {
				break;
			} else {
				System.out.println("Case "+ i +": "+ x);
			}
		}

	}

}

Measured memory_bytes: 41492
#include<stdio.h>

int main(void){
  int a,b,c,d;
  int n;

  while(scanf("%d",&n)!=EOF){
    int ans=0;
    for(a=0;a<=9;a++){
      for(b=0;b<=9;b++){
	for(c=0;c<=9;c++){
	  for(d=0;d<=9;d++){
	    if(a+b+c+d==n) ans++;
	  }
	}
      }
    }
  printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    // int N = Integer.parseInt(scanner.nextLine());
    // int N = scanner.nextInt(), M = scanner.nextInt();
    // scanner.nextLine();
    // int[] n = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    // long[] n = Arrays.stream(scanner.nextLine().split(" ")).mapToLong(Long::parseLong).toArray();
    static void solve(Scanner scanner) {
        int[] n = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int N = n[0], M = n[1], K = n[2];

        Combination combination = new Combination(200_000, MOD);
        long x = 0, y = 0;
        for (int d = 1; d < N; d++) {
            long tmp = d;
            tmp = (tmp * (N - d)) % MOD;
            tmp = (tmp * M) % MOD;
            tmp = (tmp * M) % MOD;
            x = (x + tmp) % MOD;
        }
        for (int d = 1; d < M; d++) {
            long tmp = d;
            tmp = (tmp * (M - d)) % MOD;
            tmp = (tmp * N) % MOD;
            tmp = (tmp * N) % MOD;
            y = (y + tmp) % MOD;
        }
        long abs = (combination.kFromN(K - 2, N * M - 2) * (x + y)) % MOD;
        System.out.println(abs);
    }

}

class Combination {

    private int MOD;
    private int MAX;

    private final long[] fac, facInv, inv;

    public Combination(int max, int mod) {
        this.MAX = max + 1;
        this.MOD = mod;
        fac = new long[MAX];
        facInv = new long[MAX];
        inv = new long[MAX];

        fac[0] = fac[1] = 1;
        facInv[0] = facInv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            facInv[i] = facInv[i - 1] * inv[i] % MOD;
        }
    }

    public long kFromN(int k, int n) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (facInv[k] * facInv[n - k] % MOD) % MOD;
    }
}



Measured memory_bytes: 30676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)

int main() {
    ll ans = 0;
    string S;
    cin >> S;
    for (ll i = 1; i <= floor((S.length()-1)/2); i++)
    {
        bool flag = true;
        for (ll j = 0; j < i; j++) {
            if (S[j] != S[j + i]) flag = false;
        }

        if (flag) ans = max(ans, i*2);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        // 主処理
        boolean judge = s.matches("[a-z]");
        String result = judge ? "a" : "A";

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 35568
#include<stdio.h>
#define MAX 500001
#define NIL -1
typedef struct node{
  int left;
  int right;
  int key;
  int p;
  int leftid;
  int rightid;

}Node;
Node node[MAX];
int root=NIL;
void inorder(int);
void preorder(int);
void addTree(int n,int num){
  int tmp;
  //rootが空の場合
  if(node[n].key==root){
    root=n;
    node[root].key=num;
    
  }
  else{
  tmp=root;

  while(1){
    if(node[tmp].key>num){
      if(node[tmp].left!=NIL){
	tmp=node[tmp].leftid;
      }
      else{
	node[tmp].left=num;
	node[tmp].leftid=n+1;
	node[n+1].key=num;
	
	break;
      }
    }
    else{
      if(node[tmp].right!=NIL){
	tmp=node[tmp].rightid;
	
      }
      else{
	node[tmp].right=num;
	node[n+1].key=num;
	node[tmp].rightid=n+1;
	break;
      }
    }
  }
  
  node[n].p=tmp;
  
  }
}
int main(){
  int num,i,n,l=0,tmp;
  char name[100];
  scanf("%d",&n);
 for(i=0;i<MAX;i++){//初期化
    node[i].p=NIL;
    node[i].left=NIL;
    node[i].right=NIL;
    node[i].key=NIL;
    
  }


 for(i=0;i<n;i++){
    scanf("%s",name);
    if(name[0]=='i'){
      scanf("%d",&num);
      addTree(l,num);
      l++;
      }
      
   else if(name[0]=='p'){
    inorder(root);
   printf("\n");
   preorder(root);
   printf("\n");
      
    }
  }
 
 
 
  return 0;
}
void inorder(int t){
  if(node[t].left!=NIL){
    inorder(node[t].leftid);
  }
    printf(" %d",node[t].key);
  if(node[t].right!=NIL){
    inorder(node[t].rightid);
  }
}
void preorder(int t){
 
      printf(" %d",node[t].key);
  if(node[t].left!=NIL){
    preorder(node[t].leftid);
  }
  if(node[t].right!=NIL){
    preorder(node[t].rightid);
  }
}




Measured memory_bytes: 13460
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cctype>

using namespace std;

int main(){
	int N;
	cin >> N;
	while(N--){
		int H, W;
		cin >> H >> W;
		vector<string> bag(H);
		for(int i = 0; i < H; ++i){ cin >> bag[i]; }
		bool flag = true;
		while(flag){
			flag = false;
			int minx[26], miny[26], maxx[26], maxy[26];
			for(int i = 0; i < 26; ++i){
				minx[i] = miny[i] = 10000;
				maxx[i] = maxy[i] = 0;
			}
			bool found[26] = { false };
			for(int i = 0; i < H; ++i){
				for(int j = 0; j < W; ++j){
					if(isupper(bag[i][j])){
						int c = bag[i][j] - 'A';
						minx[c] = min(minx[c], j);
						miny[c] = min(miny[c], i);
						maxx[c] = max(maxx[c], j);
						maxy[c] = max(maxy[c], i);
						found[c] = true;
					}
				}
			}
			for(int c = 0; c < 26; ++c){
				if(!found[c]){ continue; }
				char letter = c + 'A';
				bool accept = true;
				for(int i = miny[c]; i <= maxy[c]; ++i){
					for(int j = minx[c]; j <= maxx[c]; ++j){
						if(bag[i][j] != letter && bag[i][j] != '?'){
							accept = false;
						}
					}
				}
				if(accept){
					flag = true;
					for(int i = miny[c]; i <= maxy[c]; ++i){
						for(int j = minx[c]; j <= maxx[c]; ++j){
							bag[i][j] = '?';
						}
					}
				}
			}
		}
		flag = true;
		for(int i = 0; i < H; ++i){
			for(int j = 0; j < W; ++j){
				if(bag[i][j] != '.' && bag[i][j] != '?'){ flag = false; }
			}
		}
		cout << (flag ? "SAFE" : "SUSPICIOUS") << endl;
	}
	return 0;
}

Measured memory_bytes: 924
#include <iostream>
#include <string>

using namespace std;

int main(void){
  int N;
  int listCounter = 0, ans = 0;
  string S, compS;

  cin >> N;
  cin >> S;

  for(int i=0; i < 1000; i++){
    compS = "";
    compS += to_string(i / 100);
    compS += to_string((i - i / 100 * 100) / 10);
    compS += to_string(i -  i / 100 * 100 - (i - i / 100 * 100) / 10 * 10);
    listCounter = 0;
    for(int j=0; j < N; j++){
      if(S[j] == compS[0] && listCounter == 0){
        listCounter++;
        continue;
      }
      if(S[j] == compS[1] && listCounter == 1){
        listCounter++;
        continue;
      }
      if(S[j] == compS[2] && listCounter == 2){
        ans++;
        break;
      }
    }
  }
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //greater<T> for sorting decreasingly
#define ll 	long long
#define pll	pair<ll,ll>
#define unique(a) a.resize(unique(a.begin(), a.end()) - a.begin())
#define fill(v, p) memset(v,p,sizeof v)
#define all(x) x.begin(),x.end()
#define _fastio	ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(0)
#define PI acos(-1.0)
#define EPS 0.000000000000001
#define INF 1LL<<62
#define MAX 100005
#define MOD 1000000007

//int dx[]={1,0,-1,0};
//int dy[]={0,1,0,-1}; //4 Direction
 
//int dx[]={1,1,0,-1,-1,-1,0,1};
//int dy[]={0,1,1,1,0,-1,-1,-1}; //8 direction
 
//int dx[]={2,1,-1,-2,-2,-1,1,2};
//int dy[]={1,2,2,1,-1,-2,-2,-1}; //Knight Direction (horse)

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

int main()
{
	_fastio;
	
	ll n;
	cin >> n;
	
	string s;
	cin >> s;
	
	ll cnt=0;
	for(int i=0;i<n-2;i++)
	{
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
		 cnt++;
	}
	
	cout <<cnt << endl;
	
	return 0;
}


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

const int N = 55555;
int n, mark[N];
vector <int> vec[10];

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	for (int i = 2; i < N; i++)
		if (!mark[i]) {
			vec[i % 10].push_back(i);
			for (int j = i; j < N; j += i)
				mark[j] = 1;
		}
	
	cin >> n;
	for (int i = 0; i < 10; i++)
		if (vec[i].size() >= n) {
			for (int j = 0; j < n; j++)
				cout << vec[i][j] << ' ';
			return 0;
		}
}

Measured memory_bytes: 768
#include <iostream>

int main(void){
    using namespace std;
    int n, l;
    cin >> n >> l;

    int pie = (l + l + n - 1) * n / 2;

    int ret = pie;
    if(l>0){
        ret -= l;
    } else if (l + n - 1 < 0){
        ret -= l + n - 1;
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
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; }

int main() {
	int a, b, c, x;
	cin >> a >> b >> c >> x;
	int res = 0;
	for (int i = 0;i <= a;++i) {
		for (int j = 0;j <= b;++j) {
			for (int k = 0;k <= c;++k) {
				int total = 500 * i + 100 * j + 50 * k;
				if (total == x)++res;
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
//
// Created by Hideaki Imamura on 2020-03-19.
//
# 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;

inline ll take_mod(ll a) {
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b) {
    return take_mod(a + b);
}

inline ll sub(ll a, ll b) {
    return take_mod(a - b);
}

inline ll mul(ll a, ll b) {
    return take_mod(a * b);
}

inline ll mod_pow(ll x, ll n) {
    ll res = 1LL;
    while (n > 0) {
        if (n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x) {
    return mod_pow(x, mod - 2);
}

int N;
vector<ll> A;

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

    ll ans = 0;
    for (int d = 0; d < 60; ++d) {
        ll n0 = 0, n1 = 0;
        for (int i = 0; i < N; ++i) {
            if (1 & (A[i] >> d)) n1++;
            else n0++;
        }
        ans = add(ans, mul(mul(n0, n1), mod_pow(2, d)));
    }

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

Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	private static List<Integer> card = new ArrayList<>();

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int n = Integer.parseInt(str);
		for (int i = 1; i <= 2 * n; i++) {
			card.add(i);
		}
		str = br.readLine();
		int m = Integer.parseInt(str);
		for (int i = 0; i < m; i++) {
			str = br.readLine();
			int command = Integer.parseInt(str);
			if (command == 0)
				Riffle(n);
			else
				Cut(command, n);
		}
		for (int num : card) {
			System.out.println(num);
		}
	}

	private static void Riffle(int n) {
		for (int i = 0; i < n; i++) {
			card.add(card.get(i));
			card.add(card.get(i + n));
		}
		card.subList(0, 2 * n).clear();
	}

	private static void Cut(int k, int n) {
		for (int i = k; i < 2 * n; i++)
			card.add(card.get(i));
		for (int i = 0; i < k; i++)
			card.add(card.get(i));
		card.subList(0, 2 * n).clear();
	}
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};


template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

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

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

signed main()
{   
    gearup;
    ll n,m; cin >> n >> m;
    UnionFind<ll> uf(n);
    rep(i,m){
        ll l,r,d; cin >> l >> r >> d;
        l--;r--;
        if(uf.issame(l,r)){
            if(uf.diff(l,r) != d){
                out("No");
                return 0;
            }
        }
        else uf.merge(l,r,d);
    }
    out("Yes");
}


Measured memory_bytes: 1792
l, r = map(int, input().split())

minv = float('inf')
if l == 0 or (l-1)//2019 != r//2019 or ((l-1)//3 != r//3 and (l-1)//673 != r//673):
	print(0)
	exit()
else:
	for a in range(l, r):
		for b in range(l + 1, r + 1):
			minv = min(minv, (a%2019)*(b%2019)%2019)
			if minv == 0:
				print(0)
				exit()
print(minv)

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

namespace ABC050_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] tt = Console.ReadLine().Split(' ');
            int[] t = new int[n];
            for (int i = 0; i < n; i ++)
            {
                t[i] = int.Parse(tt[i]);
            }
            int m = int.Parse(Console.ReadLine());
            int[] p = new int[m];
            int[] x = new int[m];
            for(int i = 0;i < m; i++)
            {
                string[] px = Console.ReadLine().Split(' ');
                p[i] = int.Parse(px[0]);
                x[i] = int.Parse(px[1]);
            }

            long[] ruiseki = new long[n + 1];
            ruiseki[0] = 0;
            for(int i = 1;i < n + 1; i++)
            {
                ruiseki[i] = ruiseki[i - 1] + t[i - 1];
            }

            for(int i= 0;i < m; i++)
            {
                long ans = ruiseki[p[i] - 1] - ruiseki[0];
                ans += ruiseki[n] - ruiseki[p[i]];
                ans += x[i];
                Console.WriteLine(ans);
            }
            Console.Read();
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int64_t INF = 1LL << 60;

int main() {
 	int64_t N,T;
	 cin>>N>>T;
	vector<int64_t>t(N);
	for(int i=0;i<N;i++){
		cin>>t[i];
	}
    int64_t sum=0;
	for(int i=0;i<N;i++){
		if(i<N-1){if(t[i+1]-t[i]<T){sum=sum+t[i+1]-t[i];}
		          else{sum+=T;}
				  }
		else{sum+=T;}		  
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)
#define MAXK 26
#define MAXX 15000006
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n,black[MAXN],white[MAXN], ans=LLINF; string A;
int main()
{
	cin>>n>>A;
	FOR(i,0,n) black[i] = (i>0?black[i-1]:0ll) + (A[i] == '#');
	for(ll i=n-1;i>=0;i--) white[i] = white[i+1] + (A[i] == '.');
	ans = white[0];
	FOR(i,0,n) {
		ans = min(ans, black[i] + white[i+1]);
	}
	cout<<ans;
}


Measured memory_bytes: 4228
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<cstring>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define output(x) cout<<x<<endl;

int par[100001];

void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
	}
}
//木の根を求める
int root(int x) {
	if (par[x] == x)
		return x;
	else {
		return par[x] = root(par[x]);
	}
}
//find
bool same(int x, int y) {
	return root(x) == root(y);

}
//union
void unite(int x, int y) {
	x = root(x);
	y = root(y);
	if (x == y) return;
	par[x] = y;
}

int main()
{
	long long int i, j, k, l, m, n, sum, flag;
	sum = 0;
	flag = 0;
	char S[6];
	cin >> S;
	for (i = 0; i < strlen(S) - 1; i++) {
		if (S[i] == 'A'&&S[i + 1] == 'C') {
			flag = 1;
			break;
		}
	}
	if (flag) {
		output("Yes");
	}
	else
		output("No");


	return 0;
}



Measured memory_bytes: 256