akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
string s;
int k;
cin >> k;
cin >> s;
int nagasa;
  nagasa = s.size();
  
  if(nagasa <= k)
  {
    cout << s << endl;
  }
  else
  {
    for(int i=0; i<k; i++)
    {
      cout << s[i];
    }
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    if(n==3||n==5||n==7)
    	cout<<"YES\n";
    else
    	cout<<"NO\n";
}


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

// Define
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
#define endl '\n'
#define space ' '
#define elif else if
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

// Debug
#define debug(...)                                                             \
    cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ";                         \
    for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] ";                   \
    cerr << endl;

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define rep(i, n) inc(i, 0, n - 1)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

// Math
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }

ll A[100000], B[100000];
signed main() {
    ll N, X, MA = 0, MB = 0, MA2 = 0, MB2 = 0, iA, iB;
    cin >> N;
    rep(i, N) {
        if (i & 1) {
            cin >> X;
            A[X - 1]++;
        } else {
            cin >> X;
            B[X - 1]++;
        }
    }
    rep(i, 100000) {
        if (A[i] > MA) {
            MA2 = MA;
            MA = A[i];
            iA = i;
        } else if (A[i] > MA2) {
            MA2 = A[i];
        }
        if (B[i] > MB) {
            MB2 = MB;
            MB = B[i];
            iB = i;
        } else if (B[i] > MB2) {
            MB2 = B[i];
        }
    }
    if (iA == iB) MB = max(MA2, MB2);

    cout << (N - MA - MB) << endl;
}

// for compilation: g++ -O3 -o _ _.cpp -std=c++17


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

#define ll long int

ll ar[10000001];

int main() {
	// your code goes here
ll n,i,ans=-1,a;
cin>>n;
for(i=0;i<n;i++)
 {
   cin>>a;
   ar[a]++;
   if(a>0)
   {
   ar[a-1]++;
   }
   ar[a+1]++;
 }
for(i=0;i<10000001;i++)
 {
   ans=max(ans,ar[i]); 
 }
 cout<<ans;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define ll long long
using namespace std;
void deb(){
    cout<<"a";
    exit(0);
}
int main(){
int x;
cin>>x;
if(x>=30)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}

Measured memory_bytes: 3620
#include<stdio.h>

int main(void){

    int n;

    scanf("%d",&n);

    int p[n];

    for(int i=0;i<n;i++){

        scanf("%d",&p[i]);

    }

    for(int l=0;l<n-1;l++){

        for(int j=0;j<n-1;j++){

           if(p[j]<p[j+1]){

                int buf = p[j];

                p[j] = p[j+1];

                p[j+1] = buf;

            }

        }

    }

    int sum;

    p[0] = p[0]/2;

    for(int k=0;k<n;k++){

        sum += p[k];

    }

    printf("%d\n",sum);

    return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int fib(int a){
    int b=0;
    if(a==1){
        return 1;
    }
  else if(a==2){
    return 2;
  }
    else{
        b=+(fib(a-1)+fib(a-2));
        return b;
    }
}
int main(){
  ll n;
  cin>>n;
  ll a[200010];
  for(ll i=0;i<n;i++){
    cin>>a[i];
    a[n+i]=a[i];
  }
      ll ans=0;
   for(ll j=0;j<n;j++){
      if(j%2==0){
        ans+=a[j];
      }
      else{
        ans-=a[j];
      }
   }
  cout<<ans<<" ";
  for(ll i=1;i<n;i++){
    ans=a[i-1]*2-ans;
    cout<<ans<<" ";
  }
}


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

int main() {
  string b;
  cin >> b;
  if (b == "RRR"){
    cout << 3;
  } else if (b == "RRS"){
    cout << 2;
  }else if (b == "SRR"){
    cout << 2;
  }else if (b == "SSS"){
    cout << 0;
  }else {
    cout << 1;
  }
	return 0;
}


Measured memory_bytes: 3596
import java.util.*;

public class Main {
	public static void main (String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a >= b) {
			System.out.println("delicious");
		} else if (a + x >= b) {
			System.out.println("safe");
		} else {
			System.out.println("dangerous");
		}
	}
}


Measured memory_bytes: 23764
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n;cin>>n;
  vl p(n);
  rep(i,n)cin>>p[i];
  ll count=0;
  rep(i,n-2){
    if((p[i]>p[i+1]&&p[i+1]>=p[i+2])||(p[i+2]>p[i+1]&&p[i+1]>=p[i]))count++;
  }
  cout<<count<<endl;
}
    

Measured memory_bytes: 256
if __name__ == "__main__":
	i = list(map(int, input().split()))
	h = list(map(int, input().split()))

	n = i[0]
	k = i[1]

	count = 0

	for h_n in h:
		if h_n >= k:
			count = count + 1

	print(count)

Measured memory_bytes: 11908
#include <iostream>
#include<string>
using namespace std;
int main()
{   int Count=0;
    string S;
    string T;
    cin >> S >> T;
    for(int i=0; i < S.size(); i++){
        if(S[i] != T[i]){
            Count+=1;
        }
    }
    cout<<Count;
    return 0;
}

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

int main() {
    int64_t n;
    cin >> n;
    
    int64_t pre_check = 0;
    int64_t check = 26;
    int dan = 1;
    while(1){
        if(check >= n){
            break;
        }
        dan++;
        pre_check = check;
        check += pow(26, dan);
    }

    check -= pre_check;
    check--;
    n -= pre_check;
    n--;

    string name;


    for(int i = 0 ; i < dan ; i++){
        int temp = n % 26;
        char c = 'a' + temp;
        name.push_back(c);
        n /= 26;
    }

    reverse(name.begin(), name.end());

    cout << name << endl;
}


Measured memory_bytes: 4132
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pf push_front
#define pb push_back
#define debug(val) cerr << "The Value Of " << #val << " is : " << val << '\n';
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 1e5+5;
ll n, arr[nax], satu=0, dua=0, empat=0;	

int main(){
	IOS
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> arr[i];
		if(arr[i]&1) satu++;
		else if(arr[i]%2==0){
			if(arr[i]%4==0) empat++;
			else dua++;
		}
	}
	if(dua==0){
		if(satu<=empat+1){
			cout << "Yes" << '\n';
		}
		else{
			cout << "No" << '\n';
 		}
	}
	else{
		if(satu<=empat){
			cout << "Yes" << '\n';
		}
		else{
			cout << "No" << '\n';
		}
	}
}


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

using namespace std;

int main() {
    int N;
    vector<int> v;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int num;
        cin >> num;
        v.push_back(num);
    }
    int count = 0;
    int oddFlag = 0;
    while (true) {
        for (int i = 0; i < N; i++) {
            if (v[i] % 2 != 0)oddFlag = 1;
        }
        if (oddFlag == 0) {
            for (int i = 0; i < N; i++) {
                v[i] /= 2;
            }
            count++;
        }
        else break;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import queue
from collections import namedtuple
U = namedtuple("U", "id parent depth type children")
n = int(input())

dic, link = [dict() for _ in range(2)]
se = set([int(x) for x in range(n)])

for i in range(n):
    tmp = list(map(int, input().split()))
    tmp.reverse()

    a, k = [tmp.pop() for _ in range(2)]
    link[a] = []
    for j in range(k):
        b = tmp.pop()
        link[a].append(b)

        se.remove(b)


def bfs(s):
    q = queue.Queue()
    q.put(U(s, -1, 0, "root", link[s]))

    while q.qsize() != 0:
        u0 = q.get()
        dic[u0.id] = u0

        for u1 in u0.children:
            children = link[u1]
            node_type = "leaf" if children == [] else "internal node"
            q.put(U(u1, u0.id, u0.depth + 1, node_type, children))


bfs(se.pop())

for i in range(n):
    print("node", dic[i].id, end="")
    print(": parent =", dic[i].parent, end="")
    print(", depth =", dic[i].depth, end="")
    print(",", dic[i].type, end="")
    print(",", dic[i].children)



Measured memory_bytes: 50116
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  long long k;
  cin >> k;
  long long b = k % 10, l = 0, j = 0, a = 0;
  if (b % 2 == 0 || b == 5) {
    cout << -1;
  } else {
    rep(i,10)
    {
      if ((b * i + l) % 10 == 7) {
        l += k * i;
        l /= 10;
        j++;
        a = i;
        break;
      }
    }
    bool f = false;
    while (!f) {
      f = true;
      for (int i = 1; i <= l; i *= 10) {
        if (l % (i * 10) - l % i != i * 7) {
          f = false;
          break;
        }
      }
      if (!f) {
        rep(i,10)
        {
          if ((b * i + l) % 10 == 7) {
            l += k * i;
            l /= 10;
            j++;
            a = i;
            break;
          }
        }
      }
    }
    cout << j + (int) log10(a * k);
  }
  return 0;
}


Measured memory_bytes: 3904
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007 
#define ll long long 
#define N 100005
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define piii pair<int, pii>
#define print(x) cout << #x << "=" << x << "\t";
#define endl "\n"
#define newline cout << endl;

int n;
int k;
ll a[N];
ll dp[2][N];

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); 
    cin >> n >> k;
    if (k == 0) {
        cout << 1;
        return 0;
    }
    for(int i=1;i<=n;i++)
        cin >> a[i];
    int act = 0, pas = 1;
    for(int i=0;i<=k;i++)
        dp[0][i] = 1;
    for(int i=1;i<=n;i++) {
        swap(act, pas);
        memset(dp[act], 0, sizeof(dp[act]));
        for(int j=0;j<=k;j++) {
            int red = 0;
            if (j - a[i] > 0)
                red = dp[pas][j - a[i] - 1];
            dp[act][j] = (0ll + dp[act][j - 1] + dp[pas][j] - red + mod) % mod;
        }
    }
    cout << (dp[act][k] - dp[act][k - 1] + mod) % mod;
    return 0;
}


Measured memory_bytes: 1792
using System;

class Hello{

    public static void Main(){
    
        int h;
        int a;
        
        var inpts = Console.ReadLine().Split(' ');
        
        h = int.Parse( inpts[0] );
        a = int.Parse( inpts[1] );
        
        var ans = h/a;
        if(h%a != 0){
            ans++;
        }
        Console.WriteLine(ans);
        
        
    }

}

Measured memory_bytes: 13140
# coding: utf-8
# Your code here!

from collections import deque, defaultdict
import bisect

X, Y, Z, K = map(int, input().rstrip().split(' '))
A = sorted(list(map(int, input().rstrip().split(' '))))[::-1]
B = sorted(list(map(int, input().rstrip().split(' '))))[::-1]
C = sorted(list(map(int, input().rstrip().split(' '))))[::-1]

ai = 0
bi = 0
ci = 0


diff = [1, 0, -1]
memo = set()
memo.add('000000000000')
    
d = defaultdict(lambda: [])
current_total = A[ai] + B[bi] + C[ci]
totals = [current_total]
d[current_total].append([ai, bi, ci])
current_total_index = 0
count = 0
while True:
    current_total = totals[-(current_total_index+1)]

    for candidate in d[current_total]:
        count += 1
        ai, bi, ci = candidate
        print(current_total)
        if count >= K:
            break
        for i in diff:
            for j in diff:
                for k in diff:
                    if (ai + i) < 0 or (ai + i) >= len(A) or (bi + j) < 0 or (bi + j) >= len(B) or (ci + k) < 0 or (ci + k) >= len(C):
                        continue
                    
                    before_len_memo = len(memo)
                    memo.add('{:04d}{:04d}{:04d}'.format(ai + i, bi + j, ci + k))
                    if before_len_memo != len(memo):
                        total = A[ai+i] + B[bi+j] + C[ci+k]
                        
                        if len(d[total]) == 0:
                            bisect.insort_right(totals, total)
                        
                        d[total].append([ai+i, bi+j, ci+k])
                    
        
    if count >= K:
        break
        
    current_total_index += 1


Measured memory_bytes: 7212
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

print(sum(list(map(int,list(inputS())))))


Measured memory_bytes: 63980
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>

#define loop(i, times) for(int i = 0; i < times; i++)
#define seloop(i, start_index, end_index) for(int i = start_index; i < end_index; i++)
#define eqseloop(i, start_index, end_index) for(int i = start_index; i <= end_index; i++)

using namespace std;

struct Town
{
	int prefectures_;	// 都道府県
	long time_;			// 街生成時間
	string id_;			// 認識番号
};

int main()
{
	int n;  cin >> n;
	int m;	cin >> m;
	vector<Town> town_collection;
	town_collection.resize(m + 1);

	// 街のデータ入力
	loop(i, m)
		cin >> town_collection[i].prefectures_ >> town_collection[i].time_;

	// 街が出来た時間でソートされたコンテナを作る
	vector<set<pair<int, Town*>>> time_collection;
	time_collection.resize(n + 1);
	loop(i, m)
		time_collection[town_collection[i].prefectures_].insert(make_pair(town_collection[i].time_, &town_collection[i]));

	string p, x;
	for (int prefecture_index = 1; prefecture_index < n + 1; prefecture_index++)
	{	// 認識番号を作る
		int time_index = 1;
		for (const auto& e : time_collection[prefecture_index])
		{
			p.resize(6, '0');
			p.replace(6 - to_string(prefecture_index).size(), to_string(prefecture_index).size(), to_string(prefecture_index));
			x.resize(6, '0');
			x.replace(6 - to_string(time_index).size(), to_string(time_index).size(), to_string(time_index));
			e.second->id_ = p + x;
			p.clear();
			x.clear();
			time_index++;
		}
	}

	// 結果出力
	for (const auto& e : town_collection)
		cout << e.id_ << endl;
}


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

using P=pair<int,int>;

int n;

void solve(){
    vector<P> v;
    cin>>n;
    for(int i=0; i<n; i++){
        int u;
        P q;
        cin>>u;
        q.first=u;q.second=i;
        v.push_back(P(u,i+1));
    }
    sort(v.begin(), v.end());
    for(int i=0; i<n; i++){
        if(i!=0) cout<<" ";
        cout<<v[i].second;
    }
}

int main(){
    //while(1)
    solve();
}

Measured memory_bytes: 1780
#ABC 079 C

#頭を使わず8通り試す

s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
ans = a

#---=000,+--=100みたいにすればいいのでは説

puramai = []
for i in range(8):
    bs = format(i,'03b')
    for j in range(3):
#        print(bs[j])
        if bs[j] == "0":
            ans = ans - int(s[j+1])
            puramai.append("-")
        if bs[j] == "1":
            ans = ans + int(s[j+1])
            puramai.append("+")
#    print(ans)
    if ans == 7:
        print(s[0] + puramai[0] + s[1] + puramai[1] + s[2] + puramai[2] + s[3] + "=7")
        break
    else:
        ans = a
        puramai = []
else:
    print("NO")

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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

int main(void)
{
  string s; cin >> s;
  string ans;
  ans = s;
  if(s[1]=='B') {
    ans[1] = 'R';
  } else {
    ans[1] = 'B';
  }
  cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
    int n;
    int[] as;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        solve();
    }

    void solve() {
        ArrayList<Integer> xList = new ArrayList<>();
        ArrayList<Integer> yList = new ArrayList<>();
        int maxAbs = 0;
        int maxAbsIndex = -1;
        for (int i = 0; i < n; i++) {
            if (Math.abs(as[i]) > Math.abs(maxAbs)) {
                maxAbs = as[i];
                maxAbsIndex = i;
            }
        }
        if (maxAbs == 0) {
            System.out.println(0);
            return;
        }
        for (int i = 0; i < n; i++) {
            xList.add(maxAbsIndex + 1);
            yList.add(i + 1);
        }
        if (maxAbs < 0) {
            for (int i = n - 1; i > 0; i--) {
                xList.add(i + 1);
                yList.add(i);
            }
        } else {
            for (int i = 0; i < n - 1; i++) {
                xList.add(i + 1);
                yList.add(i + 2);
            }
        }
        System.out.println(xList.size());
        for (int i = 0; i < xList.size(); i++) {
            System.out.println(xList.get(i) + " " + yList.get(i));
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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: 22228
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
	int i,j,k,n,m,l,f,y,z; string s;
	cin >> n;
	ll x = 1;
	REP(i,1,n+1){
		x = x*i % 1000000007;
	}
	cout << x << endl;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int , input().split()))
dp = [0 , abs(h[1] - h[0])]
for i in range(2 , n):
    dp.append(min(dp[i-1] + abs(h[i] - h[i-1]) , dp[i-2] + abs(h[i]-h[i-2])))
print(dp[-1])
    


Measured memory_bytes: 13908
#include <iostream>
#include <fstream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const { return pow(mod-2);}
	mint& operator/=(const mint a) { return *this *= a.inv();}
	mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
	int N; cin>>N;
	int zero = 0;
	map<pair<ll,ll>, P> el;
	rep(i,N){
		ll x,y;
		cin>>x>>y;
		if(x == 0 && y == 0){
			++zero;
			continue;
		}
		ll g = gcd(x,y);
		x /= g;
		y /= g;
		if(y<0)x = -x, y = -y;
		if(y == 0 && x < 0)x = -x, y = -y;
		bool rot = false;
		if(x<=0){
			rot = true;
			ll tmp = x;
			x = y;
			y = -tmp;
		}
		if(rot)el[{x,y}].first++;
		else el[{x,y}].second++;
	}
	mint ans = 1;
	for(auto x: el){
		int a = x.second.first;
		int b = x.second.second;
		mint t = 1;
		t += mint(2).pow(a) -1;
		t += mint(2).pow(b) -1;
		ans *= t;
	}
	ans -= 1;
	ans += zero;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 16096
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int ss[50][26];
int main(void) {
  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 0; j < s[i].size(); j++) {
      ss[i][s[i][j] - 'a']++;
    }
  }
  vector<int> cnt(26, 51);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 26; j++) {
      if (cnt[j] > ss[i][j]) {
        cnt[j] = ss[i][j];
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < cnt[i]; j++) {
      cout << (char)('a' + i);
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  if(n%10 == 3) cout << "bon";
  else if(n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8 ) cout << "pon";
  else cout << "hon";
}

Measured memory_bytes: 3100
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()
 
s=input()
n=len(s)
s10=[]
for i in range(n):
  if i%2==0:
    s10.append(1)
    
  else:
    s10.append(0)
    
s01=[]
for i in range(n):
  if i%2==0:
    s01.append(0)
    
  else:
    s01.append(1)
cnt10=0
cnt01=0
for i in range(n):
  if int(s[i])!=s10[i]:
    cnt10+=1
    
  if int(s[i])!=s01[i]:
    cnt01+=1
   
    
print(min(cnt10,cnt01))
  

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

using namespace std;

int main () {
  int n; cin >> n; int j; cin >> j;
  vector<int> vec;
  int dp[n+300];
  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    vec.push_back(h);
    dp[i] = 2000000000;
  }
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    for (int k = 1; k <= j; k++)
      if (abs(vec[i] - vec[i+k]) + dp[i] < dp[i+k])
        dp[i+k] = abs(vec[i] - vec[i+k]) + dp[i];
  }
  printf("%d\n", dp[n-1]);
}

Measured memory_bytes: 1148
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define rrep1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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 int MAX = 200010;
ll fac[MAX], finv[MAX], inv[MAX];

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

ll comb(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll n, k; cin >> n >> k;

    COMinit();

    ll ans = 0;
    for (ll m = 0; m <= min(k, n-1); m++) {
        ll a = comb(n, m) * comb(n-1, n-m-1);
        a %= MOD;
        ans += a;
        ans %= MOD;
    }
    cout << ans << endl;
}


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

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

    string l = S.substr(0, 2);
    string r = S.substr(2, 2);

    if ("01" <= l && l <= "12" && "01" <= r && r <= "12") cout << "AMBIGUOUS" << endl;
    else if ((l == "00" || l >= "13") && ("01" <= r && r <= "12")) cout << "YYMM" << endl;
    else if ((r == "00" || r >= "13") && ("01" <= l && l <= "12")) cout << "MMYY" << endl;
    else cout << "NA" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define ll long long 
using namespace std;
const int N=100000+7;
const int inf=0x3f3f3f3f;
int n,size[N],cg,cg2,minx=inf;
int lst[N],nxt[2*N],to[2*N],tot;
ll len[2*N],dis[N],ans;
void add(int x,int y,ll w){
    nxt[++tot]=lst[x];
    to[tot]=y;
    len[tot]=w;
    lst[x]=tot;
}
void read(){
    cin>>n;
    int x,y;
    ll w;
    for(int i=1;i<n;i++){
        scanf("%d%d%lld",&x,&y,&w);
        add(x,y,w);
        add(y,x,w);
    }
}
void build(int u,int fa){
    int maxn=0;
    for(int i=lst[u];i;i=nxt[i]){
        int v=to[i];
        if(v==fa) continue;
        build(v,u);
        size[u]+=size[v];
        maxn=max(maxn,size[v]);
        ans+=(ll)min(size[v],n-size[v])*len[i];
    }
    size[u]++;
    maxn=max(maxn,n-size[u]);
    if(maxn<minx){
        minx=maxn;
        cg=u;
        cg2=0;
    }
    else if(maxn==minx) cg2=u;
}
int main(){
    read();
    build(1,0);
    ans*=2;
    ll minx=inf;
    for(int i=lst[cg];i;i=nxt[i]){
        minx=min(minx,len[i]);
        if(to[i]==cg2){
            printf("%lld\n",ans-len[i]);
            return 0;
        }
    }
    printf("%lld\n",ans-minx);
    return 0;
}


Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lowb lower_bound
#define upb upper_bound
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	rep(i, n - 2) {
		if(s.substr(i, 3) == "ABC") ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define line cout << endl
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
long long x;
long long num = 100, ans;
int main() {
	cin >> x;
	while (num < x) {
		num += num * 0.01;
		ans++;
	}
	cout << ans;
	line;
	return 0;
}


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

constexpr int inf = 1e9;

int main() {
    int h, w, n; cin >> h >> w >> n;
    vector<vector<int>> xs(w, vector<int>(1, h + 1));
    for(int i = 0; i < n; ++i) {
        int x, y; cin >> x >> y;
        xs[y - 1].push_back(x);
    }
    for(auto& xx : xs) sort(xx.begin(), xx.end());

    auto dist = [&] (int x, int y) {
        return *upper_bound(xs[y].begin(), xs[y].end(), x) - x;
    };

    auto find_hole = [&] (int x, int y) {
        if(y + 1 == w) return -1;
        int res = -1;
        while(x < h) {
            const int nx = *lower_bound(xs[y + 1].begin(), xs[y + 1].end(), x + 1);
            if(nx > x + 1) {
                res = x + 1;
                break;
            }
            x = nx;
        }
        return res;
    };

    int ans = inf, x = 1;
    for(int y = 0; y < w; ++y) {
        const int d = dist(x, y);
        ans = min(ans, x + d - 1);
        if(y + 1 != w) {
            const int hole = find_hole(x, y);
            if(hole == -1) {
                break;
            }
            x = hole;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 11648
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    char s[11];
    while(gets(s)!=NULL)
    {
        int max=0,i;
        for(i=0; s[i]; i++)
            if(s[i]!='A'&&s[i]!='T'&&s[i]!='G'&&s[i]!='C')
                s[i]='*';
        int a[5]={0},j;
        for(i=0,j=0; s[i]; i++)
        {
            if(s[i]!='*')
                a[j]++;
            else
                j++;
        }
        for(i=0;i<5;i++)
            max=max>a[i]?max:a[i];
        printf("%d\n",max);
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
const int maxn=200010;
typedef long long ll;
ll s[maxn];
ll ab(ll x)
{
	return x>0?x:-x;
}
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		s[0]=0;
		for(int i=1;i<=n;i++)
		{
			int t;
			scanf("%d",&t);
			s[i]=s[i-1]+t;
		}
		ll temp=s[n],ans=1e15;
		for(int i=1;i<n;i++)
		{
			ans=min(ans,ab(temp-2*s[i]));	
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1792
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]
ans = -1
for i in range(10**(n-1),10**n):
    si = str(i)
    is_ans = True
    for j in range(m):
        if not si[sc[j][0]-1]==str(sc[j][1]):
            is_ans = False
    if is_ans:
        ans = i
        break
if n==1:
    anszero = True
    for i in range(m):
        if not sc[i][1]==0:
            anszero = False
            break
    if anszero:
        ans = 0
print(ans)


Measured memory_bytes: 3064
#![allow(unused_imports)]

use std::cmp;
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::ops::*;
use std::process::exit;
use std::str::FromStr;

pub const MOD: usize = 1000000007;

fn main() {
    let (n, a, b): (usize, usize, usize) = input_three();
    let mi = a * (n - 1) + b;
    let ma = a + b * (n - 1);
    let ans = if mi > ma {
        0
    } else {
        ma - mi + 1
    };

    println!("{}", ans);
}

pub fn input<T: FromStr>() -> T {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

pub fn input_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>()
}

pub fn input_lines<T: FromStr>(l: usize) -> Vec<T> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input());
    }
    res
}

pub fn input_lines_two<T: FromStr, U: FromStr>(l: usize) -> Vec<(T, U)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_two());
    }
    res
}

pub fn input_lines_three<T: FromStr, U: FromStr, V: FromStr>(l: usize) -> Vec<(T, U, V)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_three());
    }
    res
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}


Measured memory_bytes: 4352
from sys import stdin
def S(): return stdin.readline().rstrip()

t = S()
lt = list(t)

for i,item in enumerate(lt):
    if item == '?':
        if i<len(lt)-1:
            if 0<i:
                if lt[i-1]=='P':
                    lt[i] = 'D'
                else:
                    if lt[i+1]=='D' or lt[i+1]=='?':
                        lt[i] = 'P'
                    else:
                        lt[i] = 'D'
            else:
                if lt[i+1]=='D' or lt[i+1]=='?':
                    lt[i] = 'P'
                else:
                    lt[i] = 'D'
        else:
            if item=='?':
                lt[i] = 'D'

ans = ''
for i in lt:
    ans += i
print(ans)

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] X = new int[N+1];
		for(int i = 1 ; i <= N ; i++){
			X[i] = sc.nextInt();
		}
		sc.close();
		int[] Y = new int[N+1];
		for(int i = 1 ; i <= N ; i++){
			Y[i] = X[i];
		}

		Arrays.sort(Y);

		int a = Y[N/2];
		int b = Y[(N/2) + 1];

	//	System.out.println(a);
	//	System.out.println(b);

		for(int i = 1 ; i <= N ; i ++){
			//System.out.println("X[i] : "+X[i]);
			if(a != b){
				if(X[i] <= a){
					System.out.println(b);
				}
				if(X[i]>= b){
					System.out.println(a);
				}
			}
			else if(a == b){
				System.out.println(a);

			}
		}



	}

}

Measured memory_bytes: 111956
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<iomanip>
using namespace std;
 
int main(){
	string s="",t="";
	cin >> s;
	for(int i=0;i<s.length();i++){
		if(s[i]=='B'){
			s[i]='X';
			for(int j=i-1;j>=0;j--){
				if(s[j]=='0' || s[j] == '1'){
					s[j]='X';
					break;
				}
			}
		}
	}
	
	for(int i=0;i<s.length();i++){
		if(s[i]!='X'){
			cout << s[i];
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
/********************************************************************************

        Code by a weak man who named CYJian, and he hopes the code can get more points.

        Algorithm:

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

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//{{{ FAST IO AND SOME FUNCTIONS
const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s "in", "r", stdin), freopen(s "out", "w", stdout)

template <typename T> inline void read(T &x) {
    char ch, t = 0;
    x = 0;
    while (!isdigit(ch = ge))
        t |= ch == '-';
    while (isdigit(ch))
        x = x * 10 + (ch ^ 48), ch = ge;
    x = t ? -x : x;
}
inline int read_int() {
    int x;
    return read(x), x;
}
inline ll read_ll() {
    ll x;
    return read(x), x;
}

template <typename T> inline void chkmin(T &a, T b) { a = a < b ? a : b; }
template <typename T> inline void chkmax(T &a, T b) { a = a > b ? a : b; }
//}}}

const int mod = 1e9 + 7;

inline int Mod(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) { x += y, x -= x >= mod ? mod : 0; }

int f[5010];
int g[5010];
int P[5010];
int M[5010];
int F[2][5010];

int main() {
#ifdef LOCAL
    FILE("");
#endif

    int n = ri, A = ri, B = ri, res = 1;
    for (int i = 1; i <= n; i++)
        res = Mod(res << 1);
    if (A == 1 || B == 1)
        return printf("%d\n", res), 0;
    if (A > B)
        swap(A, B);
    f[0] = 1, g[0] = 1;
    for (int i = A; i < B; i++) {
        f[i] = Mod(f[i - 1] + g[i - 1]);
        for (int j = A; j <= i; j++)
            Add(g[i], f[i - j]);
    }

    for (int i = 1; i < B; i++)
        for (int j = 1; j <= i; j++)
            P[i] = (P[i] + 1LL * g[i - j] * (i == j ? 1 : j)) % mod;
    for (int i = 1; i < B; i++)
        for (int j = 1; j <= i; j++)
            M[i] = (M[i] + 1LL * g[i - j] * (i == j ? 1 : j - 1)) % mod;

    F[0][0] = F[1][0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j < B; j++) {
            if (i == j || i == n) {
                F[1][i] = (F[1][i] + 1LL * F[0][i - j] * P[j]) % mod;
                if (i == j)
                    break;
            } else
                F[1][i] = (F[1][i] + 1LL * F[0][i - j] * M[j]) % mod;
        }
        for (int j = 1; j < A; j++) {
            Add(F[0][i], F[1][i - j]);
            if (i == j)
                break;
        }
    }

    cout << Mod(res + mod - Mod(F[0][n] + F[1][n])) << endl;
    return 0;
}


Measured memory_bytes: 3704
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    ll K, T;
    cin >> K >> T;

    vector<ll> v(T);

    for(int i = 0; i < T; i++) cin >> v[i];
    
    if(T == 1){
        cout << K - 1 << endl;
        return 0;
    }

    auto mx = *max_element(all(v));
    ll rem = mx - K / 2;
    if(rem > 0){
        ll ans = 0;
        if(K % 2 == 1){
            rem -= 1;
            ans += 2 * rem;
        }
        else{
            rem -= 1;
            ans += 1;
            ans += rem * 2;
        }
        cout << ans << endl;
    }
    else{
        cout << 0 << endl;
    }



}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>

using namespace std;

int main(void) {

	int n, num = 0,tmp;

	cin >> n;

	for (int k = 3; k >= 0; k--) {

		tmp = n / pow(10, k);
		if (tmp == 2)num++;

		n -= tmp * pow(10, k);


	}

	cout << num << "\n";

	return 0;
}

Measured memory_bytes: 512
import math
N, H = map(int, input().split())
sword =[list(map(int, input().split())) for _ in range(N)]
def f1(l):
    a, b = l
    return a
def f2(l):
    a, b = l
    return b
sword.sort(key = f2)
sword.sort(key = f1)
amax, b1 = sword[-1]
sword.sort(key = f2)
dam = 0
ans = 0
while sword:
    a, b = sword.pop()
    if b < amax:
        break
    else:
        dam += b
        ans += 1 
        if dam >= H:
            break
if dam < H:
    dam -= b1
    ans -= 1
    ans += max(math.ceil((H-dam-b1)/amax), 0) + 1
print(ans)

Measured memory_bytes: 28920
import collections

n=int(input())
a=[1]

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

for i in range(1,n+1):
    a+=prime_factorize(i)


a=collections.Counter(a)
a=a.most_common()



v=0
w=0
count=0

for i in range(len(a)):
    if a[i][1]+1>=5:
        v+=1
    elif 3<=a[i][1]+1<=4:
        w+=1

if v<2 or v-2+w<1:
    print(0)
    exit()

for i in range(len(a)):

    if a[i][1]+1>=75:
        count+=1+v+w-1+v-1
    elif a[i][1]+1>=25:
        count+=v+w-1+v-1
    elif a[i][1]+1>=15:
        count+=v-1
    else:
        continue

print((v*(v-1)//2)*(w+v-2)+count)

Measured memory_bytes: 38492
using System;
using System.Collections.Generic;
using System.Linq;

namespace ALDS1_3_B
{
    class Program
    {
        static void Main(string[] args)
        {
            Queue queue = new Queue();
            var nq = Console.ReadLine();
            int n = int.Parse(nq.Split(' ')[0]);
            int q = int.Parse(nq.Split(' ')[1]);
            for(int i=0;i<n;i++)
            {
                var nt = Console.ReadLine();
                queue.enqueue(new Process(nt.Split(' ')[0], int.Parse(nt.Split(' ')[1])));
            }
            queue.calculation(q);
        }
    }

    public class Process
    {
        public string name { get; set; }
        public int time { get; set; }
        public Process()
        {

        }
        public Process(string name,int time)
        {
            this.name = name;
            this.time = time;
        }
    }


    public class Queue
    {
        int head { get; set; }
        int tail { get; set; }
        int max { get; set; }
        Process[] queue { get; set; }

        public Queue()
        {
            head = 0;
            tail = 0;
            max = 100000;
            queue = new Process[max];
        }

        private bool isEmpty()
        {
            return head == tail;
        }

        private bool isFull()
        {
            return head == (tail + 1) % max;
        }

        public void enqueue(Process x)
        {
            if (isFull())
            {
                Console.WriteLine("オーバーフロー");
            }
            queue[tail] = x;
            if (tail + 1 == max)
            {
                tail = 0;
            }
            else
            {
                tail++;
            }

        }

        public Process dequeque()
        {
            if (isEmpty())
            {
                Console.WriteLine("アンダーフロー");
            }
            Process x = queue[head];
            if (head + 1 == max)
            {
                head = 0;
            }
            else
            {
                head++;
            }
            return x;
        }

        public void calculation(int q)
        {
            int sum = 0;
            while(!isEmpty())
            {
                Process process = dequeque();
                if (process.time > q)
                {
                    sum += q;
                    process.time -= q;
                    enqueue(process);
                }
                else
                {
                    sum += process.time;
                    Console.Write(process.name);
                    Console.Write(' ');
                    Console.WriteLine(sum);
                }
            }
        }
    }

}



Measured memory_bytes: 23776