akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <deque>
#include <numeric>

#ifdef WIN32
#define I64 "%I64d"
#else
#define I64 "%lld"
#endif
#define speed() ios_base::sync_with_stdio(0), cin.tie()
#define pb push_back
#define mp make_pair
#define y1 y1asd
#define f first
#define s second
#define sz(s) ((int)s.size())
#define all(s) (s).begin(), (s).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
const int inf = (1 << 30) - 1;
const int N = (int)1e6 + 5;

int n, s;
int a[100000];
vector <int> g, d2, d3;
int was[1000000];
int main() {
    cin >> n;

    if (n == 3) {
        cout << 2 << " " << 5 << " " << 63;
        return 0;
    }
    if (n == 4) {
        cout << 2 << " " << 5 << " " << 20 << " " << 63;
        return 0;
    }


    a[1] = 2;
    a[2] = 3;
    a[3] = 9;
    a[4] = 4;
    was[2] = was[3] = was[9] = was[4] = 1;
    was[6] = 1;
    // 2, 1, 2, 1, 2, 1
    int cnt = 4;
    for (int i = 3; i <= 30000; i++) {
        if (i % 2 == 0 && i % 3 == 0 && !was[i])
            a[++cnt] = i, was[i] = 1;
    }
    for (int i = 1; i <= 30000; i++) {
        for (int j = 1; j <= 30000; j++) {
            if (cnt + 2 > n) break;
            if (was[i]) break;
            if (was[j] || i == j) continue;
            if (i % 2 != 0 && i % 3 != 0) continue;
            if (j % 2 != 0 && j % 3 != 0) continue;
            if ((i + j) % 2 == 0 && (i + j) % 3 == 0) {
                a[++cnt] = i;
                a[++cnt] = j;
                was[i] = was[j] = 1;
            }
        }
    }
    if (cnt < n) {
        a[++cnt] = 6;
    }

    for (int i = 1; i <= n; i++) cout << a[i] << " ";
    return 0;
}



Measured memory_bytes: 2560
#include<iostream>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<string>
#include<algorithm>
#include <cmath>

#define rep(i, a) for (int i = 0; i < a; i++)
#define reps(i, s, a) for (int i = s; i < a; i++)
#define llint long long int
using namespace std;

const int N_MAX = 505;
const llint INF = 999999999999999;

int main()
{
    int n;
    llint m;
    cin >> n >> m;

    double sq = (int) (sqrt(m));
    vector<llint> div;
 
    reps(i, 1, sq + 1) {
        if (m % i == 0) {
            div.push_back(i);
            div.push_back(m / i);
        }
    }
    int ds = div.size();

    llint max = -1;
    rep(i, ds) {
        if (m / div[i] >= n && div[i] > max) max = div[i];
    }

    cout << max;
    //rep(i, div.size()) cout << div[i] << endl;   
}

Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
Scanf.scanf "%d %d %d" (fun n m k ->
    let extgcd x y =
        let rec eg r0 r1 a0 a1 b0 b1 =
            if r1 = 0 then a0 else
                let q1 = r0 / r1 in
                eg r1 (r0 mod r1) a1 (a0 - q1 * a1) b1 (b0 - q1 * b1)
        in
        eg x y 1 0 0 1
    in
    let inv x y = (* 1/x in mod y *)
        let c = extgcd x y in
        if c < 0 then c + y else c
    in
    let mm = 998244353 in
    let ( +@) a b = (a + b) mod mm in
    let ( *@) a b = (a * b) mod mm in
    let ( /@) a b = a *@ inv b mm in

    let modpow a b =
        let rec loop r bit acc =
            if bit = 0 then acc else
                loop (r *@ r) (bit lsr 1) (if bit land 1 = 0 then acc else acc *@ r)
        in
        loop a b 1
    in

    let rec loop cur over single acc =
        let acc = acc +@ cur in
        if single > k then acc else
            let cur = cur *@ over /@ (single *@ (m - 1)) in
            loop cur (over - 1) (single + 1) acc
    in
    (if m = 1 && k = n - 1 then 1 else
        loop (m *@ modpow (m - 1) (n - 1)) (n - 1) 1 0) |> Printf.printf "%d\n"
)

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

int main()
{
	string s1, s2;
	int n;
	cin >> n;
	int p1 = 0, p2 = 0;
	while (n--) {
		cin >> s1 >> s2;
		int length = (s1.size() >= s2.size() ? s1.size() : s2.size());
		int flag = 0;
		for (int i = 0; i < length; i++) {
			if (s1[i] < s2[i]) {
				flag = 2;
				break;
			}
			else if (s1[i] > s2[i]) {
				flag = 1;
				break;
			}
		}
		if (flag == 0) {
			if (s1.size() > s2.size()) {
				flag = 1;
			}
			else if (s1.size() < s2.size()) {
				flag = 2;
			}
			else {
				flag = 0;
			}
		}
		if (flag == 0) {
			p1 += 1;
			p2 += 1;
		}
		else if (flag == 1) {
			p1 += 3;
		}
		else {
			p2 += 3;
		}
	}
	cout << p1 << " " << p2 << endl;
    return 0;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define INF 2000000000000000000LL
#define EPS 1e-8
#define debug(a) cerr<<#a<<"="<<(a)<<"\n"
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 998244353;
const double pi = acos(-1);

int n,i,j,k,t;
int m;
char a[100002];
char b[100002];

int main(){
	scanf("%d %d", &n, &m);
	scanf("%s", a);
	scanf("%s", b);
	ll ans = 1LL*n*m/__gcd(n, m);
	ll x = ans/n;
	ll y = ans/m;
	for(i=j=0;i*x < ans && j*y < ans;){
		if(i*x == j*y){
			if(a[i] != b[j])
				return puts("-1") & 0;
			++i;
		}
		else if(i*x < j*y)
			++i;
		else
			++j;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 384
N,K=map(int,input().split())
H=[int(i) for i in input().split()]
f_inf=float('inf')
dp=[f_inf]*(N+5)
dp[0]=0
for i in range(1,N):
  for j in range(1,K+1):
    if (i-j)<0:
      continue
    dp[i]=min(dp[i-j]+abs(H[i-j]-H[i]),dp[i])
print(dp[N-1])


Measured memory_bytes: 55264
#include<bits/stdc++.h>
#define re register
int x[1010],y[1010],xa[]={0,1,-1,0,0},ya[]={0,0,0,1,-1};
char cc[]={0,'L','R','D','U'};
void dfs(re int i,re int xx,re int yy)
{
	if(i<0&&xx==0&&yy==0)return;
	for(re int i1=1;i1<=4;i1++)
	{
		re int x1=xx+((i==31)?1:(1<<i))*xa[i1];
		re int yy1=yy+((i==31)?1:(1<<i))*ya[i1];
		if(abs(x1)+abs(yy1)<(1u<<i))
		{
			putchar(cc[i1]);
			dfs(i-1,x1,yy1);
			return;
		}
	}
}
int main()
{
	re int n,xp=-1;
	scanf("%d",&n);
	for(re int i=1;i<=n;i++)
	{
		scanf("%d%d",&x[i],&y[i]);
		if(xp==-1)xp=abs(x[i]+y[i])&1;
		else if(xp!=(abs(x[i]+y[i])&1))puts("-1"),exit(0);
	}
	printf("%d\n",32-xp);
	if(!xp)printf("1 ");
	for(re int i=30;i>=0;i--)printf("%d ",1<<i);puts("");
	for(re int i=1;i<=n;i++)
	{
		dfs(30+(!xp),x[i],y[i]);
		puts("");
	}
}

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

int64_t rui(int64_t n,int64_t x){
vector<int64_t> vec(50);
  int64_t i,s,ans;
  i=0;
  ans=1;
  while(x>0){
  vec.at(i)=x%2;
    x=x/2;
  i++;    
  }
  s=n;
  for(int j=0;j<50;j++){
  if(vec.at(j)==1){ans=(ans*s)%1000000007;}  
   s=(s*s)%1000000007; 
    
}
  return ans;}

int main(){
  int64_t n;
  cin>>n;
  int64_t a=(rui(10,n)-rui(9,n)*2+rui(8,n))%1000000007;
cout<<(a+1000000007)%1000000007<<endl;

  }

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main() {
	long long n, sum=0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0 || i % 5 == 0) {
		}
		else {
			sum += i;
		}
	}
	cout << sum;
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));

		int numberS = Integer.parseInt(br.readLine());

		String[] progressionS = br.readLine().split(" ");

		int[] progressionSInteger = new int[numberS];

		for (int i = 0; i < numberS; i++) {
            progressionSInteger[i] = Integer.parseInt(progressionS[i]);
		}

		int numberT = Integer.parseInt(br.readLine());

		String[] progressionT = br.readLine().split(" ");

		int[] progressionTInteger = new int[numberT];

		for (int i = 0; i < numberT; i++) {
			progressionTInteger[i] = Integer.parseInt(progressionT[i]);
		}

		int equalCount = 0;
		for(int i = 0; i < numberT; i++) {
			for(int j = 0; j < numberS; j++) {
				if(progressionTInteger[i] == progressionSInteger[j]) {
					equalCount++;
					break;
				}
			}
		}
		System.out.println(equalCount);
	}
}

Measured memory_bytes: 27360
import itertools
 
N, M, Q = map(int, input().split())
cmb = [list(map(int, input().split())) for _ in range(Q)]
 
def score(seq):
  s = 0
  for q in range(Q):
    if seq[cmb[q][1]-1] - seq[cmb[q][0]-1] == cmb[q][2]:
      s += cmb[q][3]
  return s
 
p = [i for i in range(1, M+1)]
A = itertools.combinations_with_replacement(p, N)
ans = 0
for a in A:
  ans = max(ans, score(a))
print(ans)

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
clock_t startTime;
long double getTime(){
	return (long double)(clock()-startTime)/CLOCKS_PER_SEC;
}

int main(){
	startTime=clock();
	int n;
	ll maxx=-1;
	cin >> n;
	ll a[n];
	FOR(i,n){
		cin >> a[i];
		maxx=max(a[i],maxx);
	}
	ll q=maxx/2;
	if(maxx%2){
		ll s;
		ll t=1e15;
		for(int j=0;j<n;j++){
			if(t > min(abs(a[j]-q),abs(a[j]-q-1)) && a[j]!=maxx){
				t=	min(abs(a[j]-q),abs(a[j]-q-1));
				s=a[j];
			}
					
		}
	cout << maxx <<" "<<s;
	}
	else{
		ll s;
		ll t=1e15;
		for(int i=0;i<n;i++){
			if(t > abs(a[i]-q) && a[i]!=maxx){
				t=abs(a[i]-q);
				s=a[i];
			}
		}
	cout << maxx <<" "<< s;
	}

	return 0;
}

Measured memory_bytes: 4272
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x

using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	std::ios::sync_with_stdio(false);
	int t = 1;
	// cin >> t;
	while (t--) {
		int n;
		cin >> n;
		map<string, int> m;
		for (int i = 0; i < n; i++) {
			string s;
			cin >> s;
			m[s]++;
		}

		cout << "AC x " << m["AC"] << endl;
		cout << "WA x " << m["WA"] << endl;
		cout << "TLE x " << m["TLE"] << endl;
		cout << "RE x " << m["RE"] << endl;


	}
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
#define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y))

int main()
{
	int n, tmp, mi = 1000001, ma = -1000001;
	long long int total = 0;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> tmp;
		ma = max(ma, tmp);
		mi = min(mi, tmp);
		total += tmp;
	}
	cout << mi << ' ' << ma << ' ' << total << endl;
}

Measured memory_bytes: 1164
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double ans = 0;
        for (int i = 0; i < n; i++) {
            double x = sc.nextDouble();
            String u = sc.next();
            if (u.equals("BTC")) {
                ans += x*380000;
            } else {
                ans += x;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23252
N = int(input())
A = list(map(int, input().split()))

from itertools import groupby, accumulate, product, permutations, combinations

def solve(N,A):
    dp = [[0]*N for _ in range(N)] #dp[i][j] i人目まででj個を分ける場合の数
    cum = [0]+list(accumulate(A))
    for k in range(1,N):
        for i in range(N-k):
            j = i + k
            dp[i][j] = cum[j+1]-cum[i] + min([dp[i][i+l]+dp[i+l+1][j] for l in range(k)])
    ans = dp[0][N-1]
    return ans
print(solve(N,A))

Measured memory_bytes: 44332
#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; }
//------------------------------------------------------------------------------
template<typename T, int N, T F(const T& a, const T& b)>
struct SegTree
{
public:
    SegTree()
    {
        dat = vector<T>(N * 2 - 1, 0);
    }

    void update(int i, T x)
    {
        i += N - 1;
        dat[i] = x;
        while (i > 0)
        {
            i = (i - 1) / 2;
            dat[i] = F(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = N)
    {
        if (r <= a || b <= l) return 0;
        if (a <= l && r <= b) return dat[k];
        else
        {
            T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return F(vl, vr);
        }
    }

    vector<T> dat;
};

/*------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
------------------------------------------------------------------------------*/











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

//---------------------------------------------------------------------------------------------------
void _main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && B == C && C == A)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


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

int n, s, a[55];
int main() {
	int i, j;
	cin >> n;
	for(i=0; i<n; i++) cin >> a[i];
	for(i=0; i<n; i++) for(j=i+1; j<n; j++) s += a[i] * a[j];
	cout << s;
	return 0;
}

Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque
from sys import exit
import math
import copy
from bisect import bisect_left

import sys
# sys.setrecursionlimit(1000000)
# list(map(int, input().split()))
mod = 10 ** 9 + 7

from collections import deque

# まず、Kの最小値を求める
#　頂点に繋がる辺の数 <= Kを全ての頂点で満たす
N = getN()
dist = [[] for i in range(N + 1)]
# エッジの配列はこうする
edge = {}
for i in range(N - 1):
    a, b = getNM()
    dist[a].append(b)
    dist[b].append(a)
    # エッジの色の入力の仕方
    edge[(a, b)] = i
    edge[(b, a)] = i

ignore = [-1] * (N + 1)
ignore[1] = 0
# 辺の数は頂点の数より一つ少ない
ans = [0] * (N - 1)

pos = deque([1])
while len(pos) > 0:
    u = pos.popleft()
    # 一番最初の色から順にサーチしていく
    j = 1
    for i in dist[u]:
        if ignore[i] < 0:
            # 根元の頂点の色と一致していたら色を変える
            if j == ignore[u]:
                j += 1
            # 辺をスライドしていくたびに行先の頂点の色を変える
            ignore[i] = j
            # 辺の色は行先の頂点の色に合わせる
            ans[edge[(i, u)]] = j
            pos.append(i)
            j += 1
print(max(ans))
for a in ans:
    print(a)

Measured memory_bytes: 99104
#include <stdio.h>
int main(){
  int i,j,n,x;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    x=i;
    if(i%3==0)printf(" %d",i);
    else{
      for(j=0;j<4;j++){
	if(x%10==3){
	  printf(" %d",i);
	  break;
	}
	x/=10;
      }
    }
  }
  printf("\n");
  return 0;
}

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

int assort(const void *a, const void *b){return *(long long*)a-*(long long*)b;}
int dessort(const void *a, const void *b){return *(long long*)b-*(long long*)a;}

int main(void){
    int n;
    scanf("%d",&n);
    long long a[300030],ar[n+1],al[n+1],tmp,R[100005]={},L[100005]={};
    ar[0]=-10e10;
    al[0]=10e10;
    for (int i=0; i<n*3; i++){
        scanf("%lld",&a[i]);
    }
    
    if (n==1){
        tmp=a[0]-a[1];
        tmp=tmp>(a[1]-a[2])?tmp:(a[1]-a[2]);
        tmp=tmp>(a[0]-a[2])?tmp:(a[0]-a[2]);
        printf("%lld\n",tmp);
        return 0;
    }
    
    for (int i=0; i<n; i++){
        ar[i+1]=a[i];
        R[0]+=ar[i+1];
    }
    qsort (ar,n+1,sizeof(long long),assort);
    for (int i=0; i<n; i++){
        tmp=a[i+n];
        if (tmp>ar[1]){
            R[i+1]=R[i]-ar[1]+tmp;
            ar[1]=tmp;
            long long bf=1;
            while(1){
                if (bf*2>n){
                    break;
                }
                if (ar[bf*2]<=ar[bf*2+1] || bf*2+1>n){
                    if (ar[bf]>ar[bf*2]){
                        tmp=ar[bf];
                        ar[bf]=ar[bf*2];
                        ar[bf*2]=tmp;
                        bf=bf*2;
                    } else {
                        break;
                    }
                } else {
                    if (ar[bf]>ar[bf*2+1]){
                        tmp=ar[bf];
                        ar[bf]=ar[bf*2+1];
                        ar[bf*2+1]=tmp;
                        bf=bf*2+1;
                    } else {
                        break;
                    }
                }
            }
        } else {
            R[i+1]=R[i];
        }
    }
    
    for (int i=0; i<n; i++){
        al[i+1]=a[n*3-i-1];
        L[0]+=al[i+1];
    }
    qsort (al,n+1,sizeof(long long),dessort);
    for (int i=0; i<n; i++){
        tmp=a[2*n-i-1];
        if (tmp<al[1]){
            L[i+1]=L[i]-al[1]+tmp;
            al[1]=tmp;
            long long bf=1;
            while(1){
                if (bf*2>n){
                    break;
                }
                if (al[bf*2]>=al[bf*2+1] || bf*2+1>n){
                    if (al[bf]<al[bf*2]){
                        tmp=al[bf];
                        al[bf]=al[bf*2];
                        al[bf*2]=tmp;
                        bf=bf*2;
                    } else {
                        break;
                    }
                } else {
                    if (al[bf]<al[bf*2+1]){
                        tmp=al[bf];
                        al[bf]=al[bf*2+1];
                        al[bf*2+1]=tmp;
                        bf=bf*2+1;
                    } else {
                        break;
                    }
                }
            }
        } else {
            L[i+1]=L[i];
        }
    }
    tmp=R[0]-L[n];
    for (int i=0; i<=n; i++){
        tmp=tmp>(R[i]-L[n-i])?tmp:(R[i]-L[n-i]);
    }
    printf("%lld\n",tmp);
    return 0;
}


Measured memory_bytes: 6392
n,m,c=map(int,input().split())
b=[int(i)for i in input().split()]
a=[[int(i)for i in input().split()]for j in range(n)]
res=0
for i in range(n):
    tmp=sum([a[i][j]*b[j]for j in range(m)])+c
    if tmp>0:
        res+=1
print(res)

Measured memory_bytes: 9228
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

signed main() {
	string S, T;
	int A, B;
	cin >> S >> T;
	cin >> A >> B;
	string U; cin >> U;
	if (U == S)
		cout << (--A) << " " << B << endl;
	else
		cout << A << " " << (--B) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int k, x; cin >> k >> x;
  for(int i=max(-1000000, x-k+1); i<=min(1000000, x+k-1); i++) cout << i << ' ';
  cout << endk;
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
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<int> a(n),b(n+1,0),c(n+1,0);
 for(int i=0;i<n;i++)cin>>a.at(i);
 for(int i=0;i<n;i++)b.at(i+1)=a.at(i)+b.at(i);
 for(int i=n-1;i>=0;i--)c.at(i)=a.at(i)+c.at(i+1);
 int ans=INT_MAX;
 for(int i=0;i<n;i++){
     chmin(ans,abs(b.at(i)-c.at(i)));
 }
 cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int sumAll = 0;

        for(int i=1;i <= n; i++) {
            String t = String.valueOf(i);
            int sum = 0;
            for(int j = 0; j < t.length(); j++) {
                sum += Integer.parseInt(t.substring(j, j+1));
            }

            if(sum >=a && sum <=b) {
                sumAll += i;
            }

        }
        System.out.println(sumAll);
    }
}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
 
using namespace std;
 
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const int mod=1e9+7;
			
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);
int sub(int,int);
template<typename A> ostream& operator<<(ostream&,vector<A>&);
 
const int N=1000001;

void solve(){
	int n;
	cin>>n;
	cout<<3*n*n;
	
	
	
	
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n,l,t;
    in>>n>>l>>t;
    int X,V,x,v,E;
    ll ans{};
    vector<int> e(n);
    in>>X>>V;
    if(V==1) e[0]=(X+t)%l;
    else e[0]=(X-t)%l;
    if(e[0]<0) e[0]+=l;
    E=e[0];
    Fr(i,n-1){
        in>>x>>v;
        if(v==1) e[i]=(x+t)%l;
        else e[i]=(x-t)%l;
        if(e[i]<0) e[i]+=l;
        if(v==V) continue;
        if(V==1){
            ll p=0,q=1e9,r;
            while(q-p>1){
                r=(p+q)/2;
                if(x-X+(r-1)*l<2*t) p=r;
                else q=r;
            }
            ans+=p;
        }
        else{
            ll p=0,q=1e9,r;
            while(q-p>1){
                r=(p+q)/2;
                if(l-x+X+(r-1)*l<=2*t) p=r;
                else q=r;
            }
            ans-=p;
        }
    }
    sort(e.begin(),e.end());
    ans%=n;
    if(ans<n) ans+=n;
    int i=lower_bound(e.begin(),e.end(),E)-e.begin();
    vector<int> ANS(n);
    fr(j,n) ANS[(ans+j)%n]=e[(i+j)%n];
    fr(j,n) cout<<ANS[j]<<endl;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define  rep(i,a,b) for(i=a;i<b;i++)
#define ll long long int
#define ld long double
using namespace std;
int main()
{
IOS;
ll n,i,k,s=0;
cin>>n>>k;
ll a[n];
rep(i,0,n)
{
  cin>>a[i];
  if(a[i]>=k)
  s++;
}
cout<<s;
return 0;
}


Measured memory_bytes: 1024
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
list<long long int> Prime(int M) {
	list<long long int>P;
	P.push_back(2);
	P.push_back(3);
	for (int i = 5; i <= M; i += 6) {
		bool flag = true;
		for (auto j : P) {
			if (i%j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i);
		flag = true;
		for (auto j : P) {
			if ((i + 2) % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i + 2);
	}
	return P;
}

long long int N, M, K, Q, W, H;
long long int ans;

int main() {
	ios::sync_with_stdio(false);
	char a;
	cin >> a;
	if (a == 'a' || a == 'i' || a == 'u' || a == 'e' || a == 'o')cout << "vowel\n";
	else  cout << "consonant\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <utility>

using namespace std;

#define pb push_back
#define ft first
#define sd second
#define mpr make_pair
#define all(x) begin((x)), end((x))
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define max3(a, b, c) max((a), max((b), (c)))
#define max4(a, b, c, d) max(max((a), (b)), max((c), (d)))
#define min3(a, b, c) min((a), min((b), (c)))
#define min4(a, b, c, d) min(min((a), (b)), min((c), (d)))
#define isz(x) (int)(x).size()

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef vector<int> vi;

/* <------------------------------------------------------------------------------------> */

void solve()
{
    int n, c2 = 0, c4 = 0;
    scanf("%d", &n);
    forn (i, n)
    {
        int a;
        scanf("%d", &a);
        if (a % 4 == 0) ++c4;
        else if (a % 2 == 0) ++c2;
    }
    int m = n - c2 - c4;
    if (m <= c4 + (int)(c2 == 0)) puts("Yes");
    else puts("No");
}

/* <------------------------------------------------------------------------------------> */

// #define LOCAL
// #define FILE_NAME

int main()
{
    #if defined LOCAL
        freopen("input.txt", "r", stdin);
    #elif defined FILE_NAME
        freopen(FILE_NAME".in", "r", stdin);
        freopen(FILE_NAME".out", "w", stdout);
    #endif

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

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

ll Exp(ll n, vector<ll> &memo);

int main()
{
    ll A, B;
    cin >> A >> B;
    vector<ll> fa(41, 0), fb(41, 0), memo(50, -1);
    if ((A != 0) && (B != 0))
    {
        A--;
        rep(i, 0, 41)
        {
            if (A % Exp(i + 1, memo) - (Exp(i, memo) - 1) > 0)
            {
                fa.at(i) = Exp(i, memo) * (A / Exp(i + 1, memo)) + A % Exp(i + 1, memo) - (Exp(i, memo) - 1);
            }
            else
            {
                fa.at(i) = Exp(i, memo) * (A / Exp(i + 1, memo));
            }
            if (B % Exp(i + 1, memo) - (Exp(i, memo) - 1) > 0)
            {
                fb.at(i) = Exp(i, memo) * (B / Exp(i + 1, memo)) + B % Exp(i + 1, memo) - (Exp(i, memo) - 1);
            }
            else
            {
                fb.at(i) = Exp(i, memo) * (B / Exp(i + 1, memo));
            }
        }
    }
    else if (B == 0)
    {
        cout << 0 << endl;
        return 0;
    }
    else
    {
        rep(i, 0, 41)
        {
            if (B % Exp(i + 1, memo) - (Exp(i, memo) - 1) > 0)
            {
                fb.at(i) = Exp(i, memo) * (B / Exp(i + 1, memo)) + B % Exp(i + 1, memo) - (Exp(i, memo) - 1);
            }
            else
            {
                fb.at(i) = Exp(i, memo) * (B / Exp(i + 1, memo));
            }
        }
    }
    ll ans = 0;
    rep(i, 0, 40)
    {
        if (((fb.at(i) - fa.at(i)) % 2) != 0)
        {
            ans += Exp(i, memo);
        }
    }
    cout << ans << endl;
}

ll Exp(ll n, vector<ll> &memo)
{
    if (memo.at(n) != -1)
    {
        return memo.at(n);
    }
    if (n == 0)
    {
        return memo.at(0) = 1;
    }
    return memo.at(n) = 2 * Exp(n - 1, memo);
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); ++i)
using ll = long long int;

using namespace std;

int main() {
  string S;
  cin >> S;
  int A = (S[0]-'0') * 10 + (S[1]-'0');
  int B = (S[2]-'0') * 10 + (S[3]-'0');

  bool monthA = false;
  bool monthB = false;

  if(A > 0 && A <= 12) monthA = true;
  if(B > 0 && B <= 12) monthB = true;

  if(monthA && monthB) {
    cout << "AMBIGUOUS" << endl;
  } else if(monthA) {
    cout << "MMYY" << endl;
  } else if(monthB) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <string>
int a[3005], b[3005], n;
char str[6005];
std::string work(int l, int r)
{
	int L = n, R = -1;
	for (int i = 0; i < n; i++)
	{
		if (l <= a[i] && a[i] <= r)
		{
			L = std::min(L, i);
			R = std::max(R, i);
		}
	}
	std::string ans;
	if (a[L] < b[L])
	{
		int lst = l - 1;
		for (int i = L; i <= R; i++)
		{
			if (a[i] > lst)
			{
				ans += "ab";
				lst = b[i];
			}
		}
		return ans;
	}
	for (int i = L; i <= R; i++)
	{
		auto res = ans;
		res = "";
		for (int j = l; j <= r; j++)
		{
			if ((str[j] == 'a' && j >= a[i]) || (str[j] == 'b' && j >= b[i]))
				res += str[j];
		}
		ans = std::max(ans, res);
	}
	return ans;
}
std::string part[3005];
int main()
{
	// freopen("AGC026-E.in", "r", stdin);
	scanf("%d%s", &n, str);
	int cur = 0, lst = 0, cnt = 0, cnta = 0, cntb = 0;
	for (int i = 0; i < n << 1; i++)
		(str[i] == 'a' ? a[cnta++] : b[cntb++]) = i;
	for (int i = 0; i < n << 1; i++)
	{
		cur += str[i] == 'a' ? -1 : 1;
		if (!cur)
		{
			part[cnt++] = work(lst, i);
			lst = i + 1;
		}
	}
	std::string ans;
	for (int i = cnt - 1; i >= 0; i--)
		ans = std::max(ans, part[i] + ans);
	puts(ans.c_str());
	return 0;
}


Measured memory_bytes: 384
n = int(input())
ary = [list(map(int,input().split())) for _ in range(n)]
ans = sum([sum(i) for i in ary])
for i in range(n):
    for j in range(n):
        flag = 0
        for k in range(n):
            if j == k or i == k:continue
            if ary[i][j] > ary[i][k] + ary[k][j]:print(-1);exit()
            if ary[i][j] == ary[i][k] + ary[k][j]:
                flag = 1
        if flag:ans -= ary[i][j]
print(ans//2)

Measured memory_bytes: 43740
#define ll long long
#define MOD 1000000007
#define MOD2 998244353
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set2d(array, val, m, n) memset(array, val, sizeof(array[0][0]) * m * n);
#include <bits/stdc++.h>
using namespace std;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x %= p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll po(ll base, ll powerRaised)
{
    if (powerRaised != 0)
        return (base * po(base, powerRaised - 1));
    else
        return 1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b;
}

Measured memory_bytes: 256
gets
as = gets.split.map(&:to_i)
gets
ms = gets.split.map(&:to_i)
min = as.min
sum = as.inject(:+)

def can_make?(m, numbers)
  return false if numbers.size <= 1
  2.upto(numbers.size).each {|n|
    return true if numbers.combination(n).any? {|a| a.inject(:+) == m}
  }
  false
end

ms.each {|m|
  if m < min || sum < m
    puts "no"
    next
  end

  if as.include?(m)
    puts "yes"
    next
  end

  pickups = as.select{|a| a < m}
  puts can_make?(m, pickups) ? "yes" : "no"
}

Measured memory_bytes: 9632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

   ll cum[90]={0};
   cum[0]=2;
   cum[1]=1;
   for(ll i=2;i<=86;i++)
   {
       cum[i]=cum[i-1]+cum[i-2];
   }
   ll n;
   cin>>n;
   cout<<cum[n]<<endl;

}










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

int n,q;
int a[30][1000005];

char s[500005];

int lowbit(int n)
{
	return n&(-n);
}

int get(char x)
{
	return x-'a'+1;
}

inline void change(int num,int rt,int plus)
{
	while (rt<=n)
	{
		a[num][rt]+=plus;
		rt+=lowbit(rt);
	}
}

inline int get_sum(int num,int r)
{
	int sumv=0;
	while (r>=1)
	{
		sumv+=a[num][r];
		r-=lowbit(r);
	}
	return sumv;
}

signed main()
{
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>s[i];
		change(get(s[i]),i,1);
	}
	cin>>q;
	
	while (q--)
	{
		int flag,t1,t2;
		cin>>flag;
		
		if (flag==1)
		{
			char x;
			cin>>t1>>x;
			change(get(x),t1,1);
			change(get(s[t1]),t1,-1);
			s[t1]=x;
		}
		else if (flag==2)
		{
			int tot=0;
			
			cin>>t1>>t2;
			for (int i=1;i<=26;i++)
			{
				if (get_sum(i,t2)-get_sum(i,t1-1))  tot++;
			}
			cout<<tot<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 154368
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
signed main(){
	int h,w;
	scanf("%d %d",&h,&w);
	int dp[10][10];
	rep(i,10)rep(j,10)scanf("%d",&dp[i][j]);

	rep(k,10)rep(i,10)rep(j,10){
		chmin(dp[i][j],dp[i][k]+dp[k][j]);
	}

	int ans=0;
	rep(i,h*w){
		int a;
		scanf("%d",&a);
		if(a==-1)continue;
		ans+=dp[a][1];
	}

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

	return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int r;
  cin >> r;
  if (r < 1200) {
      cout << "ABC" << endl;
  } else if(r < 2800) {
      cout << "ARC" << endl;
  } else {
      cout << "AGC" << endl;
  }
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
dp=[[0]*(k+1) for _ in range(n+1)]
dp[0][0]=1
for i in range(1,n+1):
    accum=[0,dp[i-1][0]]
    for j in range(1,k+1):
        accum.append((dp[i-1][j]+accum[-1])%mod)
    for j in range(k+1):
        dp[i][j]+=(accum[j+1]-accum[max(j-a[i-1],0)]+mod)%mod
        dp[i][j]%=mod
print(dp[n][k])

Measured memory_bytes: 219580
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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 x; cin >> x;
    cout << 10 - (x / 200) << endl;
}


Measured memory_bytes: 3600
// AOJ ITP 1_7_B
#include<cstdio>
#define repi(i,a,b) for( int i = (a); i != (b); ++i )

int n, x, ans;

int main()
{
	while( scanf( "%d%d", &n, &x ), n|x )
	{
		ans = 0;
		repi( i, 1, n+1 ) repi( j, i+1, n+1 ) repi( k, j+1, n+1 )
			if( i+j+k == x )
				++ans;

		printf( "%d\n", ans );
	}

	return 0;
}

Measured memory_bytes: 1028
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<limits.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int IINF=INT32_MAX;
static const ll LINF=INT64_MAX;
static const ll mod=1e9+7;
static const double eps=1e-13;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};

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

int N;
ll A[100005];

ll res=1;

ll maxR=1e18+0.5;

bool ok=true;


int main(){
    cin>>N;
    for(int i=0;i<N;++i){
        cin>>A[i];
        if(A[i]==0)ok=false;
    }
    if(!ok){
        cout<<0<<endl;
        return 0;
    }
    for(int i=0;i<N;++i){
        ll c=maxR/res;
        if(A[i]>c){
            cout<<-1<<endl;
            return 0;
        }
        res*=A[i];
    }
    cout<<res<<endl;
}


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

int main()
{
  char c;
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
  {
    cout << "vowel" << endl;
  }
  else
  {
    cout << "consonant" <<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const long long INF=1e18,MOD=1e9+7;
int main(){
    int n,m;
    cin>>n>>m;
    vector<ll>a(m);
    map<ll,ll>check;
    for(int i=0;i<m;i++){
        cin>>a[i];
        check[a[i]]++;
    }
    vector<ll>dp(n+1,0);
    dp[0]=1;
    for(int i=1;i<=n;i++){
        if(check[i]!=0)continue;
        dp[i]+=dp[i-1];
        if(i!=1)dp[i]+=dp[i-2];
        dp[i]=dp[i]%MOD;
    } 
    cout<<dp[n]<<endl;  

}

Measured memory_bytes: 8064
/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (win, osx, linux)
 * Author: step_by_step
 * Time: 2020-03-19 17:35:03
**/

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
  
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    //freopen("circus.in", "r", stdin);
    //freopen("circus.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    ll n, k;
    cin >> n >> k;
    n %= k;
    cout << min(n, k - n) << "\n";
    return 0;
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<ull, ull> P; //ペア　タイプでふ
constexpr ll bigNum = 1000000007;

int main(void)
{
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    //ここから本体
    int n = 0;
    cin >> n;
    vector<int> vec(n);
    REP(i, n)
    cin >> vec[i];

    int max = 0;
    bool isOk = true;
    for (int i = 0; i < n; i++)
    {
        if (max < vec[i])
        {
            max = vec[i];
        }
        if (max - 1 > vec[i])
        {
            isOk = false;
            break;
        }
    }
    if (isOk)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

ll bit[2][100002];
int N, M;

void _add(int k, int x, ll val){
    while (x <= M + 1){
        bit[k][x] += val;
        x += x & -x;
    }
}

// add to [l, r] (1-indexed)
void add(int l, int r, ll val){
    _add(0, l, -l * val);
    _add(1, l, val);
    _add(0, r+1, (r+1) * val);
    _add(1, r+1, -val);
}

// sum of [1, x] (1-indexed)
ll sum(int x) {
    ll ret = 0;
    ll c = x + 1;
    while (x > 0){
        ret += bit[0][x] + c * bit[1][x];
        x &= (x - 1);
    }
    return ret;
}


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

    vector<vector<int>> intervals(N);
    for(int i=0;i<N;i++){
        int l, r;
        cin >> l >> r;
        intervals[i] = vector<int>{r-l+1, l, r};
    }
    sort(intervals.begin(), intervals.end());

    memset(bit, 0, sizeof(bit));
    int k = 0;
    for(int d=1;d<=M;d++){
        while(k < N && intervals[k][0] < d){
            add(intervals[k][1], intervals[k][2], 1);
            k++;
        }
        ll ans = N - k;
        for(int d_mul=d;d_mul<=M;d_mul+=d){
            ans += sum(d_mul) - sum(d_mul-1);
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 18944
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

ans=[]
for i in range(N):
    ans.append(0)

sum_A=sum(A)
sum_A_part=0
for j in range((N-1)//2):
    sum_A_part+=A[2*j]

ans[N-1]=sum_A-2*sum_A_part
ans[0]=2*A[N-1]-ans[N-1]
for k in range(1,N-1):
    ans[k]=2*A[k-1]-ans[k-1]

print(*ans)






Measured memory_bytes: 14092
#include "bits/stdc++.h"
 
using namespace std;
 
#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define rep(i, x, n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define trav(a, x) for(auto& a: x)
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define MOD 1000000007
 
typedef vector<int> vec;
typedef long long ll;
typedef unsigned long long ull;
 
int main(){
    fast_cin();
    string s;cin>>s;
    if(s[2]==s[3] and s[4]==s[5])
    	puts("Yes");
    else
    	puts("No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    string s,t;
    int c=0;
    cin>>s>>t;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]==t[i])
        {
            c=c+1;
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <map>
#include <vector>
//#include <unordered_map>
//#include <unordered_set>
#include <stack>
#include <set>
#include <queue>
#include <list>
#define LL long long
#define N 100100
#define M 110
#define MOD 1000000007
#define FOR(i,l,r) for (int i = (l); i <= (r); i ++)
#define CLR(a,x) memset(a,x,sizeof(a))
#define INF 0x3f3f3f3f
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define X first
#define Y second
using namespace std;
const int maxn=100005;
LL gcd(LL a,LL b)
{
    return b?gcd(b,a%b):a;
}
int main()
{
    LL n,ans,k;
    cin>>n;
    cin>>ans;
    for(int i=1;i<n;++i)
    {
        cin>>k;
        ans=k*(ans/(gcd(ans,k)));
    }
    cout<<ans<<endl;
	return 0;
}


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

int main(){
  int n;
  cin >> n;

  int cnt = 0;
  for(int i = 1; i <= n; i += 2){
    cnt++;
  }

  double ans = (double) cnt / n;

  cout << setprecision(10) << ans << endl;

  return 0;
}


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

using namespace std;

const int N = 1e6 + 5;
int _w;

char str[N];
int n , mn , f[N] , mx , ans , g[N];
bool mark[N];

int main( void ) {
  _w = scanf("%s",str+1); 
  n = strlen( str + 1 ); mx = 0;
  for( int i = 1 , s = 0 ; i <= n ; ++i ) {
    if( str[i] == '?' ) mark[i] = 1 , str[i] = '0';
    if( str[i] == '0' ) --s;
    else ++s;
    f[i] = s;
    mx = max( mx , f[i] );
  }
  ans = n; 
  g[n] = f[n];
  for( int i = n - 1 ; i ; --i )
    g[i] = max( g[i + 1] , f[i] );
  for( int _ = 0 ; _ < 2 ; ++_ , ++mx ) {
    mn = 0;
    for( int i = 1 , s = 0 ; i <= n ; ++i ) {
      if( mark[i] ) {
        if( s + g[i] - f[i - 1] + 2 <= mx )
          ++s;
        else --s;
      } else {
        if( str[i] == '0' ) --s;
        else ++s;
      }
      mn = min( mn , s );
    }
    ans = min( ans , mx - mn );
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 13596
import java.util.Scanner;
public class Main{
  	public static void main (String [] args){
      	Scanner scanner = new Scanner (System.in);
      	int a = scanner.nextInt();
      	int b = scanner.nextInt();
      	int difference = a-b;
      	if (difference >= 0)
          	System.out.println(difference);
        else
          	System.out.println("0");
    }
}

Measured memory_bytes: 35492
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll x;
    cin >> x;
    ll ans = 1;
    for(int b = 2; b * b <= x; ++b){
        ll tmp = b * b;
        while(tmp <= x){
            ans = max(ans, tmp);
            tmp *= b;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256