akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<"\n"

int main(){
    string s;
    cin >> s;
    if(s=="ABC")COUT("ARC");
    else COUT("ABC");
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

const int MAX_N = 21;
ll dp[MAX_N+1][(1<<MAX_N)];
int a[MAX_N][MAX_N];

int main(){
    int n;
    cin >> n;
    rep(i, n) rep(j, n) cin >> a[i][j];
    dp[0][0] = 1LL;
    rep(i, n) {
        rep(mask, 1<<n) if(dp[i][mask]){
            rep(j, n) {
                if(mask&(1<<j) || a[i][j] == 0) continue;
                (dp[i+1][mask|(1<<j)] += dp[i][mask]) %= MOD;
            }
        }
    }
    cout << dp[n][(1<<n)-1] << endl;
    return 0;
}

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

const int N = 2e5+15;

int ret[N];
void solve() {
    int n,q;
    scanf("%d%d",&n,&q);
    vector<pair<int,pair<int,int> > > in;
    for(int i=0;i<n;++i) {
        int s,t,x;
        scanf("%d%d%d",&s,&t,&x);
        in.push_back(make_pair(s-x,make_pair(0,x)));
        in.push_back(make_pair(t-x,make_pair(1,x)));
    }
    for(int i=1;i<=q;++i) {
        int d;
        scanf("%d",&d);
        in.push_back(make_pair(d,make_pair(i+1,0)));
    }
    sort(in.begin(),in.end());
    multiset<int> s;
    for(int i=0;i<in.size();++i) {
        int curTime = in[i].first;
        int type = in[i].second.first;
        int dist = in[i].second.second;
        if(type==0) {
            s.insert(dist);
        } else if(type==1) {
            multiset<int>::iterator it = s.find(dist);
            s.erase(it);
        } else {
            int id = type-1;
            if(s.size()==0) {
                ret[id] = -1;
            } else {
                ret[id] = *(s.begin());
            }
        }
    }
    for(int i=1;i<=q;++i) {
        printf("%d\n", ret[i]);
    }
}
int main() {
   //freopen("input.txt","r",stdin);
   solve();
}


Measured memory_bytes: 18920
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        long sum = 0;
        for(int i=0; i<n; i++){
            a[i] = sc.nextLong();
            sum += a[i];
        }
        sc.close();

        long ans = Long.MAX_VALUE;

        long x = 0;
        for(int i=0; i<n-1; i++){
            x += a[i];
            long dif = Math.abs((sum-x) - x);
            if(dif < ans) ans = dif;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 85392
#include <iostream>
#include <string>
using namespace std;
int main(){
    int i,j,n; string s;
    cin >> n >> s;
    long long r = 0,g = 0,b = 0,ans,cnt = 0;
    for(i=0;i<n;i++){
        if(s[i]=='R') r++;
        if(s[i]=='G') g++;
        if(s[i]=='B') b++;
    }
    ans = r*g*b;
    for(i=0;i<n;i++){
        for(j=i + 1;j<n;j++){
            if(2*j - i<n && s[i]!=s[j] && s[i]!=s[2*j - i] && s[j]!=s[2*j - i]) cnt++;
        }
    }
    cout << ans - cnt << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rgi register int
#define ll long long
class fastin{
	private: int _ch,_f;
	public: template<typename _Tp> inline fastin& operator>>(_Tp&_x){
		_x=0; while(!isdigit(_ch)) _f|=(_ch==45),_ch=getchar();
		while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
		_f&&(_x=-_x,_f=0); return *this;}
	fastin() {_ch=_f=0;}
}fin;
class fastout{
	private: int _num[32],_head;
	public: int SUF; template<typename _Tp> inline fastout& operator<<(_Tp _x){
		_Tp _k; if(_x==0) {putchar(48),putchar(SUF);return *this;} if(_x<0) putchar(45),_x=-_x;
		while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
		while(_head>0) putchar(_num[_head]),--_head; putchar(SUF); return *this;}
	fastout() {_head=0,SUF=' ';}
}fout;
// ----------------------------
// #define int ll
// using namespace std;
const int maxn=2222;
const int mod=998244353,inf=1000000007;

bool fill[maxn][maxn];

void solve(int ax,int ay,int bx,int by)
{
	int xmid=(ax+bx)>>1,ymid=(ay+by)>>1;
	fill[xmid][ymid]=1;
	if(ax==bx&&ay==by) return;
	solve(ax,ay,xmid-1,ymid-1);
	solve(xmid+1,ay,bx,ymid-1);
	solve(ax,ymid+1,xmid-1,by);
	solve(xmid+1,ymid+1,bx,by);
}

signed main()
{
	int n,m,t;
	fin>>n>>m;
	t=std::max(n,m);
	solve(1,1,(1LL<<t)-1,(1LL<<t)-1);
	for(rgi i=1;i<1LL<<n;++i)
	{
		for(rgi j=1;j<1LL<<m;++j) printf("%d",fill[i][j]);
		printf("\n");
	}
	return 0;
}
// ----------------------------
// by imzzy


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

using namespace std;
#define ll long long
ll search(ll pos, ll nd, ll k, ll num){
    if(pos==nd){
        if(k==1){
            cout<<num<<endl;
            exit(0);
        }
        else{
            return 1;
        }
    }
    ll start, end;
    if(pos == 0){
        start = 1;
        end = 9;
    }
    else{
        start = max(0LL, num % 10 - 1);
        end = min(9LL, num % 10 + 1);
    }
    ll ret = 0;
    for(ll x = start; x <= end; ++x){
        ret += search(pos + 1, nd, k - ret, 10 * num + x);
        if(ret >= k){ 
            return ret;
        }
    }
    return ret;
}
 
void solve(long long K){
    ll count = 0;
    for(ll nd=1;nd<=10;++nd){
        count += search(0, nd, K - count, 0);
    }
}
int main(){
    long long k;
    cin>>k;
    solve(k);
    return 0;
}

Measured memory_bytes: 256
n = int(input())
AB = list(list(map(int,input().split())) for _ in range(n))
CD = list(list(map(int,input().split())) for _ in range(n))

CD.sort() # sort x in ascending order
AB.sort(key=lambda z: z[1], reverse=True) # sort x in descending order

vis_r = [False]*(n)
for b in range(n): # ascending order of x
    for r in range(n): # descending order of y
        if not vis_r[r] and AB[r][0] < CD[b][0] and AB[r][1] < CD[b][1]:
            vis_r[r] = True; break

print(sum(vis_r))


Measured memory_bytes: 3064
#!/usr/bin/ruby
while (h,w,l=gets.split.map(&:to_i))!=[0,0,0]
d=[[0,-1],[1,0],[0,1],[-1,0]]
d0="NESW".split('')
z=0
x=y=0
f=(h+2).times.map{[1]*(w+2)}
g=(h+2).times.map{(w+2).times.map{[nil]*4}}
h.times{|i|
	s=gets.chomp
	w.times{|j|
		if (k=d0.index(s[j..j]))
			x=j+1;y=i+1;z=k
		end
		if s[j..j]!='#'
			f[i+1][j+1]=nil
		end
	}
}
c=0
while l>0
	if g[y][x][z]
		l%=(c-g[y][x][z])
		break if l==0
	end
	g[y][x][z]=c
	while true
		if !f[y+d[z][1]][x+d[z][0]]
			x+=d[z][0];y+=d[z][1]
			break
		end
		z=(z+1)%4
	end
	l-=1
	c+=1
end
puts "#{y} #{x} #{d0[z]}"
end

Measured memory_bytes: 10456
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)

	s := next()
	if s == "ABC" {
		fmt.Println("ARC")
	} else {
		fmt.Println("ABC")
	}
}

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, err := strconv.Atoi(next())
	if err != nil {
		fmt.Println(err)
	}
	return i
}


Measured memory_bytes: 1760
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n  =sc.nextInt();
    if(n == 3 || n == 5 || n == 7){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	#define rf freopen("inputf.in", "r", stdin)
	#define wf freopen("outputf.in", "w", stdout)

	using namespace std;
	int main(void)
	{//rf;wf;
		std::ios::sync_with_stdio(false);
		int temp,H,a,b,sum=0;
		cin>>H;cin>>a;
		for (int i = 0; i < a; ++i)
		{cin>>temp;sum+=temp;}

	if(sum>H){cout<<"-1\n";}
	else{cout<<H-sum<<endl;}
	}

Measured memory_bytes: 3652
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a)), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  const ll MAXW = 10000;
  vector<ll> dp(MAXW+1, -1); dp[0] = 0;

  ll N, W; cin >> N >> W;
  rep(i, N) {
    ll vi, wi; cin >> vi >> wi;
    for (ll j = W; j >= wi; j--) {
      if (dp[j-wi] != -1) {
        dp[j] = max(dp[j], dp[j-wi] + vi);
      }
    }
  }
  ll ans = 0;
  rep(i, W+1) ans = max(ans, dp[i]);
  outl(ans);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}



Measured memory_bytes: 3312
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    boolean n = false;
    boolean w = false;
    boolean s = false;
    boolean e = false;
    for (int i = 0; i < S.length(); i++) {
      char c = S.charAt(i);
      if (c == 'N') {
        n = true;
      } else if (c == 'W') {
        w = true;
      } else if (c == 'S') {
        s = true;
      } else if (c == 'E') {
        e = true;
      }
    }
    System.out.println(((n&&s)||((!n)&&(!s)))&&(((w&&e)||((!w)&&(!e)))) ? "Yes" : "No");
  }
}

Measured memory_bytes: 22996
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
typedef long long lint;
using namespace std;

const int MAXN = 1123;
lint X[MAXN][3];

int main() {
    int N, M;
    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> X[i][j];
        }
    }
    lint ans = 0;
    for (int s = 0; s < (1<<3); ++s) {
        vector<lint> A(N);
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 3; j++) {
                if ((s>>j)&1) {
                    A[i] += X[i][j];
                } else {
                    A[i] -= X[i][j];
                }
            }
        }
        sort(A.rbegin(), A.rend());
        lint sum = 0;
        for (int i = 0; i < M; i++) {
            sum += A[i];
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

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

namespace multiset
{

class multiset
{
  private:
    std::vector<int> tree;
    int MSB;

    void add(int i, int x)
    {
        for (; i < tree.size(); i += i & -i) {
            tree[i] += x;
        }
    }

    int sum(int i)
    {
        int res = 0;
        for (; i > 0; i -= i & -i) {
            res += tree[i];
        }
        return res;
    }

    int bisect(int w)
    {
        int i = 0;
        for (int k = MSB; k > 0; k /= 2) {
            if (i + k < tree.size() && tree[i + k] < w) {
                w -= tree[i + k];
                i += k;
            }
        }
        return i + 1;
    }

    uint32_t get_MSB(uint32_t x) { return 0x80000000 >> __builtin_clz(x); }

  public:
    multiset(int N) : tree(N + 1), MSB(get_MSB(N)) {}
    void insert(int x) { add(x, 1); }
    void erase(int x) { add(x, -1); }
    int lower_bound(int x)
    {
        int s = sum(x);
        return (s == 0) ? 0 : bisect(s);
    }

    size_t size() { return sum(tree.size() - 1); }
};

} // namespace multiset

struct FastIO {
    FastIO()
    {
        std::ios_base::sync_with_stdio(false);
        std::cin.tie(nullptr);
    }
} fastio;

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

    std::vector<int> A(N);
    for (auto &&a : A) {
        std::cin >> a;
    }

    std::vector<int> B = A;
    std::sort(begin(B), end(B));
    B.erase(std::unique(begin(B), end(B)), end(B));

    std::transform(begin(A), end(A), begin(A), [&](int val) -> int {
        return std::lower_bound(begin(B), end(B), val) - begin(B) + 1;
    });

    multiset::multiset ms(B.size());
    for (auto a : A) {
        auto i = ms.lower_bound(a - 1);
        if (i != 0) {
            ms.erase(i);
        }
        ms.insert(a);
    }

    std::cout << ms.size() << '\n';
}

Measured memory_bytes: 1408
from collections import defaultdict
n, t = map(int, input().split())
a = list(map(int, input().split()))

ans = defaultdict(int)
min_v = [10**9+1, 1]

for v in a:
    ans[v - min_v[0]] += min_v[1]
    if v < min_v[0]:
        min_v = [v, 1]
    elif v == min_v[0]:
        min_v[1] += 1
ans= sorted(ans.items(), key=lambda x:x[0], reverse=True)
print(ans[0][1])


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

// clang-format off
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>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

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

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int k, x;
    cin >> k >> x;
    int bi = max(x - k + 1, -1000000LL), ed = min(x + k - 1, 1000000LL);
    For(i, bi, ed - 1) cout << i << " ";
    cout << ed << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define ll long long

using namespace std;

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

    int n;
    cin >> n;

    int res = 0;

    if ((n % 100) % 10 == 9)
    {
        res += 1;
        if (n%100 == 99) {
            res += 10;
            if (n >= 900)
                res += 100;
            else
                res += 900;
        }
        else {
            res += 90;
            if (n >= 900)
                res += 100;
            else
                res += 900;
        }
    }
    else
    {
        res += 9;
        if (n%100 == 91) {
            res += 10;
            if (n >= 900)
                res += 100;
            else
                res += 900;
        }
        else
        {
            res += 90;
            if (n >= 900)
                res += 100;
            else
                res += 900;
        }
    }


    cout << res;
}

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

int main(void)
{
	int s_length, i,j, q_length,C = 0;
	scanf("%d", &s_length);
	int *s, *q;
	s = (int *)malloc(sizeof(int) * s_length);
	for(i = 0;i < s_length;i++){
		scanf("%d", &s[i]);
	}
	
	scanf("%d", &q_length);
	
	q = (int *)malloc(sizeof(int) * q_length);
	for(i = 0;i < q_length;i++){
		scanf("%d", &q[i]);
	}
	for(i=0;i<q_length;i++){
		for(j=0;j<s_length;j++){
			if(s[j]==q[i]){
				C++;
				break;
			}
		}
	}
	printf("%d\n",C);
	return(0);
}

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

int main(){
    using namespace std;
    unsigned long N, M;
    cin >> N >> M;
    vector<vector<unsigned long>> edge(N);
    for(unsigned long i{0}, a, b; i < M; ++i){
        cin >> a >> b;
        edge[--a].push_back(--b);
        edge[b].push_back(a);
    }
    vector<unsigned long> ans(N);
    ans[0] = 10000000000;
    queue<unsigned long> q;
    q.emplace(0);
    while(!q.empty()){
        auto t = q.front();
        q.pop();
        for(const auto& i : edge[t])if(!ans[i]){
            ans[i] = t + 1;
            q.emplace(i);
        }
    }
    puts("Yes");
    copy(ans.begin() + 1, ans.end(), ostream_iterator<unsigned long>(cout, "\n"));
    return 0;
}

Measured memory_bytes: 12976
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

#define ll long long

int main(){

    int N,sum=0;
    vector<int> L;
    cin>>N;
    for(int i=0;i<N*2;i++){
        int l;
        cin>>l;
        L.push_back(l);
    }
    sort(L.begin(),L.end());
    for(int i=0;i<N*2;i+=2){
        sum+=L[i];
    }
    cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;
const int INF = 1<<30;

ll dp[100200];

int main(){
    int N,K; cin >> N >> K;
    vector<int> h(N);
    rep(i,N)cin >> h[i];
    rep(i,N+1)dp[i]=INF;
    dp[0]=0;
    rep(i,N){
        for(int j=1;j<=K;j++){
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
        }
    }
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int n;
        cin >> n;
        vector<int> a(n);
        rep(i, 0, n) cin >> a[i];

        int ans = 0;
        for (int i = 1; i + 1 < n; ++i) {
            if ((a[i - 1] - a[i]) * (a[i + 1] - a[i]) < 0) {
                ans++;
            }
        }
        cout << ans << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<int,int> a,pair<int,int> b)
{
  return a.second<b.second;
}
void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void input()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}
int main()
{
  
  int n;
  cin>>n;
  vector<pair<int,int>> jobs;
  for(int i=0;i<n;i++)
  {
    int a,b;
    cin>>a>>b;
    jobs.push_back(make_pair(a,b));
  }
  sort(jobs.begin(),jobs.end(),cmp);
  int cur=0;
  for(int i=0;i<n;i++)
  {
    if(cur+jobs[i].first>jobs[i].second)
    {
      cout<<"No";
      return 0;
    }
    
    cur+=jobs[i].first;
  }
  cout<<"Yes";
  return 0;
}


Measured memory_bytes: 2420
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string.h>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;
typedef unsigned long long ull;
typedef  long long ll;
#define INF  0x7f7f7f7f//7f7f7f7f
#define M 2000010
#define N 100010
const ll mod = 1e9 + 7;
ll a[M],dp[M],sum[M],n;
int main(void){
	scanf("%lld",&n);
	for(ll i = 1;i <= n;i++){
		scanf("%lld",&a[i]);
		if(i%2)
		sum[i] =sum[i-1]+a[i];
		else
		sum[i] =sum[i-1];
	}
	for(ll i = 2;i <= n;i++){
		if(i%2)
		dp[i] =max(dp[i-2]+a[i],dp[i-1]);
		else
		dp[i] =max(dp[i-2]+a[i],sum[i-1]);
	}
	printf("%lld\n",dp[n]);
	return 0;
}

Measured memory_bytes: 7928
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> vec(n),ans(n,1);
    int t = count(ALL(s),'1');
    if(t==0){
        For(i,0,n){
            cout << ans[i] << endl;
        }
        return;
    }
    else if(t==1){
        if(s[n-1] == '1'){
            For(i,0,n-1){
                cout << 2 << endl;
            }
            cout << 0 << endl;
        }
        else{
            For(i,0,n-1){
                cout << 1 - (s[i] == '1') << endl;
            }
            cout << 2 << endl;
        }
        return;
    }
    int tp=0,tm=0;
    For(i,0,n){
        tp = tp * 2 + (s[i] == '1');
        tm = tm * 2 + (s[i] == '1');
        tp %= (t+1);
        tm %= (t-1);
    }
    reverse(ALL(s));
    int pp=1,pm=1;
    For(i,0,n){
        if(s[i] == '1'){
            vec[i] = ((tm - pm)%(t-1) + (t-1)) % (t-1);
        }
        else{
            vec[i] = ((tp + pp)%(t+1) + (t+1)) % (t+1);
        }
        pp *= 2;
        pm *= 2;
        pp %= (t+1);
        pm %= (t-1);
    }
    reverse(ALL(vec));
    For(i,0,n){
        while(vec[i]){
            vec[i] %= __builtin_popcount(vec[i]);
            ans[i]++;
        }
        cout << ans[i] << endl;
    }
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 5236
import numpy as np

[n,m,x] = [int(x) for x in input().split()]
data = np.array([[int(x) for x in input().split()] for _ in range(n)])

ans = []

for i in range(2**(n)):
    temp = np.array([0]*(m+1))

    for j in range(n):
        if (i >> j) & 1:
            temp = temp + data[j]
    
    for k in temp[1:]:
        if k < x:
            break
    else:
        ans.append(temp[0])

if ans == []:
    print(-1)
else:
    print(min(ans))


Measured memory_bytes: 27264
#include<stdio.h>
int main(){
    int a, b;
    scanf("%d%d",&a,&b);
    if(a <= 0 && b >= 0){
        printf("Zero\n");
    }
    else if(a < 0 && (b-a+1)%2 == 1){
        printf("Negative\n");
    }
    else{
        printf("Positive\n");
    }
}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main()
{
	int N;
	cin >> N;
	vector<int> a(N, 0);
	rep(i, N) cin >> a[i];

	int search = 1;
	int cnt = 0;
	for (int i = 0; i < N; ++i)
	{
		if (a[i] == search) {
			search += 1;
			cnt++;
		}
	}

	if (cnt != 0) {
		cout << N - cnt << endl;
	}
	else {
		cout << "-1" << endl;
	}

	return 0;
}


Measured memory_bytes: 4044
#include <algorithm>
#include <numeric>
#include <cstring>
#include <numeric>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;


char f[505][505];
int c[505][505] = {};
int c2[505][505][3] = {};

lli h, w;

int main()
{
    cin >> h >> w;
    int cnt = 0;
    memset(c, -1, sizeof(c));
    rep(i, h) rep(j, w) cin >> f[i][j];
    rep(i, h) rep(j, w)
    {
        if (i % 2 == 0) {
            c[i][j] = 1;
        } else {
            c[i][j] = 2;
        }
    }
    rep(i, h) rep(j, 2)
    {
        if (j == 0) {
            c[i][0] = 1;
        }
        if (j == 1) {
            c[i][w - 1] = 2;
        }
    }
    for (int col = 1; col < 3; col++) {
        rep(i, h) rep(j, w)
        {
            char hoge = (c[i][j] == col or f[i][j] == '#' ? '#' : '.');
            cout << hoge;
            if (j == w - 1)
                cout << endl;
        }
        puts("");
    }
}


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

int main(){
    int r;
    cin >> r;
    r*=2;

    double ans = r*3.14159265358979;

    printf("%.9f\n", ans);

    return 0;
}


Measured memory_bytes: 3764
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ');
  const x = s[0];
  const y = s[1];
  let ans = '';

  if (x > y) ans = '>';
  if (x < y) ans = '<';
  if (x === y) ans = '=';

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<iostream>
#include<math.h>
using namespace std;
//long long extGCD(long long a, long long b, long long& x, long long& y);

int main() {
	string s;
	cin >> s;
	int i,counter = 0;
	for (i = 0; i < s.size(); i++) {
		if (i % 2 == 0) {
			if (s[i] == 'p')counter--;
		}
		else {
			if (s[i] == 'g')counter++;
		}
	}
	cout << counter << endl;
	return 0;

	/*int n;
	cin >> n;
	int i;
	long long T[1000], A[1000];
	for (i = 0; i < n; i++) {
		cin >> T[i] >> A[i];
	}
	long long ta, ao;
	ta = T[0], ao = A[0];
	long long x, y, k;

	for (i = 1; i < n; i++) {
		k = ta * A[i] + ao * T[i];
		if (k > 0) {
			extGCD(T[i], -A[i], y, x);
		}
		else if (k == 0) {
			x = 0; y = 0;
		}
		else {
			extGCD(A[i], -T[i], x, y);
		}
		ao = ao + y *abs( k); ta = ta + x * abs(k);
	}
	//cout << gojo(60, 100) << endl;

	//cout << x << ' ' << y << endl;
	cout << ta + ao << endl;
	return 0;
	*/
}
/*
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}*/

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

#define int long long
#define INF 1000000000000000000

signed main() {
  int c[3], t[3];
  std::cin >> c[0] >> c[1] >> t[0] >> t[1] >> t[2];
  c[2] = INF;

  std::vector<std::pair<int, int> > seq;
  for(int i = 0; i < 3; i++) {
    for(int j = 0; j < t[i]; j++) {
      int x;
      std::cin >> x;
      seq.push_back({x, i});
    }
  }

  std::sort(seq.begin(), seq.end());
  std::reverse(seq.begin(), seq.end());

  std::vector<int> cur(3, 0);
  int ans = 0;
  int done = 0;
  for(std::pair<int, int> j : seq) {
    int u = j.first;
    int v = j.second;

    if(cur[v] < c[v]) {
      cur[v]++;
      done++;
      ans += u;
    }

    if(done == c[0] + c[1])
      break;
  }

  std::cout << ans << std::endl;

  return 0;
}



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

int main(){
    string a;
    int n,m;
    while(1){
        cin>>a;
        if(a=="-")break;
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>m;
            a=a.substr(m)+a.substr(0,m);
        }
        cout<<a<<endl;
    }
    return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
using Graph=vector<vector<int>>;

int main(){
  vector<int> l;
  for(int i=0;i<220;i++){
    int n;cin>>n;
    int sum=1150;
    if(n==-1) break;
    if(n>30){
      int t=n-30;
      sum+=t*160;
      n-=t;
    }
    if(n>20){
      int t=n-20;
      sum+=t*140;
      n-=t;
    }
    if(n>10){
      int t=n-10;
      sum+=t*125;
      n-=t;
    }
    int resu=4280-sum;
    l.pb(resu);
  }
  for(int i=0;i<l.size();i++){
    cout<<l[i]<<endl;
  }
}


Measured memory_bytes: 3148
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

K, N = get_ints
A = get_ints

A.sort!

X = []
A.each_cons(2) do |a,b|
  X.push((a-b).abs)
end
X.push(K - A.last + A.first)

puts K - X.max


Measured memory_bytes: 30556
#include <iostream>

using namespace std;

int main() {
	long long n, d; cin >> n >> d;
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		long long x, y; cin >> x >> y;
		if (x * x + y * y <= d * d) ++ans;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3588
//problem_b.go

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	//"strings"
)

const (
	mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

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

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getIntSlice(n int) []int {
	ns := []int{}
	for i := 0; i < n; i++ {
		ns = append(ns, getInt())
	}
	return ns
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func getStringSlice(n int) []string {
	ss := []string{}
	for i := 0; i < n; i++ {
		ss = append(ss, getString())
	}
	return ss
}

func sortIntSlice(ns []int) []int {
	sort.Sort(sort.IntSlice(ns))
	return ns
}

func rsortIntSlice(ns []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(ns)))
	return ns
}

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

func solve() {
	n, k := getInt(), getInt()

	i := 1
	d := 0

	for n >= i {
		d++
		i *= k
	}

	fmt.Fprintln(wr, d)
}

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

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}


Measured memory_bytes: 640
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cmath>     // pow
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;

long long gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
// int binary_search(int key) {
//     int ng = -1;
//     int ok = (int)a.size();
//     while(abs(ok - ng) > 1) {
//         int mid = (ok + ng) / 2;
//         if(isOK(mid, key))
//             ok = mid;
//         else
//             ng = mid;
//     }
//     return ok;
// }
// cout << fixed << setprecision(10);
// vector<vector<int>> vec(H, vector<int>(W))    // int H*W
int MOD = 1000000007;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> stair(N, 0);
    int last_a = -1;
    for(size_t i = 0; i < M; i++) {
        int a;
        cin >> a;
        stair[a - 1] = -1; // 穴あき
        if(a - last_a == 1) {
            cout << 0 << endl;
            return 0;
        }
        last_a = a;
    }

    for(int i = 0; i < N; i++) {
        if(stair[i] == -1) {
            stair[i] = 0;
            continue;
        }
        if(i == 0) {
            stair[i] = 1;
        } else if(i == 1) {
            stair[i] = stair[i - 1] + 1;
        } else {
            stair[i] = (stair[i - 1] + stair[i - 2]) % MOD;
        }
    }
    cout << stair[N - 1] << endl;
}

Measured memory_bytes: 888
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, j) for (long long i = 0; i < j; i++)

using namespace std;

signed main()
{
    int N, K;
    string s;
    cin >> N >> K >> s;

    int l, r, shiawase = 0;

    bool renzoku = false;

    int flag_count = 0;
    for (int i = 0; i < N - 1; i++) {
        if (s[i] != s[i + 1]) {
            if (flag_count == 0) {
                l = i + 1;
                flag_count++;
            } else {  // みつけた
                flag_count = 0;
                r = i;
                if (K != 0) {
                    K--;
                    shiawase += 2;
                }
            }
            // } else if (renzoku) {
            //     shiawase++;
            // cout << "shiawase increase" << i << endl;
        } else {
            shiawase++;
        }
    }
    if (K > 0 && flag_count == 1) {
        shiawase += 1;
    }
    cout << shiawase << endl;
}


Measured memory_bytes: 512
import math, heapq
from operator import itemgetter as ig
from collections import defaultdict as dd
# 定数
INF = float("inf")
MOD = int(1e9 + 7)
# データ構造：ヒープ
class heapque:
    def __init__(self, *args):
        self.que = []
        for arg in args:
            self.push(arg)
    def push(self, v):
        heapq.heappush(self.que, v)
    def pop(self):
        return heapq.heappop(self.que)
# 最大公約数 / 最小公倍数
def gcd(v1, v2):
    if v2 == 0:
        return v1
    return gcd(v2, v1 % v2)
def lcm(v1, v2):
    return (v1 // gcd(v1, v2)) * v2
# 二分探索
def bsr(a, v, lo=0, hi=None):
    if hi == None:
        hi = len(a) - 1
    if hi < lo:
        return lo
    mi = (lo + hi) // 2
    if v < a[mi]:
        return bsr(a, v, lo, mi - 1)
    else:
        return bsr(a, v, mi + 1, hi)
# Union-Find木
class uft:
    def __init__(self, n):
        self.height = [1] * n
        self.group = [-1] * n
    def root(self, v):
        if self.group[v] < 0:
            return v
        self.group[v] = self.root(self.group[v])
        return self.group[v]
    def size(self, v):
        return - self.group[self.root(v)]
    def merge(self, v1, v2):
        v1, v2 = self.root(v1), self.root(v2)
        if v1 == v2:
            return
        if self.height[v1] < self.height[v2]:
            self.group[v2] += self.group[v1]
            self.group[v1] = v2
            self.height[v2] = max(self.height[v1] + 1, self.height[v2])
        else:
            self.group[v1] += self.group[v2]
            self.group[v2] = v1
            self.height[v1] = max(self.height[v1] , self.height[v2] + 1)

def main():
    S = input()
    dp = [[0 for _ in range(13)] for _ in range(len(S) + 1)]
    dp[0][0] = 1
    for i, s in enumerate(S):
        i += 1
        loop = range(10) if s == "?" else [int(s)]
        for n in range(13):
            for m in loop:
                dp[i][(n * 10 + m) % 13] += dp[i - 1][n]
                dp[i][(n * 10 + m) % 13] %= MOD
    print(dp[-1][5])

main()


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

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

	bool odd_flag = false;
	int count = 0;

	while (1)
	{
		for (int i = 0; i < N; i++)
		{
			if (A[i] % 2 != 0)
			{
				odd_flag = true;
			}
		}
		if (odd_flag) break;

		for (int i = 0; i < N; i++)
		{
			A[i] /= 2;
		}
		++count;
	}
	cout << count << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  char nstr[6];
  int n;
  
  fgets(nstr,sizeof(nstr),stdin);
  sscanf(nstr,"%d",&n);
  
  n%1000==0?printf("0"):printf("%d\n",1000-n%1000);
  
  return 0;
}

Measured memory_bytes: 2132
/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/


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



int main()
{
    int q=1;
   // cin>>q;
    while(q--)
    {
        int n; 
        cin>>n;
       int a[n+1][3];
       for(int i=1; i<=n; i++)
       {
           cin>>a[i][0]>>a[i][1]>>a[i][2];
       }
       
       
       int dp[n+1][3];
       dp[1][0]=a[1][0];
       dp[1][1]=a[1][1];
       dp[1][2]=a[1][2];
       
       for(int i=2; i<=n; i++)
       {
           dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
           dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
           dp[i][2]=max(dp[i-1][0],dp[i-1][1])+a[i][2];
       }
       
       int m=max(dp[n][0],dp[n][1]);
       m=max(m,dp[n][2]);
       cout<<m;
       
    }
}


Measured memory_bytes: 2560
#include<iostream>
#include<cmath>

using namespace std;

int main () {
    int N, A, B;
    cin >> N >> A >> B;

    int cnt = 0;

    for (int i = 1; i <= N; i++) {
        int n = i;
        int sum = 0;
        while(n) {
            int dig = n % 10;
            sum += dig;
            n /= 10;
        }
        if (sum >= A && sum <= B) { cnt += i;} 
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n,m,c,i,j,a,score,ok=0;
    cin >> n >> m >> c;
    int b[m];
    for(i=0;i<m;i++) cin >> b[i];
    for(i=0;i<n;i++){
        score=0+c;
        for(j=0;j<m;j++) {
            cin >> a;
            score += a*b[j];
        }
        if(score>0) ok++;
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;

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


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



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
typedef long long int ll;
ll N, M;
int main(int argc, char const *argv[]) {
  cin >> N >> M;
  cout<<(100*(N-M)+1900*M)*(int)pow(2,M)<<endl;
  return 0;
}


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

#define ll long long
#define vll vector<ll>
#define vvll vector<vll>
#define rep(i, n) for(i = 0; i < n; i++)

int main(){
    int r;
    cin >> r;
    cout << (3 * r * r) << '\n';
    return 0;
}

Measured memory_bytes: 3552
#include <stdio.h>

int main(void)
{
	char str[128];
	int len, i;

	scanf("%[^\n]", str);
	len = strlen(str);
	for (i = 0; i < len; i++){
		if (str[i] >= 'a' && str[i] <= 'z'){
			str[i] -= 0x20;
		}
	}
	puts(str);

	return (0);
}

Measured memory_bytes: 524
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    return arr

A, B = list(map(int, input().split()))

prime_factors_A = [x[0] for x in factorization(A)]
prime_factors_B = [x[0] for x in factorization(B)]
prime_factors_A.append(1)
prime_factors_B.append(1)
ans = 0
for x in prime_factors_A:
    ans += 1 if x in prime_factors_B else 0
print(ans)

Measured memory_bytes: 38512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,x,y,l,sum=0;
    cin>>a>>b>>c>>x>>y;
    if(c*2<=a&&c*2<=b)
    {
        if(x>y)
        {
            x=x*2;
            c=c*x;
            cout<<c<<endl;
            return 0;
        }
        else
        {
            y=y*2;
            c=c*y;
            cout<<c<<endl;
            return 0;
        }
    }
    if(x>y)
    {
        l=y;
    }
    else
    {
        l=x;
    }
    if((2*c)<=(a+b))
    {
         x-=l;
        y-=l;
        l=l*2;
        sum+=l*c;


    }

    if(2*c<=a&&x>0)
    {
        x=x*2;
        sum+=x*c;
    }
    else if(x>0)
    {
        sum+=a*x;
    }
    if(2*c<=b&&y>0)
    {
        y=y*2;
        sum+=y*c;
    }
    else if(y>0)
    {
        sum+=b*y;
    }
    cout<<sum<<endl;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define FORR(x, arr) for (auto& x : arr)
#define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
//-------------------------------------------------------

string s1, s2;
int dp[1145][1145];

int rec(int i, int j) {
    // cout << i << " " << j << endl;
    if (i > s1.size() || j > s2.size()) {
        return 1 << 20;
    }
    if (j == 0) {
        return i;
    }
    if (i == 0) {
        return j;
    }

    if (dp[i][j] >= 0) {
        return dp[i][j];
    } else {
        int x = 1 << 20;
        if (s1[i - 1] == s2[j - 1]) {
            x = min(x, rec(i - 1, j - 1));
        }
        x = min(x, rec(i - 1, j) + 1);
        x = min(x, rec(i, j - 1) + 1);
        x = min(x, rec(i - 1, j - 1) + 1);

        dp[i][j] = x;
        return x;
    }
}

void solve() {
    cin >> s1 >> s2;
    MINUS(dp);
    dp[0][0] = 0;
    cout << rec(s1.size(), s2.size()) << endl;
    /*
    REP(i, 7) {
        REP(j, 7) { cout << dp[i][j] << "\t"; }
        cout << endl;
    }
    */
}

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}



Measured memory_bytes: 8520
import numpy as np

N, M = map(int, input().split())
X = np.array([int(x) for x in input().split()])

X.sort()

dif_X = X[1:] - X[:-1]
dif_X.sort()

if M - N <= 0:
  print(0)
else:
  print(sum(dif_X[:M-N]))

Measured memory_bytes: 23012
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m;
int a[N], b[N];
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
		a[i] = 1, b[i] = 0;
	b[1] = 1;
	while (m--) {
		int x, y;
		scanf("%d%d", &x, &y);
		a[x]--, a[y]++;
		if (b[x]) b[y] = 1;
		if (b[x] && !a[x]) b[x] = 0;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
		ans += b[i];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1024
using System;

class Program
{
    static void Main(string[] args)
    {
        var str = Console.ReadLine();
        var p = 700;
        p += str[0] == 'o' ? 100 : 0;
        p += str[1] == 'o' ? 100 : 0;
        p += str[2] == 'o' ? 100 : 0;
        
        Console.WriteLine(p);
    }
}


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

const string akiba="AKIHABARA";
int main(){
    string s;
    cin>>s;
    int p=0;
    for(int i=0;i<akiba.size();i++){
        if(p==s.size() || s[p]!=akiba[i]){
            if(akiba[i]=='A') continue;
            else{
                cout<<"NO"<<endl;
                return 0;
            }
        }
        else p++;
    }
    cout<<(p==s.size() ? "YES" : "NO")<<endl;
    return 0;
}

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

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

	if (N > M) {
		std::cout << "safe" << '\n';
	} else {
		std::cout << "unsafe" << '\n';
	}
}


Measured memory_bytes: 3608