akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string S, T; cin >> S >> T;
    int A, B; cin >> A >> B;
    string U; cin >> U;

    if(S == U) A--;
    else B--;
    cout << A << ' ' << B << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
string S;
  cin >>S;
  int x=S.size();
if(x%2==0) {
int count=0;
  rep(i,x/2) {
    if (S.at(i) !=S.at(x-1-i)) {
count++;
    }
  }
  cout<<count<< endl;
}
 else {
int count=0;
  rep(i,x/2) {
    if (S.at(i) !=S.at(x-1-i)) {
count++;
    }
  }
  cout<<count<< endl;
}
  
}

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

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

  vector <vector <int> > A(N, vector <int>(M));
  vector <int> C(N),sum(M);
  int max=0;

  for(int i=0; i<N; i++){
    cin >> C.at(i);
    max += C.at(i);
    for(int j=0; j<M; j++){
      cin >> A.at(i).at(j);
      sum.at(j) += A.at(i).at(j);
    }
  }

  sort(sum.begin(),sum.end());
  if(sum.at(0) < X){
    cout << -1 << endl;
    return 0;
  }


  long long int num =0;
  num = (long long int)pow(2,N);
  vector <vector <int> > a(num, vector <int>(N,0));
  for(long long int i=0;i<num;i++){
    long long int tmp1=i;
    for(int j=0; j<N; j++){
      a.at(i).at(j) = tmp1/(long long int)pow(2,N-1-j);
      tmp1 %= (long long int)pow(2,N-1-j);
    }
  }

  int min_c=max;

  for(long long int i=0;i<num;i++){
    long long int cost=0;
    vector <int> sum1(M);
    for(int j=0; j<N; j++){
      if(a.at(i).at(j)==1){
        for(int k=0; k<M; k++){
          sum1.at(k) += A.at(j).at(k);
        }
        cost += C.at(j);
      }
    }
    sort(sum1.begin(),sum1.end());
    if(sum1.at(0) >= X){
      min_c = min_c < cost ? min_c:cost;
    }
  }
  cout << min_c << endl;

}


Measured memory_bytes: 4468
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define FAST_IO ios::sync_with_stdio(false)
using namespace std;


struct jie
{
    int t,n;
}e[100005];
int head[100005],cnt=0;
void add(int a,int b)
{
    e[cnt].t=b;
    e[cnt].n=head[a];
    head[a]=cnt++;
}
int f[100005],dp[100005],c[100005],d[100005],n;
int dfs(int u)
{
    int i,m,j,t;
    for(i=head[u];~i;i=e[i].n)
    {
        dfs(e[i].t);
    }
    memset(dp,0x3f,sizeof(dp));
    dp[0]=0;
    for(i=head[u];~i;i=e[i].n)
    {
        m=e[i].t;
        for(j=d[u];j>=0;j--)
        {
            t=INF;
            if(j>=d[m])
            {
                t=min(t,dp[j-d[m]]+f[m]);
            }
            if(j>=f[m])
            {
                t=min(t,dp[j-f[m]]+d[m]);
            }
            dp[j]=t;
        }
    }
    for(i=0;i<=d[u];i++)
    {
        f[u]=min(f[u],dp[i]);
    }
}
int main()
{
    int i;
    cnt=0;
    memset(head,-1,sizeof(head));
    scanf("%d",&n);
    for(i=2;i<=n;i++)
    {
        scanf("%d",&c[i]);
        add(c[i],i);
    }
    for(i=1;i<=n;i++)
    {
        scanf("%d",&d[i]);
    }
    memset(f,0x3f,sizeof(f));
    dfs(1);
    if(f[1]<INF)
    {
        printf("POSSIBLE\n");
    }
    else
    {
        printf("IMPOSSIBLE\n");
    }
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
	ll R;
	cin >> R;
	
	ll ans =3* pow(R,2);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = input()
B = input()
C = input()

counter = 0

for i in range(N):
    if A[i] != B[i] and A[i] != C[i] and B[i] != C[i]:
        counter += 2

    elif A[i] == B[i] and A[i] != C[i] or A[i] == C[i] and A[i] != B[i] or B[i] == C[i] and A[i] != B[i]:
        counter += 1

print(counter)


Measured memory_bytes: 3064
// In the name of God

#include <bits/stdc++.h>

using namespace std;

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

	cout << (1000 - (n % 1000)) % 1000;

	return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    int n,k;
    string s;
    cin>>n>>s>>k;
    k--;
    for (int i = 0; i < n; i++)
    {
        if(s[i]==s[k]) cout<<s[k];
        else cout<<"*";
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n,f;
	while(true){
		cin>>n;
		if(n==0)
			break;
		f=0;
		for(int i=5;i<=n;i++){
			int j=5;
			while(true){
				if(i%j==0)
					f++;
				else
					break;
				j*=5;
			}
		}
		cout<<f<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a;
	a.resize(n);
	for(int i=0; i<n; i++) cin >> a[i];
	
	sort(a.begin(), a.end());
	vector<int> b;
	b.resize(a[n-1]+2);
	
	for(int i=0; i<n; i++){
		b[a[i]] += 1;
		b[a[i]+1] += 1;
		b[a[i]+2] += 1;
	}
	
	sort(b.begin(), b.end());
	cout << b[b.size()-1] << endl;
	
	return 0;
}


Measured memory_bytes: 1024
using System;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            while (true)
            {
                string[] array = Console.ReadLine().Split(' ');
                a = int.Parse(array[0]);
                b = int.Parse(array[1]);
                if (a == 0 && b == 0)
                {
                    break;
                }
                    for (int i = 0; i < a; i++)
                    {
                        string output = new string('#', b);
                        Console.WriteLine(output);
                    }
                    Console.WriteLine("");
            }
        }
    }
}

Measured memory_bytes: 8968
#include<iostream>
#include<cmath>

using namespace std;

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

int main() {
  while (true) {
    int n, y, res;
    double mx = 0;
    cin >> n;
    if (n == 0) break;
    cin >> y;
    while (n--) {
      int b, r, t;
      cin >> b >> r >> t;
      double k;
      if (t == 1) k = 1 + (double)r / 100 * y;
      else k = pow(1 + (double)r / 100, y);
      if (k > mx) {
	mx = k;
	res = b;
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1164
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val S = sc.next

    if(S(5) == '0'){
      if(S(6).toInt > '4') println("TBD")
      else println("Heisei")
    } else {
      println("TBD")
    }
  }
}


Measured memory_bytes: 25924
#include<iostream>
#include<vector>
#include<algorithm>

template< typename iterator >
iterator binarySearch( iterator first, iterator last, int value )
{
    for( int len = std::distance(first, last) ; len > 0 ; )
    {
        int half = len / 2 ;
        iterator mid = first ;
        std::advance(mid, half) ;
        if( *mid < value )
        {
            len -= half + 1 ;
            first = ++mid ;
        }
        else
        {
            len = half ;
        }
    }
    return first ;

}


int main()
{
    int n ;
    std::cin >> n ;
    std::vector<int> S(n) ;
    for( std::size_t i = 0 ; i < S.size() ; ++i )
    {
        std::cin >> S.at(i) ;
    }
    
    int q ;
    std::cin >> q ;
    std::vector<int> T(q) ;
    for( std::size_t i = 0 ; i < T.size() ; ++i )
    {
        std::cin >> T.at(i) ;
    }

    int count = 0 ;

    for( std::size_t i = 0 ; i < T.size() ; ++i )
    {
        if(std::binary_search(S.begin(), S.end(), T.at(i) ))
        {
            ++count ; 
        }
    }

    std::cout << count << std::endl ;

}



Measured memory_bytes: 3348
N, T = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

c = Float::INFINITY
af = A.inject([]){|ar, x| c = c < x ? c : x; ar << c}
ab = A.reverse.inject([]){|ar, x| c = c > x ? c : x; ar << c}.reverse
mx = ab.zip(af).uniq.map{|i, j| i - j}.sort.reverse
mx << 0
puts mx.index{|x| x != mx[0]}

Measured memory_bytes: 19708
import sys
readline = sys.stdin.readline

def floor_sum_of_linear(N, M, A, B):
    ans = 0
    while True:
        ans += (A//M)*(N-1)*N//2 + (B//M)*N
        A, B = A%M, B%M
        if A*N+B < M:
            return ans
        ymax = (N*A+B)//M
        xmax = -((B-M*ymax)//A)
        ans += (N-xmax)*ymax
        A, B, N, M = M, A*xmax-M*ymax+B, ymax, A 

T = int(readline())
Ans = [None]*T
for qu in range(T):
    Ans[qu] = floor_sum_of_linear(*tuple(map(int, readline().split())))

print('\n'.join(map(str, Ans)))

Measured memory_bytes: 77692
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;

int main() {
  int H, N;
  cin >> H >> N;
  int A[1002], B[1002];
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }
  int dp[10002];
  fill(dp, dp + H + 1, INT_MAX);
  dp[0] = 0;

  for (int i = 0; i <= H; i++) {
    if (dp[i] == INT_MAX) {
      continue;
    }
    for (int j = 0; j < N; j++) {
      int next = min(H, i + A[j]);
      dp[next] = min(dp[next], dp[i] + B[j]);
    }
  }
  cout << dp[H] << endl;
}


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

int main()
{
  vector<int> n(4);
  int i;
  for(i = 0; i < 4; i++)
  {
    cin >> n.at(i);
  }
  int ch = 0;
  for(i = 0; i < 4; i++)
  {
    if(n.at(i) == 1)
    {
      ch++;
      break;
    }
  }
  for(i = 0; i < 4; i++)
  {
    if(n.at(i) == 9)
    {
      ch++;
      break;
    }
  }
  for(i = 0; i < 4; i++)
  {
    if(n.at(i) == 7)
    {
      ch++;
      break;
    }
  }
  for(i = 0; i < 4; i++)
  {
    if(n.at(i) == 4)
    {
      ch++;
      break;
    }
  }
  if(ch == 4)
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	void run(){
		Scanner s = new Scanner(System.in);
		String str = s.next();
		while(!"0".equals(str)){
			int num = 0;
			String st[] = str.split("");
			for(int i = 0;i < st.length;i++){
				num += Integer.valueOf(st[i]).intValue();
			}
			System.out.println(num);
			str = s.next();
		}
	}
	public static void main(String args[]){
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 27400
#import numpy as np
#import functools
#import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm


#N = int(input())
a,b= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
#prod = functools.partial(functools.reduce, operator.mul)
#c=np.array(A)
#p=np.prod(A)

if a<0:
    if 0<=b:
        print('Zero')

    else:
        if abs(a-b)%2==0:
            print('Negative')
        else:
            print('Positive')
elif a==0:
    print('Zero')

else:
    print('Positive')


Measured memory_bytes: 2940
N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]
X = {}
for a, b in L:
    if b not in X:
        X[b] = []
    X[b].append(a)
now = 0
for b, Y in sorted(X.items(), key=lambda x: x[0]):
    for a in Y:
        now += a
        if b < now:
            print("No")
            exit()
print("Yes")


Measured memory_bytes: 92704
#!/usr/bin/env python3
# 最初はごちゃごちゃ考えていたが、文字列を１文字ずつリストにしてからソートして
# それをさらに文字列に戻してソートしたらおわり
n = int(input())
sort = [""]*n
for i in range(n):
    s = list(input())
    s.sort()
    sort[i] = s
sort.sort()
#print(sort)
ans = 0
cnt = 0
for i in range(n-1):
    if sort[i+1] == sort[i]: cnt += 1
    else: 
        ans += cnt*(cnt+1)//2
        cnt = 0
print(ans+cnt*(cnt+1)//2)


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

#define PMAX 200000

vector<int> eratosthenes (int n) {
    vector<bool> is_prime(n+1);
    rep(i, n) is_prime[i] = true;

    vector<int> p;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i]) {
            for (int j = i*2; j <= n; j += i) {
                is_prime[j] = false;
            } 
            p.emplace_back(i);
        }
    }
    return p;
}

int main()
{
    int x;
    cin >> x;
    for (const auto tmp : eratosthenes(PMAX)) {
        if (tmp >= x ) {
            cout << tmp << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3768
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=998244353;
const llint moe=992186091;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
vector<int>atu;
int scan(void){int h,m;cin>>h>>m;atu.pub(h*60+m);return h*60+m;}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,i;cin>>n;
	
	vector<int>as(n);
	vector<int>ae(n);
	vector<int>hs(n);
	vector<int>he(n);
	vector<int>bs(n);
	vector<int>be(n);
	for(i=0;i<n;i++){
		as[i]=scan();ae[i]=scan();
		hs[i]=scan();he[i]=scan();
		bs[i]=scan();be[i]=scan();
	}
	SO(atu);atu.erase(unique(atu.begin(),atu.end()),atu.end());
	int ans=0;
	for(auto A:atu){
		for(auto H:atu){
			if(A>=H){continue;}
			for(auto B:atu){
				if(H>=B){continue;}
				int gen=0;
				for(i=0;i<n;i++){
					if(as[i]<=A&&A<=ae[i]&&hs[i]<=H&&H<=he[i]&&bs[i]<=B&&B<=be[i]){gen++;}
				}
				maxeq(ans,gen);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

const int INF = 1e9;

int dp[101010];

int main() {
  int N, K = 2;
  cin >> N;
  vector<int> h(N);
  for (int i = 0; i < N; i++) cin >> h[i];

  for (int i = 0; i < 101010; i++) dp[i] = INF;

  dp[0] = 0;

  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j <= i + K; j++) {
      int cost = abs(h[i] - h[j]);
      dp[j] = min(dp[j], dp[i] + cost);
    }
  }

  cout << dp[N - 1] << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;

int n, W;
int v[110], w[110];
int dp[110][100010];

int solve(int i, int j){
    if(i < 0 || j < 0) return -1000000;
    if(i == 0) return dp[0][j] = 0;
    if(dp[i][j] >= 0) return dp[i][j];
    dp[i][j] = max(solve(i-1, j-w[i-1])+v[i-1], solve(i-1, j));
    return dp[i][j] = max(dp[i][j], solve(i, j-1));
}

int main(){
    cin >> n >> W;
    rep(i, n) cin >> v[i] >> w[i];
    rep(i, n+1)rep(j, W+1) dp[i][j] = -1000000;
    cout << solve(n, W) << endl;
}


Measured memory_bytes: 8060
package main

import "fmt"

func dedup(ns []int) []int {
	ret := make([]int, 0)
	prev := -1
	for _, n := range ns {
		if prev != n {
			prev = n
			ret = append(ret, n)
		}
	}
	return ret
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	xs := make([]int, m)
	for i := range xs {
		fmt.Scan(&xs[i])
	}
	xs = dedup(xs)

	memo := make([]int, n+1)
	memo[0] = 1
	j := 0
	if m > 0 && xs[0] == 1 {
		memo[1] = 0
		j++
	} else {
		memo[1] = 1
	}

	for i := 2; i <= n; i++ {
		if j < len(xs) && i == xs[j] {
			memo[i] = 0
			j++
		} else {
			memo[i] = (memo[i-1] + memo[i-2]) % 1000000007
		}
	}

	fmt.Println(memo[n])
}


Measured memory_bytes: 7168
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    float d,t,s;
    cin>>d>>t>>s;
    float tim= d/s;
    if(tim<=t)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    

    return 0;
}


Measured memory_bytes: 3720
import sys
from operator import itemgetter

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def iif(n): return [int(input()) for _ in range(n)]
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    mod = 1000000007

    F = [1, 1]
    for i in range(100000):
        F.append(F[i] + F[i+1])

    N, M = mi()

    if M == 0:
        print(F[N] % mod)
        return

    A = iif(M)
    DA = []
    left = 0
    for i in range(M):
        da = A[i] - left
        if da == 0 and left != 0:
            print(0)
            return
        else:
            DA.append(da-1)
        left = A[i] + 1
    if A[-1] != N:
        DA.append(N - A[-1] - 1)


    ans = 1
    for i in DA:
        ans *= F[i]

    print(ans % mod)

    return

main()


Measured memory_bytes: 469764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main() {
    int n;
    cin >> n;
    double ans = 0;
    rep(i, n) {
        string u;
        double x;
        cin >> x >> u;
        if (u == "JPY")
            ans += x;
        else
            ans += x * 380000.0;
    }
    cout << fixed << setprecision(20) << ans << endl;
}

Measured memory_bytes: 256
#ifdef loc
    #include "codes/loc_debug.h"
#else
    #include <bits/stdc++.h>
    #define pr(...)
    #define pra(a,n)
    #define praa(a,n,m)
    #define prl()
#endif
using namespace std;

typedef long long ll;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define sz(a) int(a.size())
const int N = 100005;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    cout << a[n / 2] - a[n / 2 - 1] << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iostream>
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1, 0, 1, 1, -1, -1}, dx = {1,-1,0,0, 0, 1, -1, 1, -1};
//vector<int> dy = {0, 0, 1, -1}, dx = {1, -1, 0, 0};



int main(void){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll r, D, x;
    cin >> r >> D >> x;
    for(int i = 0; i < 10; i++){
        x = x * r - D;
        cout << x << endl;
    }
}

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

using namespace std;

int gcd(int a, int b)
{
    return (b == 0) ? a : gcd(b, a % b);
}

int main()
{
    int a, b, tmp, uc;
    vector<int> v;
    cin >> a >> b;

    for (int i = 0; i < a; i++)
    {
        cin >> tmp;
        v.push_back(abs(tmp - b));
    }
    if (a==1) {
        cout << v[0];
    }
    else
    {
        for (int i = 0; i < a; i++)
        {
            if (i == 0)
            {
                uc = gcd(v[0], v[1]);
            }
            else
            {
                uc = gcd(uc,v[i]);
            }
        }
        cout << uc;
    }
}


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

int main(){
	vector<int> primes;
	primes.reserve(200);
	vector<char> tbl(1121);

	for(int i = 2; i < 1120; ++i){
		if( !tbl[i] ){
			primes.push_back(i);
			for(int j = i * i; j <= 1120; j += i){
				tbl[j] = 1;
			}
		}
	}

	int n, k;
	vector<int>::iterator p;
	while( scanf("%d%d", &n, &k), n != 0 ){
		vector<vector<int> > dp(k + 1, vector<int>(n + 1) );
		dp[0][0] = 1;

		for(p = primes.begin(); p != primes.end(); ++p){
			for(int i = k - 1; i >= 0; --i){
				for(int j = n - *p; j >= 0; --j){
					dp[i + 1][j + *p] += dp[i][j];
				}
			}
		}
		
		printf("%d\n", dp[k][n]);
	}
}

Measured memory_bytes: 1132
import heapq
n, m = map(int, input().split())
d = [[] for _ in range(m)]
for _ in range(n):
    a, b = map(int, input().split())
    if a <= m:
        d[a-1].append(-b)

t = []
heapq.heapify(t)
ans = 0
for i in range(m):
    for dd in d[i]:
        heapq.heappush(t, dd)
    if t:
        ans += heapq.heappop(t)*(-1)
print(ans)

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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(3e5) + 17;

int n, k;
int a[MAXN];
int dp[MAXN];

bool read() {
    if (!(cin >> n >> k))
        return false;

    forn (i, n)
        cin >> a[i];

    return true;
}

void dfs(int t) {
    if (t < 0 || dp[t] != -1)
        return ;

    if (t == 0) {
        dp[t] = 0;
        return ;
    }

    dp[t] = 0;

    forn (i, n) {
        dfs(t - a[i]);

        if (t >= a[i] && dp[t - a[i]] == 0)
            dp[t] = 1;
    }
}

void solve() {
    fill(dp, dp + k + 1, -1);
    dfs(k);

    if (dp[k] == 1)
        cout << "First\n";
    else
        cout << "Second\n";
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    
#ifdef SEREZHKA
    freopen("file.in", "r", stdin);
#endif
    
    while (read())
        solve();
    
    return 0;
}



Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
const double inf=1e9;
typedef long long ll;
typedef pair<int,int>pr;
const ll mod=1e9+7;
ll _pow(ll  a,ll b) {
    ll ans=1;
    while(b) {
        if(b&1)
            ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
pr a[maxn];
int cmp(pr x,pr y){
    return x.first<y.first;
}
int main(){
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i].first;
    a[i].second=i;
  }
  sort(a+1,a+n+1,cmp);
  int num=0;
  for(int i=1;i<=n;i++){
     if(a[i].second!=i){
        num++;
     }
  }
  if(num>2){
    cout<<"NO"<<endl;
  }
  else cout<<"YES"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define all(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };

int n, a, b;
ll v[50], c[51][51];

void comb_table(int n) { //パスカルの三角形
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			if (i == 0 || j == i) {
				c[i][j] = 1LL; //最初と最後は１
			}
			else {
				c[i][j] = c[i - 1][j - 1] + c[i - 1][j]; //左の親と右の親の合計
			}
		}
	}
}

int main()
{
	cin >> n >> a >> b;
	rep(i, n) cin >> v[i];
	
	comb_table(n);
	sort(v, v + n);
	reverse(v, v + n);

	double max_ave = 0.0;
	for (int i = 0; i < a; i++) {
		max_ave += v[i];
	}
	max_ave /= a;
	
	int num = 0, pos = 0;
	for (int i = 0; i < n; i++) {
		if (v[i] == v[a - 1]) {
			num++;			//v[n-1]と同じ値の数の合計
			if (i < a) {
				pos++;		//a個以下の数
			}
		}
	}

	ll cnt = 0LL;
	if (pos == a) {
		for (pos = a; pos <= b; pos++) {
			cnt += c[num][pos];
		}
	}
	else {
		cnt += c[num][pos];
	}

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

Measured memory_bytes: 256
#include <algorithm> //STLͨ���㷨
#include <cmath> //������ѧ����
#include <cstdio> //��������/�������
#include <iostream> //����������/���
#include <cstring> //�ַ�������
#include <string> //�ַ�����
#include <ctime> //�������ʱ��ĺ���
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLλ������
#include <cstype> //�ַ�����
#include <cerrno> //���������
#include <complex> //������
#include <clocale> //���屾�ػ�����
#include <cstdlib> //������������ڴ���亯��
#include <deque> //STL˫�˶�������
#include <exception> //�쳣������
#include <fstream> //�ļ�����/���
#include <functional> //STL�������㺯��(���������)
#include <limits> //�����������������ֵ����
#include <list> //STL�����б�����
#include <map> //STLӳ������
#include <iomanip> //����������/���
#include <ios> //��������/���֧��
#include <iosfwd> //����/���ϵͳʹ�õ�ǰ������
#include <istream> //����������
#include <ostream> //���������
#include <queue> //STL��������
#include <set> //STL��������
#include <sstream> //�����ַ�������
#include <stack> //STL��ջ����
#include <stdexcept> //��׼�쳣��
#include <streambuf> //�ײ�����/���֧��
#include <utility> //STLͨ��ģ����
#include <vector> //STL��̬��������
#include <cwchar.h>//���ַ�����������/���
#include <cwctype.h> //���ַ�����*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

void exgcd(int a,int b,int &d,int &x,int &y){if (!b){d=a,x=1,y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a)if (b&1) r=r*a;return r;}

inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}
int main()
{
	string s;
	cin>>s;
	for (int i=0;i<s.length();i++)
		if (s[i]=='R'&&i%2==1) return puts("No"),0;
		else
		if (s[i]=='L'&&i%2==0) return puts("No"),0;
	puts("Yes");
	return 0;
}









Measured memory_bytes: 256
n = int(input())
a = []
b = [0]*n
c = [0]*n
for _ in range(n):
    a.append(int(input()))

b[0] = a[0]
c[n-1] = a[n-1]
for i in range(1,n):
    b[i] = max(b[i-1],a[i-1])
    
for i in range(n-2,-1,-1):
    c[i] = max(c[i+1],a[i+1])
    
for i in range(n):
    if i == 0:
        print(c[i])
    elif i == n-1:
        print(b[i])
    else:
        print(max(c[i],b[i]))


Measured memory_bytes: 17020
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	long N = sc.nextLong();
      	long A = sc.nextLong();
      	long B = sc.nextLong();
      
      	long ans = N / (A+B) * A;
      	long rem = N % (A+B);
      	ans += Math.min(rem, A);
      
      	System.out.println(ans);
    }
}

Measured memory_bytes: 35644
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <functional>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)

#define huge 1000000007
typedef long long ll;
ll gcd(ll a, ll b);

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll D = 0;
	ll M = 0;
	//ll M = 0;
	//ll a[200] = {};
	//ll b[200] = {};
	//ll v[3] = {};
	//ll *a, *b, *x;
	string S,T,U[52];
	ll count = 0;
	ll count2 = 0;
	ll sum = 0;
	ll min = 100000;
	ll max = 0;
	ll smax = 0;
	ll max2 = 0;
	ll smax2 = 0;
	int tmax = 0;
	int tmax2 = 0;
	int flag = 0;
	char temp,head;
	//int is = 0;
	
	
	//char p;


	

	

	//cin >> S;
	
	//b = (ll *)malloc(M * sizeof(ll));
	//vector<pair<int,int>> ch(50);

	
	cin >> A >> B;
	cin >> S;
	//a = (ll *)malloc(A * sizeof(ll));
	
	rep(i,0,A+B+1) {

		temp = S[i];

		//cout << (int)temp << temp <<endl;

		if (i == A) {

			if ((int)temp != 45)
				sum++;

		}
		else {

			if ((int)temp < 48 || (int)temp > 57)
				sum++;

		}

		//cout << sum << endl;

	}

	if(sum > 0)
	cout << "No" << endl;
	else
		cout << "Yes" << endl;
	//x = (ll *)malloc((N+1) * sizeof(ll));
	//c = (ll *)malloc((N) * sizeof(ll));
	//cin >> D >> G;
	//vector<pair<int,int>> tr(M);
	//vector<pair<int,int>> qes(Q);
	//sort(c.begin(), c.end());
	
	//cout << c[2] - c[1] << endl;

	

	/*A = N / 1000;
	N %= 1000;
	B = N / 100;
	N %= 100;
	C = N / 10;
	N %= 10;
	D = N;*/
	


	return 0;

}

ll gcd(ll a, ll b) {
	ll x = a * b;

	/* 自然数 a > b を確認・入替 */
	if (a<b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}


	return x/b;
}



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

class Main{
  public static void main(String[] args){
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String str = br.readLine();
      String[] str2 = str.split(" ");
      int a = Integer.parseInt(str2[0]);
      int b = Integer.parseInt(str2[1]);
      if (a < b){
        System.out.println("a < b");
      } else if (a > b){
        System.out.println("a > b");
      } else {
        System.out.println("a == b");
      }
    } catch(IOException e){
      System.err.println(e.toString());
    }
  }
}


Measured memory_bytes: 24460
program ABC096C
    implicit none
    integer(8)::H,W,i,j,judge
    integer(8),allocatable,dimension(:,:)::flg
    character(50),allocatable,dimension(:)::S
    read*,H,W
    allocate(flg(W,H))
    allocate(S(H))
    flg=0
    judge=0
    read*,S

    do i=1,H
        do j=1,W
            if(S(i)(j:j)=="#")then
                if(j<W)then
                    if(S(i)(j+1:j+1)=="#")then
                        flg(j,i)=1
                        flg(j+1,i)=1
                    end if
                end if

                if(j>1)then
                    if(S(i)(j-1:j-1)=="#")then
                        flg(j,i)=1
                        flg(j-1,i)=1
                    end if
                end if

                if(i<H)then
                    if(S(i+1)(j:j)=="#")then
                        flg(j,i)=1
                        flg(j,i+1)=1
                    end if
                end if

                if(i>1)then
                    if(S(i-1)(j:j)=="#")then
                        flg(j,i)=1
                        flg(j,i-1)=1
                    end if
                end if
            end if
        end do
    end do

    do i=1,H
        do j=1,W
            if(S(i)(j:j)=="#".and.flg(j,i)==0)then
                judge=1
                exit
            end if
        end do

        if(judge==1)exit
    end do

    if(judge==0)print'(A)',"Yes"
    if(judge==1)print'(A)',"No"
end program ABC096C

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, a[100008], ans[100008];
string str;

int main(){
	cin >> n;
	ll suma = 0;
	for(ll i = 1; i <= n; i++){cin >> a[i]; suma += a[i];}
	suma /= 2;
	
	for(ll i = 1; i < n; i++){
		if(i%2 == 1){suma -= a[i];}
	}
	ans[n] = 2*suma;
	for(ll i = n-1; i >= 1; i--){
		ans[i] = 2*(a[i]-ans[i+1]/2);
	}
	
	for(ll i = 1; i < n; i++){
		cout << ans[i] << " ";
	}
	cout << ans[n] << endl;
	return 0;
}

Measured memory_bytes: 2816
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
std::mt19937 rnd((int)std::chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

const int MAXLEN = 300;
const int MOD = 998244353;
void inc(int& a, int b) { if ((a += b) >= MOD) a -= MOD; }
void dec(int& a, int b) { inc(a, MOD - b); }

char s[MAXLEN + 1]; int slen;

int dp[MAXLEN + 1][MAXLEN + 1][MAXLEN + 1];
bool can[MAXLEN + 1][MAXLEN + 1][MAXLEN + 1];

int solve() {
	for (int i = slen; i >= 0; --i) REPE(a, slen) REPE(b, slen) {
		dp[i][a][b] = i == slen && a == 0 && b == 0 ? 1 : 0;
		if (a > 0 && (i >= slen || s[i] != '0')) inc(dp[i][a][b], dp[i][a - 1][b]);
		if (b > 0 && (i >= slen || s[i] != '1')) inc(dp[i][a][b], dp[i][a][b - 1]);
		if (i < slen) inc(dp[i][a][b], dp[i + 1][a][b]);
	}

	REPE(i, slen) REPE(a, slen) REPE(b, slen) can[i][a][b] = false;
	can[0][0][0] = true;
	int ret = 0;
	REPE(i, slen) for (int a = slen; a >= 0; --a) for (int b = slen; b >= 0; --b) if (can[i][a][b]) {
		//printf("%d %d %d = %d\n", i, a, b, dp[i][a][b]);
		inc(ret, dp[i][a][b]);
		if (i - 1 >= 0 && s[i - 1] == '0' && a >= 1 && can[i - 1][a - 1][b]) dec(ret, dp[i - 1][a - 1][b]);
		if (i - 1 >= 0 && s[i - 1] == '1' && b >= 1 && can[i - 1][a][b - 1]) dec(ret, dp[i - 1][a][b - 1]);
		if (a >= 2) can[i][a - 1][b] = true;
		if (a >= 1 && b >= 1) can[i][a - 1][b] = can[i][a][b - 1] = true;
		if (b >= 2) can[i][a][b - 1] = true;
		if (i < slen) {
			if (a >= 1 || b >= 1) can[i + 1][a][b] = true;
			if (s[i] == '0' && b >= 1) can[i + 1][a + 1][b - 1] = true;
			if (s[i] == '1' && a >= 1) can[i + 1][a - 1][b + 1] = true;
		}
		if (i + 1 < slen) {
			if (s[i] == '0' || s[i + 1] == '0') can[i + 2][a + 1][b] = true;
			if (s[i] == '1' || s[i + 1] == '1') can[i + 2][a][b + 1] = true;
		}
	}
	return ret;
}

void run() {
	scanf("%s", s); slen = strlen(s);
	printf("%d\n", solve());
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 136972
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;


int main() {
    ll k, n; cin >> n >> k;
    vector<double> num(n+1);
    double add = 0;
    Rep(i, 1, n+1) {
        double p; cin >> p;
        add += (double)(p+1) / (double)2;
        num[i] = add;
    }
    double ans = 0;
    rep(i, n-k+1) {
        chmax(ans, num[i+k] - num[i]);
    }
    cout << setprecision(10) << ans << endl;
    //rep(i, n+1) cout << num[i] << endl;
}

Measured memory_bytes: 1792
const Main = (input) => {
    const lines = input.split('\n')
    line0=lines[0].trim().split(" ")
    N=parseInt(line0[0])
    K=lines[1]
    a=new Array(N)
    for (i=2;i<lines.length;i=i+2){
        line=lines[i].trim().split(" ").map(n=>parseInt(n))
        for(j=0;j<line.length;j++){
            a[line[j]-1]=-2
        }
    }
    ans=0
    for( i=0 ;i<a.length;i++){
        if(a[i]!==-2){
            ans=ans+1
        }
    }
    console.log(ans)
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 29752
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: ngupta
 * Date: 4/5/2020 AD
 * Time: 23:41
 */
class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] NK = br.readLine().trim().split(" ");
        int N = Integer.parseInt(NK[0]);
        int K = Integer.parseInt(NK[1]);
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < K; i++) {
            br.readLine();
            String[] snukes = br.readLine().trim().split(" ");
            for (String sn : snukes)
                set.add(Integer.parseInt(sn));
        }

        System.out.println(N - set.size());
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] inputData = Console.ReadLine().Split(' ');

            int data = int.Parse(inputData[0]);
            int nCnt = int.Parse(inputData[1]);


            int count = 1;
            while (true) {
                int div = data / nCnt;
                int per = data % nCnt;
                if(div < nCnt)
                {
                    if (count != 1 || div != 0)
                    {
                        count++;
                    }
                    break;
                }
                data = div;
                count++;

            }
            Console.WriteLine(count);
        }
    }
}


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

int main(){
	LL n;
	cin>>n;
	LL k=1000000007;
	LL ans=1;
	for(LL i=1;i<=n;i++){
		ans=((ans%k)*(i%k))%k;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size() 
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)


/****************************** CODE IS HERE ***********************************/

const int mod = 1e9 + 7;

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

    int n, m; cin >> n >> m;
    vector <string> s(n);
    for (string &i: s) cin >> i;

    vector <vector<int>> dp(n+1, vector<int> (m+1, 0));
    dp[1][1] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (s[i-1][j-1] == '.') {
                dp[i][j] += (dp[i-1][j] + dp[i][j-1]) % mod;
            }
        }
    }

    cout << dp[n][m];

    return 0;
}

/*

Recurrence: f(i, j) = f(i-1, j) + f(i, j-1), if S[i][j]='.' otherwise 0,
            if you want to make topdown you can do by calling f(N, N), then every time it checks (up, left), then base (1, 1)
            we are doing opposite becuz problem says you have to move from (1, 1)=>(N, N) by moving (down, right),
            we just change the approach by moving from (N, N) to (1, 1) by (up, left).
            This will help to see and build the bottom up solution easily.

*/


Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,p[12],a[11]={0,1,2,4,7,12,20,29,38,52,73};
int g[12][12];
signed main(){
	cin>>n;
	for(int i=2;i<=n;++i){
		int mx=0,tmp=0;
		for(int j=1;j<i;++j)
			p[j]=j;
		do{
			tmp=0;
			for(int j=1;j<i-1;++j)
				tmp+=g[p[j]][p[j+1]];
			mx=max(mx,tmp);
		}while(next_permutation(p+1,p+i));
		for(int j=1;j<i;++j)
			g[i][j]=g[j][i]=(mx+1)*a[j]; 
	}
	for(int i=1;i<=n;++i,puts(""))
		for(int j=1;j<=n;++j)
			cout<<g[i][j]<<" ";
	return 0;
}

Measured memory_bytes: 3588
program aaa;
var
  n,i:longint;
  ans:int64;
  a:array[0..100010]of longint;
begin
  readln(n);
  a[0]:=0;
  for i:=1 to n do
  begin
    read(a[i]);
    ans:=ans+abs(a[i]-a[i-1]);
  end;
  a[n+1]:=0;
  ans:=ans+abs(a[n]);
  for i:=1 to n do
   writeln(ans+abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i+1]-a[i]));
  readln;
  readln;
end.     

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

ll calc(ll a,ll b,ll p){
  if(!b) return 1;
  if(b%2) return (a*calc(a,b-1,p))%p;
  ll d=calc(a,b/2,p);
  return (d*d)%p;
}

ll cc(ll n){
  if(n==1) return 2;
  ll tmp=cc(n/2),rtn=tmp*tmp;
  rtn%=MOD;
  if(n%2){
    rtn*=2;
    rtn%=MOD;
  }
  return rtn;
}

int main(){
  ll n,a,b,ans=1;cin>>n>>a>>b;
  vector<ll> A(2,1),B(2,1);
   
  ans=cc(n);

  ll tmp=1;
  for(ll i=n;i>n-a;i--){
    tmp*=i;
    tmp%=MOD;
  }
  for(ll i=1;i<=a;i++){
    tmp*=calc(i,(MOD-2),MOD);
    tmp%=MOD;
  }
  if(ans>tmp) ans-=tmp;
  else ans+=MOD-tmp;
  ans%=MOD;

  tmp=1;
  for(ll i=n;i>n-b;i--){
    tmp*=i;
    tmp%=MOD;
  }
  for(ll i=1;i<=b;i++){
    tmp*=calc(i,(MOD-2),MOD);
    tmp%=MOD;
  }
  if(ans>tmp) ans-=tmp;
  else ans+=MOD-tmp;
  ans%=MOD;
  
  cout<<ans-1;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
void Unused(...) {}
#ifndef DEBUG
  #define echo(...) Unused(__VA_ARGS__)
#else
  #define echo(...) fprintf(stderr, __VA_ARGS__)
#endif

typedef long long laolin;

const int MaxN = int(1e5) + 7;
const int Mod = int(1e9) + 7;

int h, w, a, b;

laolin fac[MaxN * 2];

void initfac(int n)
{
    fac[0] = fac[1] = 1;
    for (int i = 2; i <= n; ++i)
        fac[i] = (fac[i - 1] * i) % Mod;
}
laolin ksm(laolin base, int ex)
{
    laolin res = 1;
    for (; ex; ex >>= 1, base = base * base % Mod)
        if (ex & 1)
            res = res * base % Mod;
    return res;
}

laolin Comb(int sel, int tot)
{
    laolin res = fac[tot] * ksm(fac[sel] * fac[tot - sel] % Mod, Mod - 2) % Mod;
    return res;
}
laolin way(int x, int y)
{
    return Comb(x - 1, x + y - 2);
}

int main()
{
    scanf("%d %d %d %d", &h, &w, &a, &b);
    if (h > w)
    {
        std::swap(h, w);
        std::swap(a, b);
    }
    initfac(w + h);
    laolin ans = 0;
    for (int col = b + 1; col <= w; ++col)
        ans = (ans + way(col, h - a) * way(w - col + 1, a) % Mod) % Mod;
    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 1664