akhauriyash/Code-Regression huggingface dataset:
#pragma region header
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int r,g,b,n;cin >> r >> g >> b >> n;
    int count = 0;
    rep(i, n/r+1) {
        rep(j, n/g+1) {
            if((n-(r*i+g*j))%b==0&&(n-(r*i+g*j))/b>=0) {
                count++;
                // cout << i << ' ' << j << ' ' << (n-(r*i+g*j))/b << endl;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3644
void main() {
	auto N = ri;
	auto A = readAs!(int[]);
	long[] arr;
	foreach(i; 0..N) {
		arr ~= A[i] - (i+1);
	}
	arr.sort();
	//arr.writeln;
	long t;
	if(N%2==0) {
		t = (arr[$/2-1] + arr[$/2])/2;
	} else {
		t = arr[$/2];
	}
	//t.writeln;
	long res;
	foreach(i; 0..N) {
		res += abs(arr[i] - t);
	}
	res.writeln;
}

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

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

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

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

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

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 11632
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;
const int INF = 1001001001;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, k;
    cin >> n >> k;
    ll res = 0;
    while(n > 0){
        ++res;
        n /= k;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(A * N, B) << endl;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

struct Node{
	int key;
	Node *prev,*next;
};

Node *nil;
void init(){
	nil=(Node *)malloc(sizeof(Node));
	nil->next=nil;
	nil->prev=nil;
}

void insert(int key){
	Node *x=(Node *)malloc(sizeof(Node));
	x->key=key;
	x->next=nil->next;
	nil->next->prev=x;
	nil->next=x;
	x->prev=nil;
}

Node* listSearch(int key){
	Node *cur=nil->next;
	while(cur!=nil && cur->key!=key){
		cur=cur->next;
	}
	return cur;
}

void deleteNode(Node *t){
	if(t==nil)return;
	t->prev->next=t->next;
	t->next->prev=t->prev;
	free(t);
}

void deleteFirst(){
	deleteNode(nil->next);
}

void deleteLast(){
	deleteNode(nil->prev);
}

void deleteKey(int key){
	deleteNode(listSearch(key));
}

int n;
int main(void){
	init();
	char com[21];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int key;
		scanf("%s",com);
		if(com[0]=='i'){
			scanf("%d",&key);
			insert(key);
		}
		else if(com[0]=='d'){
			if(strlen(com)>6){
				if(com[6]=='F')deleteFirst();
				if(com[6]=='L')deleteLast();
			}else{
				scanf("%d",&key);
				deleteKey(key);
			}
		}
	}
	Node *now=nil->next;
	while(now!=nil){
		printf("%d%c",now->key,now->next==nil?'\n':' ');
		now=now->next;
	}
	return 0;
}



Measured memory_bytes: 33940
#include <iostream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
int main(){
	char s[10010];
	int n,str,i;
	cin>>n>>s;
	str=strlen(s);
	for(i=0;i<str;i++){
		s[i]+=n;
		if(s[i]>90){
			s[i]-=26;
		}
		cout<<s[i];
		
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
typedef long long ll;

int main()
{
    ll n;
    int q;
    cin >> n >> q;
    set<ll> st1, st2;
    st1.insert(n);
    st2.insert(n);
    ll c1[200005]{0}, c2[200005]{0};
    ll ans = (n - 2) * (n - 2);
    while(q--){
        int c;
        ll x;
        cin >> c >> x;
        if(c == 1){
            auto itr = st1.lower_bound(x);
            if(itr == st1.begin()){
                st1.insert(x);
                c1[x] = *st2.begin() - 2;
                ans -= c1[x];
            }
            else ans -= c1[*--itr];
        }
        else{
            auto itr = st2.lower_bound(x);
            if(itr == st2.begin()){
                st2.insert(x);
                c2[x] = *st1.begin() - 2;
                ans -= c2[x];
            }
            else ans -= c2[*--itr];
        }
    }
    cout << ans << endl;
}


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

// flag?????¨????????????????????????
int bubbleSort(int A[], int N) {
  int sw = 0;
  bool flag = 1;
  for ( int i = 0; flag; i++ ) {
    flag = 0;
    for ( int j = N - 1; j >= i + 1; j-- ) {
      if ( A[j] < A[j - 1] ) {
        // ??£??\????´????????????????
        swap(A[j], A[j - 1]);
        flag = 1;
        sw++;
      }
    }
  }
  return sw;
}

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

  sw = bubbleSort(A, N);

  for ( int i = 0; i < N; i++ ) {
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;

  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

ll modpow(ll a,ll n){
  a%=MOD;
  ll res=1;
  while(n){
    if(n&1) res=res*a%MOD;
    a=a*a%MOD;
    n>>=1;
  }
  return res;
}

int main(){
  ll n,k;
  cin>>n>>k;
  ll cnt[100005];
  for(ll gcd=1;gcd<=k;gcd++){
    ll d=k/gcd;
    cnt[gcd]=modpow(d,n);
  }
  for(ll gcd=k;gcd>=1;gcd--){
    for(int i=2*gcd;i<=k;i+=gcd){
      cnt[gcd]=(cnt[gcd]-cnt[i]+MOD)%MOD;
    }
  }
  ll ans=0;
  for(ll gcd=1;gcd<=k;gcd++){
    ans=(ans+(gcd*cnt[gcd])%MOD)%MOD;
  }
  cout<<ans<<endl;
  return 0;
}








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

int A, B;

int main () {
	cin >> A >> B;
	if(A==1) A+=13;
	if(B==1) B+=13;
	if (A > B){
		cout << "Alice" << endl;
	}
	if (A < B){
		cout << "Bob" << endl;
	}
	if (A==B){
		cout << "Draw" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
  int N, L;
  cin >> N >> L;
  string word;
  vector<string> v;
  for (int i = 0; i < N; i++) {
    cin >> word;
    v.push_back(word);
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < N; i++)
    cout << v[i];
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<ctype.h>

#define MOD 1e7+7
typedef long long ll;

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

ll mylcm(ll a, ll b) { return a / mygcd(a, b) * b; }

ll mymax(ll a, ll b) { return (a > b) ? a : b; }

ll mymin(ll a, ll b) { return (a < b) ? a : b; }

ll myasc(const void* a, const void* b) { return *(ll*)a - *(ll*)b; }

ll mydsc(const void* a, const void* b) { return *(ll*)b - *(ll*)a; }

int flag;
ll n,m,a,r,c,h ;
char s[11];

int main() {
	scanf("%lld", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", s);
		if (s[0] == 'M') m++; 
		else if (s[0] == 'A') a++;
		else if (s[0] == 'R') r++; 
		else if (s[0] == 'C') c++; 
		else if (s[0] == 'H') h++;
	}
	if (m == 0) flag++;
	if (a == 0) flag++;
	if (r == 0) flag++;
	if (c == 0) flag++;
	if (h == 0) flag++;
	if (flag >= 3) {
		printf("0");
		return 0;
	}
	printf("%lld",m*(a*r+a*c+a*h+r*c+r*h+c*h)+a*(r*c+r*h+c*h)+r*c*h);

	return 0;
}


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

int main()
{
  std::string s, t;
  std::cin >> s >> t;
  s = s+s;

  std::string ans = "No";
  std::string::iterator its;
  std::string::iterator itt;
  for (its = s.begin(); its != s.end(); its++) {
    if (*its == *(t.begin())) {
      bool judge = true;
      int idx = std::distance(s.begin(), its);
      for (itt = t.begin(); itt != t.end(); itt++, idx++) {
	if (s[idx] != *itt) {
	  judge = false;
	  break;
	}
      }
      if (judge == true) {
	ans = "Yes";
	break;
      }
    }
  }

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


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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int n;
int d[100010];
signed main() {
    cin >> n;
    for (int i=0;i<n;i++) cin >> d[i];
    sort(d,d+n);
    int ans = d[n/2] - d[n/2-1];
    cout << ans << endl;
}


Measured memory_bytes: 1024
n,m = map(int, input().split())
l = [[] for _ in range(n)]
ans = ""
for i in range(m):
  s,c = map(int, input().split())
  l[s-1].append(c)
if len(l) > 1 and 0 in l[0]:
  print(-1)
elif n == 1 and m == 0:
  print(0)
else:
  for j in l:
    if len(set(j)) > 1:
      print(-1)
      break
    elif len(j) == 0:
      if ans == "":
        ans += "1"
      else:
        ans += "0"
    else:
      ans += str(j[0])
  else:
    print(ans)

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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
constexpr ll INF = 1999999999999999997; 
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    int main() {
      fastio;

      ll n;
      cin>>n;
      // ll a[n];
      ll s=0;
      map<ll,ll> m;
      for(ll i=0;i<n;i++)
      {
        ll x;
        cin>>x;
        s+=x;
        m[x]++;
      }
      ll q;
      cin>>q;
      while(q--)
      {
           ll a,b;
           cin>>a>>b;
           s=s-(m[a]*a);
           m[b]+=m[a];
           s=s+(m[a]*b);
           m.erase(a);
           cout<<s<<endl;
      }
    }

Measured memory_bytes: 7524
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
edge = [[] for _ in range(N)]
for i in range(M):
  a,b = map(int, input().split())
  edge[a-1].append(b-1)

def dfs(start):
  stack = [start]
  while stack:
    v = stack[-1]
    marker = 0
    path_l[v] = 0
    for u in edge[v]:
      if path_l[u]==-1: #子へ降ろす
        marker = 1
        stack.append(u)
      else: #子から吸い上げる
        #吸い上げる際の個々の処理
        path_l[v] = max(path_l[v], path_l[u]+1)
    if marker==0:
      stack.pop()
  return

path_l = [-1]*N
for i in range(N):
  if path_l[i]==-1:
    dfs(i)
ans = max(path_l)
print(ans)


Measured memory_bytes: 89148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define REV(x) (reverse(x.begin(),x.end()))
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))
const ll INF=1e18+7;
const ll MOD=1e9+7;
const ll N=100002;
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}



int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll q,h,s,d,n;
	cin>>q>>h>>s>>d>>n;
	ll min1,min2;
	min1 = min({q*4,h*2,s});
	min2 = min(d,min1*2);
	ll ans = (n/2)*min2;
	if(n%2)ans+=min1;
	cout<<ans<<endl;

}

Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    double a=scan.nextDouble();
    double b=scan.nextDouble();
    double x=scan.nextDouble();
    
    double S=x/a;
    double h=0;
    if(S>=a*b/2){
      h=(double)(a*b-S)*2/a;
    }else{
      a=(double)S*2/b;
      h=b;
    }
    System.out.println(Math.toDegrees(Math.atan((double)h/a)));
  }
}

Measured memory_bytes: 26452
from sys import stdin
input = stdin.readline

# map(int, input().rstrip().split())

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

LINF = int(1e18+7)
S = input().rstrip()
K = int(input().rstrip())

tmp = LINF
ch = '1'
for i in range(len(S)):
  if S[i] != '1':
    tmp = i
    ch = S[i]
    break

if tmp >= K:
  print(1)
else:
  print(ch)



Measured memory_bytes: 38384
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
// typedef pair<ll,ll> P;

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

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

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

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

double sum[3010][3010];
int main() {
    int N; cin >> N;
    double p[3010];
    rep(i,N){
        cin >> p[i];
    }
    sum[0][0]=1.0;
    for(int i=0; i<N; i++){
        for(int j=0; j<=i; j++){
            sum[i+1][j+1]+=sum[i][j]*p[i];
            sum[i+1][j]+=sum[i][j]*(1-p[i]);
        }
    }
    double res = 0.0;
    for (int j = (N+1)/2; j <= N; ++j) res += sum[N][j];

    cout << fixed << setprecision(20) << res << endl;
    return 0;
}


Measured memory_bytes: 69120
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

int main()
{
    cin >> N;
    vector<int> Y(N), M(N), D(N);
    for (int i = 0; i < N; i++)
    {
        cin >> Y[i] >> M[i] >> D[i];
    }
    for (int i = 0; i < N; i++)
    {
        ll ans = 0;
        for (int j = Y[i]; j < 1000; j++)
        {
            for (int k = 1; k <= 10; k++)
            {
                if (j == Y[i] && k < M[i])
                    continue;
                bool f = k % 2 == 1; // ture -> big
                if (j % 3 == 0)
                    f = true;
                ans += (f ? 20 : 19);
                if (j == Y[i] && k == M[i])
                    ans -= D[i] - 1;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 2980
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var imp = Console.ReadLine().Split(' ');
            if (int.Parse(imp[0]) + int.Parse(imp[1]) >= int.Parse(imp[2]))
            {
                Console.Write("Yes");
            }
            else
            {
                Console.Write("No");
            }
            //System.Threading.Thread.Sleep(1000);
        }
    }
}


Measured memory_bytes: 11092
import itertools
import math

dist = lambda X,Y: math.sqrt(sum((x-y)**2 for x,y in zip(X,Y)))

def solve():
    N, D = [int(s) for s in input().split() if s]
    X = []
    cnt = 0
    for _ in range(N):
        X.append([int(s) for s in input().split() if s])
    for x1,x2 in itertools.combinations(X,2):
        if dist(x1,x2).is_integer():
            cnt+=1
    print(cnt)

solve()

Measured memory_bytes: 3064
t[1250],n,w,z,i,k;main(u,v){for(;scanf("%d%d",&w,&n)+n;memset(t,i=!printf("Case %d:\n%d\n%d\n",++z,t[w],k),5e3))for(;i>u?i--:n--&&scanf("%d,%d",&v,&u,i=w);k=t[i]-t[w]?k:i)t[i]=fmax(t[i-u]+v,t[i]);}

Measured memory_bytes: 0
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

int main(){
  int n,a,b;
  cin>>n>>a>>b;
  int sum=0;
  for(int i=1;i<=n;i++){
    string s=to_string(i);
    int part=0;
    for(int j=0;j<s.size();j++){
      part+=s[j]-'0';
    }
    if(part>=a && part <=b)sum+=i;
  }
  cout<<sum<<endl;
}
    

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
	int n;
	cin>>n;
	vector<ll> a(n);
	rep(i,n)cin>>a[i];
	a.erase(unique(a.begin(),a.end()),a.end());
	n=a.size();
	int cnt=0;
	int up=2;
	rep(i,n-1){
		if(up==2){
			++cnt;
			up=(a[i]<a[i+1]);
			continue;
		}
		int b=(a[i]<a[i+1]);
		if(b!=up){
			up=2;
		}
	}
	if(up==2)++cnt;
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 1024
/*
                                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include <bits/stdc++.h>
 
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
 
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}
signed main()
{   jaldi
    string str,ch;
    cin>>ch>>str;
    cout<<str<<ch;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
//#include <atcoder/all>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007; //998244353;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}

static void A();

int main()
{
	A();
	fflush(stdout);
	return 0;
}

static void A()
{
	int S;
	get(S);

	std::vector<LLONG> dp(S + 1, 0);
	dp[0] = 1;

	for (int i = 3; i <= S; i++) {
		dp[i] = (dp[i - 3] + dp[i - 1]) % MOD_NUM;
	}
	printf("%lld\n", dp[S]);
} 


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

using namespace std;

#define ll long long
#define fr(n) for(ll i=0;i<n;i++)
#define frr(n) for(ll i=n;i>=0;i--)
#define nl printf("\n")
#define debug(arr,n) for(int i=0; i<n; i++) printf("%lld ", arr[i])
#define debugr(arr,s,e) for(int i=s; i<=e; i++) printf("%lld ", arr[i])

int main(){
    ll n,q;
    cin>>n>>q;
    vector<queue<int>>qu(n);
    while(q--){
        ll a,t,x;
        cin>>a;
        if(a==0){
            cin>>t>>x;
            qu[t].push(x);
        }
        else if(a==1){
            cin>>t;
            if(!qu[t].empty()) cout<<qu[t].front()<<endl;
        }
        else{
            cin>>t;
            if(!qu[t].empty()) qu[t].pop();
        }
    }
    return 0;
}


Measured memory_bytes: 4316
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

string S, T;

int main() {
	cin >> S >> T;
	int ans = (int)T.size();
	for (unsigned int i = 0; i <= S.size() - T.size(); i++) {
		int now = 0;
		for (unsigned int j = 0; j < T.size(); j++) {
			if (S[i + j] != T[j]) {
				now++;
			}
		}
		ans = min(ans, now);
	}
	cout << ans << endl;
}

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

int basket[200001];
int main()
{
	int n, k; cin >> n >> k;
	for (int i = 0; i < n; ++i)
	{
		int a; cin >> a;
		basket[a]++;
	}
	sort(basket, basket+n+1);
	int c = 0;
	for (int i = n; i > n-k; --i) c += basket[i];
	cout << n-c << endl;
}



Measured memory_bytes: 4412
from numpy.linalg import solve
def C(n, r, MOD):
    num = 1
    den = 1
    for i in range(r):
        num *= n - i
        num %= MOD
        den *= i + 1
        den %= MOD
    return ((num * pow(den, MOD - 2, MOD)) % MOD)

X, Y = map(int, input().split())
MOD = 1_000_000_007
A = [[1, 2],[2, 1]]
B = [X, Y]
n, m = solve(A, B)
if n >= 0 and m >= 0 and n == int(n):
    n = int(n)
    m = int(m)
    print(C(n + m, n, MOD))
else:
    print(0)


Measured memory_bytes: 27416
#include<stdio.h>
#include<string.h>
int main(){
char moji[201],temp[201];
int m,i,n;
while(1){
scanf("%s",moji);
if(strcmp(moji,"-")==0) break;
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d",&n);
strcpy(temp,&moji[n]);
strncat(temp,moji,n);
strcpy(moji,temp);
}
printf("%s\n",moji);
}
return 0;
}



Measured memory_bytes: 2052
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}

int main() {
    int n;
    cin >> n;
    vector<pair<int,int>>p,q;
    rep(i,n) {
        int a,b;
        cin >> a >> b;
        p.push_back(make_pair(b,a));//(y,x)
    }
    rep(i,n) {
        int c,d;
        cin >> c >> d;
        q.push_back(make_pair(c,d));
    }
    sort(q.begin(),q.end());//青い点についてx座標が小さいものからみていく
    sort(p.rbegin(),p.rend());//赤い点についてy座標が大きいものからとる
    int ans = 0;
    vector<bool>flagp(n,true);
    vector<bool>flagq(n,true);
    rep(i,n) {
        if(!flagq[i]) continue;
        rep(j,n) {
            if(!flagp[j])continue; 
            if(p[j].second < q[i].first && p[j].first < q[i].second) {
                ans++;
                flagp[j] = false;
                flagq[i] = false;
                break;
            }
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> vec(m);
  rep(i,m) cin>>vec[i];

  vector<bool> b(n,true);
  rep(i,m) b[vec[i]] = false;

  int ans = 0;
  for(int d=1; d<n; d*=2){
    for(int i=0; i<n; i+=d*2){
      if(b[i] && b[i+d]) ans++;
      else if(b[i] || b[i+d]) b[i]=true;
    }
//    dbg(b);
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, K; cin >> N >> K;
    vector<ll> x(N); rep(i, N){cin >> x.at(i);}

    ll cost = INF;
    rep(l, N - K + 1){
        ll ans;
        ll ansl = abs(x.at(l)) + abs(x.at(l+K-1)-x.at(l));
        ll ansr = abs(x.at(l+K-1)) + abs(x.at(l+K-1)-x.at(l));
        ans = (ansl > ansr) ? ansr : ansl;
        if (ans < cost){cost = ans;}
    }
    cout << cost << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.ArrayList;
class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String[] s = stdIn.next().split("");

        ArrayList<String> a = new ArrayList<String>();

        for(int i = 0; i < s.length;i++) {
            if(s[i].equals("R") && s[i+1].equals("L")) {
                a.add("X");
                if(i == s.length-1){
                    break;
                }
                i++;
            }else if(s[i].equals("R")) {
                a.add("R");
            }else {
                a.add("L");
            }
        }

        int n = a.size();

        int ii = 0;
        //int rcount = 0;
        //int lcount = 0;
        ArrayList<Integer> rlength = new ArrayList<Integer>();
        ArrayList<Integer> llength = new ArrayList<Integer>();

        int[] result = new int[s.length];
        int pluscount = 0;
        int iii = 0;
        for(int i = 0;i < n;i++) {
            if(a.get(i).equals("R")) {
                //rcount++;
                rlength.add(i);
                //result[i] = 0;
            }else if(a.get(i).equals("L")) {
                //lcount++;
                llength.add(i);
                //result[i] = 0;
            }else {
                result[i+pluscount] = 1;
                result[i+1+pluscount] = 1;
                for(int j = 0;j < rlength.size();j++) {
                    if((i - rlength.get(j))%2 == 0) {
                        result[i+pluscount]++;
                    }else{
                        result[i+1+pluscount]++;
                    }
                }
                rlength = new ArrayList<Integer>();

                for(int j = 0;j < llength.size();j++) {
                    if((llength.get(j)-iii)%2 == 1) {
                        result[ii]++;
                    }else{
                        result[ii+1]++;
                    }
                }
                llength = new ArrayList<Integer>();
                ii = i+pluscount;
                iii = i;
                pluscount++;
            }
        }

        if(llength.size() != 0) {
            for(int j = 0;j < llength.size();j++) {
                if((llength.get(j)-iii)%2 == 1) {
                    result[ii]++;
                }else{
                    result[ii+1]++;
                }
            }
        }

        for(int i = 0;i < result.length;i++) {
            System.out.println(result[i]);
        }
    }

}

Measured memory_bytes: 45156
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {


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

    private void solve() throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        StringTokenizer tokenizer = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(tokenizer.nextToken());
        int k = Integer.parseInt(tokenizer.nextToken());
        int[] scores = new int[n];
        tokenizer = new StringTokenizer(f.readLine());
        for (int i = 0; i < n; i++) scores[i] = Integer.parseInt(tokenizer.nextToken());

        for (int i = k; i  < n; i++) {
            if (scores[i] > scores[i - k]) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

        out.close();
    }
}

Measured memory_bytes: 55864
#include <stdio.h>
#include <queue>
using namespace std;
struct side{
    int to;
    int cost;
};
struct walk{
    int now;
    int cost;
};
int main(){
    int n,l,m,d[100];
    queue<walk> q;
    vector<side> map[100];
    walk temp,t;
    side s;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d%d",&l,&m);
        d[i]=-1;
        for(int j=0;j<m;j++){
            scanf("%d%d",&s.to,&s.cost);
            map[l].push_back(s);
        }
    }
    temp.now=temp.cost=0;
    q.push(temp);
    while(!q.empty()){
        temp=q.front();
        q.pop();
        if(d[temp.now]!=-1&&d[temp.now]<=temp.cost)continue;
        d[temp.now]=temp.cost;
        for(int i=0;i<map[temp.now].size();i++){
            t.cost=temp.cost+map[temp.now][i].cost;
            t.now=map[temp.now][i].to;
            q.push(t);
        }
    }
    for(int i=0;i<n;i++){
        printf("%d %d\n",i,d[i]);
    }
}

Measured memory_bytes: 2856
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N;

int main() {
    cin >> N;

    int ans = (N - 1) / 2;

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


Measured memory_bytes: 256
k = int(input())
a, b = list(map(int, input().split(" ")))

a_r = a % k
a_m = a // k
b_r = b % k
b_m = b // k

if (a_m != b_m) or (a_r == 0) or (b_r == 0):
    print('OK')
else:
    print('NG')

Measured memory_bytes: 9180
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int N;

int main() {
    cin >> N;
    vector<int> nums(N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> nums[i];
        sum += nums[i];
    }
    int x = floor(sum / N);
    int y = ceil((float)sum / N);
    int ans1 = 0, ans2 = 0;
    for(auto index : nums) {
        ans1 += (index - x) * (index - x);
        ans2 += (index - y) * (index - y);
    }
    cout << min(ans1, ans2) << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <math.h>
using namespace std;

int main() {
    int A, B;
    cin >> A >> B;
    if ((A+B)<=16) {
        if ( ((A+B)-abs(A-B)) >= 2 * abs(A-B) ) {
            cout << "Yay!";
        } else {
            cout << ":(";
        }
    } else {
        cout << ":(";
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int k,t,a[10005];
int main() 
{
    cin>>k>>t;
    for(int i=1;i<=t;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+t+1);
    cout<<max(a[t]-1-(k-a[t]),0)<<endl;//-1是减第一天 
    return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vl vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  int A, B;
  std::cin >> A >> B;
  if(A<=2*B){
    std::cout << 0 << '\n';
  }else{
    std::cout << A -2*B << '\n';
  }
  return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;

using namespace std;

int main() 
{
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    
    int x = tx - sx;
    int y = ty - sy;

    irep(i, x) { cout << "R"; }
    irep(i, y) { cout << "U"; }
    irep(i, x) { cout << "L"; }
    irep(i, y) { cout << "D"; }

    cout << "D"; 
    
    irep(i, x+1) { cout << "R"; }
    irep(i, y+1) { cout << "U"; }

    cout << "L"; 
    cout << "U"; 

    irep(i, x+1) { cout << "L"; }
    irep(i, y+1) { cout << "D"; }

    cout << "R" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int x[100010];
priority_queue<int> q;
signed main(){
	int a,b,ans=0;
	cin>>a>>b;
	f(i,a){
		cin>>x[i];
		q.push(x[i]);
	}
	f(i,b){
		int c=q.top();
		q.pop();
		c/=2;
		q.push(c);
	}
	while(q.size()){
		int d=q.top();
		ans+=d;
		q.pop();
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1912
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                             it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;

// up right down left
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};

const double EPS = 1e-9;
const int days[]     = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

const int NO = 1000000000;

int main(){
    while(true){
        int n;
        cin >> n;
        if(n==0)break;
        vector<pair<pair<int,int>,int> > R;
        int m=0;
        rep(i,n){
            int a,b,c;
            cin >> a >> b >> c;
            m = max(m,max(a,b));
            R.push_back(mp(mp(a,b),c));
        }
        m++;
        vector<vector<int> > V(m,vector<int>(m,NO));

        rep(i,m){
            V[i][i] = 0;
        }

        rep(i,n){
            int a = R[i].first.first;
            int b = R[i].first.second;
            int c = R[i].second;
            V[a][b] = V[b][a] = c;
        }



        for(int k=0;k<m;k++){
            for(int i=0;i<m;i++){
                for(int j=0;j<m;j++){
                    V[i][j] = min(V[i][j],V[i][k]+V[k][j]);
                }
            }
        }

        int ret = -1;
        int mi = NO;

        for(int i=0;i<m;i++){
            int s = 0;
            for(int j=0;j<m;j++){
                s += V[i][j];
            }
            if(mi > s){
                mi = s;
                ret = i;
            }
        }
        cout << ret << " " << mi << endl;
    }
    return 0;
}

Measured memory_bytes: 1216
# coding: utf-8
import numpy as np
from numba import i8, njit


@njit(i8[:](i8, i8[:]), cache=True)
def f(k, A):
    n = len(A)
    cur = A
    for _ in range(k):
        prev = cur
        cur = np.zeros_like(A)
        for x, p in enumerate(prev):
            cur[max(0, x-p)] += 1
            if x+p+1 < n:
                cur[x+p+1] -= 1

        satulated = True
        for i in range(1, n):
            cur[i] += cur[i-1]
            satulated &= cur[i] == n
        if satulated:
            break
    return cur


def solve(*args: str) -> str:
    n, k = map(int, args[0].split())
    A = np.array(tuple(map(int, args[1].split())))
    return ' '.join(map(str, f(k, A)))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 130240
# from sys import exit

N = int(input())
P = [int(n) for n in input().split()]
t = [int(n) for n in input().split()]
Pt = sorted([(p, t) for p, t in zip(P,t)])

memo = [0 for _ in range(N)]
def rec(n):
    if n >= N:
        return 0
    elif memo[n] != 0:
        return memo[n]
    else:
        memo[n] = min([rec(n+t[i]) + P[i] for i in range(4)])
        return memo[n]
print(rec(0))



Measured memory_bytes: 5772
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

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



signed main(){
	ll n,m;
	cin >> n >> m;
	
	ll dp[n+1] = {};
	dp[0] = 1;
	ll a[n] = {};
	bool check[n] = {false};
	
	rep(i,0,n){
		cin >> a[i];
		check[a[i]-1] = true;
	}
	
	rep(i,0,n){
		if(!check[i]){
			dp[i+1] += dp[i];
			dp[i+1] %= MOD;
		}
		if(i < n && !check[i+1]){
			dp[i+2] += dp[i];
			dp[i+2] %= MOD;
		}
		
		
	}
	
	cout << dp[n] << endl;
	
    return 0;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

int A[1100];

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

    while(true){
        int N;
        std::cin >> N;
        if(!N){return 0;}
    
        for(int i=0;i<N;++i){
            std::cin >> A[i];
        }

        sort(A, A+N);

        int res = 1001001001;
        for(int i=0;i+1<N;++i){
            res = min(res, A[i+1] - A[i]);
        }

        std::cout << res << std::endl;
    }
}



Measured memory_bytes: 3152
n, m = map(int, input().split())
xl = sorted(list(map(int, input().split())))

diff = [0]*(m-1)

for i in range(m-1):
    diff[i] = xl[i+1] - xl[i]

diff_s = sorted(diff, reverse=True)
# print(diff_s)
print(sum(diff_s[n-1:]))

Measured memory_bytes: 20312
#include<bits/stdc++.h>
#define FOR(i,x) for(i=1;i<=x;i++)
using namespace std;
using ll = long long int;
typedef vector<ll> vi;
ll k,b,ar[11]={};
void Next_letter()
{
	char k;
	cin>>k,k++;
	cout<<k<<"\n";
}
int main()
{
    Next_letter();
	return 0;
}

Measured memory_bytes: 256
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F();
		var a = G();
		var b = new List<int>(N);
		for (var i = N - 1; i >= 0; i -= 2) b.Add(a[i]);
		for (var i = N % 2; i < N; i += 2) b.Add(a[i]);
		Console.WriteLine(string.Join(" ", b));
	}
	public static List<long> GetPrimes(long n)
	{
		if (n < 3) n = 3;
		var m = (n - 1) >> 1;
		var primes = new List<long>();
		primes.Add(2);
		var composites = new bool[m];
		composites[0] = false;
		for (var p = 0L; p < m; p++)
		{
			if (!composites[p])
			{
				var pnum = 2 * p + 3;
				primes.Add(pnum);
				for (var k = 3 * p + 3; k < m; k += pnum) composites[k] = true;
			}
		}
		return primes;
	}
}


Measured memory_bytes: 52024
//#pragma GCC optimize(2)
#include<set>    
#include<map>    
#include<stack>    
#include<ctime>    
#include<cstdio>    
#include<queue>    
#include<cmath>    
#include<vector>    
#include<cstring>   
#include<climits>    
#include<iostream>   
#include<algorithm>
using namespace std;
#define LL long long
#define ULL unsigned long long
int read(){
    int f=1,x=0;char c=getchar();
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
    while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();}
    return f*x;
}
#define MAXN 1000000
#define INF 0x3f3f3f3f
char S[MAXN+5];
int nxt1[MAXN+5],nxt2[MAXN+5];
int main(){
	scanf("%s",S+1);
	int n=strlen(S+1);
	for(int i=2,j=0;i<=n;i++){
		while(j!=0&&S[i]!=S[j+1])
			j=nxt1[j];
		if(S[i]==S[j+1])
			j++;
		nxt1[i]=j;
	}
	reverse(S+1,S+n+1);
	for(int i=2,j=0;i<=n;i++){
		while(j!=0&&S[i]!=S[j+1])
			j=nxt2[j];
		if(S[i]==S[j+1])
			j++;
		nxt2[i]=j;
	}
	reverse(S+1,S+n+1);
	reverse(nxt2+1,nxt2+n+1);
	int ans=0;
	if(n%(n-nxt1[n])!=0||nxt1[n]==0)
		puts("1"),puts("1"),exit(0);
	if(n-nxt1[n]==1)
		printf("%d\n%d\n",n,1),exit(0);
	for(int i=1;i<n;i++)
		if((i%(i-nxt1[i])!=0||nxt1[i]==0)&&((n-i)%(n-i-nxt2[i+1])!=0||nxt2[i+1]==0))
			ans++;
	printf("%d\n%d\n",2,ans);
	return 0;
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
	for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
	for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
	os<<"{ ";for(auto m:M)os<<"("<<m.F<<":"<<m.S<<")";
	return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << 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 trace(...) 1
#endif
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define For(i,n) for(int i=0;i<(int)n;++i)
#define Rev(i,n) for(int i=(int)n-1;i>=0;--i)
#define Rep(i,n) for(int i=1;i<=(int)n;++i)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


int main(){
	fio; cout<<fixed<<setprecision(25);	
	ll n; cin >> n;
	ll a = 1 , b = 1;
	ll c , d;
	for(int i = 1 ;i <= n ; ++i){
		cin >> c >> d;

		ll jst , jst1;
		if(a%c == 0){
			jst = a;
		}
		else{
			jst = a + (c-a%c);
		}
		if(b%d == 0){
			jst1 = b;
		}
		else{
			jst1 = b + (d-b%d);
		}
		ll r = max(jst/c , jst1/d);
		a = r*c;
		b = r*d;
		// a = jst;
		// b = jst1;
		// trace(jst , jst1 , r , a , b);
	}
	cout << a+b << endl;



	return 0;
}


Measured memory_bytes: 256