akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>

int main() {
    int n;
    std::string s;
    std::cin >> n >> s;

    std::vector<std::vector<int>> len(n, std::vector<int>(n, -1));
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (s[i] != s[j]) {
                len[i][j] = 0;
            } else {
                len[i][j] = (i == 0 ? 0 : len[i - 1][j - 1]) + 1;
            }
            ans = std::max(ans, std::min(len[i][j], j - i));
        }
    }

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


Measured memory_bytes: 98176
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int[] p = new int[4];
		for (int i = 0; i < 4; ++i) {
			p[i] = sc.nextInt() - 1;
		}
		int[] x = new int[4];
		int[] y = new int[4];
		int ans = 999;
		for (int i = 1; i <= N; ++i) {
			for (int j = 0; j < 4; ++j) {
				x[j] = p[j] % i;
				y[j] = p[j] / i;
			}
			ans = Math
					.min(ans, Math.abs(x[0] - x[1]) + Math.abs(y[0] - y[1]) + Math.abs(x[2] - x[3]) + Math.abs(y[2] - y[3]));
		}
		System.out.println(ans);
	}
}

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


int main(){
  int n,l;
  cin >> n >> l;
  vector<string> s(n);
  for(int i=0;i<n;++i){
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  string ans;
  for(int i=0;i<n;++i){
    ans+=s[i];
  }
  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<n;++i)
using ll = long long;
using P = pair<int,int>;

int main(){
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  ll ans = 0;
  ans += min(k,a);
  k -= a;
  if(k > 0){
    k -= b;
    if(k > 0){
      ans -= min(k,c);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>

using namespace std;

const int maxn=100010;
int a[maxn],t[maxn];
int n;


int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	
	int i,j,k,sum,ans;
	scanf("%d",&n);
	memset(t,0,sizeof(t));
	int t1=0,t2=0;
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
		t[a[i]]++;
	}
	sort(a+1,a+1+n);
	ans=n;
	for(i=1;i<maxn;i++){
		if(t[i]>1&&t[i]%2==1){
		    ans-=(t[i]-1);
		    t[i]=1;
		}
		else{
			if(t[i]>2&&t[i]%2==0){
				ans-=(t[i]-2);
				t[i]=2;
			}
		}
	}
	sum=0;
	for(i=1;i<maxn;i++){
		if(t[i]>1)sum++;
	}
	if(sum==0){
		cout<<ans<<endl;
		return 0;
	} 
	if(sum%2==0)ans-=sum;
	else ans-=(sum+1);
	if(ans<1)ans=0;
	cout<<ans<<endl;
	return 0;
}
	
	
	
	/*
	sum1=0;
	if(t1%2==0){
		int t11=0;
		for(i=1;i<=n;i++){
			if(a[i]%2==1)t11++;
			if(t11==t1/2)break;
		}
		if(a[i+1]%2==1)sum1=0;
		else sum1=n-t1;
	}
	else{
		int t11=0;
		for(i=1;i<=n;i++){
			if(a[i]%2==1)t11++;
			if(t11==t1/2)break;
		}
		int i1=i+1;
		int t12=0;
		for(i=n;i>=1;i--){
			if(a[i]%2==1)t12++;
			if(t12==t1/2)break;
		}
		int i2=i-1;
		i=i1;
		int k1=0,k2=0;
		while(a[i]%2!=1)i++;
		k1=i-i1;
		k2=i2-i;
		if(k1<2&&k2<2)sum1=0;
		else sum1=n-t1-1;
		if(t1==1){
			if(n>=5)sum1=n-2;
			else {
				if(a[2]%2==1)sum1=0;
			}
		}
	}*/
	//cout<<sum1<<endl;

/*
	sum2=0;
	if(t2%2==0){
		int t11=0;
		for(i=1;i<=n;i++){
			if(a[i]%2==0)t11++;
			if(t11==t2/2)break;
		}
		if(a[i+1]%2==0)sum2=0;
		else sum2=n-t2;
	}
	else{
		int t11=0;
		for(i=1;i<=n;i++){
			if(a[i]%2==0)t11++;
			if(t11==t2/2)break;
		}
		int i1=i+1;
		int t12=0;
		for(i=n;i>=1;i--){
			if(a[i]%2==0)t12++;
			if(t12==t2/2)break;
		}
		int i2=i-1;
		i=i1;
		int k1=0,k2=0;
		while(a[i]%2!=0)i++;
		k1=i-i1;
		k2=i2-i;
		if(k1<2&&k2<2)sum2=0;
		else sum2=n-t2-1;
		if(t2==1){
			if(n>=5)sum2=n-2;
			else {
				if(a[2]%2==0)sum2=0;
			}
		}
	}
	//cout<<sum2<<endl;	
	int ans=max(sum1,sum2);
	cout<<ans<<endl;
	
	



*/


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr ll INF = 2147483647;
constexpr long long INFF = 9223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    ll N;cin >> N;
    ll A,B;cin >> A >> B;
    ll h[N];REP(i,N) cin >> h[i];
    ll left = 0,right = 1000000000;
    ll ans = 0;
    while(right - left > 1){
        ll mid = left + (right - left)/2;
        ll k = mid;
        ll basic = B*k,ex = (A-B);//basicで残ったものをexをk回以内で賄えるか
        REP(i,N){
            if(h[i] > basic){
                k -= (h[i] - basic + ex - 1)/ex;
            }
        }
        if(k < 0){
            left = mid;
        }
        else if(k >= 0){
            ans = mid;
            right = mid;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(sc.next());
        }
        int endIndex = 2;
        int cnt = 0;
        for (int i = 1; i < n; i++) {
            if (endIndex + 1 > n) break;
            if ((nums[i] > nums[i - 1] && nums[i] < nums[endIndex]) || (nums[i] < nums[i - 1] && nums[i] > nums[endIndex])) {
                cnt++;
            }
            endIndex++;
        }
        System.out.println(cnt);
    }
}


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

  int main() {
    int N;
    cin >> N;
    string hasY = "n";
    for (int i = 0; i < N; i++) {
      string color;
      cin >> color;
      if (color == "Y") {
        hasY = "y";
      }
    }
    if (hasY == "y") {
      cout << "Four";
    } else {
      cout << "Three";
    }
  }
      
    


Measured memory_bytes: 3592
n = int(input())

divisor = 0

for i in range(1,n+1):
  count = 0
  if i % 2 != 0:
    for j in range(1,i+1):
      if i % j ==0:
        count += 1
    if count == 8:
      divisor += 1

print(divisor)

Measured memory_bytes: 3064
use std::io::Read;

fn main() {
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input);
    let input:Vec<&str> = input.split_whitespace().collect();
    println!("{}", input[0].chars().zip(input[1].chars()).fold(0, |cnt, (r1, r2)| cnt + (if r1 == r2 {1} else {0})));
}


Measured memory_bytes: 4352
data class MInt(val value: Long) {
    operator fun plus(that: MInt): MInt {
        return MInt((value + that.value) % MOD)
    }
    operator fun minus(that: MInt): MInt {
        return MInt(((value - that.value) % MOD + MOD) % MOD)
    }
    operator fun times(that: MInt): MInt {
        return MInt(value * that.value % MOD)
    }
    operator fun div(that: MInt): MInt {
        return this * power(that, MOD - 2)
    }
    companion object {
        private fun power(base: MInt, exp: Long): MInt {
            return when(exp) {
                0L -> One
                1L -> base
                else -> power(base * base, exp shr 1) * power(base, exp and 1)
            }
        }
        val MOD = 2147483659L
        val One = MInt(1L)
    }
}
fun Long.toMInt(): MInt {
    val value = this
    return when{
        value >= 0 -> MInt(value)
        else -> MInt(MInt.MOD + value)
    }
}
data class MInt2(val value: Long) {
    operator fun plus(that: MInt2): MInt2 {
        return MInt2((value + that.value) % MOD)
    }
    operator fun minus(that: MInt2): MInt2 {
        return MInt2(((value - that.value) % MOD + MOD) % MOD)
    }
    operator fun times(that: MInt2): MInt2 {
        return MInt2(value * that.value % MOD)
    }
    operator fun div(that: MInt2): MInt2 {
        return this * power(that, MOD - 2)
    }
    companion object {
        private fun power(base: MInt2, exp: Long): MInt2 {
            return when(exp) {
                0L -> One
                1L -> base
                else -> power(base * base, exp shr 1) * power(base, exp and 1)
            }
        }
        val MOD = 2147483693L
        val One = MInt2(1L)
    }
}
fun Long.toMInt2(): MInt2 {
    val value = this
    return when {
        value >= 0 -> MInt2(value)
        else -> MInt2(MInt2.MOD + value)
    }
}
fun main(args: Array<String>) {
    val ops = List(readLine()!!.trim().toInt()){
            val (op, y) = readLine()!!.trim().split(' ').map(String::toInt)
            op to y.toLong()
        }
    val ops1 = arrayOf(MInt::plus, MInt::minus, MInt::times, MInt::div)
    val res1 = ops.fold(MInt(0)){acc, (op, y) ->
        //println(acc)
        ops1[op - 1](acc, y.toMInt())
    }
    val ops2 = arrayOf(MInt2::plus, MInt2::minus, MInt2::times, MInt2::div)
    val res2 = ops.fold(MInt2(0)){acc, (op, y) ->
        //println(acc)
        ops2[op - 1](acc, y.toMInt2())
    }
    when {
        res1.value == res2.value ->
            println(res1.value)
        res1.value - MInt.MOD == res2.value - MInt2.MOD ->
            println(res1.value - MInt.MOD)
        else -> throw NotImplementedError()

    }
}



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

int main() {
    int N;
    string S;

    cin >> N;
    cin >> S;

    unsigned long long int output = 1;
    int R = 0;
    int G = 0;
    int B = 0;

    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') {
            R++;
        } else if (S[i] == 'G') {
            G++;
        } else if (S[i] == 'B') {
            B++;
        }
    }
    output *= R;
    output *= G;
    output *= B;
    for (int i = 1; i < (N + 1) / 2; i++) {
        int j = 0;
        while (j + 2 * i < N) {
            if (S[j] != S[j + i] && S[j + i] != S[j + 2 * i] &&
                S[j] != S[j + 2 * i]) {
                // cout << j << " " << j + i << " " << j + 2 * i << endl;
                output--;
            }
            j++;
        }
    }

    cout << output << endl;

    return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

template<long long mod>
class modint{
private:
  long long num;
  long long extgcd(long long a, long long b, long long&x, long long&y)const {
    long long d = a;
    if(b != 0){d = extgcd(b, a%b, y, x);  y -= (a/b) * x;}
    else{x = 1; y = 0;}
    return d;
  }
  long long modinverse()const{
    long long x, y;
    extgcd(num, mod, x, y);
    return (mod + x%mod)%mod;
  }
public:
  modint():num(0){}
  modint(const long long x):num((x < 0?(x+mod):x)%mod ){}
  friend modint operator+(const modint&a, const modint&b)
  {    return modint(a.num + b.num);  }
  friend modint operator-(const modint&a, const modint&b)
  {    return modint(a.num - b.num);  }
  friend modint operator*(const modint&a, const modint&b)
  {    return modint(a.num * b.num);  }
  friend modint operator/(const modint&a, const modint&b)
  {    return modint(a*b.modinverse());  }
  modint& operator+=(const modint&b)
  {    return (*this) = (*this) + b;  }
  modint& operator-=(const modint&b)
  {    return (*this) = (*this) - b;  }
  modint& operator*=(const modint&b)
  {    return (*this) = (*this) * b;  }
  modint& operator/=(const modint&b)
  {    return (*this) = (*this) / b;  }
  modint& operator++()
  {    (*this)+=1; return (*this);  }
  modint& operator--()
  {    (*this)-=1; return (*this);  }
  modint operator++(int){
    modint tmp(*this);
    ++(*this);
    return tmp;
  }
  modint operator--(int){
    modint tmp(*this);
    --(*this);
    return tmp;
  }    
  modint pow(unsigned long long i){
    if(i == 0) return 1;
    if(i & 1){
      return (*this) * (this->pow(i-1));
    }
    modint<mod>hpow = (this->pow(i>>1));
    return hpow * hpow;
  }
  friend ostream& operator<<(ostream&os, const modint&a){
    os << a.num;
    return os;
  }
  friend istream& operator>>(istream&is, modint&a){
    long long x; is >> x;
    a = x;
    return is;
  }
};

constexpr int mod = 1'000'000'007;
using mint = modint<mod>;

mint Rec(int n){
  static mint dp[2001] = {};
  static bitset<2001> used;  
  if(0 < n && n < 3)return 0;
  if(n == 0) return 1;
  if(used[n]) return dp[n];
  used[n] = 1;
  for(int i = 3; i <= n; ++i){
    dp[n] += Rec(n-i);
  }
  return dp[n];
}

int main(){
  int n; cin >> n;
  cout << Rec(n) << endl;
  return 0;
}


Measured memory_bytes: 3584
def solve2():
    s = raw_input()
    s = s.replace('BC', 'X')
    ans = 0
    acc_A = 0
    for ele in s:
        if ele == 'A':
            acc_A += 1
        elif ele == 'X':
            ans += acc_A
        else:
            acc_A = 0
    print ans

if __name__ == '__main__':
    solve2()


Measured memory_bytes: 33180
#include <bits/stdc++.h>
using namespace std;
#define EB emplace_back
#define PB push_back
#define G(i, x) get<i>(x)
#define F(i,s,n) for(int i = s; i < (ll)n; i++)
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;

#define MOD 998244353

template<class T>
class ST {
	struct N {
		N *ln,*rn;
		int l,r;
		T v;
	};

	N *root;
	vector<T> *data;
	bool hasData;

	T Q(int li, int ri, N *n) {
		if (ri <= n->l || n->r <= li) return INT_MIN;
		if (li <= n->l && n->r <= ri) return n->v;
		T l = Q(li, ri, n->ln);
		T r = Q(li, ri, n->rn);
		return max(l, r);
	}

	void U(int e, T v, N *n) {
		if (e < n->l || n->r <= e) return;
		if (n->r - n->l == 1) {
			n->v = v;
			return;
		}
		U(e, v, n->ln);
		U(e, v, n->rn);
		T l = n->ln->v;
		T r = n->rn->v;
		n->v = max(l, r);
	}

	void B(N *n) {
		if (n->r - n->l == 1) {
			n->v = 0;
			return;
		}
		n->ln = new N;
		n->rn = new N;
		n->ln->l = n->l;
		n->ln->r = n->rn->l = (n->r + n->l) / 2;
		n->rn->r = n->r;
		B(n->ln);
		B(n->rn);
	}

public:
	T Q(int l, int r) {
		return Q(l, r, root);
	}

	void U(int e, T v) {
		U(e, v, root);
	}

	ST(vector<T> &v) {
		hasData = 1;
		data = &v;
		root = new N;
		root->l = 0;
		root->r = v.size();
		B(root);
	}

	ST(int siz){
		hasData = 0;
		root = new N;
		root->l = 0;
		root->r = siz;
		B(root);
	}
};

int h[200005];
int a[200005];

int main() {
	iostream::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin>>N;
	ST<ll> st(N+1);
	F(i,0,N){
		cin>>h[i];
	}
	F(i,0,N){
		cin>>a[i];
	}
	st.U(h[0], a[0]);
	F(i,1,N){
		ll v = a[i] + st.Q(0, h[i]);
		st.U(h[i], v);
	}
	cout<<st.Q(0, N + 1);
}

Measured memory_bytes: 20608
#include<stdio.h>

int main(){
  int n,p[10],i,max,sum;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&p[i]);
  }
  max=p[1];
  for(i=1;i<=n;i++){
    if(max<p[i]) max=p[i];
  }
  sum=0;
  for(i=1;i<=n;i++){
    sum+=p[i];
  }
  printf("%d\n",sum-(max/2));
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

int main() {
    int N; cin >> N;
    string S; cin >> S;
    int cnt = 0;
    rep(i,N){
        if(S[i] == 'A'){
            if(S[i+1] == 'B' && S[i+2] == 'C'){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long H,N;
    cin>>H>>N;
    vector<int> il;
    int maks=2*H;
    vector<pair<int,int> > attack;
    for(int i = 0;i<N;i++)
    {
        int dmg,c;
        cin>>dmg>>c;
        maks=max(maks,2*dmg);
        attack.push_back(make_pair(dmg,c));
    }
    il.assign(maks+1,-1);
    il[0]=0;
    for(int i = 0;i<N;i++)
    {
        int dmg=attack[i].first;
        int c=attack[i].second;
        for(int j = dmg;j<=maks;j++)
        {
            if(il[j-dmg]>=0)
            {
                if(il[j]<0||il[j]>il[j-dmg]+c)il[j]=il[j-dmg]+c;
            }
        }
    }
    int mini = -1;
    for(int i = H;i<=maks;i++)
    {
        if(il[i]>0&&(il[i]<mini||mini==-1))mini=il[i];
    }
    cout<<mini;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main() {
  int N;
  cin >> N;
  int CMAX = 100 / 4;
  int DMAX = 100 / 7;
  for (int i = 0; i <= CMAX; i++)
  {
    for (int j = 0; j <= DMAX; j++)
    {
      if (i * 4 + j * 7 == N )  {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<vector<int> > v(100000);
    vector<int> deg(n,0);
    bool seen[n];
    memset(seen,0,sizeof(seen));
    for (int i = 1; i < n ; ++i) {
        int a, b; 
        cin >> a >> b; --a, --b;
        v[a].push_back(b);
        v[b].push_back(a);
        deg[a]++, deg[b]++;
    }
    bool res = true;
    queue<int> que;
    for (int i = 0; i < n; ++i) if (deg[i] == 1) que.push(i);
    while (!que.empty()){
        int now = que.front(); que.pop();
        if(seen[now]) continue;
        seen[now] = true;

        int nv = -1;
        for (auto e:v[now])if(!seen[e]) nv = e;
        if (nv == -1){
            res = false;
            break;
        }
        seen[nv] = true;
        for (auto v2 : v[nv]) {
            if (seen[v2]) continue;
            deg[v2]--;
            if (deg[v2] == 1) que.push(v2);
        }
    }
    if (res) cout << "Second" << endl;
    else cout << "First" << endl;
    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m, x, a[102] = {}, b, y = 0, z = 0;
    cin >> n >> m >> x;
    while (m--) cin >> b, a[b] = 1;
    for (int i = x; i; i--) y += a[i];
    for (int i = x; i <= n; i++) z += a[i];
    cout << min(y, z);
}


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

def main():
    n, m = map(int, input().split())

    dp = [[] for _ in range(n)]
    ans = [0] * m

    for i in range(m):
        p, y = map(int, input().split())
        dp[p - 1].append((y, i))
    
    for j, k in enumerate(dp):
        k.sort()    
        for l, (s, t) in enumerate(k):
            ans[t] = str(j + 1).zfill(6) + str(l + 1).zfill(6)
    
    print(*ans, sep = "\n")


if __name__ == '__main__':
    main()

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

using namespace std;

long long n, k, m;
vector <long long> v;

int main () {
	cin >> n >> k >> m;
	if(n == k && n != m || n == m && n != k || k == m && m != n) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(){
	int h, w, x, y;
	std::cin>>h>>w>>y>>x;

	int s= h*w;

	s= s- h*x;
	s= s- w*y;
	s= s+ x*y;

	std::cout<< s<<std::endl;


	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	n, m := getInt(), getInt()
	dp := make([]int, n+1)
	dp[0] = 1
	broken := make([]bool, n+1)
	for i := 0; i < m; i++ {
		a := getInt()
		broken[a] = true
	}

	for i := 1; i <= n; i++ {
		if broken[i] {
			continue
		}

		if i-1 >= 0 {
			dp[i] = (dp[i] + dp[i-1]) % mod
		}
		if i-2 >= 0 {
			dp[i] = (dp[i] + dp[i-2]) % mod
		}
	}

	fmt.Fprintln(wr, dp[n])
}

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

const (
	inf = 1 << 60
	mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


Measured memory_bytes: 1792
import java.util.*;
import java.lang.*;
public class Main {
        public static void main (String[]args){
            Scanner scanner = new Scanner(System.in);
            int A = scanner.nextInt();
            int B = scanner.nextInt();
            double rateA=.08;
            double rateB=.1;
            int potenialA=(int)(A/rateA);
            int potenialB=(int)(B/rateB);
            int lowestNumber=0;
            if (potenialA<potenialB){
                lowestNumber=potenialA;
            }else{
                lowestNumber=potenialB;
            }
            int price=lowestNumber;
            boolean answerFound=false;
            boolean possible=false;
            while(answerFound==false){
                if((int)(price*rateA)==A&&(int)(price*rateB)==B){
                    possible=true;
                    answerFound=true;
                    break;
                }
                if((int)(price*rateA)>A||(int)(price*rateB)>B){
                    answerFound=true;
                    break;
                }
                price++;
            }
            if(possible){
                System.out.println(price);
            }else{
                System.out.println(-1);
            }
        }
}





Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,m;
  cin >> a >> b >> m;
  vector<int> x(a+1),y(b+1);
  int mn1 = INT_MAX;
  int mn2 = INT_MAX;
  for (int i = 1; i <= a; i++){
    cin >> x[i];
    mn1 = min(mn1,x[i]);
  }
  for (int i = 1; i <= b; i++){
    cin >> y[i];
    mn2 = min(mn2,y[i]);
  }
  int ans = mn1+mn2;
  while (m--){
    int x1,y1,c1;
    cin >> x1 >> y1 >> c1;
    ans = min(ans,x[x1]+y[y1]-c1);
  }
  cout << ans;
  
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
using namespace std;
int n, u, v;
int disu[123321], disv[123321];
bool bu[123321], bv[123321];
vector<int>v1[123321];
void fu(int u1) {
	for (int i : v1[u1]) {
		if (bu[i] == 0) {
			bu[i] = 1;
			disu[i] = disu[u1] + 1;
			fu(i);
		}
	}
}
void fv(int u1) {
	for (int i : v1[u1]) {
		if (bv[i] == 0) {
			bv[i] = 1;
			disv[i] = disv[u1] + 1;
			fv(i);
		}
	}
}
signed main() {
	cin >> n >> u >> v;
	for0(i, n - 1) {
		int a, b; cin >> a >> b;
		v1[a].push_back(b);
		v1[b].push_back(a);
	}
	bu[u] = 1; fu(u);
	bv[v] = 1; fv(v);
	int dv = 0, du = 0;
	for1(i, n)
		if (disu[i] < disv[i] && dv < disv[i]) {
			du = disu[i];
			dv = disv[i];
		}
	cout << dv - 1 << endl;
}

Measured memory_bytes: 11008
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll a[100010], b[100010], c[100010], N, i, dp[100010][3], ans;
int main()
{
    cin >> N;
    memset(dp, -1, sizeof(dp));
    for(int i=1;i<=N;i++)
        cin >> a[i] >> b[i] >> c[i];
    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    for(i=1;i<=N;i++)
    {
        dp[i][0] = a[i]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = b[i]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = c[i]+max(dp[i-1][0],dp[i-1][1]);
    }
    cout << max({dp[N][0],dp[N][1],dp[N][2]}) << endl;
    return 0;
}




Measured memory_bytes: 8224
//
//  AOJ0046.c
//  
//
//  Created by 中野 優 on 2014/02/22.
//
//

#include <stdio.h>
int main(void){
    float max,min,temp;
    scanf("%f",&max);
    min = max;
    while(scanf("%f",&temp)!=EOF){
        if(temp > max) {
            max = temp;
        } else if (temp < min) {
            min = temp;
        }
    }
    printf("%f",max-min);
    return 0;
}

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

int main(int argc, char const *argv[])
{
	string s;
	cin >> s;
	int len = s.size();
	string ans = s;
	if (s[len-1]=='s') {
		ans += "es";
	} else {
		ans += "s";
	}
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 3628
/*
      author : nishi5451
      created: 11.08.2020 00:04:02
*/

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


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

Measured memory_bytes: 3596
let n, m = Scanf.scanf " %d %d" @@ fun a b -> a, b
let f g n = let rec f i = if i * i <= n then (if n mod i = 0 then (g i; if i <> n / i then g (n / i)); f (i + 1)) in f 1
let ans = ref 0
let g d = if m / d >= n then ans := max !ans d
let _ = f g m; Printf.printf "%d\n" !ans

Measured memory_bytes: 2560
#include <stdio.h>
char s[300000];
int main(){
 int n,c=0,m,i;
 scanf("%d%s",&n,s);
 for(i=0;i<n;i++)if(s[i] == 'E')c++;
 m=c;
 for(i=0;i<n;i++){
  if(s[i]=='E')c--;
  if(i!=0&&s[i-1]=='W')c++;
  if(c<m)m=c;
 }
 printf("%d",m);
 return 0;
}

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

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

    for (int a = 1; a <= 1000; a++) {
        ll i = pow(a, 5);
        for (int b = -1000; b <= 1000; b++) {
            ll j = pow(b, 5);
            if (i - j == x) {
                printf("%d %d\n", a, b);
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4164
N = gets.to_i

class String
  def lcs(str)
    n = size
    m = str.size
    dp = Array.new(n + 1) { Array.new(m + 1, 0) }

    list = str.chars
 
    chars.each_with_index do |s, i|
      list.each_with_index do |t, j|
        if s == t
          dp[i + 1][j + 1] = dp[i][j] + 1
        else
          dp[i + 1][j + 1] = [dp[i][j + 1], dp[i + 1][j]].max
        end
      end
    end
 
    dp[n][m]
  end
end

N.times do
  x = gets.chomp
  y = gets.chomp

  puts x.lcs(y)
end



Measured memory_bytes: 48956
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

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

#define f first
#define s second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int md = 1e9+7;
const ll inf = 1e18;
const int maxn = 55;
const int maxl = 25;

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

char s[maxn][maxl];
int c[maxn];
int len[maxn];

int n;

bool checkpal(int k, int x, int y)
{
	for(; x<= y; x++, y--)
	{
		if(s[k][x] != s[k][y]) return false;
	}
	return true;
}

bool prfpal[maxn][maxl];
bool sufpal[maxn][maxl];

ll dist[maxn][maxl][2];

struct node
{
	int id, pos, isPref;
	ll d;
	node(int a, int b, int c, ll _d)
	{
		id = a;
		pos = b;
		isPref = c;
		d = _d;
	}
	bool operator < (node other) const
	{
		return d> other.d;
	}
};

int main()
{
	scanf("%d", &n);
	for(int i = 0; i< n; i++)
	{
		scanf("%s", s[i]);
		scanf("%d", &c[i]);
		len[i] = strlen(s[i]);
		int k = len[i];
		for(int j = 0; j< k; j++) prfpal[i][j] = checkpal(i, 0, j);
		for(int j = 0; j< k; j++) sufpal[i][j] = checkpal(i, j, k-1); 
	}
	
	for(int i = 0; i< n; i++) for(int j = 0; j<= len[i]+1; j++) dist[i][j][0] = dist[i][j][1] = 4e18;

	priority_queue<node> pq;
	for(int i = 0; i< n; i++)
	{
		dist[i][len[i]][1] = c[i];
		pq.push(node(i, len[i]-1, 1, c[i]));
	}

	while(!pq.empty())
	{
		node kk = pq.top(); pq.pop();
		int id = kk.id, pos = kk.pos, isPref = kk.isPref;
		ll d = kk.d;
		if(isPref && pos == -1 || !isPref && pos == len[id] || isPref && prfpal[id][pos] || !isPref && sufpal[id][pos])
		{
			printf("%lld\n", d);
			return 0;
		}
		if(d> dist[id][pos+1][isPref]) continue;

		for(int i = 0; i< n; i++)
		{
			if(isPref)
			{
				int p1 = 0, p2 = pos;
				bool bad = false;
				while(p1< len[i] && p2>= 0)
				{
					if(s[i][p1] == s[id][p2]) p1++, p2--;
					else
					{
						bad = true;
						break;
					}
				}
				if(bad) continue;
				int nid, npos, nisPref;
				ll nd = d+c[i];
				if(p1 == len[i])
				{
					nid = id;
					npos = p2;
					nisPref = isPref;
				}
				else
				{
					nid = i;
					npos = p1;
					nisPref = !isPref;
				}
				if(nd< dist[nid][npos+1][nisPref])
				{
					dist[nid][npos+1][nisPref] = nd;
					pq.push(node(nid, npos, nisPref, nd));
				}
			}
			else
			{
				int p1 = pos, p2 = len[i]-1;
				bool bad = false;
				while(p1< len[id] && p2>= 0)
				{
					if(s[id][p1] == s[i][p2]) p1++, p2--;
					else
					{
						bad = true;
						break;
					}
				}
				if(bad) continue;
				int nid, npos, nisPref;
				ll nd = d+c[i];
				if(p1 == len[id])
				{
					nid = i;
					npos = p2;
					nisPref = !isPref;
				}
				else
				{
					nid = id;
					npos = p1;
					nisPref = isPref;
				}
				if(nd< dist[nid][npos+1][nisPref])
				{
					dist[nid][npos+1][nisPref] = nd;
					pq.push(node(nid, npos, nisPref, nd));
				}
			}
		}
	}
	printf("-1\n");
}

Measured memory_bytes: 3768
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
        int ans = 0;
        for (int i = 0; i < 2; i++) {
           if (a > b) {
            ans += a;
            a--;
           } else {
            ans += b;
            b--;
           }
        }
       
          
		// 出力
		System.out.println(ans);
	}
}

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

using namespace std;
typedef long long int ll;

#define INF (1e9)

int N;

int main() {
    cin >> N;

    int ans = 0, h = 0, g;
    for (int i = 0; i < N; i++) {
        cin >> g;
        if (h < g) ans += g - h;
        h = g;
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 305

struct Edge{
	Edge(int arg_to,int arg_cost){
		to = arg_to;
		cost = arg_cost;
	}
	bool operator<(const struct Edge &arg) const{
		return to < arg.to;
	}

	int to,cost;
};

int V;
int parent;
int edge[SIZE][SIZE],ans,WORK;
int rev[SIZE];
bool is_OK;
bool visited[SIZE];
vector<Edge> G[SIZE],reserve;

void dfs(int node_id,int pre){
	if(!is_OK)return;

	if(visited[node_id]){

		is_OK = false;
		return;
	}
	visited[node_id] = true;

	if(node_id == parent){

		for(int next = 0; next < V; next++){
			if(next == pre)continue;

			if(edge[node_id][next]*rev[node_id]*rev[next] > 0){

				WORK += abs(edge[node_id][next]);
				if(WORK >= ans){
					is_OK = false;
					return;
				}

				dfs(next,node_id);
			}
		}

	}else{

		if(pre != parent && (edge[node_id][parent]*rev[node_id]*rev[parent] > 0)){

			WORK += abs(edge[node_id][parent]);
			if(WORK >= ans){
				is_OK = false;
				return;
			}

			dfs(parent,node_id);
		}

		for(int i = 0; i < G[node_id].size(); i++){

			int next = G[node_id][i].to;

			if(next == pre || next == parent)continue;

			WORK += abs(edge[node_id][next]);
			if(WORK >= ans){
				is_OK = false;
				return;
			}

			dfs(next,node_id);
		}
	}
}


void func(){

	int tmp;

	for(int from = 0; from <= V-2; from++){
		for(int to = from+1; to <= V-1; to++){
			scanf("%d",&tmp);
			edge[from][to] = tmp;
			edge[to][from] = tmp;
		}
	}

	ans = BIG_NUM;

	//葉と、その葉と繋がる節点のペアを全探索
	for(int leaf = 0; leaf < V; leaf++){

		for(int i = 0; i < V; i++){
			G[i].clear();
		}

		//反転するか否かを決定
		for(int i = 0; i < V; i++){
			if(i == leaf){

				rev[i] = -1; //葉は反転しないとしておく

			}else{

				if(edge[i][leaf] > 0){

					rev[i] = 1;

				}else{

					rev[i] = -1;
				}
			}
		}

		for(int from = 0; from <= V-2; from++){
			for(int to = from+1; to <= V-1; to++){

				if((edge[from][to]*rev[from]*rev[to]> 0)){
					G[from].push_back(Edge(to,abs(edge[from][to])));
					G[to].push_back(Edge(from,abs(edge[from][to])));
				}
			}
		}

		for(parent = 0; parent < V; parent++){

			if(parent == leaf)continue;

			int pre_rev = rev[parent];

			if(edge[parent][leaf] < 0){

				rev[parent] = 1;
			}else{

				rev[parent] = -1;
			}

			//全域木か調べる
			for(int i = 0; i < V; i++){
				visited[i] = false;
			}

			is_OK = true;
			WORK = 0;
			dfs(parent,-1);

			if(!is_OK){
				rev[parent] = pre_rev;
				continue;
			}

			bool FLG = true;
			if(is_OK){
				for(int i = 0; i < V; i++){
					if(!visited[i]){
						FLG = false;
						break;
					}
				}
			}

			if(is_OK && FLG){
				ans = min(ans,WORK);
			}

			rev[parent] = pre_rev;
		}
	}

	if(ans == BIG_NUM){

		printf("-1\n");

	}else{

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

int main(){

	while(true){
		scanf("%d",&V);
		if(V == 0)break;

		func();
	}

	return 0;
}






Measured memory_bytes: 4540
#include <bits/stdc++.h>
using namespace std;
 
int main(void)
{
	int a, b, x=0, y=0, z=0;
	cin >> a >> b;
	
	x = a+b;
	y = a-b;
	z = a*b;
	
	if(x>=y && x>=z)
		cout << x << endl;
	else if(y>=x && y>=z)
		cout << y << endl;
	else if(z>=x && z>=y)
		cout << z << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ans=0;
	cin>>n;
	int a[n];
	for(int i=1;i<=n;i++)
	{
        cin>>a[i];
	}
	for(int j=1;j<=n;j++)
    {
        ans=ans+a[j];
    }
    cout<<ans-n;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
	if(a%2==0) {
		System.out.println(a);
	}
	else {
		System.out.println(a*2);
	}
	}
}

Measured memory_bytes: 23124
#include<iostream>

using namespace std;

int main() {
	string A, B, C;

	cin >> A >> B >> C;

	if (A[A.length()-1] == B[0] && B[B.length()-1] == C[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){

  long long a,b,c;
  cin >> a >> b;

  while(1){
    c = a % b;
    if( c == 0 ) break;
    a = b;
    b = c;
  }
  cout << b << endl;

  return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int l,r,d,ll,rr;
	cin>>l>>r>>d;
	ll=l/d;
	if(l%d!=0)
		ll++;
	rr=r/d;
	int ans=rr-ll+1;
	cout<<ans<<endl;
	return 0;
}




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

using namespace std;

int		main(void)
{
	int A, B;

	cin >> A >> B;
	if (A >= 13)
		cout << B << endl;
	else if (A >= 6)
		cout << B / 2 << endl;
	else
		cout << 0 << endl;
}


Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    a,b,c,d = inpm()
    while True:
        c -= b
        if c <= 0:
            print('Yes')
            return
        a -= d
        if a <= 0:
            print('No')
            return

    
if __name__ == "__main__":
    main()

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define MAX 110
#define LOCAL

int main() {
	int n; scanf("%d", &n);
	char H[MAX][15];
	bool flag = true;

	for (int i = 0; i < n; i++) {
		scanf("%s", &H[i]);
		if (i == 0) { continue; }

		int len = strlen(H[i - 1]);
		if (H[i - 1][len - 1] != H[i][0]) { 
//			printf("1\n");
			flag = false; 
		}
		for (int j = 0; j < i; j++) {
			if (strcmp(H[j], H[i]) == 0) {
//				printf("%s, %s, 2\n", H[j], H[i]);
				flag = false; 
			}
		}
	}

	if (flag) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 128
n = int(input())
b = list(map(int,input().split()))
ans = []

while(b):
    targ = -1
    for i in range(len(b)):
        #print(i+1,b[i])
        if b[i] == i+1:
            targ = i
    if targ == -1:
        break
    #print(b[targ])
    ans.append(b[targ])
    b.pop(targ)


if targ == -1:
    print(-1)
else:
    for i in range(len(ans)):
        print(ans[-1*(1+i)])


Measured memory_bytes: 3064
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
char s[SIZE];
int dp[SIZE];
int main(){
    int N,Q;
    R(N,Q);
    RS(s+1);
    FOR(i,2,N){
        if(s[i-1]=='A'&&s[i]=='C')dp[i]++;
        dp[i]+=dp[i-1];
    }
    REP(cs,Q){
        int x,y;
        R(x,y);
        W(dp[y]-dp[x]);
    }
    return 0;
}


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

int N;
char p[100005];

signed main(){
  
  cin>>N;
  
  for(int i=0;i<N;i++) cin>>p[i];
  
  char pp = p[0];
  
  for(int i=1;i<N;i++){
    
    if( pp == 'T' && p[i] == 'T' ) pp = 'T';
    else if( pp == 'T' && p[i] == 'F' ) pp = 'F';
    else if( pp == 'F' && p[i] == 'T' ) pp = 'T';
    else if( pp == 'F' && p[i] == 'F' ) pp = 'T';
    
  }

  cout<<pp<<endl;
  
  return 0;
}



Measured memory_bytes: 3168
N = int(input())

def dfs(s): # 文字列 s で始まる七五三数の個数
  if int(s) > N:
    return 0

  ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1

  for c in '753':
    ret += dfs(s + c)
  return ret

print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく


Measured memory_bytes: 2940
fun main(args: Array<String>) {
    val (a, b, x) = readLine()!!.split(' ').map { it.toDouble() }
    val h = x / (a * a)
    val thr = a * a * b / 2
    if (x > thr) {
        val diff = b - h
        println(Math.atan((diff * 2) / a) * 180 / Math.PI)
    } else {
        val y = x / b / a * 2
        println(90 - Math.atan(y / b) * 180 / Math.PI)
    }
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

//a^b % MOD
long long mod_pow(ll a,ll b){
	long long ret = 1;
	long long c = a;
	for(int i = 0;i <= 60;i++){
		if(b & (1LL << i))ret = (ret * c) % MOD;
		c = (c * c) % MOD;
	}
	return ret;
}

//ａをbで割る
long long mod_div(long long a,long long b){
	long long tmp = MOD - 2,c = b,ret = 1;
	while(tmp > 0){
		if(tmp & 1){
			ret *= c;ret %= MOD;
		}
		c *= c;c %= MOD;tmp >>= 1;
	}
	return a*ret%MOD;
}

#define MAX_K 333333
vector<long long> fact(MAX_K);
long long combination(long long n, long long r){
    if(n < r || n < 0 || r < 0)
        return 0;
	if(fact[0] != 1){
		fact[0] = 1;
		for(long long i = 1;i < MAX_K;i++)fact[i] = (fact[i-1] * i) % MOD;
	}
    long long ret = fact[n];
	long long tmp = (fact[r] * fact[n-r]) % MOD;
    return mod_div(ret,tmp);
}

ll seica[111111];

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

	for(int i = 1;i < 111111;i++){
		seica[i] = mod_div(1, i);
	}

	REP(i, 111111 - 1)seica[i+1] = (seica[i+1] + seica[i]) % MOD;

	ll n;cin >> n;
	ll ans = 0;
	vector<ll> v(n);REP(i, n)cin >> v[i];
	REP(i, n-1){
		ans += seica[i+1] * (v[i+1] - v[i]) % MOD;
		ans %= MOD;
	}

	REP(i, n-1){
		ans *= (i+1);
		ans %= MOD;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4480
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    int n;
    cin >> n;
    int cnt = 0;
    repk(i, 1, n + 1) {
        if (i % 2) {
            int count = 0;
            repk(j, 1, n + 1) {
                if (i % j == 0)
                    count++;
            }
            if (count == 8)
                cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        Set<Integer> use = new HashSet<>();
        Set<Integer> primes = new HashSet<>();
        primes.add(2);
        int num = 1;
        loop: while (use.size() < n) {
            num += 2;
            for (Integer prime : primes) {
                if (num % prime == 0) {
                    continue loop;
                }
            }
            primes.add(num);
            if (num % 5 == 1) {
                use.add(num);
            }
        }

        use.forEach(System.out::println);
    }
}

Measured memory_bytes: 29004
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <string>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

int n;
int firstc, lastf;
string s;
int main(void)
{
	firstc=1111111;
	lastf=0;
	cin>>s;
	for(int i=0 ; i<s.size() ; i++)
	{
		if(s[i]=='C' && firstc>i)
		{
			firstc=i;
		}
		if(s[i]=='F' && lastf<i)
		{
			lastf=i;
		}
	}
	if(firstc<lastf)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string> 
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

int main()
{
	char c; cin >> c;
	co(char(c + 1));
	return 0;
}


Measured memory_bytes: 256