akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int K = sc.nextInt();
		int digit = N.length();
		int[][][] dp = new int[digit+1][K+1][2];
		dp[0][0][0] = 1;
		for(int i = 1; i <= digit; i++) {
			int x = Character.getNumericValue(N.charAt(i-1));
				for(int j = 0; j <= K; j++) {
					dp[i][j][1] = dp[i-1][j][1];
					if(j > 0)
						dp[i][j][1] += dp[i-1][j-1][1] * 9;
					if(x == 0)
						dp[i][j][0] = dp[i-1][j][0];
					else {
						dp[i][j][1] += dp[i-1][j][0];
						if(j > 0) {
							dp[i][j][0] = dp[i-1][j-1][0];
							dp[i][j][1] += dp[i-1][j-1][0] * (x-1);
						}
					}
				}
		}
		System.out.println(dp[digit][K][0] + dp[digit][K][1]);

	}

}

Measured memory_bytes: 23764
#!/usr/bin/perl

use strict;
use warnings;

my ($p, $q, $r);
{
    my $in = <STDIN>;
    ($p, $q, $r) = split(" ", $in);
}

if ($r>=$p && $r>=$q)
{
    print ($p+$q)."\n"; 
}
elsif ($p>=$r && $p>=$q)
{
    print ($r+$q)."\n";
}
else
{
    print ($p+$r)."\n";
}

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

typedef pair<int,int> P;

int N,C;
int T[31][100010] = {{0}};

int main(){
	cin >> N >> C;
	int tmax = 0;
	for(int i=0;i<N;i++){
		int s,t,c;
		cin >> s >> t >> c;
		T[c][s-1] += 1;
		T[c][t] += -1;
		tmax = max(t,tmax);
	}
	for(int i=1;i<=C;i++){
		for(int j=0;j<=tmax;j++){
			T[i][j] += T[i][j-1];
		}
	}
	int ans = 0;
	for(int i=0;i<=tmax;i++){
		int now = 0;
		for(int j=1;j<=C;j++){
			if(T[j][i]==1) now++;
		}
		ans = max(now,ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 12032
q,h,s,d=map(int,input().split())
n=int(input())
ans=int(0)
q*=4
h*=2
if n%2==1:
    ans+=min([q,h,s])
    n-=1

n=int(n/2)
ans+=n*min([2*q,2*h,2*s,d])
print(int(ans))

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

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

using namespace std;

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

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

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

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<int>;
using vvi = vc<vi>;

template <class T>
using va = valarray<T>;
using vad = va<ld>;

vad Read(ll n){
    auto v = vad(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

int main() {
    cout << setprecision(20) << fixed;
    ll n;
    cin >> n;
    const auto x = Read(n);
    const auto y = Read(n);

    const auto p1 = (x - y).apply(abs).sum();

    ld p2;
    {
        const auto a = (x - y) * (x - y);
        const auto b = a.sum();
        p2 = sqrt(b);
    }
    //const auto p2 = sqrt(((x - y) * (x - y)).sum());
    const auto p3 = pow(((x - y) * (x - y) * (x - y)).apply(abs).sum(), 1./3);
    const auto pinf = (x -y).apply(abs).max();

    cout << p1 << endl;
    cout << p2 << endl;
    cout << p3 << endl;
    cout << pinf << endl;
    return 0;
}



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

int main() {
    ll N;
    cin >> N;
    string ans = "";
    while (N > 0) {
        N--;
        if (N == 0) {
            ans = 'a' + ans;
            break;
        }
        ans = (char)('a' + N%26) + ans;
        N /= 26;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,a=0,b=0,c=0,d=0;
    string s;
  //  char c;
    cin>>n ;
    while(n--) {
        cin>>s;
        if(s=="AC") a++;

        if(s=="WA") b++;

        if(s=="TLE") c++;

        if(s=="RE") d++;
        
    }
  cout<<"AC"<<" "<<"x"<<" "<<a<<'\n';
   cout<<"WA"<<" "<<"x"<<" "<<b<<'\n';
   cout<<"TLE"<<" "<<"x"<<" "<<c<<'\n';
  cout<<"RE"<<" "<<"x"<<" "<<d<<'\n';
}

Measured memory_bytes: 3644
import java.util.Scanner;

//Physical Experiments
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			double t = sc.nextDouble()/9.8;
			double y = 4.9*t*t;
			int f = 1;
			while(true){
				if(5*f-5 >= y){
					System.out.println(f);
					break;
				}
				f++;
			}
		}
	}
}

Measured memory_bytes: 12000
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAddition solver = new AAddition();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAddition {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int n = in.ints();
            int odd = 0;
            for (int i = 0; i < n; i++) {
                if (in.ints() % 2 == 1) {
                    odd++;
                }
            }
            out.println(odd % 2 == 1 ? "NO" : "YES");
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

    }
}



Measured memory_bytes: 35028
#include <iostream>
#include <set>
using namespace std;
typedef long long ll;
ll n, a, s, l, r, b[200005];
set<ll> st;
int main() {
	ll i;
	set<ll>::iterator it;
	scanf("%d", &n);
	for(i=1; i<=n; i++) scanf("%d", &a), b[a] = i;;
	st.insert(0);
	st.insert(n+1);
	for(i=1; i<=n; i++) {
		it = st.lower_bound(b[i]);
		r = *it;
		l = *--it;
		s += i * (b[i]-l) * (r-b[i]);
		st.insert(b[i]);
	}
	printf("%lld", s);
	return 0;
}

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

using namespace std;

int Search(const int a, const vector<int> &d, int l, int r) {
	if (l == r)
		return l;
	int p = (l + r) >> 1;
	if (a <= d[p])
		return Search(a, d, p + 1, r);
	else
		return Search(a, d, l, p);
}

int Search(const int a, const vector<int> &d) {
	return Search(a, d, 0, d.size() - 1);
}

int main(void) {
	int n, a, i, j, ans;
	scanf("%d", &n);
	vector<int> d(n + 1, 0);
	for (i = 2; i <= n; i++) {
		a = i;
		for (j = 2; j < n; j++) {
			while (a != 0 && a % j == 0) {
				d[j]++;
				a /= j;
			}
		}
	}
	sort(d.begin(), d.end(), greater<int>());
	ans = Search(74, d);
	a = Search(4, d);
	ans += Search(14, d) * (a - 1);
	ans += Search(24, d) * (Search(2, d) - 1);
	ans += a * (a - 1) * (Search(2, d) - 2) / 2;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
 ll N,K;cin>>N>>K;
 vector<ll> v;
 ll i,j,k,l;
 rep(i,N){
   ll a;cin>>a;
   v.pb(a);
 }
 ll ans=0,tmp;
 rep(i,min(N,K)+1){
   rep(j,min(N,K)-i+1){
     tmp=0;
    vector<ll> value;
     rep(k,i){
       value.pb(v.at(k));
       tmp+=v.at(k);
     }
     rep(k,j){
       value.pb(v.at(N-k-1));
       tmp+=v.at(N-k-1);
     }
     sort(value.begin(),value.end());
     ll s=K-i-j;
     ll t=i+j;
     s=min(s,t);
     rep(l,s){
       if(value.at(l)<0) tmp -= value.at(l);
     }
     // cout<<i<<" "<<j<<" "<<tmp<<" "<<ans<<endl;
     ans=max(ans,tmp);
   }
 }
 cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K, A, B;
    cin >> K >> A >> B;
    bool ok = false;
    REP(i, A, B + 1) {
        if (i % K == 0) {
            ok = true;
        }
    }
    yesno(ok, "OK", "NG");
}


Measured memory_bytes: 3616
def solve():
    K, N = map(int, input().split())
    A = list(map(int, input().split()))

    max_diff = 0
    max_idx = -1
    for i in range(N-1):
        max_diff = max(max_diff, A[i+1]-A[i])
        if max_diff == A[i+1]-A[i]:
            max_idx = i
    
    else:
        max_diff = max(max_diff, K-A[-1]+A[0])
        if max_diff == K-A[-1]+A[0]:
            max_idx = N-1
    
    print(K - max_diff)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 78540
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 1000; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j])%mod;
//       }
//     }
//   }
//   return 0;
// }


// int factorial(int n){
//   if(n == 0) return 1;
//   return n*factorial(n-1);
// }

// int divisor(int a){
//   int cnt = 0;
//   for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
//   return cnt;
// }

// int comb(int n, int k){
//   pascal_triangle();
//   return memo[n][k];
// }

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}







//二項係数(mod剰余)----------------------------

// const int MAX = 3000010;
// const int M = 1000000007;

// vector<ll> fac(MAX); //n!(mod M)
// //a,bの範囲的にこれだけ配列を用意していけば十分
// vector<ll> ifac(MAX); //k!^{M-2} (mod M)

// ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
//     ll ans = 1;
//     while(n != 0){
//         if(n&1) ans = ans*x % M;
//         x = x*x % M;
//         n = n >> 1;
//     }
//     return ans;
// }

// ll COMinit(){
//   //大した量ではないので，先にfax[i]とifax[i]を全て計算しておく
//   fac[0] = 1;
//   ifac[0] = 1;
//   for(ll i = 0; i<MAX; i++){
//     fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
//     ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
//   }
//   return 0;
// }

// ll COM(ll a, ll b){ //aCbをmod計算
//   if(a == 0 && b == 0)return 1;
//   if(a < b || a < 0)return 0;
//   ll tmp = ifac[a-b]* ifac[b] % M;
//   return tmp * fac[a] % M;
// }

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


int main(){
  int K,X;
  cin >> K >> X;
  bool f = false;
  if(500*K >= X) f = true;
  cans(f);
  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pll pair<ll,ll>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vll vector<ll>
#define vbl vector<bool>
#define vvll vector<vll>
#define vld vector<ld>
#define vb vector<bool>
#define vc vector<char>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()

template<class T> ostream& operator<<(ostream &os, vector<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T> ostream& operator<<(ostream &os, set<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, map<T , R> V){
	os << "[ ";
	for(auto v  : V) os << "(" << v.first << ":" << v.second << ")";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, pair<T , R> V){
	return os << "(" << V.first << "," << V.second << ")";
}

#define cerr cout
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
    clock_t clk=clock();
    #define checktime() cout<<"\nTime Elapsed : "<<float(clock()-clk)/CLOCKS_PER_SEC<<endl
#else
    #define trace(...);
    #define checktime();
#endif

const ll Mod = 1e9 + 7;
// const ll Mod = 998244353;
const ll MAXN = 1e6;

void solve(){
    ll n;cin>>n;
    vll a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    map<ll,ll> mps,mpd;
    for(ll i=0;i<n;i++){
        mps[i+1+a[i]]++;
        mpd[i+1-a[i]]++;
    }
    ll ans=0;
    for(auto pp:mps){
        ans+=pp.S*mpd[pp.F];
    }
    cout<<ans<<"\n";
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<fixed<<setprecision(25);

    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 39164
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9+5;
const int mod = 998244353;

vector<int> fac(300001); //n!(mod M)
vector<int> ifac(300001); //k!^{M-2} (mod M)

long long fpow(long long a,long long n){
  long long ret=1;
  if(n==1) return a;
  if(n%2==0) {
      ret = fpow(a*a%mod, n/2) %mod ;
  }else {
      ret = (a%mod)*fpow(a*a%mod, n/2) %mod;
  }
  return ret %mod;
}
int comb(int a, int b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    int tmp = ifac[a-b]* ifac[b] % mod;
    return tmp * fac[a] % mod;
}

int dp[102][100002];
signed main(){
    string s;
    cin >> s;

    if(s == "SUN") cout << 7 << endl;
    if(s == "MON") cout << 6 << endl;
    if(s == "TUE") cout << 5 << endl;
    if(s == "WED") cout << 4 << endl;
    if(s == "THU") cout << 3 << endl;
    if(s == "FRI") cout << 2 << endl;
    if(s == "SAT") cout << 1 << endl;

    return 0;
}



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

const int MX = 100005;

vector<P> g[MX];
int x[MX];
bool used[MX];

vector<int> ans;
int dfs(int v) {
  used[v] = true;
  int res = x[v];
  for (P e : g[v]) {
    if (used[e.first]) continue;
    int r = dfs(e.first);
    if (r) ans.push_back(e.second);
    res ^= r;
  }
  return res;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> a(n);
  rep(i,n) cin >> a[i].first >> a[i].second;
  sort(a.begin(), a.end());
  x[0] = a[0].second;
  rep(i,n-1) x[i+1] = a[i].second^a[i+1].second;
  x[n] = a[n-1].second;

  rep(i,m) {
    int l, r;
    cin >> l >> r;
    //cout << endl<<l<<r<<endl;
    l = lower_bound(a.begin(),a.end(),P(l,0))-a.begin();
    r = upper_bound(a.begin(),a.end(),P(r,1))-a.begin();
    g[l].emplace_back(r,i+1);
    g[r].emplace_back(l,i+1);
  }

  rep(i,n+1) {
    if (used[i]) continue;
    if (dfs(i)) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  rep(i,ans.size()) printf("%d ", ans[i]);
  cout << endl;
  return 0;
}


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

using namespace std;

#define ll long long

const int mod  = 1e9 + 7;
const ll INF = 1e14;

void solve(){

    for(int i = 0; i < 5; ++i){
        int x; cin >> x;
        if(x == 0){
            cout << i+1;
            return;
        }
    }

}

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

	return 0;
}



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

int main(){
  int N;
  cin >> N;
  int A[N];
  int64_t ans = 0;
  for(int i=0;i<N;i++){
    cin >> A[i];
    ans += A[i] - 1;
  }
  cout << ans << endl;
}

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

int main(){

    std::priority_queue<int> q;
    int a,n;

    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d", &a);
        q.push(a);
    }


    int hype = 0;
    bool color[8] = {};
    while( q.top() >= 3200 ){
        if(q.empty()) break;
        hype++;
        q.pop();
    }

    while( !q.empty()){
        color[ q.top() / 400 ] = true;
        q.pop();
    }

    int min = 0;
    int max = 0;

    for (int i = 0; i < 8; i++){
        if(color[i]) min++;
    }


    max = hype + min;
    if(min == 0) {
        min = 1;
        max = n;
    }
    printf ("%d %d\n", min, max);

    return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long c=0;
        for(int i=0;i<s.length();i++){
            c+=(s.charAt(i)-'0');
        }
        if(c%9 == 0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 40464
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

/* mint、表示は変数名.x */
struct mint {
  ll x;
  mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
  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 {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  /* 変数名.pow(n) */
  mint pow(ll t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // 以降はMODが素数のみ
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

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

  mint dp[N + 1][5][5][5]; /* 0-dummy, 1-A, 2-C, 3-G, 4-T */
  rep(n, N + 1) {
    rep(i, 5) {
      rep(j, 5) {
        rep(k, 5) { dp[n][i][j][k] = 0; }
      }
    }
  }
  dp[0][0][0][0] = 1;

  rep(n, N) {
    rep(i, 5) {
      rep(j, 5) {
        rep(k, 5) {
          repp(l, 1, 4) {
            if (j == 1 && k == 2 && l == 3)
              continue;
            if (j == 1 && k == 3 && l == 2)
              continue;
            if (j == 3 && k == 1 && l == 2)
              continue;
            if (i == 1 && j == 3 && l == 2)
              continue;
            if (i == 1 && k == 3 && l == 2)
              continue;
            dp[n + 1][j][k][l] += dp[n][i][j][k];
          }
        }
      }
    }
  }

  mint ans = 0;

  repp(i, 1, 4) {
    repp(j, 1, 4) {
      repp(k, 1, 4) { ans += dp[N][i][j][k]; }
    }
  }
  cout << ans.x << endl;
}

Measured memory_bytes: 384
N,K = [int(x) for x in input().split()]
ans =0
for i in range(K+1,N+1):
  #print((N//i)*(i-K),N%i+1-K)
  ans += (N//i)*(i-K)
  if N%i!=0 and K!=0:
    ans +=max((N%i+1-K),0)
  elif N%i!=0 and K==0:
    ans +=(N%i)
print(ans)

Measured memory_bytes: 3188
#import <stdio.h>
#define MAXINDEX 2500
typedef long long INT;
INT getValue(INT *A, INT i){
    return A[i+MAXINDEX+1];
}
void setValue(INT *A, INT i, INT value){
    A[i+MAXINDEX+1] = value;
}
int main(){
    INT N,M;
    scanf("%lld %lld",&N,&M);
    INT A[2*MAXINDEX+2] = {0};
    INT B[2*MAXINDEX+2] = {0};
    setValue(A,0,1);
    INT *C = A;
    INT *D = B;
    for(INT i=0;i<N;i++){
        INT x;
        scanf("%lld",&x);
        for(INT j=-MAXINDEX;j<=MAXINDEX;j++){
            INT k = j - (x-M);
            setValue(D, j, getValue(C,j) + getValue(C,k));
        }
        INT *E = D;
        D = C;
        C = E;
    }
    printf("%lld",getValue(C,0)-1);
}


Measured memory_bytes: 7628
/*---------------------------------

 @Author:   Dicer
 @DateTime: 2019-05-15 19:53:54

---------------------------------*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
inline ll qpow(ll a,ll b,ll mod){ll res=1;while(b){if(b&1)res = (res*a)%mod;a=(a*a)%mod;b>>=1;}return res;}
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int MAXN = 2e5 + 7;

int main(int argc, char const *argv[])
{
	int n, m;
	cin >> n >> m;
	vector<pii> v;
	int a, b;
	for(int i = 1; i <= n; ++i){
		cin >> a >> b;
		v.push_back({a, b});
	}
	sort(v.begin(), v.end());
	ll cost = 0;
	for(int i = 0; i < n; ++i){
		if(m >= v[i].second){
			cost += 1ll*v[i].first*v[i].second;
			m -= v[i].second;
		} else {
			cost += 1ll*v[i].first*m;
			break;
		}
	}
	cout << cost << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9+1;
const ll LINF = 1e18+1;
const long double PI = acos(-1.0);

#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SORT(v) sort(ALL(v));
#define RSORT(v) sort(RALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;
 
#define HOGE COUT("HOGE")
 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}
 
template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
template<typename T> T gcd(T a,T b){if(b==0){return a;}else{return gcd(b, a%b);}}
template<typename T> T lcm(T a,T b){return a*b/gcd(a, b);}


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, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
int main() {
    ll n;
    cin >> n;
    pair<ll, ll> a = MP(1, n);
    for (ll i = 2; i*i <= n; i++) {
        if (n%i==0&&(abs(a.first-a.second)>abs(i-n/i))) {
            a.first = i;
            a.second = n/i;
        }
    }
    COUT(a.first+a.second-2);
}


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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> p(n), c(n);
  rep(i,n) cin >> p[i];
  rep(i,n) cin >> c[i];
  rep(i,n) --p[i];
    
  ll ans = INT_MIN;
  
  rep(i,n){   
    vector<int> loop; //loopする順列
    int x = i; 
    ll loop_sum = 0;
    
    while(1){
      loop.emplace_back(c[x]);
      loop_sum += c[x];
      x = p[x];
      if(x == i) break;  
    }
    
    int l = loop.size();
    ll rem_sum = 0;
    ll ans_sum = 0;
    rep(st,l){
      rem_sum += loop[st];
      if(st+1 > k) break;
      ll e = (k-(st+1)) / l;
      ans_sum = rem_sum + max((ll)0, loop_sum) * e;
      ans = max(ans,ans_sum);   
    }
    
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3704
#include<stdio.h>
int main(void){
  int a, b;
  int ans;
  
  scanf("%d %d", &a, &b);
  
  ans = a + b;
  if(ans < a - b){
    ans = a - b;
  }
  if(ans < a * b){
    ans = a * b;
  }
  
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128
//Yash Kodesia, IIITM.
		#include<bits/stdc++.h>
		using namespace std;
		#define   debug3(x,y,z)   cout<<x<<" "<<y<<" "<z<<"\n";
		#define   present(c,x)    ((c).find(x) != (c).end())
		#define   debug2(x,y)     cout<<x<<" "<<y<<"\n";
		#define   rep2(i,k,n)     for(int i=k;i<=n;i++)
		#define   repd(i,k,n)     for(int i=n;i>=k;i--)
		#define   rep1(i,k,n)     for(int i=k;i<n;i++)
		#define   linp2(x,y)      ll x,y; cin>>x>>y;
		#define   linp1(n)        ll  n; cin>>n;
		#define   debug(x)        cout<<x<<"\n";

		#define   all(x)          x.begin(),x.end()
		#define   vpll            vector<pll >
		#define   sz(a)           a.size()
		#define   vll             vector<ll>
		#define   MOD             1000000007
		#define   pll             pair<ll,ll>
		#define   ppb             pop_back
		#define   INF             1e18+7

		#define   ff              first
		#define   ss              second
		#define   pf              pop_front
		#define   pb              push_back
		#define   ld              long double
		#define   eb              emplace_back
		#define   vb              vector<bool>
		#define   ll              long long int
		#define   vs              vector<string > 

		const ll MAX2 = 105;
		const ll MAX3 = 1005;
		const ll MAX4 = 10005;
		const ll MAX5 = 100005;
		const ll MAX6 = 1000005;
		const ll MAX7 = 10000005;


		// Start
		bool cmp(pair<pll , pll> A , pair<pll , pll> B){
			if(A.ss.ff == B.ss.ff){
				return A.ff.ss<B.ff.ss;
			}
			else 
				return A.ss.ff<B.ss.ff;
		} 
		void solve(){
			ll n,m;
			cin>>n>>m;
			vector<pair<pll,pll> > cities(m);
			rep1(i,0,m){
				linp2(pi,yi);
				cities[i]={{i,yi},{pi,0}};
			}
			sort(all(cities),cmp);
			ll place=1,last=-1;
		//	for(auto i:cities){
		//		cout<<i.ff.ff<<" "<<i.ff.ss<<" "<<i.ss.ff<<" "<<i.ss.ss<<" \n";
		//	}
			rep1(i,0,m){
				if(cities[i].ss.ff!=last){
					//cout<<"Diff at "<<cities[i].ss.ff<<"\n";
					place=1;
					last=cities[i].ss.ff;
					cities[i].ss.ss=place;
				}
				else{
					++place;
					cities[i].ss.ss=place;
				}
			}
			sort(all(cities));
			//for(auto i:cities){
			///	cout<<i.ff.ff<<" "<<i.ff.ss<<" "<<i.ss.ff<<" "<<i.ss.ss<<" \n";
			//}
			rep1(i,0,m){
				ll num1=cities[i].ss.ff;
				ll num2=cities[i].ss.ss;
				//cout<<num1<<" "<<num2<<" \n";
				ll nod1=floor((log10(num1)+1));
				ll nod2=floor((log10(num2)+1));
				//cout<<nod1<<"__ "<<nod2<<"\n";
				//cout<<setfill('0')<<setw(7-nod1);
				rep1(i,0,6-nod1)
					cout<<0;
				cout<<num1;	
				rep1(i,0,6-nod2)	
					cout<<0;
				cout<<num2;
				cout<<"\n";	
			}

		}
		int main(){
		  int t;
		  t=1;
		  //freopen ("input.txt","r",stdin);
		  //freopen ("output.txt","w",stdout);
		  cin.sync_with_stdio(0), cin.tie(0);
		  //cin>>t;
		  while(t--){
		          solve();
		          cout<<"\n";
		     }
		return 0;
		}
		 

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define mp make_pair
#define fi first
#define se second
using namespace std;
int i[111111];
vector<int> ii;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=1,e=0,f=0,g=0,h,j;
  char s[10];
  cin >>s[0]>>s[1]>>s[2]>>s[3]>>s[4]>>s[5];
  if(s[0]==s[5]&&s[1]==s[4]&&s[2]==s[3]) cout <<"YES\n";
  else cout <<"NO\n";
  return (0);
}


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

int main() {
    int i = 0;
    while (true) {
        int x;
        cin >> x;
        if (x) {
            cout << "Case " << ++i << ": " << x << '\n';
        } else {
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3004
program id
  implicit none
  integer               :: n, m
  integer, allocatable  :: info(:,:), idx(:)
  integer               :: i, p
  read(*,*) n, m
  allocate(info(m,4),idx(n))
  idx = 0
  do i = 1, m
     read(*,*) info(i,1), info(i,2)
     info(i,3) = i
     info(i,4) = 0
  end do
  call merge_sort(m,info,2)
  do i = 1, m
     p = info(i,1)
     idx(p) = idx(p)+1
     info(i,4) = idx(p)
  end do
  call merge_sort(m,info,3)
  do i = 1, m
     write(*,'(i6.6,i6.6)') info(i,1), info(i,4)
  end do
  stop
contains
  subroutine merge_sort(n,c,idx)
    implicit none
    integer, intent(in)    :: n, idx
    integer, intent(inout) :: c(n,4)
    integer                :: number, length, i, ubound
    number = n
    length = 1
    do while (number .gt. 1)
       do i = 1, number/2
          ubound = min(2*i*length,n)
          call merge(c(2*(i-1)*length+1:(2*i-1)*length,:),c((2*i-1)*length+1:ubound,:),idx)
       end do
       length = 2*length
       number = (number+1)/2
    end do
    return
  end subroutine merge_sort
  subroutine merge(c1,c2,idx)
    implicit none
    integer, intent(inout) :: c1(:,:), c2(:,:)
    integer, intent(in)    :: idx
    integer                :: c(size(c1(:,1))+size(c2(:,1)),size(c1(1,:)))
    integer                :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(c1(:,1))
    n2 = size(c2(:,1))
    do while (i1 .le. n1 .and. i2 .le. n2)
       if (c1(i1,idx) .lt. c2(i2,idx)) then
          c(i1+i2-1,:) = c1(i1,:)
          i1 = i1+1
       else
          c(i1+i2-1,:) = c2(i2,:)
          i2 = i2+1
       end if
    end do
    if (i1 .le. n1) then
       c(i1+i2-1:n1+n2,:) = c1(i1:n1,:)
    else if (i2 .le. n2) then
       c(i1+i2-1:n1+n2,:) = c2(i2:n2,:)
    end if
    c1 = c(1:n1,:)
    c2 = c(n1+1:n1+n2,:)
    return
  end subroutine merge
end program id

Measured memory_bytes: 4956
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(0<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(0<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(1<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(1<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(2<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(2<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(3<<3))+0x80]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(3<<3))+0x80]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	free(b);
}

int a[10000001];
long b[10000001];
int main(void){
	int n=nextint();
	for(int i=2; i<=n; i++){
		if(a[i]==0){
			for(int j=i*2; j<=n; j+=i){
				a[j]=i;
			}
		}
	}
	long ans=1;
	b[1]=1;
	for(int i=2; i<=n; i++){
		if(a[i]==0){
			b[i]=2;
		}else{
			int k=1;
			int x=i;
			while(x%a[i]==0){ x/=a[i]; k++; }
			b[i]=(long)k*b[x];
		}
		ans+=i*b[i];
		//printf("%d %d\n", i, b[i]);
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 118772
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int N, A[100], i, k, MAX = 0, S;

	scanf("%d", &N);
	for (i = 0; i < N-1; i++) {
		scanf("%d ", &A[i]);
	}
	scanf("%d", &A[i]);

	for (i = 0; i < N-1; i++) {
		for (k = i + 1; k < N; k++) {
			S = A[i] - A[k];
			if (MAX < abs(S)) {
				MAX = abs(S);
			}
		}
	}
	printf("%d\n", MAX);

	return 0;
}
  

Measured memory_bytes: 128
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }

double ans = 0;
int cnt = 0;
double dist(double x1, double x2, double y1 , double y2) {
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
void solve(vint& x, vint& y, unordered_set<int> nodes, int node, vint& path) {
    if (nodes.size() <= 0) {
        cnt++;
        double d = 0;
        rep(i, path.size() - 1) {
            d += dist(x[path[i]], x[path[i + 1]], y[path[i]], y[path[i + 1]]);
        }
        ans += d;
        return;
    }

    for (auto &adj : nodes) {
        //ans += dist(x[node], x[adj], y[node], y[adj]);
        
        unordered_set<int> new_nodes(nodes.begin(), nodes.end());
        new_nodes.erase(adj);
        vint new_path = path;
        new_path.push_back(adj);
        solve(x, y, new_nodes, adj, new_path);
        
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vint x(N), y(N);
    rep(i, N) cin >> x[i] >> y[i];


    double N_f = 1;
    REP(x, 1, N + 1) {
       
        N_f *= x;
    }
    unordered_set<int> nodes;
    rep(i, N) {
        nodes.insert(i);
    }

    rep(i, N) {
        unordered_set<int> new_nodes(nodes.begin(), nodes.end());
        new_nodes.erase(i);
        vint path;
        path.push_back(i);
        solve(x, y, new_nodes, i, path);
    }

    printf("%20.10f\n", ans/cnt);
   
    return 0;
}

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

int main(int argc, char const *argv[])
{
	string s;
	cin >> s;
	if (s == "AKIHABARA" || s == "KIHBR" || s == "AKIHBR" || s == "KIHABR" || s == "KIHBAR" || s == "KIHBRA" || s == "AKIHABR" || s == "AKIHBAR" || s == "AKIHBRA" || s == "KIHABAR" || s == "KIHABRA" || s == "KIHBARA" || s == "KIHABARA" || s == "AKIHBARA" || s == "AKIHABRA" || s == "AKIHABAR") {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

bool visited[225816];

std::vector<int> g[225816];

int dfs(int u){
	int ret=1,i,v;
	visited[u] = true;
	for(i=(g[u].l_ength()-1); i>=0; --i){
		v = g[u][i];
		if(visited[v]){
			continue;
		}
		ret += dfs(v);
	}
	return ret;
}

int main(void){
	int n,m,a,b,ans=0,i;
	std::cin >> n >> m;
	for(i=0; i<m; ++i){
		std::cin >> a >> b;
		--a; --b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	for(i=0; i<n; ++i){
		if(visited[i]){
			continue;
		}
		ans = std::max(ans,dfs(i));
	}
	std::cout << ans << std::endl;
	return 0;
}


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

int main() {
  int n,m;
  cin >> n >> m;
  int mx=max(n,m);
  int mn=min(n,m);
  for(int i=0;i<mx;i++) {
    cout << mn;
  }
  cout << endl;
}

Measured memory_bytes: 256
from itertools import product


def read():
    N, W = list(map(int, input().split()))
    pairs = list()
    for i in range(N):
        w, v = list(map(int, input().split()))
        pairs.append((w, v))
    return N, W, pairs

def solve(N, W, pairs, INF=(10**11)+1):
    V = sum([v for w, v in pairs])
    dp = [[INF for j in range(V+1)] for i in range(N+1)]
    dp[0][V] = sum([w for w, v in pairs])
    for i, j in product(range(0, N), range(V, -1, -1)):
        w, v = pairs[i]
        dp[i+1][j] = dp[i][j]
        if 0 <= j + v <= V:
            dp[i+1][j] = min(dp[i][j], dp[i][j+v] - w)
    vmax = 0
    for j, i in product(range(V, -1, -1), range(0, N+1)):
        if dp[i][j] <= W:
            vmax = j
            break
    return vmax


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


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

using namespace std;

using ll = int64_t;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

//===


template <typename _Ty>
struct Edge
{
	int src, to;
	_Ty cost;

	constexpr Edge(int _to, _Ty _cost) noexcept : src(-1), to(_to), cost(_cost) {}
	constexpr Edge(int _src, int _to, _Ty _cost) noexcept : src(_src), to(_to), cost(_cost) {}
};
template <typename _Ty>
using WeightedGraph = std::vector<std::vector<Edge<_Ty>>>;


using Tup = tuple<ll, ll, int>;


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

	int N, M, L;
	cin >> N >> M >> L;

	WeightedGraph<ll> g(N);
	for (int i = 0; i < M; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		--a; --b;
		if (c <= L) {
			g[a].emplace_back(b, c);
			g[b].emplace_back(a, c);
		}
	}

	vector<Vl> dist(N, Vl(N, L_INF)), fuel(N, Vl(N, L_INF));
	for (int i = 0; i < N; ++i) {
		priority_queue<Tup, vector<Tup>, greater<Tup>> q;
		dist[i][i] = 0;
		fuel[i][i] = 0;
		q.emplace(dist[i][i], fuel[i][i], i);
		while (!q.empty()) {
			ll cost, fu;
			int idx;
			tie(cost, fu, idx) = q.top();
			q.pop();
			if (dist[i][idx] < cost) continue;
			else if (dist[i][idx] == cost && fuel[i][idx] < fu) continue;
			for (const auto& edge : g[idx]) {
				ll next_cost = cost;
				ll next_fuel = fu + edge.cost;
				if (next_fuel > L) {
					++next_cost;
					next_fuel = edge.cost;
				}
				if (next_cost > dist[i][edge.to]) continue;
				else if (next_cost == dist[i][edge.to] && next_fuel >= fuel[i][edge.to]) {
					continue;
				}
				dist[i][edge.to] = next_cost;
				fuel[i][edge.to] = next_fuel;
				q.emplace(next_cost, next_fuel, edge.to);
			}
		}
	}


	int Q;
	cin >> Q;
	Vi s(Q), t(Q);
	for (int i = 0; i < Q; ++i) {
		int si, ti;
		cin >> si >> ti;
		--si; --ti;
		s[i] = si;
		t[i] = ti;
	}

	for (int i = 0; i < Q; ++i) {
		ll ans = dist[s[i]][t[i]];
		if (ans == L_INF) {
			cout << -1 << "\n";
		}
		else {
			cout << ans << "\n";
		}
	}


	return 0;
}

Measured memory_bytes: 5636
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		long n = sc.nextLong();
      	ArrayList<Character> name = new ArrayList<>();

      	for(;n>0;){
         n -= 1;
         name.add((char)(n%26+97));
         n /= 26;
        }
      	String dog = "";
      	for(int i=name.size()-1;i>=0;i--){
          dog += String.valueOf(name.get(i));
        }
		// 出力
		System.out.println(dog);
	}
}

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define eps 1e-9

const int MOD = 1e9+7;

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

ll POWER[65];
ll power(ll a, ll b) {ll ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
ll inv(ll x) {return power(x,MOD-2);}

void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}
int ar[100005];
int main() {
//	freopen("TASK.in","r",stdin);freopen("TASK.out","w",stdout);
	precompute();
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) scanf("%d",&ar[i]);
	ll ans=0;
	bool is=false;
	for(int i=1;i<=n;i++) {
		if(ar[i]==0) {
			is=false;
			continue;
		}
		if(ar[i]%2==0) ans+=1LL*ar[i]/2LL;
		else {
			if(is) {
				ar[i]++;
				ans+=1LL*ar[i]/2LL;
				is=false;
			}
			else {
				ans+=1LL*ar[i]/2LL;
				is=true;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
    int N;
    string S,T;
    cin >> N >> S >>T;
    for (int i = 0; i < N; i++) {
        cout << S[i] << T[i]; 
        if (i == N -1) {
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
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()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
  int a,b,c,d;
    cin >> a>>b>>c>>d;
    cout << min(a,b)+min(c,d) << "\n";
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
K,S=map(int,input().split())
z = list(range(K+1))
ans = []
for i in z:
  s_z = S - i
  if s_z < 0:
    pass
  elif K < s_z:
    if (K + 1) > (s_z - K):
      ans.append(2*K - s_z + 1)
  else:
    ans.append(s_z + 1)
print(sum(ans))

Measured memory_bytes: 3188