akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <assert.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;


#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <bitset>
const int maxn = 1e5 + 20;
LL perfixSum[maxn], absSum[maxn];
vector<int>pos;
void cut(LL &val, int pos1, int pos2) {
    if (pos1 > pos2) return;
    val -= absSum[pos2] - absSum[pos1 - 1];
}
void work() {
    int n;
    scanf("%d", &n);
    int val;
    scanf("%d", &val);
    perfixSum[1] = val;
    absSum[1] = val;
    for (int i = 2; i <= n; ++i) {
        int val;
        char op;
        cin >> op;
        scanf("%d", &val);
        if (op == '+') {
            perfixSum[i] = perfixSum[i - 1] + val;
        } else {
            perfixSum[i] = perfixSum[i - 1] - val;
            pos.push_back(i);
        }
        absSum[i] = absSum[i - 1] + val;
    }
    LL ans = perfixSum[n];
    for (int i = 0; i <= (int)pos.size() - 2; ++i) {
        int p1 = pos[i], p2 = pos[i + 1];
        LL tans = absSum[n] - absSum[p2 - 1];
        tans += perfixSum[p1];
        cut(tans, p1 + 1, p2 - 1);
        ans = max(ans, tans);
    }
    cout << ans << endl;
}

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
//    int val;
//    scanf("%d", &val);
//    cout << val << endl;
    work();
    return 0;
}


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

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

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

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

int main(){
	ll N;
	cin >> N;
	cout << (N<=999?"ABC":"ABD") << endl;
    return 0;
}

Measured memory_bytes: 256
<?php
    list($a, $b) = explode(" ", trim(fgets(STDIN)));
    $arr = array("A" => 10, "B" => 11, "C" => 12, "D" => 13, "E" => 14, "F" => 15);
    if($arr[$a] > $arr[$b]){
        echo ">";
    }elseif($arr[$a] < $arr[$b]){
        echo "<";
    }else{
        echo "=";
    }
?>

Measured memory_bytes: 4728
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int a[26] { 0 };
    for (char c : s) {
        ++a[c - 'A'];
    }
    bool answer = true;
    for (int i = 0; i < 26; ++i) {
        if (a[i] != 0 && a[i] != 2) {
            answer = false;
            break;
        }
    }
    cout << (answer ? "Yes" : "No") << endl;
}


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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long

int n, t;
VI A;
LL solve()
{
	LL sum = t;
	for(int i = 0; i + 1 < n; ++i) {
		int diff = A[i + 1] - A[i];
		sum += min(t, diff);
	}
	return sum;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	cin >> n >> t;

	A.assign(n, 0);
	REP(i, 0, n) cin >> A[i];

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 1024
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    W=[int(w) for w in input().split()]
    med=sum(W)//2
    s=0
    for i in range(N):
        s = s + W[i]
        if s >= med:
            break
    a1 = sum(W) - 2*s
    a2 = a1 + 2*W[i]
    print(min(abs(a1),abs(a2)))



# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc129","b",main)

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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(10)





void solve() {

	string s, t;
	cin >> s >> t;
	if(s == t.substr(0, s.length())) {
		cout <<"Yes\n";
	}
	else {
		cout << "No\n";
	}
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	
	solve();

	return 0;
}

Measured memory_bytes: 3644
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
int a[200007];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    sort(a+1,a+1+n);
    long long sum=0;
    for(int i=1;i<=n-k;++i)
        sum+=a[i];
    cout<<sum;
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>

int main(void){
    using namespace  std;
    int N;
    cin >> N;
    vector<int> P(N);
    for (int i = 0; i < N;i++)
        cin >> P[i];

    int ret = 1;
    int min = P[0];
    for (int i = 1; i < N;i++)
        if(min > P[i]) {
            min = P[i];
            ret++;
        }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    int n, sum = 0, ans;
    double ave = 0, d = INT_MAX;
    cin >> n;
    vector<int> a(n);
    rep(i, n)
    {
        cin >> a[i];
        sum += a[i];
    }
    ave = (double)sum / n;
    rep(i, n)
    {
        if (d > abs(a[i] - ave))
        {
            ans = i;
            d = abs(a[i] - ave);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    char c1,c2,c3;
    scanf("%c",&c1);
    scanf("%c",&c2);
    scanf("%c",&c3);
    if(c1==c2&&c2==c3){
        printf("No");
    }else{
        printf("Yes");
    }
    return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
    Main main = new Main();
    try {
      main.run(args);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void run(String[] arguments) throws Exception {
    MyScanner sc = new MyScanner();
    PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

    sc.nextLine()
        .chars()
        .mapToObj(value -> (char) value)
        .map(
            c -> {
              char result = '0';
              switch (c) {
                case '1':
                  result = '9';
                  break;
                case '9':
                  result = '1';
                  break;
              }
              return result;
            })
        .forEach(out::print);
    out.println();
    out.close();
  }

  /*
   * Form: http://codeforces.com/blog/entry/7018
   */
  private class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}


Measured memory_bytes: 27988
#include <stdio.h>

void disp(int change);

int main(void) {
	int num[10] = {
		0x3f,0x06,0x5b,0x4f,0x66,
		0x6d,0x7d,0x27,0x7f,0x6f};

	
	for(;;){
		int i,j,n;
		int pre = 0x00;
		int next = 0x00;
		int change;

		scanf("%d",&n);
		if(n == -1)break;
		else{}
	
		for(i=0;i<n;i++){
			scanf("%d",&j);
			next = num[j];
			change = pre^next;
			pre = next;
			disp(change);
		}
	}
	return 0;
}

void disp(int i){
	int j;
	int b[7] = {0};
	
	for (j=0;i>0;j++) {
		b[j] = i % 2;
		i = i / 2;
	}
	
	//if(j == 7)j--;
	//else{}
	j = 6;
	for(;j>=0;j--){
		printf("%d",b[j]);
	}
	printf("\n");
}

Measured memory_bytes: 604
/*
lakshaygpt28
Lakshay Gupta
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using vll = vector < ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;


#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << std :: 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...);
}
#else
#define debug(...)
#endif

#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 3e3 + 10;

ll dp[N][N];

int main() {
    fast_io();
    string s, t;
    cin >> s >> t;
    ll len1 = s.length(), len2 = t.length();
    s = "." + s;
    t = "." + t;
    for (ll i = 1; i <= len1; i++) {
        for (ll j = 1; j <= len2; j++) {
            dp[i][j] = max({dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1] + (s[i] == t[j])});
        }
    }
    string ans;
    ll i = len1, j = len2;
    while (i > 0 and j > 0) {
        if (s[i] == t[j]) {
            ans = s[i] + ans;
            i--, j--;
        } else if (dp[i - 1][j] >= dp[i][j - 1]) {
            i--;
        } else {
            j--;
        }
    }
    cout << ans << "\n";
    // cout << dp[len1][len2] << "\n";
    return 0;
}


Measured memory_bytes: 70912
import re

N = int(input())
S = [input() for i in range(N)]

m,a,r,c,h = 0,0,0,0,0

for i in S:
    M = re.match("M",i)
    A = re.match("A",i)
    R = re.match("R",i)
    C = re.match("C",i)
    H = re.match("H",i)

    if M:
        m += 1
    if A:
        a += 1
    if R:
        r += 1
    if C:
        c += 1
    if H:
        h += 1
    
print(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)

Measured memory_bytes: 10084
#include <bits/stdc++.h>
using lli = long long;
// 定数
constexpr lli N_MAX = 1e18;
// メモ
std::map<lli, lli> solved;

lli N, A, B, C, D;
lli solve(lli n) {
    using std::min;
    if (n == 0) return 0;
    if (n == 1) return D;
    if (solved.count(n)) return solved.at(n);

    lli m2 = n % 2;
    lli M2 = n % 2;
    lli m3 = n % 3;
    lli M3 = (3 - (n % 3)) % 3;
    lli m5 = n % 5;
    lli M5 = (5 - (n % 5)) % 5;

    lli res = N_MAX;
    // 1でわる
    if (n < res / D) {  // overflow対策
        res = n * D;
    }

    // 2でわる
    res = min(res, m2 * D + solve((n - m2) / 2LL) + A);
    res = min(res, M2 * D + solve((n + M2) / 2LL) + A);

    // 3でわる
    res = min(res, m3 * D + solve((n - m3) / 3LL) + B);
    res = min(res, M3 * D + solve((n + M3) / 3LL) + B);

    // 5でわる
    res = min(res, m5 * D + solve((n - m5) / 5LL) + C);
    res = min(res, M5 * D + solve((n + M5) / 5LL) + C);

    // solved
    solved.insert(std::make_pair(n, res));
    return res;
}

int main() {
    using std::cin;
    using std::cout;
    using std::endl;

    int T;
    cin >> T;
    for (int i = 0; i < T; ++i) {
        cin >> N >> A >> B >> C >> D;
        cout << solve(N) << endl;
        solved.clear();
    }
    return 0;
}

Measured memory_bytes: 4288
import copy

n = int(input())
nodes = list(map(int, input().split()))
heap = copy.deepcopy(nodes)
heap.insert(0, None)
# in case if the right node of the last tree is None
MIN_INF = -10 ** 10
heap.append(MIN_INF)
# heap starts with 1, 2, 3, ... n

def max_heapify(i):
  l = 2 * i
  r = 2 * i + 1

  if l <= n and heap[l] > heap[r] and heap[l] > heap[i]:
    heap[l], heap[i] = heap[i], heap[l]
    max_heapify(l)
  elif r <= n and heap[l] < heap[r] and heap[r] > heap[i]:
    heap[r], heap[i] = heap[i], heap[r]
    max_heapify(r)

  # print(heap)

i = n // 2
while i != 0:
  max_heapify(i)
  i -= 1

print(" " + " ".join([str(i) for i in heap[1:-1]]))


Measured memory_bytes: 69904
#include <iostream>

using namespace std;
int main(){
  int n;
  cin>>n;
  
  int val = 0;
  while (n > 0){
    val = n%10;
    if (val == 7){
      cout<<"Yes";
      return 0;
    }
    n /=10;
  }
  cout<<"No";
  
  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    int n;
    cin>>n;
    vector<ll> d(n);
    rep(i,n){
        cin>>d[i];
    }
    SORT(d);
    cout<<d[n/2]-d[n/2-1]<<endl;

    return 0;
}


Measured memory_bytes: 1024
def q3(a,b):
  x = a*b
  if(a<b):
    tmp = a
    a=b
    b=tmp
  r=a%b
  while(not(r==0)):
    a=b
    b=r
    r=a%b
  return int(x/b)


ans = input().split()
a = int(ans[0])
b = int(ans[1])
print(q3(a,b))

Measured memory_bytes: 3060
all_money = int(input())

big_cnt = 0
sml_cnt = 0

all_money_mod = all_money

while(all_money_mod >= 500):
  all_money_q = all_money // 500
  all_money_mod = all_money % 500
  
  big_cnt += all_money_q
  
  if all_money_mod < 500:
    break
  
  all_money = all_money_mod

all_money = all_money_mod
  
while(all_money_mod >= 5):
  all_money_q = all_money // 5
  all_money_mod = all_money % 5
  
  sml_cnt += all_money_q
  
  if all_money_mod < 5:
    break
  
  all_money = all_money_mod
  
hapiness = big_cnt * 1000 + sml_cnt * 5
print(hapiness)

Measured memory_bytes: 3064
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

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

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

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int k,a,b;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++){
    if(i%k==0){
      cout<<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;

  return 0;
}




Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	
	int k, n;
	int arr[1000];

	cin >> k >> n;
	for (int i = 0; i < k; i++)
		cin >> arr[i];

	sort(arr, arr + k);
	
	int sum = 0;
	for (int i = 0; i < n; i++)
		sum += arr[i];

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int N, P;
string S;
int zyo10[200006];
int SmodP[200006];
unordered_map<int, ll> U;

void init() {
  int res = 1;
  rep(i, N) {
    zyo10[i] = res;
    res*=10;
    res%=P;
  }
}

int main() {
  INCANT;
  cin >> N >> P;
  cin >> S;
  if (P==2 || P==5) {
    ll ans = 0ll;
    rep(i, N) if ((S[i]-'0')%P==0) ans+=i+1;
    cout << ans << "\n";
    return 0;
  }
  init();
  SmodP[N-1] = (S[N-1]-'0')%P; 
  for(int i=N-1; i>=0; i--) {
    if (i==N-1) continue;
    int c = S[i] - '0';
    int keta = N-i-1;
    SmodP[i] = (zyo10[keta]*c+SmodP[i+1])%P;
  }
  rep(i, N) U[SmodP[i]]++;
  ll res=0ll;
  rep(i, P) {
    if (i==0) res+=U[i]*(U[i]+1)/2;
    else res+=U[i]*(U[i]-1)/2;
  }
  cout << res << "\n";
  return 0;
}

Measured memory_bytes: 2452
N,M=list(map(int,input().split()))
 
g=[[] for i in range(N+1)]
 
for i in range(M):
	a,b=list(map(int,input().split()))
	g[a].append(b)
	g[b].append(a)
 
from collections import deque
 
queue = deque([1])
d = [None] * (N+1)
while queue:
	v = queue.popleft()
	for i in g[v]:
		if d[i] is None:
			d[i] = v
			queue.append(i)
 
print("Yes")
print(*d[2:],sep='\n')

Measured memory_bytes: 35704
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n;
cin >> n;
vector<ll> a(n);
map<ll,ll> mp;
ll sum = 0;
rep(i,n){
    cin >> a[i];
    sum += a[i];
    mp[a[i]]++;
}
ll q;
cin >> q;
rep(i,q){
    ll b,c;
    cin >> b >> c;
    ll sum_b = mp[b] * b;
    ll cnt_b = mp[b];
    ll sum_c = c * mp[b];
    mp[b] = 0;
    mp[c] += cnt_b;
    sum -= sum_b;
    sum += sum_c;
    cout << sum << endl;
}

}

Measured memory_bytes: 9940
a, b, c = map(int, input().split())
ans = 0

if a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and a == b == c:
    print(-1)
else :
    while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        aa, bb, cc = a, b, c
        a = bb // 2 + cc // 2
        b = aa // 2 + cc // 2
        c = aa // 2 + bb // 2
        ans += 1
    print(ans)



Measured memory_bytes: 3060
def calc(a,D,K):
  if K==1:
    return a+(D-1)*9
  elif K==2:
    return (a-1)*(D-1)*9 + (D-1)*(D-2)/2*81
  else:
    return (a-1)*(D-1)*(D-2)/2*81 + (D-1)*(D-2)*(D-3)/6*729

N=str(input())
K=int(input())
D = len(N)
score=0
for i,a in enumerate(N):	
  if a!="0":
    score+=calc(int(a),D-i,K)
    K-=1
  if K==0:
    break
print(int(score))

Measured memory_bytes: 8952
#include<bits/stdc++.h>
using namespace std;
const int N=2e7+10;
const int mod=998244353;

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,a,b,fac[N],inv[N],ifac[N];

int C(int n,int m) {
	if(m<0||n<m) return 0;
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}

int F(int x,int y) {
	if(y<=x-1) return 0;
	return (C(x+y,x)-C(x+y,x-1)+mod)%mod;
}

int main() {
	fac[0]=fac[1]=ifac[0]=ifac[1]=inv[1]=1;
	for(int i=2;i<N;i++) {
		fac[i]=1ll*fac[i-1]*i%mod;
		inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		ifac[i]=1ll*ifac[i-1]*inv[i]%mod;
	}
	cin>>n>>a>>b;
	if(!b) return cout<<1,0;
	int ans=0;
	for(int i=0;i<=n-b;i++) {
		int ways=F(i,b-1);
		if(i+b==n) {
			if(i==a) ans=(ans+ways)%mod;
		}
		else {
			int x=n-b-i-1,y=a-i+1;
			ans=(ans+1ll*ways*C(x+y-1,y-1))%mod;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 234752
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	std::string s; cin >> s;

	int ans = 1;
	for(int i = 0; i < (int)s.size() - 1; i++) ans += (s[i] != s[i + 1]);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define VALS(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define pf push_front
#define INF 1234567890ll
#define PI (acos((ld)-1.0))
#define ll long long int 
#define ld long double
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
typedef pair <int, int> pi;
typedef pair <ll, ll> pl;
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << '\n';
	err(++it, args...);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9 + 7;
string to_string(char c) {string s(1,c);return s;}
int A[100005];
int dp[100005];
int main()
{
	IAMSPEED
	int n; cin >> n;
	FOR(i,1,n) {
		cin >> A[i];
	}
	dp[1] = 0;
	FOR(i,2,n) {
		if (i == 2) dp[i] = abs(A[2]-A[1]);
		else {
			dp[i] = min(dp[i-1] + abs(A[i]-A[i-1]), dp[i-2] + abs(A[i]-A[i-2]));
		}
	}
	cout << dp[n];
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<int>> G(10,vector<int> (10));
  for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
      G[i][j] = inf;
    }
  }
  for(int i=0; i<10; i++){
    for(int j=0; j<10; j++){
      cin >> G[i][j];
    }
  }
  for(int k=0; k<10; k++){
    for(int i=0; i<10; i++){
      for(int j=0; j<10; j++){
        chmin(G[i][j],G[i][k]+G[k][j]);
      }
    }
  }
  vector<int> cnt(10,0);
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      int a;
      cin >> a;
      if(a == -1) continue;
      cnt[a]++;
    }
  }
  int sum = 0;
  for(int i=0; i<10; i++){
    sum += cnt[i] * G[i][1];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
INF = 10 ** 10

N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [INF for _ in range(N)]
dp[0] = 0
# 0-indexed

for i in range(1, N):
    for k in range(1, K + 1):
        if i - k >= 0:
            dp[i] = min(dp[i], dp[i - k] + abs(h[i] - h[i - k]))

print(dp[N - 1])


Measured memory_bytes: 56032
N, M = map(int, input().split())
A = list(map(int, input().split()))
S = 0
counter = 0
for i in A:
    S = S + i
border = S / (4 * M)
for i in A:
    if i >= border:
        counter = counter + 1
result = "No"
if counter >= M:
    result = "Yes"
print(result)

Measured memory_bytes: 3064
using System;

namespace ConsoleApp22
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Convert.ToInt32(Console.ReadLine());
            var b = Console.ReadLine();

            if (a >= 3200)
            {
                Console.WriteLine(b);
            }
            else
            {
                Console.WriteLine("red");
            }
        }
    }
}


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

int main() {
    int N;
    cin >> N;
    vector<vector<int>> edge(N+1);
    for (int i = 0; i < N-1; i++) {
        int a, b;
        cin >> a >> b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    int A = (N+2)/3, B = (N+1)/3, C = N/3;
    vector<int> ans_par(N+1, -1);
    ans_par[1] = 1;
    
    queue<int> q;
    q.push(1);
    int paint_a = 1, paint_b = 0;
    while (!q.empty()) {
        int now = q.front();
        q.pop();
        for (int nxt : edge[now]) {
            if (ans_par[nxt] == -1) {
                q.push(nxt);
                ans_par[nxt] = 3 - ans_par[now];
                if (ans_par[nxt] == 1) paint_a++;
                else paint_b++;
            }
        }
    }
    
    vector<int> ans(N+1, 0);
    int use_a = 0, use_b = 0, use_c = 0;
    
    if (A <= paint_a && B <= paint_b) {
            for (int i = 1; i <= N; i++) {
            if (ans_par[i] == 1) {
                if (use_a < A) {
                    ans[i] = 3*use_a + 1;
                    use_a++;
                }else {
                    ans[i] = use_c * 3 + 3;
                    use_c++;
                }
            }
            if (ans_par[i] == 2) {
                if (use_b < B) {
                    ans[i] = 3*use_b + 2;
                    use_b++;
                }else {
                    ans[i] = use_c * 3 + 3;
                    use_c++;
                }
            }
        }
    }
    else if (paint_a < A) {
        for (int i = 1; i <= N; i++) {
            if (ans_par[i] == 1) {
                ans[i] = use_c * 3 + 3;
                use_c++;
            }
        }
        for (int i = 1; i <= N; i++) {
            if (ans_par[i] == 2) {
                if (use_c < C) {
                    ans[i] = use_c * 3 + 3;
                    use_c++;
                }else if (use_a < A) {
                    ans[i] = use_a * 3 + 1;
                    use_a++;
                }else {
                    ans[i] = use_b * 3 + 2;
                    use_b++;
                }
            }
        }
    }
    else if (paint_b < B) {
        for (int i = 1; i <= N; i++) {
            if (ans_par[i] == 2) {
                ans[i] = use_c * 3 + 3;
                use_c++;
            }
        }
        for (int i = 1; i <= N; i++) {
            if (ans_par[i] == 1) {
                if (use_c < C) {
                    ans[i] = use_c * 3 + 3;
                    use_c++;
                }else if (use_a < A) {
                    ans[i] = use_a * 3 + 1;
                    use_a++;
                }else {
                    ans[i] = use_b * 3 + 2;
                    use_b++;
                }
            }
        }
    }
    
    for (int i = 1; i <= N; i++) {
        cout << ans[i];
        if (i < N) cout << ' ';
    }
        cout << "\n";
    return 0;
}


Measured memory_bytes: 15220
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	bool cardList[4][13];
    for(int i=0;i<4;i++){
        for(int j =0;j<13;j++){
            cardList[i][j] = false;
        }
    }
    
    int cardCount;
    cin>>cardCount;
    for(int k = 0;k<cardCount;k++){
        char cardType;
        int line = 0;
        int number;
        cin>>cardType>>number;
        number -= 1;
        switch(cardType){
            case 'S':
            line = 0;
            break;
            case 'H':
            line = 1;
            break;
            case 'C':
            line = 2;
            break;
            case 'D':
            line = 3;
            break;
        }
        
        cardList[line][number] = true;
    }
    
    for(int i=0;i<4;i++){
        for(int j =0;j<13;j++){
            char out;
            int number;
            if(cardList[i][j]==false){
                switch(i){
                    case 0:
                    out = 'S';
                    break;
                    case 1:
                    out = 'H';
                    break;
                    case 2:
                    out = 'C';
                    break;
                    case 3:
                    out = 'D';
                    break;
                }
                number = j+1;
                cout<<out<<' '<<number<<endl;
            }
        }
    }
    
	return 0;
}

Measured memory_bytes: 3092
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<ll, bool> pib;

typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;

typedef vector<double> vf;

typedef long double ld;

#define mp make_pair
#define pb push_back

#define rep(i, N) for(ll i = 0; i < N; i++)
#define repa(i, a, N) for(ll i = a; i < N; i++)
#define repr(i, N) for(ll i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

#define all(A) A.begin(), A.end()

#define printItr(A) for(auto itr = A.begin(); itr != A.end(); ++itr){cout << * itr << ", ";}cout << endl;

const double PI = 3.141592653589793;

// const ll mod = 1e9 + 7;
const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

ll id(char c) {
	return c - 'a';
}

bool isOK(vi& a, ll k, ll index) {
	return a[index] < k * (index + 1);
}

ll binary_search(vi& a, ll k) {
	ll left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	ll right = (ll)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		ll mid = left + (right - left) / 2;

		if (isOK(a, k, mid))
			right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}

template<class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
	return os << "{" << p.first << "," << p.second << "}";
}

template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
	os << "{";
	for (auto e : v)os << e << ",";
	return os << "}";
}

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

	vi A(N);

	ll ans = 0;

	ll len = 0;
	rep(i, N) {
		cin >> A[i];
		len += A[i];
	}

	vi L(N, 0);
	L[0] = A[0];

	ll min =  abs(L[0] * 2 - len);
	repa(i, 1, N) {
		L[i] = L[i - 1] + A[i];
		if (min > abs(L[i] * 2 - len)) {
			min = abs(L[i] * 2 - len);
		}
	}

	cout << min << endl;

	return 0;
}

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

struct CARD{
  char mark;
  int value;
};

void bubblesort(CARD *A, int N){
  for(int i = 0; i < N - 1; i++){
    for(int j = N - 2; j >= i; j--){
      if(A[j].value > A[j+1].value){
	CARD tmp = A[j];
	A[j] = A[j+1];
	A[j+1] = tmp;
      }
    }
  }
}

void selectionsort(CARD *A, int N){
  for(int i = 0; i < N -1; i++){
    int minj = i;
    for(int j = i; j < N; j++){
      if(A[j].value < A[minj].value) minj = j;
    }
    if(i != minj){
      CARD tmp = A[minj];
      A[minj] = A[i];
      A[i] = tmp;
    }
  }
}

bool isstable(CARD *I, CARD *A, int N){
  string judge[10];
  for(int i = 0; i < N; i++){
    judge[I[i].value] += I[i].mark;
  }
  int inx = 0;
  for(int i = 0; i < 10; i++){
    for(int j = 0; j < judge[i].size(); j++){
      if(A[inx].mark != judge[i][j]) return false;
      inx++;
    }
  }
  return true;
}

int main(){
  CARD I[36], B[36], S[36];
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    string a;
    cin >> a;
    I[i].mark = a[0];
    I[i].value = (int)(a[1] - '0');
  }
  for(int i = 0; i < n; i++) B[i] = S[i] = I[i];
  bubblesort(B, n);
  for(int i = 0 ; i < n; i++) cout << B[i].mark << B[i].value <<( i == n - 1 ? '\n' : ' ');
  cout << (isstable(I, B, n) ? "Stable" : "Not stable") << endl;
  selectionsort(S, n);
  for(int i = 0 ; i < n; i++) cout << S[i].mark << S[i].value << (i == n - 1 ? '\n' : ' ');
  cout << (isstable(I, S, n) ? "Stable" : "Not stable") << endl;
  return 0;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
template<class T, class T2> inline void chkmax(T &x, const T2 &y) { if(x < y) x = y; }
template<class T, class T2> inline void chkmin(T &x, const T2 &y) { if(x > y) x = y; }
const int MAXN = (15);
const int mod = (int)1e9 + 7;

int n, m;
int adj[MAXN][MAXN];

void read()
{
	cin >> n >> m;
	for(int i = 0; i < m; i++)
	{
		int x, y;
		cin >> x >> y;
		x--, y--;
		adj[x][y] = 1;
	}
}

int dp[1 << MAXN];

int rec(int mask)
{
	if(!mask) return 1;
	if((!!(mask & 1)) != (!!(mask & 2))) return 0;

	int &memo = dp[mask];
	if(memo != -1) return memo;
	memo = 0;

	for(int sub_mask = (mask - 1) & mask; ; sub_mask = (sub_mask - 1) & mask)
	{
		if((!!(sub_mask & 1)) != (!!(sub_mask & 2))) continue;

		int cnt = 1;
		for(int i = 0; i < n; i++)
			if(sub_mask & (1 << i))
			{
				int c = 1;
				for(int j = 0; j < n; j++)
					if(adj[i][j])
						if((1 << j) & (sub_mask ^ mask))
							c = (c * 2ll) % mod;		

				cnt = (cnt * 1ll * (c - 1ll + mod)) % mod;
			}
			else if((mask ^ sub_mask) & (1 << i))
			{
				int c = 1;
				for(int j = 0; j < n; j++)
					if(adj[i][j])
						if((1 << j) & sub_mask)
							c = (c * 2ll) % mod;

				cnt = (cnt * 1ll * c) % mod;
			}

		memo = (memo + (cnt * 1ll * rec(sub_mask)) % mod) % mod;
		if(sub_mask == 0) break; 
	}

	return memo;
}

void solve()
{
	memset(dp, -1, sizeof(dp));

	int answer = 1;
	for(int i = 0; i < m; i++)
		answer = (answer * 2ll) % mod;

	answer = (answer - rec((1 << n) - 1) + mod) % mod;
	cout << answer << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	int ans=0;
	ll sum=0LL;
	int cnt=0;
	cin >>n;
	V a(n);
	rep(i,n){
		cin>>a[i];
	}
	sort(all(a));
	rep(i,n){
		if(i==0){
			cnt=1;
			sum=a[0];
		}else{
			if(sum *2 >= a[i]){
				
				cnt++;
			}else{
				cnt=1;
			}
			sum += a[i];
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3952
if __name__ == "__main__":
    while 1:
        x,y,z = list(map(int,input().strip().split()))
        if x ==0 and y ==0 and z ==0:break
        data = []
        for i in range(1,z):
            t1 = i + int(i * x/100)
            for j in range(1,z-t1+1):
                t2 = j + int(j * x/100)
                if t1 + t2 == z:data.append([i,j])
        ans = 0
        for k in data:
            temp = k[0] + int(k[0]* y/100) + k[1] + int(k[1]* y/100)
            if temp > ans: ans = temp
        print(ans)

Measured memory_bytes: 7692
import sys

N=int(input())
hxylist=[]
for i in range(N):
  x,y,h=map(int,input().split())
  hxylist.append((h,x,y))
hxylist.sort(reverse=True)
#print(hxylist)

for cx in range(101):
  for cy in range(101):
    ch=-1
    for h,x,y in hxylist:
      if h==0:
        max_ch=h+abs(x-cx)+abs(y-cy)
        if max_ch<ch:
          break
      elif ch==-1:
        ch=h+abs(x-cx)+abs(y-cy)
        #print(cx,cy,ch)
      else:
        ch2=h+abs(x-cx)+abs(y-cy)
        if ch!=ch2:
          break
    else:
      print(cx,cy,ch)
      sys.exit(0)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){
  int N,W;
  cin>>N>>W;
  
  vector<string> vec(N);
  
  for(auto &x:vec){
    cin>>x;
  }
  for(int i=0;i<W+2;++i){cout<<"#";}
  cout<<endl;
  for(auto &x:vec){
    cout<<"#"<<x<<"#"<<endl;
  }
  for(int i=0;i<W+2;++i){cout<<"#";}
  cout<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i ,a, n) for (long long int i=a;i<=n;i++)
#define pb  push_back
#define mp make_pair
#define fp first
#define sp second
#define be(v) v.begin(),v.end()
typedef long long ll;
typedef vector<ll> vi ;
typedef vector<pair<ll , ll > >  vpi ;
const int ma1=1e5+5;
string no="NO",yes="YES";
#define MOD 1000000007
int max_char=26;


int main()
{
      ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    while(t--)
    {
         ll n;
        cin>>n;
        ll a[n];
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        ll sum=0;
        if(n<=2)
        {
            cout<<0;
            return 0;
        }
        sort(a,a+n);
        for(int i=0;i<n;i++)
        {
            for(int j=i+1;j<n;j++)
            {
                if(a[i]!=a[j])
                {
                    for(int k=j+1;k<n;k++)
                    {
                        if(a[j]!=a[k])
                        {
                            if(a[i]+a[j]>a[k] && a[k]+a[i]>a[j] && a[j]+a[k]>a[i])
                                sum++;
                        }
                    }
                }
            }
        }
        cout<<sum;
    }
    return 0;
}
















Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std;
int main(){
	map<string,int>seen;
  	int mx = 0;
  	int n; cin>>n;
  	for(int i = 0; i < n; i++){
    	string s;
      	cin>>s;
      	seen[s]++;
      	if(seen[s] > mx)mx = seen[s];
    }
  	for(auto& a : seen){
    	if(a.second == mx)cout<<a.first<<"\n";
    }
	return 0;
}

Measured memory_bytes: 25216
#include<cstring>
#include<cstdio>
using namespace std;
int n,kk[27];char s[200005];long long ans;
int main()
{
	scanf("%s",s);n=strlen(s);
	for(int i=n-1;i>=0;i--){ans+=(n-i-1)-kk[s[i]-'a']++;}
	printf("%lld",ans+1);
}

Measured memory_bytes: 384
///
// File:  alds1_1_c.cpp
// Author: ymiyamoto
//
// Created on Mon Nov 13 02:50:09 2017
//

#include <cmath>
#include <cstdint>
#include <iostream>

using namespace std;

bool is_prime(uint32_t num)
{
  for (uint32_t i = 2; i <= sqrt(num); i++) {
    if (num % i == 0) {
      return false;
    }
  }
  return true;
}

int32_t main()
{
  uint32_t n;
  cin >> n;

  uint32_t count = 0;
  for (uint32_t i = 0; i < n; i++) {
    uint32_t num;
    cin >> num;
    if (is_prime(num)) {
      count++;
    }
  }
  cout << count << endl;

  return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  long long num,a,b;
  cin >> num;
  vector<long long> list,list2;
  for (long long i=0; i<num; i++) {
      cin >> a;
      list.push_back(a);}
  sort(list.begin(), list.end());
  a=list[0];
  for (long long i=1; i<num; i+=0) {
      b=list[i];
      if (a==b) {list2.push_back(a); a=list[i+1]; i+=2;}
      else {i++; a=b;}}
  sort(list2.begin(),list2.end());
  reverse(list2.begin(),list2.end());
  if (list2.size()<=1) {cout <<0;}
  else {cout << list2[0]*list2[1];}}

Measured memory_bytes: 4680
n,score=map(int,input().split())
dp=[[[0]*(3000) for j in range(n+1)] for i in range(n+1)]
dp[0][0][0]=1
MOD=10**9+7
for i in range(n):
    for j in range(i+1):
        for k in range(score+1):
            #yoko
            nj=j
            dp[i+1][nj][k+2*nj]+=dp[i][j][k]
            dp[i+1][nj][k+2*nj]%=MOD
            #erabanai
            nj=j+1
            dp[i+1][nj][k+2*nj]+=dp[i][j][k]
            dp[i+1][nj][k+2*nj]%=MOD
            #katahou
            nj=j
            x=2*j
            dp[i+1][nj][k+2*nj]+=dp[i][j][k]*x
            dp[i+1][nj][k+2*nj]%=MOD

            if j==0:
                continue
            nj=j-1
            x=j*j
            dp[i+1][nj][k+2*nj]+=dp[i][j][k]*x
            dp[i+1][nj][k+2*nj]%=MOD
print(dp[n][0][score])


Measured memory_bytes: 104924
#include <stdio.h>
#define MAX 100000
#define TRUE 1
#define FALSE 0

int main(void){
  
  int i,j,n,q;
  int Is_Prime[MAX+1];
  int cs[MAX+1];
  
  Is_Prime[0] = FALSE;
  Is_Prime[1] = FALSE;
  for( i=2; i<=MAX; i++){
    Is_Prime[i] = TRUE;
  }
  
  for( i=2; i<=MAX/2; i++){
    if( Is_Prime[i] == TRUE ){
      //printf("%d is PRIME\n",i);
      for( j=i+1; j<=MAX; j++){
        if( j % i == 0){
          Is_Prime[j] = FALSE;
        }
      }
    }
  }
    
  for( i=1,cs[0]=0; i<=MAX; i++){
    if( Is_Prime[i] == TRUE && Is_Prime[(i+1)/2] ){
      cs[i] = cs[i-1] + 1;
    }
    else cs[i] = cs[i-1];
  }
  
  scanf("%d",&n);
  for( q=0; q<n; q++){
    scanf("%d %d",&i,&j);
    printf("%d\n",cs[j]-cs[i-1]);
  }
  
  return 0;
}


Measured memory_bytes: 1280
N = int(input())
A = [int(x) for x in input().split()]

dct = {}
for i in range(N):
    dct[i + 1] = A[i]

lst = []
for k, v in sorted(dct.items(), key=lambda x: x[1]):
    lst.append(str(k))

print(' '.join(lst))

Measured memory_bytes: 31704
N, W= map(int, input().split())
WV = [list(map(int, input().split())) for i in range(N)]


for i in range(N+10):
  WV.append([0,0])


dp = []
for i in range(N+1):
  dp.append([0]*(W+1))


for i in range(N):
  for sum_w in range(W+1):

    if sum_w - WV[i][0] >= 0:
      dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - WV[i][0]] + WV[i][1])

    dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])


print(dp[N][W])

Measured memory_bytes: 120684
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
ll dp[100001];
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
int main(void) {
  int n,ans=0,cnt=0;
  scanf("%d",&n);
  ll a[n];
  FOR(n){
    scanf("%lld",&a[i]);
    if(i){
      if(a[i-1]>=a[i]){
        cnt++;
      }else{
        ans=max(ans,cnt);
        cnt=0;
      }
    }
  }
  PRN(max(ans,cnt));
  return 0;
}

Measured memory_bytes: 896
//region Template
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
template<typename T> void debug_out(string name, T arg) { cerr<<name<<"="<<arg<<endl; }
template<typename T1, typename... T2> void debug_out(string name, T1 arg, T2... args) {
    cerr<<name.substr(0, name.find(','))<<"="<<arg<<", ";
    debug_out(name.substr(name.find(',') + 1), args...); }
#define debug(...) debug_out(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) 42
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#endif
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout<<fixed<<setprecision(12);
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
#define EXIT(answer) { cerr<<"EXIT #"<<__LINE__<<endl; cout<<answer<<endl; exit(0); }
#define sz(v) int(v.size())
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> istream& operator>>(istream& in, pair<T,U> &p) { in>>p.first>>p.second; return in; }
template<typename T> inline vector<T> READ(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T> >;
typedef signed long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
//endregion



int main() {
    FASTIO

    ll x; cin>>x;
    ll a=100;

    FOR(i,1e8) {
        if(a >= x) EXIT(i);
        a = a + a/100;
    }
}

Measured memory_bytes: 3652
import math
a, b, c = map(int, input().split())
#_ab = math.sqrt(a * b)
#print(_ab)
if c - (a + b) < 0:
    print("No")
else:
    #right = math.pow(c - (a + b), 2)
    right = (c - (a + b)) ** 2
    left = 4 * a * b
    if left < right:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 61268
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <deque>
#include <complex>
#include <cstdio>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
typedef long long int ll;
int main() {
	ll n,a;
	vector<ll> f; 
	cin >> n;
	REP(i,n){
	scanf("%lld",&a);
	if(i<4)
	f.push_back(a);
	else if(f.back()>a){
	f[3]=a;
	sort(f.begin(),f.end());
	}
	}
	vector<ll> c;
	REP(i,min((ll)4,n))
		REP(j,min((ll)4,n))
			if(i!=j)
				c.push_back(f[i]*(pow(10,(int)log10(f[j])+1))+f[j]);
	sort(c.begin(),c.end());
	cout << c[2] << endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 1316