akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define n 100000


void change(int dat,int ch[],int coin_value[],int vaild_coin)
{

    int i,j,tmp;
    int min = n+1;
    for(j = 0; j < vaild_coin; j++)
    {
        if(dat >= coin_value[j]){
            tmp = ch[dat - coin_value[j]] + 1;
        }else tmp = dat;

        if(min > tmp)//算硬幣數量
                min  = tmp;
    }
    ch[dat] = min;
}

int main()
{

    int i,j,k;
    int dat,six,nine;
    int *coin_value;
    int *ch;

    ch = (int *)malloc(n*sizeof(int));//錢
    /*for(i = 0;; i++) //製造錢幣
        if(pow(6,i) > n)
        {
            six = i;
            break;
        }*/
    for (i = 1, six = 0; i <= n; i *= 6, six++);
    for (i = 1, nine = 0; i <= n; i *= 9, nine++);

    /*for(i = 0;; i++) //製造錢幣
        if(pow(9,i) > n)
        {
            nine = i;
            break;
        }*/

    int total = six + nine;
    coin_value = (int *)malloc((total)*sizeof(int));
    coin_value[0] = 1;

    for (six = 6, nine = 9, i = 1; six <= n || nine <= n; i++) {
        if (six < nine) {
            coin_value[i] = six;
            six *= 6;
        } else {
            coin_value[i] = nine;
            nine *= 9;
        }
    }
    /*for(i = 1,j = 1,k = 1;; k++)
    {
        int tmps = pow(6,i);
        int tmpn = pow(9,j);
        if(tmps > tmpn) //6 > 9
        {
            if(tmpn < n) //9 < 100000 排序
            {
                coin_value[k] = tmpn;
                j++;
            }
        }
        else if(tmps < n)
        {
            if(tmps < n)
            {
                coin_value[k] = tmps;
                i++;
            }
        }
        else break;
    }*/
/*
    for (i = 0; i < total; i++)
        printf("%d: %ld\n", i, coin_value[i]);
    printf("%d\n", total);
*/
    int vaild_coin = total - 1;

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

        if(i == 0){
            ch[i] = 0;
        }else{
            change(i,ch,coin_value,vaild_coin);
        }
    }

    //freopen("testdata2.in","r",stdin);

    while(scanf("%d",&dat) != EOF){
        printf("%d\n",ch[dat]);
    }

    free(coin_value);
    free(ch);

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>

using namespace std;

int ipow10(int x) {
	return x == 0 ? 1 : 10 * ipow10(x - 1);
}

int main(void) {
	int N, M;
	cin >> N >> M;
	vector<int> dec(N + 1, 0);
	vector<bool> defined(N + 1, false);
	for (int i = 0; i < M; i++) {
		int s, c;
		cin >> s >> c;
		if (defined.at(s) && dec.at(s) != c || N != 1 && s == 1 && c == 0) {
			cout << -1 << endl;
			return 0;
		} else {
			dec.at(s) = c;
			defined.at(s) = true;
		}
	}

	if (N != 1 && !defined.at(1)) dec.at(1) = 1;

	int ans = 0;
	for (int i = 1; i <= N; i++) {
		ans += dec.at(i) * ipow10(N - i);
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    auto sa = atcoder::suffix_array(S);
    auto la = atcoder::lcp_array(S, sa);
    ll ans = 1LL * S.size() * (S.size() + 1) / 2;
    for(auto num : la) ans -= num;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 15572
N, C = map(int, input().split())
D = [0] * C
for i in range(C):
    D[i] = list(map(int, input().split()))
grid = [0] * N
for i in range(N):
    grid[i] = list(map(int, input().split()))

cost0 = [0] * C
cost1 = [0] * C
cost2 = [0] * C
for color in range(C):
    for h in range(N):
        for w in range(N):
            mod = (h + w) % 3
            if mod == 0:
                cost0[color] += D[grid[h][w] - 1][color]
            elif mod == 1:
                cost1[color] += D[grid[h][w] - 1][color]
            else:
                cost2[color] += D[grid[h][w] - 1][color]

ans = float('inf')
for i in range(C):
    j_list = list(range(C))
    j_list.remove(i)
    for j in j_list:
        k_list = list(range(C))
        k_list.remove(i)
        k_list.remove(j)
        for k in k_list:
            ans = min(ans, cost0[i] + cost1[j] + cost2[k])
print(ans)


Measured memory_bytes: 47076
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    int ans = 0;
    int count=0;
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i]=='S'){
            count++;
        }
        else{
            if(count!=0){
                count--;
                ans++;
            }
        }
    }
    cout << s.size()-2*ans << "\n";
}



Measured memory_bytes: 720
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1e9+7;

signed main(){
	int n,k;
	cin >> n >> k;
	vector<int> v(n);
	for (int i=0; i<n; ++i) cin >> v[i];
	int ans = 0;
	for (int i=0; i<n; ++i){
		int cnt2=0,cnt=0;
		for (int j=i+1; j<n; ++j){
			if (v[j] < v[i]) ++cnt;
		}
		for (int j=0; j<n; ++j){
			if (v[j] < v[i]) ++cnt2;
		}
		int A = k*(k-1)/2;
		A %= MOD;
		A *= cnt2;
		A %= MOD;
		ans += A;
		ans %= MOD;
		ans += k*cnt;
		ans %= MOD;
	}
	ans %= MOD;
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <bitset>
#include <string>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <map>
#include <memory>
#include <climits>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
//#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef unsigned int UINT;
typedef unsigned long long ull;
typedef pair<int, int> pdi;
typedef pair<ll, int> pli;

int const maxn = 1e5 + 10;
inline int lc(int x)  {return x << 1;}
inline int rc(int x)  {return x << 1 | 1;}



int main(void) {
    FAST_IO;
    int k, x;
    cin >> k >> x;
    int s = max(x - k + 1, -1000000);
    int e = min(x + k, 1000000);
    for (int i =s; i < e; i++ )
        cout << i << " ";
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    ans = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                if 500*i + 100*j + 50*k == x:
                    ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n;
    cin >> n;
    VI a(n), index(n);
    FOR(i, 0, n) {
        cin >> a[i];
        index[--a[i]] = i;
    }

    ll ans = 0;
    multiset<int> set = { -1,n };
    FOR(i, 0, n) {
        ll b = index[i];
        auto itr = set.lower_bound(b);
        ll c = *itr, a = *--itr;
        ans += (b - a) * (c - b) * (i + 1LL);
        set.insert(b);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll 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;}}
long long COM(ll n, ll 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() { // A C A C T A C G
  int n,q;   //0 0 1 1 2 2 2 3 3
  cin>>n>>q;
  string s;
  cin>>s;
  vi sum(n+1,0);
  for(int i=1;i<n;i++){
    if(s[i-1]=='A'&&s[i]=='C'){
      sum[i+1]=sum[i]+1;
    }else{
      sum[i+1]=sum[i];
    }
  }
  vi ans(q);;
  vi l(n),r(n);
  rep(i,q) cin>>l[i]>>r[i];
  rep(i,q){
    ans[i]=sum[r[i]]-sum[l[i]];
  }
  rep(i,q){
    cout<<ans[i]<<endl;
  }
}


Measured memory_bytes: 5108
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N,M,K;
    cin >> N >> M >> K;
    vector<ll> A(N), B(M), SA(N+1), SB(M+1);
    rep(i,N){
        cin >> A[i];
    }
    rep(i,N){
        SA[i+1] = SA[i] + A[i];
    }
    rep(i,M){
        cin >> B[i];
    }
    rep(i,M){
        SB[i+1] = SB[i] + B[i];
    }
    ll ans = 0;
    rep(i,N+1){
        ll sum = SA[i];
        if(sum > K) continue;
        ll cap = K - sum;
        ll id = upper_bound(SB.begin(), SB.end(), cap) - SB.begin();
        id--;
        cmax(ans, i+id);
    }
    cout << ans << endl;
    /*
    ll sum = 0;
    ll ind1 = 0;
    while(ind1 < N && sum + A[ind1] <= K){
        sum += A[ind1];
        ind1++;
    }
    ll ind2 = 0;
    while(ind2 < M && sum + B[ind2] <= K) {
        sum += B[ind2];
        ind2++;
    }
    ll ans = ind1 + ind2;
    for(ll i = ind1-1;i>=0;i--){
        sum -= A[i];
        while(ind2 < M && sum + B[ind2] <= K){
            sum += B[ind2];
            ind2++;
        }
        ind1--;
        //cout << ans << " " << sum << endl;
        cmax(ans, ll(ind1+ind2));
    }
    cout << ans << endl;*/
}


Measured memory_bytes: 9508
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i < b; i++)
static lld l,x,y,n,m,i,z,p,j,k,c,d,s,t;string s1,s2;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>x>>y>>z>>t;
    if((x+y)>z+t)
        cout<<"Left";
    else if((x+y)<z+t)
        cout<<"Right";
    else
        cout<<"Balanced";
}

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

int main( void )
{
    ll n;
    cin >> n;
    
    if ( n % 2 == 0 )
        cout << n << endl;
    else
        cout << n * 2 << endl;
}


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

int main(void)
{
    for (int case_n = 1;; case_n++)
    {
        int n;
        cin >> n;
        if (n == 0)
            break;
        cout << "Case " << case_n << ": " << n << endl;
    }
    return 0;
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,ll> pii;
const int max_N=1e5+10;
int n,k;
const int inf=1e9+5;
vector <pii> G[max_N],rg[max_N];
vector<int>p(105,0);
int h[100005];

int main()
{
  cin >> n >> k;
  for(int i=0;i<n;i++)
    {
      cin >> h[i];
    }
  vector<int>dp(n+5,inf);
  dp[0]=0;
  for(int i=0;i<n;i++)
    {
      for(int j=1;j<=k;j++)
	{
	  if(i+j<n) dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
	}
    }
  cout << dp[n-1] << endl;
  return 0;
}


Measured memory_bytes: 5760
n = int(input())
c = {"S":[], "H":[], "C":[], "D":[]}
for _ in range(n):
    p, r = map(str, input().split())
    c[p].append(int(r))

for p in ["S", "H", "C", "D"]:
    c[p].sort()
    for r in sorted(set(list(range(1, 14)))-set(c[p])):
        print(p, r)


Measured memory_bytes: 5600
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int solve(string &s){
  if(s.length() >= 6 && s.substr(0, 2) == ">'" && s[(int)s.length() - 1] == '~'){
    int c1 = 0, c2 = 0, t = 0, f = 0;
    for(int i = 2; i + 1 < (int)s.length(); ++i){
      if(s[i] != '=' && s[i] != '#') f = 1;
      if(s[i] == '#' && t >= 1) f = 1;
      if(f) break;
      if(s[i] == '#') ++t;
      else if(t) ++c2;
      else ++c1;
    }
    if(!f && c1 == c2) return 0;
  }
  if(s.length() >= 6 && s.substr(0, 2) == ">^" && s.substr((int)s.length() - 2) == "~~"){
    int f = 0;
    for(int i = 2; i + 2 < s.length(); i += 2) if(s.substr(i, 2) != "Q=") f = 1;
    if(!f) return 1;
  }
  return -1;
}

int main() {
  int T; cin >>T;
  REP(t, T){
    string s; cin >>s;
    int ans = solve(s);
    cout <<(ans == 0 ? "A" : (ans == 1 ? "B" : "NA")) <<endl;
  }
  return 0;
}

Measured memory_bytes: 1216
/*
        @uthor: Kashish Gilhotra
        user: CodeChef, CodeForces, HackerEarth, HackerRank, SPOJ: kashish001
*/

#include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
  
#define int long long int 
typedef vector<int> vi;
const int mod = 1e9 + 7; 

//#define CI cpp_int
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define debug(...) cerr << "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " 
#define EB emplace_back
#define ALL(v) v.begin(), v.end() 
#define size(v) (int)v.size() 
#define endl "\n"
#define UMO unordered_map
#define USO unordered_set
#define setBits(n) __builtin_popcountll(n)
#define TC int t; cin >> t; while (t--) 

void Panda() {
    int n, d, cnt = 0;
    cin >> n >> d;
    for(int i = 0, x, y; i < n; i++) {
    	cin >> x >> y;
    	if(sqrt((int)pow(x, 2) + (int)pow(y, 2)) <= d) cnt++;
    }
    cout << cnt << endl;
}
  
int32_t main() {
 
    FAST;

   
    
    Panda();

    return 0; 
} 

Measured memory_bytes: 3596
// D - Summer Vacation

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

struct Work {
	int day;
	int reward;
};

bool operator < (const Work &a, const Work &b) {
	return a.reward < b.reward;
}

Work works[100000];
bool days[100000];

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

	int day, reward;
	for (int i=0; i<N; i++) {
		cin >> day >> reward;

		works[i].day = day;
		works[i].reward = reward;
	}

	// 報酬が得られるまでの日数で昇順ソート
	sort(works, works+N, [](const Work &a, const Work &b) {
    	return a.day < b.day;
  	});

	// 優先順序つきキュー
  	priority_queue<Work> PQ;

	ll ans = 0;
  	int i = 0;
  	// day = 最終日までの日数
  	for (int day=1; day<=M; day++) {
  		while (i < N) {
  			if (works[i].day <= day) {
  				PQ.push(works[i]);
  				i++;
  			} else {
  				break;
  			}
  		}

  		if (!PQ.empty()) {
  			ans += PQ.top().reward;
  			PQ.pop();
  		}
  	}

  	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  int a,b; cin>>a>>b;
  if(a%3==0||b%3==0||(a+b)%3==0)
  puts("Possible");
  else
  puts("Impossible");

  return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

/**
 *
 * @author Administrator
 */

public class Main {

    /**
     * @param args the command line arguments
     */
    public static double plzh(int a,int b){
        double fenzi=1,fenmu=1;
        for(int i=b;i>=a;i--){
            fenzi*=i;
        }
        for(int i=1;i<=a;i++){
            fenmu*=i;
        }
        return fenzi/fenmu;
    }
    public static void main(String[] args) {
        // TODO code application logic 
        BigDecimal res,t0,t1,t2,t3,t4;
        res=BigDecimal.ZERO;
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int count=0;
        int book[]=new int[5];
        for(int i=0;i<5;i++){
            book[i]=0;
        }
        for(int i=0;i<n;i++){
            String s=sc.next();
            char c=s.charAt(0);
            if(c=='M')
                book[0]++;
            else if(c=='A')
                book[1]++;
            else if(c=='R')
                book[2]++;
            else if(c=='C')
                book[3]++;
            else if(c=='H')
                book[4]++;
        }
        t0=new BigDecimal(book[0]);
        t1=new BigDecimal(book[1]);
        t2=new BigDecimal(book[2]);
        t3=new BigDecimal(book[3]);
        t4=new BigDecimal(book[4]);
        res=res.add(t0.multiply(t1.multiply(t2)).add(t0.multiply(t1.multiply(t3))).add(t0.multiply(t1.multiply(t4))).add(t0.multiply(t2.multiply(t3))).add(t0.multiply(t2.multiply(t4))).add(t0.multiply(t4.multiply(t3))).add(t1.multiply(t2.multiply(t3))).add(t1.multiply(t2.multiply(t4))).add(t1.multiply(t3.multiply(t4))).add(t2.multiply(t3.multiply(t4))));
    //    res=book[0]*book[1]*book[2]+book[0]*book[1]*book[3]+book[0]*book[1]*book[4]+book[0]*book[2]*book[3]+book[0]*book[2]*book[4]+book[0]*book[3]*book[4]+book[1]*book[2]*book[3]+book[1]*book[2]*book[4]+book[1]*book[3]*book[4]+book[2]*book[3]*book[4];
        System.out.println(res);
    
    }
    
}


Measured memory_bytes: 45780
using System;
class Pg{
  static void Main(string[] args){
    string[] x = Console.ReadLine().Split();
    int bx = int.Parse(x[0]);
    int by = int.Parse(x[1]);
    int coin = 0;
    for(int i = 0;i < 2;i++){
      if(bx > by){
        coin += bx;
        bx--;
      }else{
        coin += by;
        by--;
      }
    }
    Console.WriteLine(coin);
  }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[100005];
int main()
{
    int n;
    ll ans=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lld",a+i);
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]!=0) sum+=a[i];
        else ans+=sum/2,sum=0;
    }
    ans+=sum/2;
    printf("%lld\n",ans);
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;

#define ll long long

//use built in gcd function?
// int gcd(int a, int b)
// {
//     return (b? gcd(b, a % b):a);
// }

int main()
{
    ll a, b, n;
    cin >> a >> b;
    n = gcd(a, b);

    ll ans = 1;
    for (ll i = 2; i * i < n; i++)
    {
        if (!(n % i))
        {
            ans++;
            while (!(n % i)) n /= i;
        }
    }

    if (n != 1) ans++;
    cout << ans << "\n";
}

Measured memory_bytes: 3608
H, W = map(int, input().split())
grid = ['.'*(W+2)]
for _ in range(H):
    tmp = '.' + input() + '.'
    grid.append(tmp)
grid.append('.'*(W+2))
ans = []
for i in range(1,H+1):
    tmp = ''
    for k in range(1,W+1):
        if grid[i][k] == '#':
            tmp = tmp + '#'
        else:
            t = 0
            if grid[i][k-1] == '#':
                t += 1
            if grid[i][k+1] == '#':
                t += 1
            if grid[i+1][k] == '#':
                t += 1
            if grid[i-1][k] == '#':
                t += 1
            if grid[i-1][k-1] == '#':
                t += 1
            if grid[i+1][k+1] == '#':
                t += 1
            if grid[i+1][k-1] == '#':
                t += 1
            if grid[i-1][k+1] == '#':
                t += 1
            tmp = tmp + str(t)
    ans.append(tmp)
for i in ans:
    print(i)

Measured memory_bytes: 3064
// E - Sequence Sum
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)

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

	int mn = min(N, (ll)M);
	set<int> S;
	vector<int> A;
	ll sum_9 = 0; // sum of pre + cycle

	rp(_i, 0, mn){
		if(S.find(X) != S.end()) break;
		S.insert(X);
		A.push_back(X);
		sum_9 += X;
		X = (ll)X*X % M;
	}

	if((int)A.size() >= mn){ cout<< sum_9 <<endl; return 0; }

	int pre_len = find(A.begin(), A.end(), X) - A.begin();
	int cyc_len = A.size() - pre_len;
	int btm_len = (N - pre_len) % cyc_len;

	ll cyc_num = (N - pre_len) / cyc_len;

	ll pre = 0; rp(i, 0, pre_len) pre += A[i];
	ll cyc = sum_9 - pre;
	ll btm = 0; rp(i, pre_len, pre_len + btm_len) btm += A[i];

	cout<< pre + cyc * cyc_num + btm <<endl;
}


Measured memory_bytes: 5848
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] h = new int[n];
        int cnt = 0;
        for(int i = 0;i < n;i++){
            h[i] = sc.nextInt();
            if(h[i] >= k)
            cnt++;
        }
        System.out.println(cnt);


    }
}

Measured memory_bytes: 48496
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999;
	public static void Main(string[] args)
	{
		var n = Console.ReadLine().ToInt();
		var map = new Dictionary<string, int>();
		for(int i = 0; i < n; i++)
		{
			var key = Console.ReadLine();
			if(!map.ContainsKey(key))
			{
				map.Add(key, 0);
				//var t = new Tuple<string, int>(key, 0);
				//map.Add(t);
			}
			map[key]++;
		}
		var ary = new Tuple<string, int>[map.Count];
		int ind = 0;
		foreach(var p in map)
		{
			ary[ind] = new Tuple<string, int>(p.Key, p.Value);
			ind++;
		}
		var max = -1;
		Array.Sort(ary, (a,b)=>{
			if(a.Item2 == b.Item2)
			{
				return string.CompareOrdinal(a.Item1, b.Item1);
			}
			return b.Item2 - a.Item2;
		});
		max = ary[0].Item2;
		foreach(var t in ary)
		{
			if(max != t.Item2)
				break;
			Console.WriteLine(t.Item1);
			
		}
	}
	
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	 }
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
int X[555];

int S[333333];

bool check(){

    rep(i,N*N)S[i+1]=1;
    rep(i,N){
        S[X[i]]-=i;
        S[X[i]+1]--;
    }
    for(int i=0;i<N*N;i++)S[i+1]+=S[i];
    rep(i,N*N)if(S[i]<0)return false;
    return true;
}

int A[333333];

signed main(){
    cin>>N;
    rep(i,N)cin>>X[i],X[i]--;
    memset(A,-1,sizeof(A));
    rep(i,N)A[X[i]]=i;

    rep(i,2){
        if(!check()){
            puts("No");
            return 0;
        }
        reverse(X,X+N);
        rep(j,N){
            X[j]=N*N-1-X[j];
        }
    }
    puts("Yes");

    vpint vec;
    rep(i,N)vec.pb(pint(X[i],i));
    sort(all(vec));

    int cur=0;
    rep(i,vec.size()){
        int k=vec[i].se;
        for(int j=0;j<vec[i].se;j++){
            while(true){
                if(A[cur]>=0){
                    cur++;
                    continue;
                }
                A[cur]=k;
                cur++;
                break;
            }
        }
    }

    rep(i,N){
        int k=vec[i].se;
        rep(j,N-1-vec[i].se){
            while(true){
                if(A[cur]>=0){
                    cur++;
                    continue;
                }
                A[cur]=k;
                cur++;
                break;
            }
        }
    }
    rep(i,N*N){
        if(i)printf(" ");
        printf("%lld",A[i]+1);
    }
    puts("");
    return 0;
}


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

using namespace std;
 
int main(){
	string s;
	cin >> s;
	if(s[0]=='S') cout << "Cloudy" << endl;
	else if(s[0]=='C') cout << "Rainy" << endl;
	else cout << "Sunny" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);


		char chA ='a';
		char chA1 ='A';
		char[] arrayAlpha = new char[26];
		char[] arrayAlpha1 = new char[26];


		int[] arrayCount = new int[26];

		for(int i = 0; i <= ('z'-'a'); i++) {
			//System.out.println(chA++);
			arrayAlpha[i] = chA;
			arrayAlpha1[i] = chA1;

			chA1++;
			chA++;
		//	System.out.println("arrayAlpha[i]"+arrayAlpha[i]);
		}

		String strKarioki ="";
		char chKarioki1 =' ';

		while(sc.hasNext()) {

			String strInput = sc.nextLine();

			for(int i = 0; i < strInput.length(); i++) {

				//??\?????????????????????????§£????????????
				strKarioki = strInput.substring(i,i+1);
				//String??????char??????????????????
				chKarioki1 = strKarioki.charAt(0);

				for(int j = 0; j <= ('z'-'a'); j++) {
					if(chKarioki1 == arrayAlpha[j] || chKarioki1 == arrayAlpha1[j]) {
						arrayCount[j] += 1;
					}
				}
			}
		}
		for(int j = 0; j <= ('z'-'a'); j++) {
			System.out.println(arrayAlpha[j] +" : "+arrayCount[j]);
		}
	}
}

Measured memory_bytes: 26420
import Control.Monad
import Control.Applicative

solver :: [Int] -> Int
solver [d, n]
    | d == 0 && n == 100 = 101
    | d == 0             = n
    | n == 100           = (n+1) * (100^d)
    | otherwise          = n * (100^d)

main :: IO ()
main = getLine >>= print . solver . (map read) . words


Measured memory_bytes: 508
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	auto N=in(),Q=in();
	vector<ll> A=vecin<ll>(N);
	vector<ll> S(N+1,0);
	REP(i,N){
		S[i+1] = S[i]+A[i];
	}

	LOOP(Q){
		ll q=in<ll>();
		ll ans=0;
		int left = 1,right = 1;
		while(true){
			if(left>N) break;
			while(right<=N && S[right]-S[left-1]<=q){
				right++;
			}
			ans += (right-left);
			left++;
		}

		out(ans);
	}
	return 0;
}



Measured memory_bytes: 4344
// Problem : B - Product Max
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Delete the dynamically allocated memory

#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define pb              push_back
#define pr              pair<long long,long long>
#define mp(a,b)         make_pair(a,b)
#define vr              vector<long long>
#define mod1            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fill(a,b)       memset(a, b, sizeof(a))
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll mx=max(a*c,max(a*d,max(b*c,b*d)));
	cout<<mx<<"\n";
	return 0;
	}

Measured memory_bytes: 3636
A, B, Q = list(map(int, input().split()))
inf = float('inf')
S = [-inf] + [int(input()) for _ in range(A)] + [inf]
T = [-inf] + [int(input()) for _ in range(B)] + [inf]
X = [(int(input()), i) for i in range(Q)]
S.sort()
T.sort()
X.sort()

ans = {}
s = 1
t = 1
for i in range(Q):
    dist = -1
    x = X[i][0]
    while s <= A and S[s] < x:
        s += 1
    while t <= B and T[t] < x:
        t += 1
    s_l = S[s-1]
    s_r = S[s]
    t_l = T[t-1]
    t_r = T[t]
    d = min(max(s_r-x, t_r-x),
            (s_r-x)*2 + (x-t_l),
            (t_r-x)*2 + (x-s_l),
            (s_r-x) + (x-t_l)*2,
            (t_r-x) + (x-s_l)*2,
            max(x-s_l,x-t_l))
    ans[X[i][1]] = str(d)
print("\n".join(ans[i] for i in range(Q)))


Measured memory_bytes: 40948
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>

typedef long double ld;
typedef long long ll;

using namespace std;

bool pal(string s) {
	bool ret = true;
	
	int i = 0, j = (int)s.length() - 1;
	while (i <= j) {
		if (s[i] != s[j]) {
			ret = false;
		}
		i++;
		j--;
	}

	return ret;
}

int main() {
	string s;
	cin >> s;
	int n = s.length();
	if (pal(s) && pal(s.substr(0, (n - 1)/2)) && pal(s.substr((n + 1)/2, (n - 1)/2))) {
		cout << "Yes";
	} else {
		cout << "No";
	}

	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()
ss = list(set(s))
answer = 0


for i in range(n):
	kari = 0
	x = s[:i]
	y = s[i:]
	for j in ss:
		if j in x:
			if j in y:
				kari += 1
	answer = max(answer, kari)
	
print(answer)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define enld endl

int main() {
	lint X, K, D;
	cin >> X >> K >> D;

	X = abs(X);

	if (X / D > K) {
		cout << X - (D * K) << endl;
	}
	else {
		lint now = X - (D * (X / D));
		if ((K - (X / D)) % 2 == 1) {
			now -= D;
		}
		cout << abs(now) << endl;
	}
}

Measured memory_bytes: 3628
import itertools
import sys
N = int(input())
if N < 3:
  print(0)
  sys.exit()

#辺を取得してint型に変換
hen_list = input().split()
for i in range(len(hen_list)):
    hen_list[i] = int(hen_list[i])

#組み合わせ
count = 0
for tri in itertools.combinations(hen_list, 3):
    sort_tri = sorted(tri)
    if sort_tri[0] + sort_tri[1] > sort_tri[2]:
        if tri[0] != tri[1] and tri[0] != tri[2] and tri[1] != tri[2]:
            #print(sort_tri)
            count += 1
print(count)

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

int top;
int Stack[102];

int pop();
void push(int x);

int main(){
  int x, y;
  top = 0;
  char s[100];

  while(scanf("%s", s) != EOF){
    if(s[0] == '+'){
      x = pop();
      y = pop();
      push(x+y);
    }else if(s[0] == '-'){
      x = pop();
      y = pop();
      push(y-x);
    }else if(s[0] == '*'){
      x = pop();
      y = pop();
      push(x*y);
    }else{
      push(atoi(s));
    }
  }

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

  return 0;
}

int pop(){
  top--;
  return Stack[top+1];
}

void push(int x){
  top++;
  Stack[top] = x;
}



Measured memory_bytes: 2092
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include <set>
#include <tuple>
#include <algorithm>
#include <unordered_map>
#include <vector>

using namespace std;

int main()
{
	int N;
	cin >> N;
	cout << N / 3;
	return 0;
}





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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long

int main() {
  int n ;
  cin >> n ;
  deque<int> d;
  
 rep(i,n){
   int a ;
   cin >> a;
   if( i % 2 == 1)
     d.push_back(a);
   else 
     d.push_front(a);
 }
  
  if(n%2 == 0)
    reverse(all(d));
  
  rep(i,n)
    cout << d.at(i) << ' ' ;
    


}


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

int main(){
    int N;
    cin >> N;
    vector<int> mochiSize(N);
    for(int i = 0; i< N; i++){
        int size;
        cin >> size;
        mochiSize.at(i) = size;
    }
    sort(mochiSize.begin(), mochiSize.end(), greater<int>());
    int upest_mochi = 10000;
    int count = 0;
    for(int i = 0; i<N; i++){
        if(upest_mochi > mochiSize.at(i)){
            upest_mochi = mochiSize.at(i);
            count++;
        }
    }
    cout << count << endl;
}

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

int main(){
    int k, d, n, i, j, smaller, x;
    string s;
    cin >> s >> k;
    n = s.length();
    ll dp[n+1][k+2][2] = {};
    dp[0][0][0] = 1;
    for(i=1; i<=n; i++){
        d = s[i-1] - '0';
        for(smaller=0; smaller<2; smaller++){
            for(j=0; j<=k; j++){
                for(x=0; x<=(smaller ? 9 : d); x++){
                    dp[i][j+(x!=0)][smaller || (x < d)] += dp[i-1][j][smaller];
                }
            }
        }
    }
    cout << dp[n][k][0] + dp[n][k][1];
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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 a, b, d; cin >> a >> b >> d;
  int cnt = 0;
  for(int i=a; i<=b; i++){
    if(i%d==0)cnt++;
  }
  cout  << cnt << ln;
}


Measured memory_bytes: 3584
import sys
input = sys.stdin.readline
import numpy as np
MOD = 10**9+7

n, c = map(int, input().split())
A = np.array(tuple(map(int, input().split())))
B = np.array(tuple(map(int, input().split())))
E = np.zeros((n, c+1), dtype=np.int64)
for j in range(c+1):
  cum = np.array(tuple(pow(k, j, MOD) for k in range(401))).cumsum()%MOD
  E[:, j] = cum[B] - cum[A-1]

dp = np.zeros((n+1, c+1), dtype=np.int64)
dp[0, 0] = 1
for i, e in enumerate(E):
  for j, f in enumerate(e):
    dp[i+1][j:] += dp[i][:c+1-j]*f
    dp[i+1] %= MOD
ans = dp[n, c]
print(ans)

Measured memory_bytes: 15824
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A;
  cin >> A;
  
  if (A % 2 == 0){
    cout << (A / 2)*(A / 2) << endl;
  }
  else {
    cout << ((A - 1) / 2)*((A + 1) / 2) << endl;
  }
 }

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
#define rep2(i, startValue, N) for (int i = (int)(startValue); i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double

// ABC085C - Otoshidama
int main(){
  int n, y; // 1 <= n <= 2000
  cin >> n >> y;

  for (int a = 0; a <= n; ++a) {
    const int total = a * 10000;
    if (y < total) {
      break;
    }
    for (int b = 0; b <= n-a; ++b) {
      const int total2 = total + b * 5000;
      if (y < total2) {
        break;
      }
      const int c = (n-a-b);
      if (total2 + c * 1000 == y) {
        cout << a << " " << b << " " << c << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
  return 0;
}


Measured memory_bytes: 3516
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
using namespace std;
int main ()
{
	while (1)
	{
		int a[4], b[4];
		int H = 0, B = 0;
		for (int i = 0; i < 4; i++)
		{
			if (scanf("%d", &a[i]) == EOF)return 0;
		}
		for (int i = 0; i < 4; i++)
		{
			if (scanf("%d", &b[i]) == EOF)return 0;
			if (b[i] == a[i])H++;
			for (int l = 0; l < 4; l++)
			{
				if (l == i)continue;
				if (a[l] == b[i])B++;
			}
		}
		cout << H << " " << B << endl;

	}
	return 0;
}

Measured memory_bytes: 1208
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;

int p = 1000000007;

int main(){
  int n, m;
  cin >> n >> m;
  vector<bool> a(n+1, true);
  for(int i = 0; i < m; i++){
    int A;
    cin >> A;
    a[A] = false;
  }
  
  vector<i64> sum(100010);
  for(int i = 0; i < sum.size(); i++)
    sum[i] = 0;
  sum[0] = 1;
  if(a[1])
    sum[1] = 1;
  
  for(int i = 2; i <= n; i++){
    if(a[i])
      sum[i] = (sum[i-1] + sum[i-2])%p;
  }
  
  cout << sum[n] << endl;
  
  return 0;
  
}

Measured memory_bytes: 1024
N, A, B = map(int, input().split())
ans = 0
for num in range(1, N+1):
  str_num = str(num)
  sum_char = 0
  for char in str_num:
    sum_char += int(char)
  if sum_char >= A and sum_char <= B:
    ans += int(str_num)
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stdio.h>

int main(void){
  long double a,b,h,m,deg,rad,pi=3.141592653589793238462643383279;
  std::cin >> a >> b >> h >> m;

  h=h+m/60.0;  deg=h*30-m*6;  rad=deg*(pi/180);
  
  printf("%.30f",sqrt(a*a+b*b-2*a*b*cos(rad)));
  return 0;
}

Measured memory_bytes: 4180
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define MAX 305
int a[MAX],x[4];
double dp[MAX][MAX][MAX];
signed main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	    x[a[i]]++;
	}
	int u=x[1]+x[2]+x[3];
	int v=x[3]+x[2];
	for(int k=0;k<=x[3];k++)
	for(int j=0;j<=v;j++)
	for(int i=0;i<=u;i++)
	{
		if(i+j+k==0)
		continue;
		dp[k][j][i]=(double)n/(i+j+k);
		if(k>0)
		dp[k][j][i]+=dp[k-1][j+1][i]*((double)k/(i+j+k));
		if(j>0)
		dp[k][j][i]+=dp[k][j-1][i+1]*((double)j/(i+j+k));
		if(i>0)
		dp[k][j][i]+=dp[k][j][i-1]*((double)i/(i+j+k));
	}
	cout<<fixed<<setprecision(10)<<dp[x[3]][x[2]][x[1]]<<"\n";
}

Measured memory_bytes: 219392
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}

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

void solve();

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

    solve();
}

void solve() {
    ll n, m, k;
    std::cin >> n >> m >> k;

    for (ll i = 0; i <= n; i++) for (ll j = 0; j <= m; j++)
        if (i * (m - j) + j * (n - i) == k) {
            std::cout << "Yes" << '\n';
            return;
        }

    std::cout << "No" << '\n';
}


Measured memory_bytes: 3640
n, h = gets.chomp.split(" ").map(&:to_i)

a = []
b = []

n.times do
  a_, b_ = gets.chomp.split(" ").map(&:to_i)
  a << a_
  b << b_
end

amax = a.max
b.sort!

ans = 0

(n-1).downto(0) do |i|
  if h <= 0
    puts ans
    exit
  end
  if b[i] > amax
    h -= b[i]
    ans += 1
  end
end

ans += h / amax

if h % amax == 0
  puts ans
else
  puts ans + 1
end

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

using namespace std;

typedef long long int llint;

//#define DEBUG

#define rep(i, n) for (int i = 0; i < n; ++i)
#ifdef DEBUG
#define dump(i) cout << "[*] " #i << i << endl;
#else
#define dump(i)
#endif

llint N, M;
const llint mo = 1000000007;

llint dp[100001] = {0};
llint factorial(llint n) {
  if (dp[n] != 0) {
    return dp[n] % mo;
  } else {
    return (dp[n] = ((n % mo) * (factorial(n - 1) % mo)) % mo);
  }
}

void solve() {
  llint ans;

  if (N == M) {
    ans = 2 * factorial(N) * factorial(M);
  } else if (N == M + 1 || M == N + 1) {
    ans = factorial(N) * factorial(M);
  } else {
    ans = 0;
  }

  cout << ans % mo << endl;
}

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

  cin >> N >> M;
  dp[1] = 1;
  dp[2] = 2;

  solve();

  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,n;
    cin >> h >> n;
    int skill[n][2];
    for(int i = 0;i<n;i++){
        cin >> skill[i][0] >> skill[i][1];
    }
    int sp[200001];
    sp[0] = 0;
    for(int i=1;i<200001;i++){
        sp[i] = 2000000000;
    }
    for(int i = 1;i<200001;i++){
        for(int j = 0;j<n;j++){
            sp[i] = min(sp[i],sp[max(i - skill[j][0],0)]+skill[j][1]);
        }
    }
    cout << sp[h];
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
public class Main {
	static long solve(long i) {
		if(i==1)return 1;
		long z=solve(i/2);
		return 1+z*2;
	}
	public static void main(String[] args) throws Exception {
		MScanner sc=new MScanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		pw.println(solve(sc.nextLong()));
		pw.flush();
	}
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] takearr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] takearrl(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public Integer[] takearrobj(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] takearrlobj(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


Measured memory_bytes: 22996
/*  
   |\_/|
   |* *|
   \_+_/
          */
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  int k;

  int cnt=0;

  cin>>k;

  for(int i=1;i<=k;i++){
    for(int j=1;j<=k;j++){
      if(i!=j){
	if((i%2==0&&j%2==1)||(i%2==1&&j%2==0)){
	  cnt++;
	}
      }
    }
  }

  cout<<cnt/2<<endl;
  
  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, x, max;
  int sum = 0;
  string answer = "No";
  cin >> N;
  vector<int> data(N);
  for (int i=0; i<N; i++){
    cin >> data.at(i);
  }
  for(int i=0; i<N; i++){
    for(int j=1; j<N-i; j++){
      if(data.at(i)<data.at(i+j)) {
        x = data.at(i);
        data.at(i) = data.at(i+j);
        data.at(i+j) = x;
      }
    }
  }
  max = data.at(0);
  for(int i=1; i<N; i++){
    sum += data.at(i);
  }
  if(max<sum) answer="Yes";
  cout << answer << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=1e5+10;
int a[N];
int main(){
    ll n;cin>>n;
    ll res=100,cnt=0;
    while(res<n){
        res=(double)res*(1+100)/100;
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3632