akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
using namespace std;

int main(){
	int n;
	while(cin >> n,n){
		int s[100],min = 1000,max = 0,sum = 0;
		for(int i = 0; i < n; i++){
			cin >> s[i];
			sum += s[i];
			if(s[i] < min){
				min = s[i];
			}
			if(s[i] > max){
				max = s[i];
			}
		}
		sum -= min + max;
		cout << floor(double(sum/(n-2))) << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
A, B = [int(i) for i in input().split(' ')]
     
def f():
    res = 0
    if A > B and A - 1 > B:
        res = A + A - 1
    elif B > A and B - 1 > A:
        res = B + B - 1
    else:
        res = A + B
    return res
print(f())


Measured memory_bytes: 2940
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;

void solve()
  {
	int n,w;
	cin>>n>>w;
	int wt[n],val[n];
	int sum=0;
	rep(i,n){cin>>wt[i]>>val[i];sum+=val[i];}
	int dp[sum+1];
	rep(i,sum+1)dp[i]=w+1;
	dp[0]=0;
	rep(i,n)
	{
		repD(j,sum,val[i])
		{
			dp[j]=min(dp[j],dp[j-val[i]]+wt[i]);
			// cout<<"dp "<<j<<" : "<<dp[j]<<endl;
		}
	}
	long long best = 0;
	for(int i = 0;i<=sum;i++) if(dp[i]<=w)best = max(best,i);
	cout << best << endl;
	
	


  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


Measured memory_bytes: 4416
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

vector<ll> divi(ll n){
    vector<ll> ret;
    for(ll i = 1; i * i <= n; ++i){
        if (n % i == 0){
            ret.emplace_back(i);
        }
    }

    return ret;
}

ll func(ll a, ll b){
    string sa = to_string(a);
    string sb = to_string(b);
    return max(sa.size(), sb.size());
}


int main() {
    ll n;
    cin >> n;
    vector<ll> divisors = divi(n);

    ll minv = numeric_limits<ll>::max();
    for(auto i : divisors){
        minv = min(minv, func(i, n / i));
    }

    cout << minv << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int m = sc.NextInt();
        int x = sc.NextInt();

        int[] c = new int[n];
        int[][] a = new int[n][];
        for (int i = 0; i < n; i++)
        {
            c[i] = sc.NextInt();
            a[i] = new int[m];
            for (int j = 0; j < m; j++)
            {
                a[i][j] = sc.NextInt();
            }
        }

        int l = 1 << n;

        int ans = int.MaxValue;
        for (int i = 0; i < l; i++)
        {
            int cost = 0;
            int[] t = new int[m];
            for (int j = 0; j < n; j++)
            {
                if ((i & (1 << j)) == 0) continue;
                cost += c[j];
                for (int k = 0; k < m; k++)
                {
                    t[k] += a[j][k];
                }
            }

            bool f = true;
            for (int j = 0; f && j < m; j++)
            {
                f &= t[j] >= x;
            }

            if (f) ans = Math.Min(ans, cost);
        }
        if (ans == int.MaxValue)
        {
            Console.WriteLine("-1");
            return;
        }
        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

using namespace std;
int main() {
	unsigned long long int a1, b0, c1, total;
	cin >> a1 >> b0 >> c1 >> total;
	long long int ans = 0;
	unsigned long long int count = 0;
	for (unsigned long long int i = 0; i < a1 && count < total; i++) {
		ans++;
		count++;
	}
	for (unsigned long long int i = 0; i < b0 && count < total; i++) {
		count++;
	}
	for (unsigned long long int i = 0; i < c1 && count < total; i++) {
		ans--;
		count++;
	}
	cout << ans<<endl;


	return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(void)
{
	int h,m,s;
	scanf("%d",&s);
	if(s>=3600){
		h=s/3600;
		s=s%3600;
	}
	else if(s<3600){
		h=0;
	}
	if(s>=60){
		m=s/60;
		s=s%60;
	}
	else if(s<60)
	{
		m=0;
	}
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

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

ll dp[3010][3010];
ll a[3010];
ll solve(int i, int j){
	if(i > j) return 0;
  	if(dp[i][j] != -1) return dp[i][j];
  	return dp[i][j] = max(a[i] - solve(i + 1, j), a[j] - solve(i, j - 1));
}
int main(){
  int n;
  cin >> n;
  memset(dp, -1, sizeof(dp));
  for(int i = 0; i < n; i++) cin >> a[i];
  cout << solve(0, n - 1);
}


Measured memory_bytes: 71296
#include <stdio.h>

int main(void)
{
	int a,b,k,i,j;
	scanf("%d%d%d",&a,&b,&k);
	if(b-a+1 <= k*2){
		for(i=a; i<=b; i++){
			printf("%d\n",i);
		}
	}
	if(b-a+1 > k*2){
		for(i=a; i<=a+k-1; i++){
			printf("%d\n",i);
		}
		for(j=b-k+1; j<=b; j++){
			printf("%d\n",j);
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair

using namespace std;

int main(){

    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    
    vector<ll> sum(n + 1);
    map<ll,ll> m;
    sum[0] = 0;
    rep(i,n){
        sum[i + 1] += sum[i] + a[i];
    }

    sort(sum.begin(),sum.end());

    ll ans = 0;

    if(n == 0){
        if(a[0] == 0){
            cout << 1 << endl;
        }
        else{
            cout << 0 << endl;
        }
        return 0;
    }

    rep(i,n + 1){
        ans += m[sum[i]];
        m[sum[i]]++;
    }

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

Measured memory_bytes: 15872
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define cost first
#define from second.first
#define to second.second
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	int n,a,l=INF,r=-INF,i;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a;
		l = min(a,l);
		r = max(a,r);
	}
	cout << (r-l) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    int max=a[0];
    int min=a[0];
    for(int i=0;i<n;i++)
    {
        if(min>a[i])
            min=a[i];
        if(max<a[i])
            max=a[i];
    }
    printf("%d",max-min);
    
}



Measured memory_bytes: 128
#include <stdio.h>

int main(){
    int a,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m,x;

   scanf("%d",&a);
   x=a;
    b=a/1000000000;
    a=a%1000000000;
    c=a/100000000;
    a=a%100000000;
    d=a/10000000;
    a=a%10000000;
    e=a/1000000;
    a=a%1000000;
    f=a/100000;
    a=a%100000;
    g=a/10000;
    a=a%10000;
    h=a/1000;
    a=a%1000;
    i=a/100;
    a=a%100;
    j=a/10;
    k=a%10;

    l=b+c+d+e+f+g+h+i+j+k;
    m=x%l;
    if(m==0){
        printf("Yes");
    }else{
        printf("No");
    }


}


Measured memory_bytes: 128
def find_sorted(elt, sarray):
    """Finds an element in a sorted array.

    Args:
        elt (int)     -- Element to search
        array (array) -- Sorted array (element in increasing order)
    Returns:
        Index of "elt" in "array", or "None" if "elt" is not in "array"
    """
    # TODO: remove the line below, and...
    # return find(elt, sarray)
    # TODO: ...implement using the knowledge that
    # TODO: the input array is already sorted.
    left = 0
    right = len(sarray)
    while left < right:
        mid = (left + right) // 2
        if sarray[mid] == elt:
            return mid
        elif sarray[mid] < elt:
            left = mid + 1
        else:
            right = mid
    else:
        return None

n  = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))
count = 0
for i in range(len(T)):
    if find_sorted(T[i],S) != None:
        count += 1

print(count)


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

#define ll long long
#define ull unsigned long long

#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

bool isPalindrome(string s) {
    string t(s.rbegin(), s.rend());
    return s == t;
}

int main(void) {
    ll N;
    ll count = 0;
    cin >> N;
    for(ll i = 1;i <= N;i++) {
        if(i % 3 && i % 5) count += i;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, mod;
vector<vector<ll>> g;
P dp[100008];

P ide(){
    return P(1, 0);
}

P f1(P a, P b){
    return P(a.first*b.first%mod, (a.first*b.second%mod+a.second*b.first%mod+a.second*b.second%mod)%mod);
}

P f2(P a){
    return P(a.first, (a.first+a.second)%mod);
}

void dfs1(ll at, ll from = -1){
    dp[at] = ide();
    zep(i, 0, g[at].size()){
        ll nx = g[at][i];
        if(nx != from){
            dfs1(nx, at);
            dp[at] = f1(dp[at], f2(dp[nx]));
        }
    }
}

void dfs2(ll at, ll from = -1, P x = ide()){
    dp[at] = f2(f1(dp[at], x));

    ll m = g[at].size();
    P l[m], r[m];
    zep(i, 0, m){l[i] = r[i] = (g[at][i] == from)? x : f2(dp[g[at][i]]);}
    rep(i, 1, m-1){l[i] = f1(l[i], l[i-1]);}
    rrep(i, m-2, 0){r[i] = f1(r[i], r[i+1]);}

    zep(i, 0, m){
        ll nx = g[at][i];
        if(nx != from){
            P tmp = ide();
            if(i > 0){tmp = f1(tmp, l[i-1]);}
            if(i < m-1){tmp = f1(tmp, r[i+1]);}
            dfs2(nx, at, f2(tmp));
        }
    }
}

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

    cin >> n >> mod;
    g.resize(n);
    zep(i, 0, n-1){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    dfs1(0);
    dfs2(0);

    zep(i, 0, n){print(dp[i].second)}
    return 0;
}

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

int main()
{
	int n;
	int A[100];

	cin >> n;
	for (int i = 0; i < n; i++) { 
		cin >> A[i];
	}
	
	for (int i = n - 1; i >= 0; i--) {
		cout << A[i];
		if(i>0)cout << " ";
	}
	cout << endl;
}

Measured memory_bytes: 3036
X = int(input())

if X == 2:
  print(X)
  exit()

isprime = False
while isprime == False:
  check = False
  for i in range(X):
    if i >= 2:
      if X % i == 0:
        check = True
        break
  if check == False:
    isprime = True
  else:
    X += 1
print(X)

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N + 1), B(N);
  for (int i = 0; i < N + 1; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < N; ++i) {
    cin >> B[i];
  }

  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    int C = min(A[i], B[i]);
    ans += C, A[i] -= C, B[i] -= C;
    ans += min(A[i + 1], B[i]), A[i + 1] -= min(A[i + 1], B[i]);
  }

  cout << ans << endl;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

// res[i] := S[i:] と S[0: ] との最長共通部分列の長さ。O(|S|)
vi Zalgorithm(const string &S) {
  int N = (int)S.size();
  vi res(N);
  res[0] = N;
  int i = 1, j = 0;
  while(i < N) {
    while(i + j < N && S[j] == S[i + j]) ++j;
    res[i] = j;
    if(j == 0) {
      ++i;
      continue;
    }
    int k = 1;
    while(i + k < N && k + res[k] < j) res[i + k] = res[k], ++k;
    i += k, j -= k;
  }
  return res;
}

int main() {
  ll n;
  string s;
  cin >> n >> s;
  ll ans = 0;
  rep(i, n) {
    string t = s.substr(i, n - i);
    vi z = Zalgorithm(t);
    rep(j, n - i) ans = max(ans, min(j, ll(z[j])));
  }
  cout << ans << endl;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
 
using namespace std;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define lp(i, a, b) for (int i=a; i<(b); i++)
#define lpd(i,a,b) for (int i = (b)-1; i >= a; i--)
	
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a, b;
    cin>>a>>b;
    if (a<1 || a>9 || b<1 || b>9) cout<<-1<<endl;
    else cout<<a*b<<endl;
 
    return 0;
}

Measured memory_bytes: 256
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_D
  * ?´???°?????°
  * ???????????´??° a???b???c ??????????????????a ?????? b ?????§?????´??°????????????c ????´???°?????????????????????????±???????????????°????????????????????????????????????
  */
object Main {
  def main(args: Array[String]): Unit = {
    val seq = io.StdIn.readLine().split(" +").map(_.toInt)
    val (a, b, c) = seq match { case Array(x, y, z) => (x, y, z) }
    val answer = (a to b).count(c % _ == 0)
    println(answer)
  }
}

Measured memory_bytes: 44072
from collections import Counter
 
n = int(input())
v = list(map(int,input().split()))
vo = v[::2]
ve = v[1::2]
co = Counter(vo).most_common()
ce = Counter(ve).most_common()
co.append((-1, 0)) #vが[1,1,1,1]のようなケースへの対応
ce.append((-2, 0)) #頻度の降順に並んでいるのでこの書き方で十分
if co[0][0] != ce[0][0]: #偶奇の最頻の要素が異なる場合
    print(n - co[0][1] - ce[0][1])
else:
    res1 = n - co[0][1] - ce[1][1] #偶数側を書き換える場合
    res2 = n - co[1][1] - ce[0][1] #奇数側を書き換える場合
    print(min(res1, res2))

Measured memory_bytes: 65388
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=200010;
ll n,k,a[MAXN],b[MAXN];
bool cmp (ll a,ll b) {return a>b;}
bool chk (ll x) {
	ll res=0;
	for (int i=1;i<=n;i++) {res+=max(0ll,a[i]-x/b[i]);}
	return (res<=k);
}
int main () {
	scanf("%lld%lld",&n,&k);
	for (int i=1;i<=n;i++) {scanf("%lld",&a[i]);}
	for (int i=1;i<=n;i++) {scanf("%lld",&b[i]);}
	sort(a+1,a+n+1,cmp);
	sort(b+1,b+n+1);
	ll l=0,r=1e12;
	while (l<r) {
		ll mid=(l+r)>>1;
		if (chk(mid)) {r=mid;}
		else {l=mid+1;}
	}
	printf("%lld\n",l);
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define fre freopen("C:\\in.txt", "r", stdin)
#define _for(i,a,b) for(int i=a; i< b; i++)
#define _rep(i,a,b) for(int i=a; i<=b; i++)
#define lowbit(a) ((a)&-(a))
#define inf 0x3f3f3f3f
#define endl "\n"
using namespace std;
typedef long long ll;
template <class T>
void read(T &x)
{
    char c; bool op=0;
    while(c=getchar(), c<'0'||c>'9') if(c=='-') op=1;
    x=c-'0';
    while(c=getchar(), c>='0'&&c<='9') x=x*10+c-'0';
    if(op) x=-x;
}

const int maxn=2e5+5;
int T, n, k, a[maxn];

int check(int x)
{
    ll step=0;
    _rep(i, 1, n) if(a[i]>x) step+=a[i]/x;
    return step<=k? true:false;
}

int main()
{
    //read(T);
    T=1;
    while(T--)
    {
        read(n), read(k);
        _rep(i, 1, n) read(a[i]);
        int l=1, r=1e9+5;
        while(l<=r){
            int mid=(l+r)>>1;
            if(check(mid)) r=mid-1;
            else l=mid+1;
        }
        printf("%d\n", l);
    }
    return 0;
}


Measured memory_bytes: 4540
#include"iomanip"
#include"iostream"
#include"limits"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"queue"
#include"stack"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"assert.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define mset(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n;
	cin>>n;
	map<ll,ll>my;
	for(int i=0;i<n;++i)
	{
		ll x;
		cin>>x;
		my[x]++;
	}
	for(map<ll,ll>::iterator it=my.begin();it!=my.end();)
	{
		auto itt=it;
		itt++;
		if((it->second)<=1)
		{
			my.erase(it);
		}
		it=itt;
	}
	if(my.empty())
	{
		cout<<"0\n";
		return 0;
	}
	if(my.size()<=1)
	{
		auto i1=my.end();
		i1--;
		if(i1->second<4)
			cout<<"0\n";
		else cout<<i1->first*i1->first<<'\n';
		return 0;
	}
	auto i1=my.end(),i2=i1;
	i1--;i2--;i2--;
	if(i1->second<4)
		cout<<i1->first*i2->first<<'\n';
	else cout<<i1->first*i1->first<<'\n';
}

Measured memory_bytes: 6528
#include <stdio.h>
int main (){
	int numberS, a, b, c;
	scanf("%d", &numberS);
  a = numberS%10;
  b = numberS/100;
  c = numberS%100/10;
	if(a==7 || b==7 || c==7){
		printf("Yes");
	}
	else{
		printf("No");
	}


}

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

int main(void){
  int n, i, lightup = 1, tmp, count = 0;
  cin >> n;
  int button[n] = {};
  for(i = 1; i <= n; i++){
    cin >> button[i];
  }

  while(true){
    if(lightup == 0){
      cout << -1 << endl;
      return 0;
    }
    tmp = button[lightup]; button[lightup] = 0; lightup = tmp; count++;
    if(lightup == 2){
      cout << count << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 640
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説通りに実装したソースコード
 * 
 * https://atcoder.jp/contests/abc166/submissions/14875943 にも参考
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] a = new int[n];
			// i+A_i の数を保存するマップ
			Map<Integer, Integer> map = new HashMap<>();
			IntStream.range(0, n).forEach(i -> map.merge(i + (a[i] = scanner.nextInt()), 1, Integer::sum));
			System.out.println(IntStream.range(0, n).mapToLong(i -> map.getOrDefault(i - a[i], 0)).sum());
		}
	}
}


Measured memory_bytes: 72996
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
  int n,k,s,a,b,c,m,DATA[101][101];
  while(1){
    cin >> n >> m;
    if(n==0&&m==0)break;
    for(int i=0;i<101;i++){
      for(int j=0;j<101;j++){
	DATA[i][j] = 10000000;
      }
      DATA[i][i]=0;
    }
    for(int l=0;l<m;l++){
      cin >> s;
      if(s==1){
	cin >> a >> b >> c;
	if(DATA[a][b]>c){
	  DATA[a][b] = DATA[b][a] = c;
	  //for(int i=1;i<=n;i++){
	    for(int j=1;j<=n;j++){
	      for(int k=1;k<=n;k++){
		DATA[j][k]=min(DATA[j][k],DATA[j][a]+DATA[a][k]);
		DATA[j][k]=DATA[k][j]=min(DATA[j][k],DATA[j][b]+DATA[b][k]);
	      }
	    }
	    //}
	}
      }else{
	cin >> a >> b;
	cout << (DATA[a][b]==10000000 ?-1:DATA[a][b]) << endl; 
      }
    }
  }
}

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

int n,i;
char a;

int main()
{
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",&a);
		if(a=='Y')
		{
			printf("Four");
			return 0;
		}
	}
	printf("Three");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using ll = long long;
using namespace std;


int main() {
    int n, k;
    while(cin >> n >> k, n|k) {
        vector<int> v(10);
        vector<int> v2(k);
        set<string> S;
        for (int i = 0; i < n; ++i) {
            cin >> v[i];
        }
        sort(v.begin(), v.begin() + n);
        for (int i = 0; i < (1 << n); ++i) {
            if (__builtin_popcount(i) == k) {
                int c = 0;
                for (int j = 0; j < n; ++j) {
                    if (i & (1 << j)) {
                        v2[c] = v[j];
                        c++;
                    }

                }
                sort(v2.begin(), v2.end());

                do {
                    string s;
                    for (int &item : v2) {
                        s += to_string(item);
                    }
                    S.emplace(s);
                } while (next_permutation(v2.begin(), v2.end()));
            }
        }
        cout << S.size() << "\n";
    }
    return 0;
}



Measured memory_bytes: 3512
import java.util.*

fun main(args: Array<String>) {
    Scanner(System.`in`).use { sc ->
        val n = sc.nextInt()
        val m = sc.nextInt()
        val x = sc.nextInt()
        val y = sc.nextInt()
        val xx:Int = sc.asSequence().take(n).map { it.toInt() }.plus(x).sorted().last()
        val yy:Int = sc.asSequence().take(m).map { it.toInt() }.plus(y).sorted().first()
        println(if (xx < yy) "No War" else "War")
    }
}


Measured memory_bytes: 35960
#include <stdio.h>

int main(void) {
  int a, b;
  scanf("%d%d", &a, &b);
  int t = b < 0 ? b - a + 1 : a <= 0 ? 0 : 2;
  printf("%s", !t ? "Zero" : t & 1 ? "Negative" : "Positive");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(12), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
using Int = long long;
struct SegTree {
    int N;
    vector<int> A, B;
    SegTree(int n, int init) {
        N = 1;
        while (N < n) N *= 2;
        A.resize(2 * N);
        B.resize(2 * N, INT_MAX);
        for (int i = 0; i < n; i++) {
            A[i + N] = init;
        }
        for (int n = N - 1; n > 0; n--) {
            A[n] = min(A[2*n+0], A[2*n+1]);
        }
    }
    void down(int node, int nodeL, int nodeR) {
        if (B[node] == INT_MAX) return;
        A[2*node+0] = min(A[2*node+0], B[node]);
        A[2*node+1] = min(A[2*node+1], B[node]);
        B[2*node+0] = min(B[2*node+0], B[node]);
        B[2*node+1] = min(B[2*node+1], B[node]);
        B[node] = INT_MAX;
    }
    void set_0(int L, int R, int val, int node, int nodeL, int nodeR) {
        if (R <= nodeL || nodeR <= L) return;
        if (L <= nodeL && nodeR <= R) {
            A[node] = min(A[node], val);
            B[node] = min(B[node], val);
            return;
        }
        down(node, nodeL, nodeR);
        set_0(L, R, val, 2*node+0, nodeL, (nodeL + nodeR) / 2);
        set_0(L, R, val, 2*node+1, (nodeL + nodeR) / 2, nodeR);
        A[node] = min(A[2*node+0], A[2*node+1]);
    }
    void set(int L, int R, int val) {
        set_0(L, R, val, 1, 0, N);
    }
    int minimum_0(int L, int R, int node, int nodeL, int nodeR) {
        if (R <= nodeL || nodeR <= L) return INT_MAX;
        if (L <= nodeL && nodeR <= R) return A[node];
        down(node, nodeL, nodeR);
        int ans = INT_MAX;
        ans = min(ans, minimum_0(L, R, 2*node+0, nodeL, (nodeL + nodeR) / 2));
        ans = min(ans, minimum_0(L, R, 2*node+1, (nodeL + nodeR) / 2, nodeR));
        return ans;
    }
    int minimum(int L, int R) {
        return minimum_0(L, R, 1, 0, N);
    }
    void dump() {
        for (int i = 0; i < N; i++) {
            cout << minimum(i, i+1) << ' ';
        }
        cout << endl;
    }
};
int main() {
    int N, Q; cin >> N >> Q;
    SegTree X(N + 1, N - 2), Y(N + 1, N - 2);
    X.set(0, 2, 0); X.set(N, N + 1, 0);
    Y.set(0, 2, 0); Y.set(N, N + 1, 0);
    Int ans = 0;
    while (Q--) {
        int axis, x; cin >> axis >> x;
        SegTree &A = (axis == 1 ? X : Y);
        SegTree &B = (axis == 1 ? Y : X);
        int ok = N, ng = 1;
        while (abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;
            bool b = B.minimum(2, mid + 1) <= x - 2;
            (b ? ok : ng) = mid;
        }
        ans += A.minimum(x, x+1);
        A.set(x, x+1, 0);
        B.set(2, ok, x-2);
    }
    cout << (Int)(N - 2) * (N - 2) - ans << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int h, w;
	cin>>h>>w;
	if(h%3 == 0 || w%3 == 0){
		cout<<0<<endl;
		exit(0);
	}
	ll ans = min(h, w);
	for(int a = 1; a < w; a++){
		vector<ll> v;
		v.push_back(h*1LL*a);
		v.push_back((h + 1)/2 * 1LL * (w - a));
		v.push_back(h/2 * 1LL * (w - a));
		sort(v.begin(), v.end());
		ans = min(ans, v.back() - v[0]);
	}
	swap(h, w);
	for(int a = 1; a < w; a++){
		vector<ll> v;
		v.push_back(h*1LL*a);
		v.push_back((h + 1)/2 * 1LL * (w - a));
		v.push_back(h/2 * 1LL * (w - a));
		sort(v.begin(), v.end());
		ans = min(ans, v.back() - v[0]);
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int in(){int x; scanf("%d",&x); return x;}
static const int MAX = 100000;


int main(){
  int ans = 0, count = 0;
  string s;
  cin >> s;

  rep(i, s.size()){
    for(int j = i; j < s.size(); j++){
      if(s[j]=='A' || s[j]=='C' || s[j]=='G' || s[j] == 'T'){
        count++;
        ans = max(ans, count);
      }else count = 0;
    }
    count = 0;
  }
  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[] array = new int[3];
        array[0] = sc.nextInt();
        array[1] = sc.nextInt();
        array[2] = sc.nextInt();
        
        Arrays.sort(array);
        System.out.println(array[0] + " " + array[1] + " " + array[2] );
    }

}

Measured memory_bytes: 26136
using System;
using System.Linq;

namespace AizuOnlineJudge {
    class Program {
        static void Main() {
            Console.ReadLine();
            var d = Console.ReadLine()
                .Split()
                .Select(int.Parse)
                .Zip(
                    Console.ReadLine().Split().Select(int.Parse),
                    (x, y) => Math.Abs(x - y)
                )
                .Aggregate(
                    new double[4],
                    (p, c) => {
                        p[0] += c;
                        p[1] += Math.Pow(c, 2);
                        p[2] += Math.Pow(c, 3);
                        p[3] = Math.Max(p[3], c);

                        return p;
                    }
                );

            Console.WriteLine(d[0].ToString("0.000000"));
            Console.WriteLine(Math.Pow(d[1], 1 / 2d).ToString("0.000000"));
            Console.WriteLine(Math.Pow(d[2], 1 / 3d).ToString("0.000000"));
            Console.WriteLine(d[3].ToString("0.000000"));
        }
    }
}



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string ss;cin>>ss;
    vector<int> a;
    int s=ss.size();
    rep(i,s-1){
        if(ss[i]!=ss[i+1]){
            a.push_back(max(i+1,s-i-1));
        }
    }
    int mini=2e5;
    a.push_back(s);
    rep(i,a.size()){
        mini=min(mini,a[i]);
    }
    cout<<mini<<endl;
    return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

constexpr ll dx[]={1,0,-1,0,1,1,-1,-1};
constexpr ll dy[]={0,1,0,-1,1,-1,1,-1};

int main(){

  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  cin>>s;

  auto calc = [&](int i,int j){
    auto dist = _vec<ll>(h,w,INF);
    queue<tuple<ll,ll,ll>> que;
    que.emplace(i,j,0);
    while(!que.empty()){
      ll y,x,c;
      tie(y,x,c) = que.front();
      que.pop();
      if(chmin(dist[y][x],c)){
        rep(i,4){
          ll ny=y+dy[i];
          ll nx=x+dx[i];
          if(ny==-1||nx==-1||ny==h||nx==w)continue;
          if(s[ny][nx]=='#')continue;
          que.emplace(ny,nx,c+1);
        }
      }
    }
    ll res=-1;
    rep(i,h)rep(j,w)if(dist[i][j]!=INF)res=max(res,dist[i][j]);
    return res;
  };

  ll ans = 0;
  rep(i,h)rep(j,w){
    if(s[i][j]=='#')continue;
    ans = max(ans,calc(i,j));
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    string s; cin >> s;
    bool ans=false;
    for(int i=1; i<4; ++i){
        if(s[i-1]==s[i]){
            ans=true;
            break;
        }
    }
    cout << (ans ? "Bad" : "Good") << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<utility>
#include<string>
#include<map>
#include<unordered_map>
#include<queue>

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; }

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}
int lcm(int a, int b){return a*b / gcd(a, b);}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    sort(a.rbegin(), a.rend());
    vector<ll> l;
    for(int i = 0; i < n; i++){
        if(a[i] == a[i+1]){
            l.push_back(a[i]);
            i++;
        }
    }

    ll ans;
    if(l.size() >= 2) ans = l[0]*l[1];
    else ans = 0;

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


Measured memory_bytes: 4236
# C - Successive Subtraction

N = int(input())
A = list(int(a) for a in input().split())

M = []
P = []
for a in A:
    if a >= 0:
        P.append(a)
    else:
        M.append(a)

P.sort(reverse=True)
M.sort()
lenP = len(P)
lenM = len(M)    

ans = []
anssum = 0

if lenM ==0:
    if lenP >= 3:
        ans.append((P[-1], P[-2]))
        tmp = P.pop() - P.pop()
        M.append(tmp)
        lenP -= 2
    else:
        ans.append((P[-2], P[-1]))
        tmp = P.pop() - P.pop()
        tmp *= -1
        P.append(tmp)
        lenP -= 2
elif lenP ==0:
    ans.append((M[-1], M[-2]))
    tmp = M.pop() - M.pop()
    P.append(tmp)
    lenP += 1
for i in range(lenP-1):
    ans.append((M[-1], P[-1]))
    tmp = M.pop() - P.pop()
    M.append(tmp)
while M != []:
    ans.append((P[-1], M[-1]))
    tmp = P.pop() - M.pop()
    P.append(tmp)
anssum = P.pop()

print(anssum)
for i in range(len(ans)):
    print(' '.join(map(str, ans[i])))


Measured memory_bytes: 19640
package main
 
import (
  "fmt"
  "unicode/utf8"
)

func main() {
 
  var a int
  var s string
  fmt.Scan(&a)
  fmt.Scan(&s)
  
  if utf8.RuneCountInString(s) >= 1 && utf8.RuneCountInString(s) <= 10 {
    if 3200 <= a && a < 5000 {
      fmt.Println(s) 
    } else if 2800 <= a && a < 3200 {
      fmt.Println("red")
    }
  }
}

Measured memory_bytes: 512
sx, sy, tx, ty = map(int, input().split())
print(
    'R' * (tx - sx) + \
    'U' * (ty - sy) + \
    'L' * (tx - sx) + \
    'D' * (ty - sy + 1) + \
    'R' * (tx - sx + 1) + \
    'U' * (ty - sy + 1) + \
    'L' + 'U' + \
    'L' * (tx - sx + 1) + \
    'D' * (ty - sy + 1) + \
    'R'
)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <tuple>
#include <cmath>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int lt = 0, lx = 0, ly = 0;
    for (int i = 0; i < N; i++) {
        int t, x, y;
        cin >> t >> x >> y;
        int minimum = abs(lx - x) + abs(ly - y);
        if (!(t - lt >= minimum && (t - lt) % 2 == minimum % 2)) {
            cout << "No" << endl;
            return 0;
        }
        lt = t, lx = x, ly = y;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] A = new int[3][3];
        boolean[][] checked = new boolean[3][3];
        boolean bingoed = false;
        for(int i =0;i<3;i++){
            for(int j=0;j<3;j++){
                A[i][j] = sc.nextInt();
            }
        }
        int n = sc.nextInt();

        for(int i=0;i<n;i++){
            int b = sc.nextInt();
            for(int j=0;j<3;j++){
                for(int k=0;k<3;k++){
                    if(b == A[j][k]){
                        checked[j][k] = true;
                    }
                }
            }
        }
        for(int i=0;i < 3;i++){
            if(checked[i][0] && checked[i][1] &&checked[i][2]){
                bingoed = true;
            }
            if(checked[0][i] && checked[1][i] && checked[2][i]){
                bingoed = true;
            }
        }
        if(checked[1][1]){
            if(checked[0][2] && checked[2][0]){
                bingoed = true;
            }
            if(checked[0][0] && checked[2][2]){
                bingoed = true;
            }
        }



        if(bingoed){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }


    }

}








Measured memory_bytes: 23636
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int a,b,h;
	cin>>a>>b>>h;
	cout<<(a+b)*h/2<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
int a[114514];
using namespace std;
signed main(){
    int k,n;
    cin>>k>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    if(a[n-1]>(k+1)/2){
        cout<<a[n-1]*2-k-1<<endl;
    }
    else{
        cout<<0<<endl;
    }
}

Measured memory_bytes: 256
import sys
N,M=map(int,input().split())
P=[]
for i in range(N):
    x,y,z=map(int,input().split())
    P.append([x,y,z])
if M==0:
    print(0)
    sys.exit()
ans =0
for i in range(8):
    A=[]
    for j in range(N):
        s = 0
        for k in range(3):
            if i& (1<<k):
                s+=P[j][k]
            else:
                s-=P[j][k]
        A.append(s)
    A.sort()
    ans = max(ans,sum(A[-M:]))
print(ans)

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

const int MOD = 1000000007;
template<class T> inline void add_mod(T &a, const T b) {
	a += b;
	if(a >= MOD) a -= MOD;
}

bool a[100010];
long dp[100010];

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	for(int i = 0; i < m; i++) {
		int x;
		scanf("%d", &x);
		a[x] = true;
	}
	dp[0] = 1;
	for(int i = 1; i <= n; i++) {
		if(a[i]) continue;
		if(i - 1 >= 0) add_mod(dp[i], dp[i-1]);
		if(i - 2 >= 0) add_mod(dp[i], dp[i-2]);
	}
	printf("%ld\n", dp[n]);
}


Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

typedef long double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos((R)(-1));

int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}

int sgn(R a, R b) {
    return sgn(b-a);
}

bool near(const P &a, const P &b) {
    return !sgn(abs(a-b));
}


R sacos(R d) {
    d = max<R>(-1, d);
    d = min<R>(1, d);
    return acos(d);
}
struct C {
    P p;
    R r;
    C() {}
    C(P p, R r) : p(p), r(r) {}
};

int crossCC(const C &c, const C &d, R &l, R &r) {
    if (near(c.p, d.p) && !sgn(c.r, d.r)) {
        l = 0; r = 2*PI;
        return -1;
    }
    R di = abs(c.p - d.p);
    if (sgn(c.r+d.r, di) == 1) return 0;
    if (sgn(di, abs(c.r-d.r)) == 1) return 0;
    R bth = arg(d.p - c.p);
    R th = sacos((c.r*c.r + di*di - d.r*d.r) / (2*c.r*di));
    l = bth-th;
    r = bth+th;
    if (sgn(th) == 0) return 1;
    return 2;
}

const int MN = 12;
int n;
C base[MN];

C c[MN];
bool calc(R md) {
    for (int i = 0; i < n; i++) {
        c[i] = base[i];
        c[i].r = sqrt(base[i].r*base[i].r - md*md);
    }

    vector<P> v;

    for (int i = 0; i < n; i++) {
        v.push_back(c[i].p);
    }
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            R l, r;
            if (crossCC(c[i], c[j], l, r) == 0) continue;
            v.push_back(c[i].p + polar(c[i].r, l));
            v.push_back(c[i].p + polar(c[i].r, r));
        }
    }

    int res = 0;
    for (P p: v) {
        int sm = 0;
        for (int i = 0; i < n; i++) {
            if (sgn(abs(c[i].p-p), c[i].r) != -1) sm++;
        }
        res = max(res, sm);
    }
    return res == n;
}

bool solve() {
    cin >> n;
    if (!n) return false;
    R r = 400;
    for (int i = 0; i < n; i++) {
        R x, y, l;
        cin >> x >> y >> l;
        base[i] = C(P(x, y), l);
        r = min(r, l);
    }

    r -= 100*EPS;
    R l = 0;
    for (int i = 0; i < 100; i++) {
        R md = (l+r)/2;
//        printf("%.20Lf %d\n", md, calc(md));
        if (calc(md)) {
            l = md;
        } else {
            r = md;
        }
    }
    printf("%.20Lf\n", l);
    return true;
}

int main() {
    while (solve()) {}
    return 0;
}

Measured memory_bytes: 1260
#include <cstdio>

bool f[100001];
int c[100002];
int N, L, R ;
int main () {
for (int i = 2; i <= 100000; i ++) if (!f[i]) for(int j = i + i; j <= 100000; j+= i) f[j] = true;
for (int i = 3; i <= 100000; i += 2) if (!f[i] && !f[(i+1)/2]) c[i]++;
for (int i = 3; i <= 100000; i ++) c[i] += c[i-1];
scanf("%d ", &N);
while (N--) {
scanf("%d %d ", &L, &R);
printf("%d\n" , c[R] - c[L-1]);
}
}


Measured memory_bytes: 1024
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

const int maxn = 2005, mod = 924844033;
int n, k;
int bor[maxn];
int dp[maxn][maxn][2][2];
int f[maxn];

void precalc() {
  f[0] = 1;
  for (int i = 1; i < maxn; i++) {
    f[i] = (long long)f[i - 1] * i % mod;
  }
}

int read() {
  if (scanf("%d%d", &n, &k) < 2) {
    return false;
  }
  return true;
}

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

void solve() {
  {
    for (int i = 0; i < n; i++) {
      bor[i] = false;
    }
    int d = n / k, r = n % k;
    for (int i = 0; i < r; i++) {
      bor[(i + 1) * (d + 1) - 1] = true;
    }
    for (int i = r; i < k; i++) {
      bor[r * (d + 1) + (i - r + 1) * d - 1] = true;
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      for (int pr = 0; pr < 2; pr++) {
        for (int cur = 0; cur < 2; cur++) {
          dp[i][j][pr][cur] = 0;
        }
      }
    }
  }
  dp[0][0][1][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      for (int pr = 0; pr < 2; pr++) {
        for (int cur = 0; cur < 2; cur++) {
          if (!dp[i][j][pr][cur]) {
            continue;
          }
          add(dp[i + 1][j][cur][0], dp[i][j][pr][cur]);
          if (!pr && !bor[i - 1]) {
            add(dp[i + 1][j + 1][cur][0], dp[i][j][pr][cur]);
          }
          if (!bor[i]) {
            add(dp[i + 1][j + 1][cur][1], dp[i][j][pr][cur]);
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    int x = dp[n][i][0][0] + dp[n][i][1][0];
    if (x >= mod) {
      x -= mod;
    }
    x = (long long)x * f[n - i] % mod;
    if (i & 1) {
      x = (mod - x) % mod;
    }
    add(ans, x);
  }
  printf("%d\n", ans);
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


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

long long f(long long x, const vector<long long> & As){
    long long cum = 0;
    for (auto & a : As) cum += abs(a - x);
    return cum;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<long long> As(N);
    for (auto & a : As) cin >> a;
    for (int i = 0; i < N; ++i) As[i] -= i + 1;
    long long x0 = -1'001'000'000;
    long long x3 =  1'001'000'000;
    while (x0 + 2 < x3){
        long long x1 = x0 + (x3 - x0) / 3;
        long long x2 = x3 - (x3 - x0) / 3;
        if (f(x1, As) > f(x2, As)){
            x0 = x1;
        }else{
            x3 = x2;
        }
    }
    long long score = 1e15;
    for (long long x = x0; x <= x3; ++x){
        score = min(score, f(x, As));
    }
    cout << score << endl;
    return 0;
}

Measured memory_bytes: 1792
abcd = [int(i) for i in input().split()]
ans = "Yes"

ab, bc, ac = abs(abcd[1]-abcd[0]), abs(abcd[2]-abcd[1]), abs(abcd[2]-abcd[0])
d = abcd[3]

if ab > d or bc > d:
    ans = "No"
if ac <= d:
    ans = "Yes"

print(ans)

Measured memory_bytes: 3060