akhauriyash/Code-Regression huggingface dataset:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ok = max(a)
ng = 1

from math import ceil

def f(length):
  rtn = 0
  for i in range(n):
    rtn += ceil(a[i]/length) - 1
  return rtn

if f(1) == 0:
  print(1)
else:
  while ok - ng > 1:
    mid = (ok + ng)//2
    if f(mid) <= k:
      ok = mid
    else:
      ng = mid

  if f(ng) > k:
    print(ok)
  else:
    print(ng)

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

int main()
{
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if (A + B > C + D)
		cout << "Left" << endl;
	else if (A + B < C + D)
		cout << "Right" << endl;
	else
		cout << "Balanced" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
 
    int x,y;
    cin >> x >> y;
 
    int a=((4*x)-y)/2;
    int b=(y-(2*x))/2;
 
    if ((a<0)||(b<0))
    {
        cout << "No" << endl;
        return 0;
    }
 
    if (((a+b)==x)&&(((2*a)+(4*b))==y))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
 
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>

typedef long long ll;

using namespace std;
int main() {
    string s;
    ll h,w;
    cin >> h >> w;
    vector<vector<char> > a(h, vector<char>(w));
    for (auto i=0; i<h; ++i){
        for (auto j=0; j<w; ++j){
            cin>>a[i][j];
        }
    }
    vector<int> x,y;
    for (auto i=0; i<h; ++i){
        bool con = false;
        for (auto j=0; j<w; ++j){
            if (a[i][j] == '#'){
                con = true;
                break;
            }
        }
        if(con) x.push_back(i);
    }
    
    for (auto j=0;j<w; ++j){
        bool con = false;
        for(auto it=x.begin(); it!=x.end(); ++it){
            if(a[*it][j]=='#'){
                con = true;
                break;
            }
        }
        if(con)y.push_back(j);
    }
    
    for(auto it=x.begin(); it!=x.end(); ++it){
        for(auto jt=y.begin(); jt!=y.end(); ++jt){
            cout << a[*it][*jt];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 888
H,W = map(int,input().split())

L = []
for i in range(H) :
    l = list(map(int,input().split()))
    L.append(l)

ans = 0
ANS = []
for i in range(H) :
    for j in range(W) :
        if L[i][j] % 2 == 0 :
            continue
        if j != W-1 :
            L[i][j+1] += 1
            ans += 1
            ANS.append([i+1,j+1,i+1,j+2])
        else :
            if i != H-1 :
                L[i+1][j] += 1
                ans += 1
                ANS.append([i+1,j+1,i+2,j+1])
print(ans)
for i in range(len(ANS)) :
    print(*ANS[i])
    

Measured memory_bytes: 30288
#include <iostream>

#define int long long

using namespace std;

const int N = 2e5 + 10;

int32_t main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);    
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < s.length(); ++i)
    {
        if (s[i] != t[i])
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


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

int main(){
    string str, inv;
    cin >> str;
    inv = str;
    reverse(inv.begin(), inv.end());
    int i, cnt=0;
    for(i=0; i<str.size(); i++){
        // cout << str.at(i) << " " << inv.at(i) << endl;
        if(str.at(i) != inv.at(i)) cnt++;
    }
    cout << cnt / 2 << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)
#define Inf 1000000000


int main() {
	
	long long N;
	cin>>N;
	
	long long ans = 0;
	
	for(long long i=1;i<=N;i++){
		if(i%3!=0&&i%5!=0){
			ans += i;
		}
	}
	
	cout<<ans<<endl;
	
    return 0;
}


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

int main() {
  long double A, B, V, W, T;
  cin >> A >> V >> B >> W >> T;
  if(W>=V || abs(A-B)/(V-W)>T) cout << "NO" << endl;
  else cout << "YES" << endl;
}

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

# define ll long long
# define mod 1000000007
# define MAX 100005
# define PI 3.141592653589793238                                                                                  //shortcut keys

# define pb push_back
# define mp make_pair
# define all(x) x.begin(),x.end()
# define fr(i,a,b) for(int i=a;i<=b;i++)

# define decimal(k) fixed<<setprecision(k)
# define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);        //---------------------------------------------------------------
using namespace std;

int main()
{
	int n,x,t;cin>>n>>x>>t;
	int y=ceil(double(n)/double(x));
	cout<<(int)t*y<<'\n';

	return 0;
}



Measured memory_bytes: 3568
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處
namespace Number {
    typedef long long int LL;
    // 求取 a, b 的最大公因數
    LL gcd(LL a, LL b) {
        if (a % b == 0) {
            return b;
        }
        return gcd(b, a % b);
    }
    // 求取 a, b 的最大公因數 gcd
    // 以及 x, y 使得 a*x + b*y = gcd
    LL gcd_extend(LL a, LL b, LL *x, LL *y) { 
        if (a == 0) { 
            *x = 0, *y = 1; 
            return b; 
        } 
    
        LL x1, y1; // To store results of recursive call 
        LL gcd = gcd_extend(b%a, a, &x1, &y1); 
    
        *x = y1 - (b/a) * x1; 
        *y = x1; 
    
        return gcd; 
    }
    // 求 a_inv 使得 (a * a_inv) % m = gcd(a, m)
    // 若 a, m 互質，即求 a 在 mod m 群的反元素 a_inv 
    LL mod_inv(LL a, LL m) { 
        LL x, y; 
        LL g = gcd_extend(a, m, &x, &y); 
        // 處理 x 爲負的情形 
        LL a_inv = (x%m + m) % m; 
        return a_inv;
    }
    // 求 x^n % m
    LL mod_pow(LL x, LL n, LL m) {
        if (n == 0) {
            return 1;
        } else if (n & 1) {
            LL half = mod_pow(x, n/2, m);
            return (half * half % m) * x % m;
        } else {
            LL half = mod_pow(x, n/2, m);
            return half * half % m;
        }
    }
    // 連乘
    LL mul(LL from, LL to, LL m) {
        LL ret = 1;
        for (LL i = from; i <= to; i++) {
            ret *= i;
            ret %= m;
        }
        return ret;
    }
    // 求 (C n 取 k) % m
    LL mod_comb(LL n, LL k, LL m) {
        LL mi = k < n-k ? k : n-k;
        LL up = mul(n - mi + 1, n, m);
        LL down = mul(1, mi, m);
        return (up * mod_inv(down, m)) % m;
    }
}
  

int main() {
    int t;
    cin >> t;
    while (t--) {
        LL cans, cost, line, supply;
        cin >> cans >> cost >> line >> supply;
        // 第一天就壞
        if (cans < cost) {
            printf("No\n");
            continue;
        }
        // 撐過第一天
        // 供不應求，終至毀滅
        if (supply < cost) {
            printf("No\n");
            continue;
        }
        // cost <= cans 且 cost <= supply
        if (cost <= line) {
            // 總是能即時補到
            printf("Yes\n");
            continue;
        } else {
            // line < cost
            // 若有個時刻 cost > cans > line 
            LL gcd = Number::gcd(cost, supply);
            // printf("%lld %lld %lld %lld\n", cans, cost, line, supply);
            // printf("gcd = %Lf\n", gcd);
            // 是否有 k 使得 k * gcd < cans, k * gcd > cans + line - cost
            LL high = cans - line;
            LL low = cans - cost;
            LL k = high % gcd == 0 ? high / gcd - 1 : high / gcd;
            if (k * gcd > low) {
                printf("No\n");
            } else {
                printf("Yes\n");
            }
        }
    }
}


Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll n;cin>>n;
    ll ans=1000-(n%1000);
    if(ans==1000)ans=0;
    cout<<ans<<endl;
}

Measured memory_bytes: 3596
n,k=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)
#n,k=200000,200000
#a=[0]*200000
z=[0]*n
[k,41].min.times do
  b=[]
  l=z.dup
  c=0
  0.upto(n-1) do |i|
    c+=1
    if i+a[i]<n-1
      l[i+a[i]]+=1
    end
    b[i]=c
    c-=l[i]
  end
  l=z.dup
  c=0
  (n-1).downto(0) do |i|
    if i-a[i]>0
      l[i-a[i]]+=1
    end
    b[i]+=c
    c-=l[i]
    c+=1
  end
  a=b.dup
end
puts a.join(" ")


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

ll ctoll(char a){
    return (ll)a-'0';
}

ll calcC(ll a,ll b){
    ll r = 1;
    if(a< b){
        return 0;
    }
    rep(i,b){
        r*=(a-i);
    }
    rep(i,b){
        r/=(i+1);
    }
    return r;
}


int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	string S;
	cin>>S;
    ll K;
    cin>>K;
	ll l = S.length();
    if(l<K){
        cout<<0<<"\n";
        return 0;
    }
    ll pow9[4] = {1,9,9*9,9*9*9};
    ll ans = 0;
    
    if(l>K){
        ans += calcC(l-1,K)*pow9[K];
    }
    ll max_n = ctoll(S[0]);
    if(K==1){
        ans += max_n;
    }else{
        int second_ind = 1;
        while(S[second_ind]=='0'){
            ++second_ind;
            if(second_ind==l){
                second_ind = l-1;
                break;
            }
        }
        ll second_n = ctoll(S[second_ind]);
        if(K==2){
            ans += (max_n-1)*(l-1)*9+second_n;
            if(second_n!=0){
                ans+=(l-1-second_ind)*9;
            }
        }else{
            ll third_ind = second_ind+1;
            if(third_ind>=l){
                third_ind = l-1;
            }
            while(S[third_ind]=='0'){
                ++third_ind;
                if(third_ind==l){
                    third_ind = l-1;
                    break;
                }
            }
            ll third_n = ctoll(S[third_ind]);
            ans +=(max_n-1)*calcC(l-1,2)*pow9[2];
            if(second_n>0){
                ans += (second_n-1)*(l-1-second_ind)*9;
                ans += calcC(l-1-second_ind,2)*pow9[2];
                if(third_n>0){
                    ans += third_n + (l-1-third_ind)*9;
                }
            }
        }
    }
    cout<<ans<<"\n";
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static int span; // 何日間のスケジューリングをするか
	public static int minus[]; // 26種類のコンテストの飽きやすさ
	public static int plus[][]; // 26種類のコンテストの満足感

	public static void main(String[] args) {

		// 入力
		Scanner sc = new Scanner(System.in);
		span = Integer.parseInt(sc.next()); // 何日間のスケジューリングをするか
		minus = new int[26]; // 26種類のコンテストの飽きやすさ
		for (int i = 0; i < 26; i++) {
			minus[i] = Integer.parseInt(sc.next());
		}
		plus = new int[span][26]; // 26種類のコンテストの満足感
		for (int d = 0; d < span; d++) {
			for (int i = 0; i < 26; i++) {
				plus[d][i] = Integer.parseInt(sc.next());
			}
		}

		// 提出用配列を初期化しておく（初期値はまぁ適当に26種類のコンテストをローテーション開催で）
		int teishutu[] = new int[span];
		for (int d = 0; d < span; d++) {
			teishutu[d] = (d % 26) + 1;
		}

		// 貪欲法をやってみよう（ちゃんと貪欲法になっているかは知らん）
		for (int d = 0; d < span; d++) {

			// d日目は何を開催したら満足度最大かを求めて、提出用配列をそれにする
			int bestKaisai = 1;
			int bestScore = -99999;
			for (int i = 0; i < 26; i++) {

				teishutu[d] = i + 1;
				int score = calc(teishutu);
				//System.out.println(Arrays.toString(teishutu) + "\t" + score);

				if (score > bestScore) {
					bestKaisai = i + 1;
					bestScore = score;
				}
			}
			teishutu[d] = bestKaisai;

		}

		// 提出
		for (int d = 0; d < span; d++) {
			System.out.println(teishutu[d]);
		}

	}

	public static int calc(int[] input) {

		int last[] = new int[26]; // 各コンテストが最終開催日から何日経過しているか
		int result = 0; // ユーザ満足度

		for (int d = 0; d < input.length; d++) {

			// lastの更新
			for (int i = 0; i < 26; i++) {
				if (i == input[d] - 1) {
					last[i] = 0;
				} else {
					last[i]++;
				}
			}

			// 開催による満足度アップ
			result += plus[d][input[d] - 1];

			// 日数経過による満足度ダウン
			for (int i = 0; i < 26; i++) {
				result -= minus[i] * last[i];
			}
		}

		return result;
	}
}


Measured memory_bytes: 43104
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  vector<int> p(n);
  vector<int> q(n);
  ll psum=0;
  rep(i,n){
    cin>>p[i];
    psum+=p[i];
  }
  ll qsum=0;
  rep(i,n){
    cin>>q[i];
    qsum+=q[i];
  }

  ll ans=0;
  rep(i,n){
    if(p[i]<q[i]) ans+=(q[i]-p[i]+1)/2;
  }

  cout << (psum+ans<=qsum?"Yes":"No") << endl;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	string S;
    cin >> S;
    string ans = "Good";
    for(int i=0; i<=2; i++){
    	if(S[i]==S[i+1]){ans="Bad";break;}
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,n,q,left,right,mid,count=0,S[100000],T[50000];

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++) scanf("%d",&T[i]);

  for(i=0;i<q;i++){
    left=0;
    right=n;
    
    while(left<right){
      mid=(left+right)/2;
      if(S[mid]==T[i]){
	count++;
	break;
      }
      
      else if(T[i]<S[mid]) right=mid;
      
      else left=mid+1;
    }

  }
  printf("%d\n",count);

  return 0;

}



Measured memory_bytes: 2296
<?php
$line = trim(fgets(STDIN));
$inputs = explode(' ', $line);
$n = $inputs[0];
$x = $inputs[1];
$ans = ($n - gcd($n, $x))*3;
print($ans);

function gcd($a, $b) {
    return $b ? gcd($b, $a % $b) : $a;
}


Measured memory_bytes: 3828
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;

#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
 
struct Less {
    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
        return x.first > y.first;
    }
};

ll GCD(ll a, ll b){
    if(b==0) return a;
    return GCD(b, a%b);
}


//グラフの隣接リスト
VI g[200010];
//頂点の入次数を管理
int h[100010];

ll dp[100010][4];
int main(){
    int N; cin >> N;
    string s; cin >> s;
    char temp=s[s.size()-1];
    map<string, int> mp;
    mp[s]++;
    REP(i, N-1){
        cin >> s;
        
        if(s[0]==temp&&mp[s]!=1){
            temp = s[s.size()-1];
        }else{
            cout << "No" << endl;
            return 0;
        }
        mp[s]++;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 6400
import java.util.Scanner;
public class Main {
	Scanner sc;
	private void run () {
		sc = new Scanner( System.in );
		int n = sc.nextInt();
		for( int i = 0; i < n; i++ ) {
			String line = sc.next();
			if( line.matches( "^\\>\\'(\\=+)\\#\\1~$" ) ) {
				System.out.println( "A" );
			} else if( line.matches( "^\\>\\^(Q=)+(~~)$" ) ) {
				System.out.println( "B" );
			} else {
				System.out.println( "NA" );
			}
		}
	}
	public static void main( String[] args ) {
		new Main().run();
	}
}

Measured memory_bytes: 25868
from sys import stdin
import bisect
n = int(stdin.readline().rstrip())
top = sorted(list(map(int, stdin.readline().rstrip().split())))
middle = sorted(list(map(int, stdin.readline().rstrip().split())))
bottom = sorted(list(map(int, stdin.readline().rstrip().split())))

res = 0

for j in middle:
    res += bisect.bisect_left(top, j) * (n - bisect.bisect_right(bottom, j))

print(res)


Measured memory_bytes: 23220
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
using namespace std;

int main() {
	string S;
	cin >> S;
	S[3] = '8';
	cout << S << endl;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

ll memo[101010];

ll rec(ll x){
	if(memo[x]>0) return memo[x];
	if(x<6) return x;
	if(x>=6 && x<9) return 1 + (x-6);

	ll cand1 = x;
	ll cand2, cand3;

	ll tmp = 1;
	while(tmp<=x){
		tmp *= 6;
	}
	tmp /= 6;
	cand2 = rec(x-tmp) + 1;

	tmp = 1;
	while(tmp<=x){
		tmp *= 9;
	}
	tmp /= 9;
	cand3 = rec(x-tmp) + 1;

	memo[x] = min(min(cand1, cand2), cand3);
	return min(min(cand1, cand2), cand3);
}

int main(){
	ll N;
	cin >> N;
	REP(i, 101010) memo[i] = -1;

	cout << rec(N) << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string a, b;
int dp[2][100010];
int dp1[2][100010];
int main()
{
	cin >> a >> b;
	int n;
	int t = a.size();
	int o = b.size();
	for (int i = 1; i <= t; i++)
	{
		dp[a[i-1] - 'A'][i]++;
		if (!i)continue;
		for (int y = 0; y < 2; y++)
			dp[y][i] += dp[y][i-1];
	}
	for (int i = 1; i <= o; i++)
	{
		dp1[b[i-1] - 'A'][i]++;
		for (int y = 0; y < 2; y++)
			dp1[y][i] += dp1[y][i - 1];
	}
	cin >> n;
	while (n--)
	{
		int q, w, e, r;
		cin >> q >> w >> e >> r;
		int tt = dp[0][w] - dp[0][q - 1] + (dp[1][w] - dp[1][q - 1]) * 2;
		int oo = dp1[0][r] - dp1[0][e - 1] + (dp1[1][r] - dp1[1][e - 1]) * 2;
		int ch = max(tt, oo);
		int ch1 = min(tt, oo);
		if ((ch - ch1) % 3 == 0)
			puts("YES");
		else
			puts("NO");
	}
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,r;
	cin>>l>>r;

	k=(r-l+1);
	if(k>=2019){
		cout<<"0";
	}
	else{
		ll mn=1e18;
		for(i=l;i<=r;i++){
			for(j=i+1;j<=r;j++){
				k=((i%2019)*(j%2019))%2019;
				mn=min(mn,k);
			}
		}
		cout<<mn;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
   
   
     int x; 
     int i=0; 
     while(1){ 
         scanf("%d", &x); 
         if(x==0)break; 
         printf("Case %d: %d\n", ++i, x); 
     } 


  
 
 return 0;
}



Measured memory_bytes: 2032
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

int main()
{
  // 整数の入力
  ll N;
  string S;
  cin >> N;
  cin >> S;
  vector<ll> Rs(N,0);
  vector<ll> Gs(N,0);
  vector<ll> Bs(N,0);
  for(int i = 0;i< N;i++){
    if (S[i] == 'R'){
      Rs[i] = 1;
    }else if(S[i] == 'G'){
      Gs[i] = 1;
    }else
    {
      Bs[i] = 1;
    }
  }
  for(int i = 1;i< N;i++){
      Rs[i] += Rs[i-1];
      Gs[i] += Gs[i-1];
      Bs[i] += Bs[i-1];
  }

  ll total = 0;
  for(int i = 0;i< N;i++){
    for(int j = i + 1;j<N;j++){
      // cout << i << " " << j << ":" << total << endl;
      ll bad_index = j + (j - i);
      if ((S[i] == 'R' && S[j] == 'G') || (S[i] == 'G' && S[j] == 'R')){
        total += Bs[N-1] - Bs[j];
        if (bad_index < N && S[bad_index] == 'B'){
          total--;
        }
      }else if ((S[i] == 'G' && S[j] == 'B') || (S[i] == 'B' && S[j] == 'G')){
        total += Rs[N-1] - Rs[j];
        if (bad_index < N && S[bad_index] == 'R'){
          total--;
        }
      }else if ((S[i] == 'B' && S[j] == 'R') || (S[i] == 'R' && S[j] == 'B')){
        total += Gs[N-1] - Gs[j];
        if (bad_index < N && S[bad_index] == 'G'){
          total--;
        }
      }
    }
  }
  cout << total << endl;
  return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define MAX 100010

typedef long long ll;

using namespace std;

ll arr[MAX];
ll sum[MAX];
ll sum2[MAX];

ll getSum(int i , int j)
{
	if ( i > j ) return 0;
	return sum[j+1]-sum[i];
}
ll getSum2(int i, int j)
{
	if ( i > j ) return 0;
	return sum2[j+1]-sum2[i];
}

int main()
{
	int n, k, l, r;
	cin>>n>>k;
	for( int i = 0; i < n; i++ ) cin>>arr[i];
	sum[0] = 0;
	sum2[0] = 0;
	for( int i = 1; i <= n; i++ ) 
	{
		sum[i] = sum[i-1]+max(arr[i-1], 0ll);
		sum2[i] = sum2[i-1]+arr[i-1];
	}
	ll result = 0ll;
	for( int i = 0; i < n-k+1; i++ )
	{
		l = i;
		r = i+k-1;
		result = max(result, getSum(0, l-1) + max(0ll, getSum2(l, r)) + getSum(r+1, n-1));
	}
	cout<<result<<"\n";
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <math.h>
#include <string.h>
typedef long long ll;
using namespace std;
char a[1000];
int main()
{
    ll t,n,k,ans,m,flag=1,i,j;
    scanf("%s",a+1);
    n=strlen(a+1);
    if(n%2==0)
    {
        printf("No\n");
        return 0;
    }
    else
    {
        for(i=1; i<=n; i++)
        {
            if(a[i]!=a[n-i+1])
            {
                flag=0;
                break;
            }
        }
        if(flag==0)
        {
            printf("No\n");
            return 0;
        }
        flag=1;
        for(i=1; i<=(n-1)/2; i++)
        {
            if(a[i]!=a[(n-1)/2-i+1])
            {
                flag=0;
                break;
            }
        }
        if(flag==0)
        {
            printf("No\n");
            return 0;
        }
        flag=1;
        for(i=(n+3)/2,j=n;i<=n ; i++)
        { // printf("%c %c\n",a[i],a[j]);
            if(a[i]!=a[j])
            {

                flag=0;
                break;
            }
            j--;
            if(j==i)break;
        }
        if(flag==0)
        {
            printf("No\n");
            return 0;
        }
          printf("Yes\n");
    }




    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <climits>

#define ll long long


ll f(ll b, ll n) {
	if (n < b) return n;
	return f(b, n / b) + n % b;
}

int main() {
    ll n, s, minn = LLONG_MAX;
    scanf("%lld%lld", &n, &s);
    if (n == s) minn = s + 1;
    else {
        for (ll i = 2; i * i <= n; i++)
            if (f(i,n) == s && minn > i)
                minn = i;
        for (ll i = 1; i * i <= n; i++) {
            ll b = (n - s) / i + 1;
            if(b > 1)
                if (f(b,n) == s && minn > b)
                    minn = b;
        }
        if (minn == LLONG_MAX)
            minn = -1;
    }
    printf("%lld", minn);
    return 0;
}


Measured memory_bytes: 128
from collections import deque
H,W,K=map(int,input().split())
A=[list(input())for _ in range(H)]
for i in range(H):
	if"S"in A[i]:y,x=i,A[i].index("S")
d=1e9
Q=deque([(1,y,x)])
while Q:
	c,i,j=Q.popleft()
	d=min(d,i,j,H-i-1,W-j-1)
	if c>K:continue
	for h,w in((i+1,j),(i,j+1),(i-1,j),(i,j-1)):
		if 0<=h<H and 0<=w<W and A[h][w]==".":
			A[h][w]=""
			Q+=[(c+1,h,w)]
print(1-(-d//K))

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1e9 + 7;


int main() {
    int n;
    scanf("%d", &n);
    int ans = 0;
    vector<vector<int>> only357(10,vector<int>());
    vector<vector<int>> only35(10, vector<int>());
    vector<vector<int>> only37(10, vector<int>());
    vector<vector<int>> only57(10, vector<int>());
    only357.at(1) = {3, 5, 7};
    only35.at(1) = {3, 5};
    only37.at(1) = {3, 7};
    only57.at(1) = {5, 7};
    rp (i, 2, 10) { // i桁のものをそれぞれのベクトルのi番目に入れていく
        rp(j, 0, only357.at(i-1).size()) {
            only357.at(i).push_back(only357.at(i-1).at(j) * 10 + 3);
            only357.at(i).push_back(only357.at(i-1).at(j) * 10 + 5);
            only357.at(i).push_back(only357.at(i-1).at(j) * 10 + 7);
        }
        rp(j, 0, only35.at(i-1).size()) {
            only35.at(i).push_back(only35.at(i-1).at(j) * 10 + 3);
            only35.at(i).push_back(only35.at(i-1).at(j) * 10 + 5);
            only37.at(i).push_back(only37.at(i-1).at(j) * 10 + 3);
            only37.at(i).push_back(only37.at(i-1).at(j) * 10 + 7);
            only57.at(i).push_back(only57.at(i-1).at(j) * 10 + 5);
            only57.at(i).push_back(only57.at(i-1).at(j) * 10 + 7);
        }
        sort(only357.at(i).begin(), only357.at(i).end());
        sort(only35.at(i).begin(), only35.at(i).end());
        sort(only37.at(i).begin(), only37.at(i).end());
        sort(only57.at(i).begin(), only57.at(i).end());
    }
    int m = to_string(n).size();
    rp(i, 3, m) { 
        ans += only357.at(i).size();
        ans -= only35.at(i).size() * 3;
        ans += 3;
    }
    ans += upper_bound(only357.at(m).begin(), only357.at(m).end(), n) - only357.at(m).begin();
    ans -= upper_bound(only35.at(m).begin(), only35.at(m).end(), n) - only35.at(m).begin();
    ans -= upper_bound(only37.at(m).begin(), only37.at(m).end(), n) - only37.at(m).begin();
    ans -= upper_bound(only57.at(m).begin(), only57.at(m).end(), n) - only57.at(m).begin();
    int a = 3;
    int b = 5;
    int c = 7;
    rp(i, 1, m) {
        a = a * 10 + 3;
        b = b * 10 + 5;
        c = c * 10 + 7;
    }
    if (n >= a) {
        ans += 1;
    }
    if (n >= b) {
        ans += 1;
    }
    if(n >= c) {
        ans += 1;
    }
    printf("%d\n", ans);
    return 0;

} 

Measured memory_bytes: 512
X = int(input())
dp = [0] * (X + 1000)
dp[0] = 1
array = [100, 101, 102, 103, 104, 105]

for x in range(X):
    for y in array:
        if dp[x] == 1:
            dp[x + y] = 1
print(dp[X])


Measured memory_bytes: 41324
k, s = gets.split.map(&:to_i) 
                              
x = 0                         
y = 0                         
z = 0                         
                              
ans = 0                       
(0..k).each do |x|            
  (0..k).each do |y|          
    break if x + y > s        
    ans += 1 if x + y + k >= s
  end                         
end                           
                              
puts ans                      


Measured memory_bytes: 1788
/*
 *  Created on: 26-May-2019
 *      Author: ankur314
 */
#include<bits/stdc++.h>
#define lli long long int 
#define li long int
#define db double 
#define ldb long double
#define vr vector 
#define it iterator
#define fi(i,a,n) for(int i=a;i<n;i++)
#define fli(i,a,n) for(long int i=a;i<n;i++)
#define flli(i,a,n) for(long long int i=a;i<n;i++)
#define pb(n) push_back(n)
#define ppf() pop_front()
#define pii pair<int,int>
#define MOD 1000000007

#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define debug4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    int a,p;cin>>a>>p;
    cout<<(3*a+p)/2;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

static const int N=1000;

int lcs(char* X,char* Y){
  int i,j;
  int c[N+1][N+1];
  int m=strlen(X);
  int n=strlen(Y);

  for(i=0;i<=m;i++)c[i][0]=0;
  for(j=1;j<=n;j++)c[0][j]=0;
  
  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(X[i-1]==Y[j-1])c[i][j]=c[i-1][j-1]+1;
      else if(c[i-1][j-1]>=c[i][j-1]) {
	c[i][j]=c[i-1][j];
      }
      else c[i][j]=c[i][j-1];
    }
  }
  if(i==0||j==0)return 0;
  else if(i>0&&j>0&&m==n)return c[i-1][j-1];
  else if(i>0&&j>0&&m!=n)return c[m][n];
  return 0;
}

int main(){
  char s1[1001],s2[1001];
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%s",s1,s2);
    printf("%d\n",lcs(s1,s2));
  }
  return 0;
}



Measured memory_bytes: 5664
import sys
from collections import deque
def input():
    return sys.stdin.readline()[:-1]

S = deque(map(int, list(input())))
num = 0
dict = {}
dict[0] = 1
ans = 0

for i in range(len(S)):
    num += S.pop() * pow(10,i,2019)
    cand = num % 2019
    if cand in dict.keys():
        dict[cand] += 1
    else:
        dict[cand] = 1

for key in dict.keys():
    ans += dict[key] * (dict[key] - 1) // 2
print(ans)


Measured memory_bytes: 12232
N, K, *A = map(int, open(0).read().split())

x = A[:]

for _ in range(min(50, K)):
    y = [0] * (N + 1)
    for i in range(N):
        y[max(0, i - x[i])] += 1
        y[min(N, i + x[i] + 1)] -= 1
        
    for i in range(N):
        y[i + 1] += y[i]
        
    x = y[:]
        
    
print(*x[:-1])


Measured memory_bytes: 171548
# -*- coding: utf-8 -*-
N = int(input())
B = list(map(int,input().split()))
sum = 0

if N == 2:
  sum += B[0]
else:
  for i in range(N-1):
    if i == 0:
      sum += B[i]
    else:
      sum += min(B[i-1], B[i])
sum += B[N-2]
print(sum)

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, h;
    cin >> n >> h;
    vector<ll> a(n), b(n);
    rep (i, n) {
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end(), greater<ll>());
    sort(b.begin(), b.end(), greater<ll>());
    ll cnt = 0;
    for (int i = 0; i < n && b[i] >= a[0]; ++i) {
        h -= b[i];
        cnt++;
        if (h <= 0) {
            cout << cnt << endl;
            return 0;
        }
    }
    cnt += (h + a[0] - 1) / a[0];
    cout << cnt << endl;
    
    return 0;
}



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

using ll = long long;

const int MAX_N = 100010;
int par[MAX_N];
int rnk[MAX_N];
int siz[MAX_N];

void init(int n) {
    rep(i,n) {
        par[i] = i;
        rnk[i] = 0;
        siz[i] = 1;
    }
}

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

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    int s = siz[x] + siz[y];
    if (rnk[x] < rnk[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
    siz[find(x)] = s;
}

bool same(int x, int y) {
    return find(x) == find(y);
}

int size(int x) {
    return siz[find(x)];
}

int main() {
    int V, E, s, t, w;
    cin >> V >> E;
    vector<tuple<int, int, int>> v;
    rep(i, E) {
        cin >> s >> t >> w;
        v.emplace_back(w, s, t);
    }
    sort(v.begin(), v.end());
    /*
    rep(i, E) {
        cout << get<0>(v[i]) << get<1>(v[i]) << get<2>(v[i]) << "\n";
    }
    */
    init(V);
    int ans = 0;
    rep(i, E) {
        int a = get<0>(v[i]), b = get<1>(v[i]), c = get<2>(v[i]);
        if (same(b, c)) continue;
        ans += a;
        unite(b, c);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 4452
#include<bits/stdc++.h>
#define fs first
#define se second
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef double db;

const int maxn=5e5+5;
const ll inf=0x3f3f3f3f;
const ll mod=1e9+7;

char s[maxn];
int main(){
	scanf("%s",s+1);
	if(s[3]==s[4]&&s[5]==s[6]) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

#define ll long long
#define ar array

void solve() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int K;
  cin >> K;
  string S;
  cin >> S;
  
  if (S.length()>K) {
    cout << S.substr(0, K);
    cout << "...";
  }
  else {
    cout << S;
  }
  cout << "\n";
}


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

int main(){
    int N,ans=1,first;
    cin >> N;
    vector<int> inn(N);
    for(int i=0;i<N;i++){
        cin >> inn[i];
        if(i==0){
            first = inn[i];
        }else{
            ans++;
            for(int j=0;j<i;j++){
                if(inn[j]<=inn[i]){
                    continue;
                }else{
                    ans--;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input){
    var nums = input.split('\n')[1].split(' ').map((n) => parseInt(n, 10)).sort((a,b) => b-a);
    var alice = 0;
    var bob = 0;
    nums.forEach((num,index) =>{
      if (index %2 === 0){
          alice += num;
      }else {
          bob += num;
      }
    })
    console.log(alice-bob);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7500
import copy
import numpy as np
H, W, K = map(int, input().split())
c_map = []
for _ in range(H):
    c = np.array(list(input()))
    c_map.append(c)
c_map = np.array(c_map)

ans = 0
for bit1 in range(2**H):
    y_map = copy.deepcopy(c_map)
    for i in range(H):
        if bit1 & (1<< i):
            y_map[i] = np.where(y_map[i]!=1, ".", y_map[i])

    for bit2 in range(2**W):
        x_map = copy.deepcopy(y_map)
        for j in range(W):
            if bit2 & (1<< j):
                x_map[:,j] = np.where(x_map[:,j]!=1, ".", x_map[:,j])
        if np.count_nonzero(x_map == "#") == K:
            ans += 1
print(ans)

Measured memory_bytes: 27360
# 深さ優先探索の問題
import sys

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

N, Q = map(int, input().split())

# 隣接リスト
t = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = [int(i) for i in readline().split()]
    t[a-1].append(b-1)
    t[b-1].append(a-1)

# スコア
score = [0] * N
for _ in range(Q):
    p, x = [int(i) for i in readline().split()]
    #s[p-1] = s[p-1] + x
    score[p-1] += x

ans = [0] * N

# 深さ優先探索 (スタック)
rootchecker = [0] * N
rootchecker[0] = 1
stack = [0]
while stack:
    #print(stack)
    s = stack.pop()
    ans[s] += score[s]
    for c in t[s]:
        if rootchecker[c] == 0:
            ans[c] += ans[s]
            rootchecker[c] = 1
            stack.append(c)

print(*ans)


Measured memory_bytes: 62576
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

//#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>

using namespace std;
#define REP(i,a,n) for(int i = a; i < (int)n; ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

LL Q, H, S, D, N;
int main() {
	cin >> Q >> H >> S >> D >> N;
	LL L = min({ Q * 4, H * 2, S });
	if (L * 2 < D) {
		cout << N * L << endl;
	} else {
		cout << D * (N / 2) + L *(N % 2) << endl;
	}
	return 0;
}

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


int main(){
	/*input*/
	int n;
	cin >> n;
	vector<int> l(n,0);
	for(int i = 0; i < n; i++){
		cin >> l[i];
	}
	/*calc*/
    string ans;
	sort(l.begin(),l.end());
	int max = l[n-1];
	int sum = 0;
    for(int i = 0; i < n-1; i++) sum += l[i];
	if(max < sum) ans = "Yes";
	else{
		ans = "No";
	}

    /*output*/
	cout<< ans <<endl;
    return 0;
}


Measured memory_bytes: 256
import qualified Data.IntMap.Strict as Map
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.Maybe

main :: IO ()
main = do
  [h, w, n] <- map read . words <$> getLine
  points <- replicateM n $ do
    [a, b] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    return (a, b)
  let
    po = do
      (x, y) <- points
      x1 <- [x-1..x+1]
      y1 <- [y-1..y+1]
      guard $ x1 > 1 && x1 < h && y1 > 1 && y1 < w
      return $ x1 + y1 * h
    ma = foldl (\m c -> Map.insertWith (+) c 1 m) Map.empty po
    ans = Map.foldl (\m i -> Map.insertWith (+) i 1 m) Map.empty ma
    l = sum ans
  forM_ [0..9] $ \i -> print $ fromMaybe 0 (i `Map.lookup` Map.insert 0 ((h-2) * (w-2) - l) ans)


Measured memory_bytes: 146300
import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;

T readNum(T)(){
  return readStr.to!T;
}

T[] readNums(T)(){
  return readStr.split.to!(T[]);
}

string readStr(){
  return readln.chomp;
}

void main(){
  auto nk = readNums!int;
  auto s = readStr;
  int len = 1, ret;

  foreach(i; 0 .. nk[0]-1){
    if(s[i] == s[i+1]) ret++;
    else len++;
  }

  foreach(i; 0 .. nk[1]){
    if(len >= 3){
      len -= 2;
      ret += 2;
    } else if(len == 2){
      len -= 1;
      ret += 1;
    } else {
      break;
    }
  }

  writeln(ret);
}


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::cout << n * n * n << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M=1000000007;
int n,top,i,l,r,f[200005],vis[200005],h,w;
long long ans;
struct str{
	int r,c,a;
}a[200005];
bool cmp(str a,str b)
{
	return a.a>b.a;
}
int Find(int x)
{
	if(f[x]==0)
		return x;
	return f[x]=Find(f[x]);
}
void uniot(int u,int v)
{
	int x=Find(u),y=Find(v);
	if(x!=y)
	{
		vis[y]|=vis[x];
		f[x]=y;
	}
}
int main()
{
	scanf("%d %d %d",&n,&h,&w);
	for(i=1;i<=n;i++)
		scanf("%d %d %d",&a[i].r,&a[i].c,&a[i].a);
	sort(a+1,a+1+n,cmp);
	for(i=1;i<=n;i++)
	{
		int x=Find(a[i].c+h),y=Find(a[i].r);
		if(x!=y)
		{
			if(vis[x]==1&&vis[y]==1)
				continue;
			ans+=a[i].a;
			uniot(a[i].c+h,a[i].r);
		}
		else
			if(vis[x]==0)
			{
				vis[x]=1;
				ans+=a[i].a;
			}
	}
	cout<<ans;
}


Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
# define MOD 1000000000+7
# define INF 1000000000
typedef long long ll;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }


int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << a[0] + a[1] << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i=0; i < int(n); i++)


// 素集合データ構造
struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    rep(i,n) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = -1;  // sizes[y]は無意味な値となるので-1を入れておいてもよい
  }

  // 2つのデータx, yが属する木が同じならtrueを返す
  bool same(int x, int y) {
    return find(x) == find(y);
  }

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};


// 頂点a, bをつなぐコストcostの（無向）辺
struct Edge
{
  int a, b, cost;

  // コストの大小で順序定義
  bool operator<(const Edge& o) const {
    return cost < o.cost;
  }
};

// 頂点数と辺集合の組として定義したグラフ
struct Graph
{
  int n;  // 頂点数
  vector<Edge> es;  // 辺集合

  // クラスカル法で無向最小全域木のコストの和を計算する
  // グラフが非連結のときは最小全域森のコストの和となる
  int kruskal() {
    // コストが小さい順にソート
    sort(es.begin(), es.end());

    UnionFind uf(n);
    int min_cost = 0;

    rep(ei, es.size()) {
      Edge& e = es[ei];
      if (!uf.same(e.a, e.b)) {
        // 辺を追加しても閉路ができないなら、その辺を採用する
        min_cost += e.cost;
        uf.unite(e.a, e.b);
      }
    }

    return min_cost;
  }
};

// 標準入力からグラフを読み込む
Graph input_graph() {
  Graph g;
  int m;
  cin >> g.n >> m;
  rep(i, m) {
    Edge e;
    cin >> e.a >> e.b >> e.cost;
    g.es.push_back(e);
  }
  return g;
}


int main()
{
  Graph g = input_graph();
  cout << g.kruskal() << endl;
  return 0;
}

Measured memory_bytes: 2724
void main() {
	auto ip = readAs!(int[]), A = ip[0], B = ip[1], C = ip[2];
	writeln(min(C, B / A));
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

int G(int x, int N){
	if(x%10 == 0) return 0;

	int res = 0;

    int F = x%10;
	while(x > 9) x /= 10;

	if(F == x) ++res;
    
	for(int tmp = 10; true; tmp *= 10){
		for(int i = 0; i < tmp/10; ++i)
			if(F*tmp + x + i*10 > N) return res;
			else ++res;
	}

	return 0;
}

int main(){
	int n; cin >> n;
	int ans = 0;

	for(int i = 1; i <= n; i++)
		ans += G(i, n);

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


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

int main()
{
	int A, B, C;
	std::cin >> A >> B;
	C = A % 500;
	if (B - C >= 0) {
		std::cout << "Yes" << std::endl;
	} else {
		std::cout << "No" << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  int i,len,check=0;
  char s[101];
  scanf("%s",&s);
  len=strlen(s);
  for(i=0;i<len;i++){
    if(s[i]=='L' && i%2==0)
      check=1;
    else if(s[i]=='R' && i%2==1)
      check=1;
  }
  if(check==1)
    printf("No\n");
  else
    printf("Yes\n");
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

void Compute(ll n,ll x,ll y)
{
	KAKA
	vector<ll> vec(n,0);
	pragi(1,n + 1)
	{
		pragj(1,n + 1)
		{
			ll a = min(i,j);
			ll b = max(i,j);
			ll dist;
			if((y >= b) and (x <= a))
			{
				dist = min(b - a,a - x + 1 + y - b);
			}
			else if((b >= y) and (x <= a))
			{
				dist = min(b - a,a - x + 1 + b - y);
			}
			else if((x >= a) and (y >= b))
			{
				dist = min(b - a,y - b + 1 + x - a);
			}
			else 
			{
				dist = min(b - a,1 + x - a + b - y);
			}
			vec[dist]++;
		}
	}
	pragi(1,n)
	{
		cout<<vec[i]/2<<"\n";
	}
}
int main()
{
	KAKA
	ll n,x,y;
	cin>>n>>x>>y;
	Compute(n,x,y);
}

Measured memory_bytes: 3576