akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<list>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
#define all(x) (x).begin(), (x).end()
//#define double long double

using namespace std;

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 int MOD = 1e9 + 7;
const ll INF = 1e17;
const int INT_INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;


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

	int N; cin >> N;
	int K; cin >> K;
	string S; cin >> S;
	int num = 0, cnt = 1;
	vector<P>v;
	int M = 0;
	FOR(i, 1, N) {
		//print(i);
		if (S[i] != S[i - 1]) {
			M++;
		}
		else {
			cnt++;
		}
	}
	
	//vector<bool>used(M+1);
	int rem = K;
	M++;
	REP(i, K) {
		M -= 2;
	}
	int ans = N;
	if (M > 0) {
		ans -= M;
	}
	else {
		ans = N - 1;
	}
	print(ans);
}

Measured memory_bytes: 512
#include <iostream>

int main(){
    int N, K;
    std::cin >> N >> K;
    K = std::min(K, N);
    int h[100010];
    for(int i = 0; i < N; i++){
        std::cin >> h[i];
    }
    int dp[100010];
    std::fill(dp, dp+100010, 1e9);
    dp[0] = 0;
    for(int i = 1; i < N; i++){
        int m = 1e9;
        for(int j = std::max(0, i-K); j < i; j++){
            m = std::min(m, dp[j]+std::abs(h[j]-h[i]));
        }
        dp[i] = m;
    }
    std::cout << dp[N-1] << std::endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    int N;
    cin >> N;

    vector<ll> v(N);
    for(int i = 0; i < N; i++){
        cin >> v[i];
    }

    ll tmp = 0;
    vector<ll> ans(N);
    ans.back() = 0;
    for(int i = N - 2; i >= 0; i--){
        if(v[i] >= v[i+1]){
            ans[i] = ans[i + 1] + 1;
        }
        else{
            ans[i] = 0;
        }
    }

    cout << *max_element(all(ans)) << endl;

}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define popb(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  ull x,ans=0;
  cin>>x;
  ans=x/11*2;
  if(x%11>6){
    ans+=2;
  }else if(x%11>0){
    ans+=1;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int tmp=a;
    a=b;
    b=tmp;
    tmp=a;
    a=c;
    c=tmp;
    cout<<a<<" "<<b<<" "<<c<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()
typedef unsigned long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "\n"; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/***********************************************************************/

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n; cin >> n;
  vector<int> a(n), pos(n);
  for (int &z : a) cin >> z, --z;
  for (int i = 0; i < n; ++i) pos[a[i]] = i;
  set<int> s;
  vector<vector<int>> L(n, vector<int>(2, -1));
  vector<vector<int>> R(n, vector<int>(2, n));
  for (int i = n - 1; i >= 0; --i) {
    s.insert(pos[i]);
    auto it = s.find(pos[i]);
    if (it != s.begin()) {
      --it;
      for (int j = 0; j < 2; ++j) {
        L[pos[i]][j] = *it;
        if (it == s.begin()) break;
        --it;
      }
    }
    it = s.find(pos[i]);
    ++it;
    for (int j = 0; j < 2 && it != s.end(); ++j, ++it) {
      R[pos[i]][j] = *it;
    }
  }
  i64 ans = 0;
  for (int i = 0; i < n; ++i) {
    int l = 1, r = 1;
    if (L[i][0] != -1) {
      l = L[i][0] - L[i][1];
      r = R[i][0] - i;
      ans += (i64) l * r * (a[i] + 1);
    }
    if (R[i][0] != n) {
      r = R[i][1] - R[i][0];
      l = i - L[i][0];
      ans += (i64) l * r * (a[i] + 1);
    }
  }
  kek(ans);
}


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


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int lS;
	int h, m, s;

	scanf("%d", &lS);

	h = lS / 3600;
	lS -= (h * 3600);
	m = lS / 60;
	s = lS - m * 60;

	printf("%d:%d:%d\n", h, m, s);

	return 0;
}

Measured memory_bytes: 2676
N = int(input())
A, B = [int(_) for _ in input().split()]
P = [int(_) for _ in input().split()]

X = [0,0,0]
for p in P:
    if p <= A:
        X[0] += 1
    elif p <= B:
        X[1] += 1
    else:
        X[2] += 1

print(min(X))


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

int main(){

    int x, y; cin >> x >> y;

    long long ans =  pow(2, 56);

    int A = y - x;
    if(A >= 0 && A < ans) ans = A;

    int BA = (y + x)+ 1; 
    if (BA >= 0 && BA < ans) ans = BA;

    int BAB = (x - y) + 2;
    if (BAB >= 0 && BAB < ans) ans = BAB;

    int AB = -1 * (x + y) + 1;
    if (AB >= 0 && AB < ans) ans = AB;
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <set>

using namespace std;
using ll = long long;
using ld = long double;

int main() {
  int n,q;
  string str;
  cin >> n >> str >> q;
  
  int query, i, l, r, cnt;
  char c;
  set<int> s[26];

  for (auto j = 0; j !=n; ++j) {
    s[str[j]-'a'].insert(j+1);
  }
  
  for (auto j = 0; j!= q; ++j) {
    cin >> query;
    if (query == 1) {
      cin >> i >> c;
      for (auto alpha = 0; alpha != 26; ++alpha) {
        if (s[alpha].erase(i)) break;
      }
      s[c-'a'].insert(i);
    } else {
      cin >> l >> r;
      cnt = 0;
      for (auto alpha = 0; alpha != 26; ++alpha) {
        auto lb = s[alpha].lower_bound(l);
        if (lb != s[alpha].end() && *lb < r+1) ++cnt;
      }
      cout << cnt << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 24196
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int N=2e5+10;
const int B=316;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(LL x){
    if(x>9) print(x/10);
    putchar(x%10+'0');
}
char s[N];
int main(){
	int n;
	scanf("%s",s+1);n=strlen(s+1);
	int x=0;
	for(int i=1;i<=n;++i){
		x=x+s[i]-'0';
		x=x%9;
	}
	if(!x) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3952
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    sort(All(a));
    deque<int> Q,P,R,O;
    for(auto i:a)Q.push_back(i);
    O=Q;
    int i=Q.front();Q.pop_front();
    P.push_back(i);
    int turn=0;
    while(true){
        if(turn==0){
            if(!Q.empty()){
                i=Q.back();
                Q.pop_back();
                P.push_back(i);
            }
            else break;
            if(!Q.empty()){
                i=Q.back();
                Q.pop_back();
                P.push_front(i);
            }
            else break;
            turn=1;
        }
        else{
            if(!Q.empty()){
                i=Q.front();
                Q.pop_front();
                P.push_back(i);
            }
            else break;
            if(!Q.empty()){
                i=Q.front();
                Q.pop_front();
                P.push_front(i);
            }
            else break;
            turn=0;
        }
    }
    i=O.back();O.pop_back();
    R.push_back(i);
    turn=1;
    while(true){
        if(turn==0){
            if(!O.empty()){
                i=O.back();
                O.pop_back();
                R.push_back(i);
            }
            else break;
            if(!O.empty()){
                i=O.back();
                O.pop_back();
                R.push_front(i);
            }
            else break;
            turn=1;
        }
        else{
            if(!O.empty()){
                i=O.front();
                O.pop_front();
                R.push_back(i);
            }
            else break;
            if(!O.empty()){
                i=O.front();
                O.pop_front();
                R.push_front(i);
            }
            else break;
            turn=0;
        }
    }
    int res1=0,res2=0;
    for(int i=0;i<n-1;i++){
        res1+=abs(P[i]-P[i+1]);
    }
    for(int i=0;i<n-1;i++){
        res2+=abs(R[i]-R[i+1]);
    }
    cout<<max(res1,res2)<<endl;
}

Measured memory_bytes: 2816
#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;



int main(){

	int N;
	scanf("%d",&N);

	int pre,current;
	scanf("%d",&pre);

	int minimum = 1; //最初の1回

	for(int i = 1; i < N; i++){

		scanf("%d",&current);
		if(current <= pre){

			minimum += 1;
		}
		pre = current;
	}

	printf("%d\n",minimum);
	printf("%d\n",N);

	return 0;
}



Measured memory_bytes: 3216
S = list(input())
T = list(input())
lenS = len(S)
lenT = len(T)
change = 0
for i in range(lenS-lenT,-1,-1):
    a = 1
    for j in range(lenT):
        if S[i+j] != T[j] and S[i+j] != '?':
            a = 0
    if a == 1:
        for j in range(lenT):
            S[i+j] = T[j]
        change = 1
        break

for i in range(lenS):
    if S[i] == '?':
        S[i] = 'a'

if change == 1:
    print(''.join(S))
else:
    print('UNRESTORABLE')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
long long s,w,h,i,a,b,c,d,e,ans=1e10;
using namespace std;
int main()
{
	cin>>w>>h;
	for(i=0;i<=h/2;i++)
	{
		a=w*i;
		b=(h-i)*(w/2);
		c=w*h-a-b;
		s=max(max(a,b),c)-min(min(a,b),c);
		ans=min(ans,s);
		d=(h-i)/2*w;
		e=w*h-a-d;
		s=max(max(a,d),e)-min(min(a,d),e);
		ans=min(ans,s);
	}
	for(i=0;i<=w/2;i++)
	{
		a=h*i;
		b=(w-i)*(h/2);
		c=w*h-a-b;
		s=max(max(a,b),c)-min(min(a,b),c);
		ans=min(ans,s);
		d=(w-i)/2*h;
		e=w*h-a-d;
		s=max(max(a,d),e)-min(min(a,d),e);
		ans=min(ans,s);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair <LL,LL>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,x,y,now=0,whi=0,ai=0,bi=0;
vector <pair <int,pii> > v;
LL ans[2];

bool cmp(pair <int,pii> a,pair <int,pii> b)
{
	return a.fi>b.fi;
}

int main()
{
	cin>>n;
	rep(i,n)
	{
		scanf("%I64d%I64d",&x,&y);
		v.pb({x+y,{x,y}});
	}
	sort(v.begin(),v.end(),cmp);
	rep(i,n)
	{
		if(i%2==0) ans[0]+=v[i].se.fi;
		else ans[1]+=v[i].se.se;
	}
	cout<<ans[0]-ans[1];
	rt0;
}

Measured memory_bytes: 4724
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
int main(){
  priority_queue<pair<int,int> > p_q;
  int n,q;
  vector<int> mem;
  cin >> n >> q;
  mem.resize(n+1,0);
  p_q.push(make_pair(0,-1));
  for(int i=0,a,v;i<q;i++){
    cin >> a >> v;
    mem[a] += v;
    p_q.push(make_pair(mem[a],-a));
    while(!p_q.empty()){
      int pf = p_q.top().first , ps = p_q.top().second;
      if(pf == mem[-ps]){
        cout << -ps << " " << pf << endl;
        break;
      }
      p_q.pop();
    }
  }
}

Measured memory_bytes: 6012
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define int long long
using namespace std;
signed main() {
	int A, B;
	string op;

	cin >> A >> op >> B;

	if (op == "+") {
		cout << A + B << endl;
	}
	else {
		cout << A - B << endl;
	}
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	//m <= min(n, 5)

	int ans = (1900 * m +100 * (n - m)) * pow(2, m);

	dunk(ans);

	return 0;
}


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

using namespace std;
const int maxn=1e5+5;
char s[maxn];
int a[maxn];
int main()
{
    scanf("%s",s+1);
    int n=strlen(s+1);
    for(int i=1;i<=n;i++)
    {
        int ans1=0,ans2=0;
        i--;
        while(s[++i]=='R')
        {
            ans1++;
        }
        int flag=i-1;
        i--;
        while(s[++i]=='L')
        {
            ans2++;
        }
        i--;
        if((ans1+ans2)%2==0)
        {
            a[flag+1]=a[flag]=(ans1+ans2)/2;
        }
        else
        {
            int t=max(ans1,ans2);
            t--;
            int k1=(ans1+ans2-1)/2+1;
            a[flag]=k1;
            int k2=(ans1+ans2-1)/2;
            a[flag+1]=k2;
            if(ans1<ans2)
            {
                swap(a[flag],a[flag+1]);
            }
            if(t%2)
                swap(a[flag],a[flag+1]);
        }
    }
    printf("%d",a[1]);
    for(int i=2;i<=n;i++)
        printf(" %d",a[i]);
    return 0;
}


Measured memory_bytes: 896
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

int main()
{
    int n, m;
    cin >> n;
    string s[n];
    bool bs[n];
    REP(i, n)
    {
        string tmp;
        cin >> tmp;
        s[i] = tmp;
        bs[i] = false;
    }

    cin >> m;
    string t[m];
    bool bt[m];
    REP(i, m)
    {
        string tmp;
        cin >> tmp;
        t[i] = tmp;
        bt[i] = false;
    }

    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int tmpans = 0;
        if (bs[i])
            continue;
        for (int j = i; j < n; j++)
        {
            if (s[i] == s[j])
            {
                tmpans++;
                bs[j] = true;
            }
        }
        for (int j = 0; j < m; j++)
        {
            if (s[i] == t[j])
            {
                tmpans--;
                bt[j] = true;
            }
        }
        ans = max(ans, tmpans);
    }

    for (int i = 0; i < m; i++)
    {
        int tmpans = 0;
        if (bt[i])
            continue;
        for (int j = i; j < m; j++)
        {
            if (t[i] == t[j])
            {
                tmpans--;
                bt[j] = true;
            }
        }
        ans = max(ans, tmpans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define sq(x) ((x)*(x))
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
vector<int> pqr;
int form(string &s, int &pos){
	if(s[pos]=='-'){
		return 2-form(s,++pos);
	}else if(s[pos]=='('){
		int a = form(s,++pos);
		char op = s[pos];
		int b = form(s,++pos);
		pos++;
		if(op=='+')return max(a,b);
		else return min(a,b);
	}else{
		char c = s[pos];
		if(c>='0'&&c<='2'){
			pos++;
			return c-'0';
		}else{
			pos++;
			return pqr[c-'P'];
		}
	}
}
int solve(){
	string s;
	cin >> s;
	if(s==".")return 1;
	int ans = 0;
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				pqr.clear();
				pqr.pb(i);
				pqr.pb(j);
				pqr.pb(k);
				int pos = 0;
				int res = form(s,pos);
				if(res==2)ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}
int main(){
	while(!solve()){}
	return 0;
}

Measured memory_bytes: 3048
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 7
#define M 55
long long dp[M][1<<N][M][N];
int n,le,v[N],p[N],su;
double as;
int main()
{
	scanf("%d%d",&n,&le);
	for(int i=1;i<=n;i++)scanf("%d",&v[i]);sort(v+1,v+n+1);
	for(int i=1;i<n;i++)p[i]=i;
	do{
		memset(dp,0,sizeof(dp));
		dp[0][0][v[n]][0]=1;
		for(int i=0;i<le;i++)
		for(int j=0;j<(1<<n-1);j++)
		for(int k=i;k<=le;k++)
		for(int l=0;l<n;l++)
		if(dp[i][j][k][l])
		for(int s=((1<<n-1)-1)^j;s<(1<<n-1);s=(s-1)&(((1<<n)-1)^j))
		{
			int fg=0;
			if(k>i)fg=1;
			int rs=k,rs2=l;
			for(int t=1;t<n;t++)if(s&(1<<t-1)){if(p[t]<l)fg=1;if(rs<(i+v[t]>le?le:i+v[t]))rs=(i+v[t]>le?le:i+v[t]),rs2=p[t];else if(rs==i+v[t]&&rs2<p[t])rs2=p[t];}
			if(fg)dp[i+1][j|s][rs][rs2]+=dp[i][j][k][l];
		}
		long long su=0;
		for(int i=0;i<n;i++)su+=dp[le][(1<<n-1)-1][le][i];
		double tp=su;
		for(int i=1;i<n;i++)tp/=le;
		as+=tp;
	}while(next_permutation(p+1,p+n));
	for(int i=1;i<n;i++)as/=i;
	printf("%.15lf\n",as);
}

Measured memory_bytes: 21504
#include<stdio.h>
int main(void){
	int a,b,sum;
	int i;
	
	while(scanf("%d %d",&a,&b)!=EOF){
		sum=a+b;
		for(i=1;sum/10!=0;sum/=10,i++){
		}
		printf("%d\n",i);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll A, B, C;
    cin >> A >> B >> C;
    map<ll, ll> m;
    m[A]++;
    m[B]++;
    m[C]++;
    if (m[5] == 2 && m[7] == 1)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3512
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect


def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


def main():
    #N = list(input().strip())
    N, R = map(int, input().split())

    penalty = max([0, 100 * (10 - N)])

    print(R + penalty)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;

int parser()
{
	int temp, res;
	char ch = getchar();
	vector<int> v;
	if (ch == '[') {
		while ((ch = getchar()) != ']') {
			ungetc(ch,stdin);
			v.push_back(parser());
		}
		sort(v.begin(),v.end());
		res = 0;
		for (int i = 0; i < (v.size() + 1) / 2; i++)
			res += v[i];
		return res;
	}
	else if (isdigit(ch)) {
		ungetc(ch, stdin);
		cin >> temp;
		return (temp + 1) / 2;
	}
	else
		return -1;
}

int main()
{
	int n;
	cin >> n;
	getchar();
	for (int i = 0; i < n; i++) {
		cout << parser() << endl;
		if(i < n - 1)
			getchar();
	}
	return 0;
}

Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        StringTokenizer st;
        try {
            String line;
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                st = new StringTokenizer(line);
                MathContext mc = new MathContext(10);
                BigDecimal x1 = new BigDecimal(st.nextToken());
                BigDecimal y1 = new BigDecimal(st.nextToken());
                BigDecimal x2 = new BigDecimal(st.nextToken());
                BigDecimal y2 = new BigDecimal(st.nextToken());
                BigDecimal x3 = new BigDecimal(st.nextToken());
                BigDecimal y3 = new BigDecimal(st.nextToken());
                BigDecimal x4 = new BigDecimal(st.nextToken());
                BigDecimal y4 = new BigDecimal(st.nextToken());
                BigDecimal a1 = y2.subtract(y1);
                BigDecimal b1 = x1.subtract(x2);
                BigDecimal a2 = y4.subtract(y3);
                BigDecimal b2 = x3.subtract(x4);
                if (a1.multiply(b2, mc).compareTo(a2.multiply(b1, mc)) == 0) {
                    System.out.println("YES");
                } else {
                    System.out.println("NO");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}

Measured memory_bytes: 24740
N = int(raw_input())
D1 = 20*5 + 19*5
D2 = 20*10

for i in xrange(N):
    y, m, d = map(int, raw_input().split())
    ans = 0
    if d != 1:
        if y % 3 == 0 or m % 2 == 1:
            last = 20
        else:
            last = 19
        ans += last - d + 1
        d = 1
        if m < 10:
            m += 1
        else:
            y += 1
            m = 1
    if m != 1:
        while m < 11:
            if y % 3 == 0 or m % 2 == 1:
                ans += 20
            else:
                ans += 19
            m += 1
        m = 1
        y += 1
    while y < 1000:
        if y % 3 == 0:
            ans += D2
        else:
            ans += D1
        y += 1
    print ans

Measured memory_bytes: 6372
#include<iostream>
#include<vector>
#include<algorithm>
#define ll long long
using namespace std;

int main(){
    ll N,K,ans=0;
    vector<ll>p;
    cin >> N >> K;
    for(int i=0; i< N; i++){
        int a;
        cin >>a;
        p.push_back(a);
    }
    sort(p.begin(),p.end());
    for(int i=0; i< K; i++){
        ans += p[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
s = [input() for _ in range(3)]

count = [0 for _ in range(3)]

i = 0
while True:
    if count[i] >= len(s[i]):
        print('ABC'[i])
        exit()
    next = ord(s[i][count[i]]) - ord('a')
    count[i] += 1
    i = next

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node treeMinimum(Node);
Node treeMaximum(Node);
Node treeSearch(Node,int);
Node treeSuccessor(Node);
void treeDelete(Node);
void insert(int);
void inorder(Node);
void preorder(Node);

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;

}

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
  return x;

}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key) return u;

  if(k < u->key) return treeSearch(u->left, k);
  else return treeSearch(u->right,k);

}

Node treeSuccessor(Node x){
  Node y;
  
  if(x->right != NIL) return treeMinimum(x->right);

  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->parent = y->parent;

  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;

  if(y != z) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  
  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;

}

void inorder(Node u){  
  if(u == NIL) return;

  inorder(u->left); 
  printf(" %d",u->key);
  inorder(u->right);
	 
}
void preorder(Node u){
  if(u == NIL) return;

  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n,i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 24040
"""AtCoder Beginner Contest 178.

B
"""

import sys


def input() -> str:  # noqa: A001
    """Input."""
    return sys.stdin.readline()[:-1]


def main():
    """Run."""
    a, b, c, d = list(map(int, input().split(' ')))
    ans = b * d
    ans = max(ans, a * c)
    ans = max(ans, a * d)
    ans = max(ans, b * c)
    print(ans)


main()


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

int main() {
  int a, b;
  cin >> a >> b;

  vector<string> s1(50, string(100, '.')), s2(50, string(100, '#'));
  for (int i = 0; i < b - 1; i++) s1[i / 50 * 2 + 1][i % 50 * 2] = '#';
  for (int i = 0; i < a - 1; i++) s2[i / 50 * 2 + 1][i % 50 * 2] = '.';
  cout << "100 100" << endl;
  for (auto&& u : s1) cout << u << endl;
  for (auto&& u : s2) cout << u << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 998244353
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n, s = map(int, input().split())
    dp = [0] * (s + 1)
    res = 0
    for a in map(int, input().split()):
        dp[0] += 1
        for i in range(s - a, -1, -1):
            dp[i + a] += dp[i]
            if dp[i + a] >= MOD:
                dp[i + a] -= MOD
        res += dp[s]
        if res >= MOD:
            res -= MOD

    print(res)
resolve()

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	long long d, t, s;
  	cin >> d >> t >> s;
  	if(t*s >= d) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
}


Measured memory_bytes: 3608
# https://atcoder.jp/contests/abc126/tasks/abc126_c
N, K = list(map(int, input().split()))

probs = []
keisuu = 1 / N
for dice in range(1, N + 1):
    score = dice
    cnt = 0
    while score < K:
        score *= 2
        cnt += 1
    probs.append(keisuu * (1 / 2)**cnt)


print(sum(probs))


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

int main(){
    int N;
    cin >> N;
    int N2 = N;
    int n = 0;
    int ans = 0;
    while(N!=0){
        N /= 10;
        n++;
    }
    
    if(n == 2){
        ans = 9;
    }else if(n == 3){
        ans = 9 + (N2 - 100)+1;
    }else if(n == 4){
        ans = 9 + 900;
    }else if(n == 5){
        ans = 9 + 900 + (N2 - 10000)+1;
    }else if(n == 6){
        ans = 9 + 900 + 90000;
    }else if(n==1){
        ans = N2;
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int i,j,k,h,w,c[10][10],a[201][201],sum;
	scanf("%d %d",&h,&w);
	for(i=0;i<10;i++)	{
		for(j=0;j<10;j++)	{
			scanf("%d",&c[i][j]);
		}
	}
	for(i=1;i<=h;i++)	{
		for(j=1;j<=w;j++)	{
			scanf("%d",&a[i][j]);
		}
	}
	for(k=0;k<10;k++)	{
		for(i=0;i<10;i++)	{
			for(j=0;j<10;j++)	{
				c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
			}
		}
	}
	sum=0;
	for(i=1;i<=h;i++)	{
		for(j=1;j<=w;j++)	{
			if(a[i][j]>=0)	{
				sum+=c[a[i][j]][1];
			}
		}
	}
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A , B , C , D;
  cin >> A >> B >> C >> D;
 
  if (A+B==C+D) {
    cout << "Balanced" << endl;
  }
  else if (A+B>C+D) {
    cout << "Left" << endl;
  }
  else if (A+B<C+D) {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define  __  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;


int main()
{
    __;

    int n,k;

    string s;

    cin>>n>>k>>s;

    for(int i=0;i<s.size();i++)
    {
        if(i==k-1) {
                char c=tolower(s[i]);
                cout<<c;
        }
        else cout<<s[i];
    }

    return 0;
}


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

using namespace std;

long long inf=1000000007;

int main(){
	long long n;
	cin>>n;
	long long ans=0;

	for(long long i=1;i<=n;i++){
		long long y=n/i;
		ans+=y*(1+y)/2*i;
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <vector>

#define ll long long

using namespace std;

int main()
{
    ll N, A[100001], maxC = 0;
    A[0] = 0;
    cin >> N;
    for (size_t i = 1; i <= N; i++) {
        cin >> A[i];
        maxC += abs(A[i] - A[i - 1]);
    }
    maxC += abs(A[N]);

    for (size_t i = 1; i <= N; i++) {
        cout << maxC - abs(A[i] - A[i - 1]) - abs(A[i + 1] - A[i]) + abs(A[i + 1] - A[i - 1]) << endl;
    }

    return 0;
}

Measured memory_bytes: 2048
N,M = map(int,input().split())

dp = [0 for i in range(N+1)]

for i in range(M) :
    a = int(input())
    dp[a] = -1

dp[0] = 1

if dp[1] != -1 :
    dp[1] = 1

for i in range(2,N+1) :
    if dp[i] == -1 :
        continue
    
    calc = 0
    
    if dp[i-2] != -1 :
        calc += dp[i-2]
    if dp[i-1] != -1 :
        calc += dp[i-1]
    
    dp[i] = calc

ans = dp[-1]

ans %= (10**9 + 7)

print(ans)
    
    


Measured memory_bytes: 462744
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  char c;cin>>c;
  c++;
  cout<<c<<ENDL;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 764
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define INF 0x7FFFFFFF

int main(){
  long long n,q,xx,nn;
  scanf ("%lld %lld",&n,&q);
  xx=int(sqrt(n))+1;
  nn=xx*xx;
  vector<long long> a(nn,INF);
  vector<long long> aa(xx,INF);
  long long int x,y,c,xxx,yyy;
  for(int i=0;i<q;i++){
    scanf ("%lld %lld %lld",&c,&x,&y);
    xxx=x/xx;
    yyy=y/xx;
    if(c==0){
      a[x]=y;
      aa[xxx]=INF;
      for(int t=0;t<xx;t++){
        aa[xxx]=min(aa[xxx],a[xxx*xx+t]);
      }
    }
    else{
      long long ma,mb,ans;
      ans=INF;
      ma=xxx*xx+xx;
      mb=yyy*xx;
      if((y-x)>=xx*2){
        for(int t=x;t<ma;t++){
          ans=min(ans,a[t]);
        }
        for(int t=xxx+1;t<yyy;t++){
          ans=min(ans,aa[t]);
        }
        for(int t=mb;t<=y;t++){
          ans=min(ans,a[t]);
        }
      }
      else{
        for(int t=x;t<=y;t++){
          ans=min(ans,a[t]);
        }
      }

      printf("%lld\n",ans);
    }
    /*for(int s=0;s<nn;s++){
      printf("%d",a[s]);
    }
    printf("\n");*/
  }
}



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

signed main(){
	int N,H; cin>>N>>H;
	vector<int> a(N);
	vector<int> b(N);
	for(int i=0;i<N;i++)cin>>a[i]>>b[i];
	sort(b.begin(),b.end());
	reverse(b.begin(),b.end());
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	int j=0; int ans=0;
	while(b[j]>a[0] && j<N && H>0){
		H-=b[j]; j++; ans++;
	}
	if(H>0){
		double t,h,p;h=H;p=a[0]; t=h/p; ans+=ceil(t);
	}
	cout<<ans<<endl;
}


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

#define         ll      long long int

int main( )
{
    ll d, n, a, p;
    cin >> d >> n;
    if (d == 0)
    {
        if (n == 100)   cout << "101\n" << "\n";
        else            cout << n << "\n";
        return 0;
    }
    else if (d == 1)
    {
        if (n == 100)   cout << "10100\n";
        else            cout << 100 + (n - 1) * 100 << "\n";
        return 0;
    }
    else
    {
        if (n == 100)   cout << "1010000\n";
        else            cout << 10000 + (n - 1) * 10000 << "\n";
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
int a[10];char z[10];
main(N,i,j,w,l,x){
  for(;scanf("%d",&N),N;){
    for(i=0;i<N;i++){
      scanf(" %c",z+i);
      for(j=w=l=0;j<N-1;j++){
        scanf("%d",&x);
        if(x==0)w++;
        if(x==1)l++;
      }
      a[i]=(w<<8)+((10-l)<<4)+10-i;
    }
    for(i=0;i<N;i++)
      for(j=0;j<N;j++)
        if(a[i]>a[j])x=a[i],a[i]=a[j],a[j]=x;
    for(i=0;i<N;i++)
      printf("%c\n",z[10-a[i]&15]);
  }
  return 0;
}

Measured memory_bytes: 0
import math
A, B, H, M = map(int,input().split())
pi = math.pi
theta_A = 2*pi*H/12 + 2*pi*M/(60*12)
theta_B = 2*pi*M/60
point_A = [A*math.cos(theta_A), A*math.sin(theta_A)]
point_B = [B*math.cos(theta_B), B*math.sin(theta_B)]
r = ((point_A[0]-point_B[0])**2 + (point_A[1] - point_B[1])**2 )**0.5
print(r)

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

int main() {
  int n;
  cin>>n;
  int h[n];
  for (int i=0; i<n; i++) cin>>h[i];
  int ans = 0;
  int cnt = 0;
  for (int i=0; i<n-1; i++) {
    if (h[i] >= h[i+1]) {
      ++cnt;
    } else {
      ans = max(cnt, ans);
      cnt = 0;
    }
  }
  ans = max(cnt, ans);
  cout<<ans<<endl;
}


Measured memory_bytes: 640
import * as fs from 'fs'
import {debug} from '../../../util'

const input = fs.readFileSync('/dev/stdin', 'utf8').split(' ') // ['1', '2' , ...]
const output = (x: any) => console.log(x)
// debug(input)

const [A, B, C, D] = input.map(n => parseInt(n, 10))

const t = Math.floor((A + D - 1) / D)
const a = Math.floor((C + B - 1) / B)

t >= a ? output('Yes') : output('No')

Measured memory_bytes: 29608
import sys
from string import ascii_lowercase

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    ans = []
    while N:
        N, r = divmod(N - 1, 26)
        ans.append(ascii_lowercase[r])

    print(''.join(reversed(ans)))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9976
#include <iostream>
using namespace std;
long long dp[105][10];
int main(void){
    int fib[10]={0,1,1,2,3,5,8,13,21,34};
    int H,W,K; cin>>H>>W>>K;
    dp[0][0]=fib[W]; dp[0][1]=fib[W-1];
    for(int i=1;i<H;i++){
        for(int j=0;j<W;j++){
            if(j==0){
                dp[i][j]=(dp[i-1][j]*fib[W]+dp[i-1][j+1]*fib[W-1])%1000000007;
            }else if(j==W-1){
                dp[i][j]=(dp[i-1][j]*fib[W]+dp[i-1][j-1]*fib[W-1])%1000000007;
            }else{
                dp[i][j]=(dp[i-1][j-1]*fib[j]*fib[W-j]+dp[i-1][j]*fib[j+1]*fib[W-j]+dp[i-1][j+1]*fib[j+1]*fib[W-j-1])%1000000007;
            }
            //cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        }
    }
    cout<<dp[H-1][K-1]<<endl;
    
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while(scanf("%d",&n),n != -1){
		double x = 1.0, y = 1.0, sum = 0.0;
		double R = 1.0;
		for(int i = 0; i < n-1; i++){
			double q = sqrt(R*R+1);
			sum += acos((q*q+R*R-1)/(2*q*R));
			R = q;
      		x = R*cos(sum);
      		y = R*sin(sum);
		}
		
		printf("%.2lf %.2lf\n",x,y);
		
	}
	return 0;
}

Measured memory_bytes: 1116
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

ans = 0
pre_dish = -1
for i in A:
    ans += B[i-1]
    if i == pre_dish + 1:
        ans += C[pre_dish-1]
    pre_dish = i

print(ans)

Measured memory_bytes: 3064
from collections import deque 
import sys
H, W = map(int, input().split())
city = []
dot_count = 0
for i in range(H):
    city.append(input())
    dot_count += city[i].count('.')
search_point = deque([[0, 0, 0]])
direction_list = [[1,0],[-1,0],[0,1],[0,-1]]
searched_point = [[False for _ in range(W)] for _ in range(H)]
while search_point:
    now_point = search_point.popleft()
    for direction in direction_list:
        next_point = [now_point[0] + direction[0], now_point[1] + direction[1], now_point[2] + 1]
        if next_point[0] < 0 or next_point[0] >= H or next_point[1] < 0 or next_point[1] >= W \
        or city[next_point[0]][next_point[1]] == '#' or searched_point[next_point[0]][next_point[1]] == True:
            continue
        if next_point[0] == H-1 and next_point[1] == W-1:
            print(dot_count - next_point[2] - 1)
            sys.exit()
        searched_point[next_point[0]][next_point[1]] = True
        search_point.append(next_point)
print("-1")

Measured memory_bytes: 3316
#include<iostream>
#include<string>

int main(){
    int n,k;
    std::string s;
    std::cin >> n;
    std::cin >> s;
    std::cin >> k;
    char c;
    c = s[k-1];
    for(int i=0; i<n; i++){
        if (s[i] != c){
            s[i] = '*';
        }
    }
    std::cout << s;
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int h, w, n, cnt = 0;
    cin >> h >> w >> n;
    while (n > 0) {
        if (h < w) {
            n -= w;
            h--;
        }
        else {
            n -= h;
            w--;
        }
        cnt++;
    }
    cout << cnt;
}

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


using ll = long long;
typedef std::pair<int, int>p;

ll min(ll a, ll b) {
	if (a >= b)return b;
	else return a;
}
ll max(ll a, ll b) {
	if (a >= b)return a;
	else return b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);

}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
int d[210];
bool flag = true;
bool fl = true;
struct edge { int to, cost; };
std::vector<edge>v[100];
bool used[210];

int main() {
	int n, a[100], ans = 0;
	std::cin >> n;
	for (int i =0 ;i < n;i++){
		std::cin >> a[i];
	}
	while (flag) {
		for (int i = n - 1;i > 0;i--) {
			if (a[i] < a[i - 1]) {
				int b = a[i-1];
				a[i - 1] = a[i];
				a[i] = b;
				ans++;
			}
		}
		for (int i = 0;i < n;i++) {
			if (i == n - 1) {
				flag = false;
				break;
			}
			if (a[i] > a[i + 1]) {
				break;
			}
		}
	}
	for (int i = 0;i < n-1;i++) {
		std::cout << a[i] << ' ';
	}
	std::cout << a[n - 1] << std::endl;
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3084
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())

typedef long long ll;
typedef tuple<int,int,bool> Tb;


int atcoder(){
    //入力
    vector<ll> sft;
    sft.push_back(3);
    sft.push_back(5);
    sft.push_back(7);
    for(int j=0; j<100000; j++){
        sft.push_back(sft[j]*10+3);
        sft.push_back(sft[j]*10+5);
        sft.push_back(sft[j]*10+7);
    }
    REP(i,0,sft.size()){
        ll tmp = sft[i];
        int cnt[3]={};
        while(tmp!=0){
            if(tmp%10==3) cnt[0]++;
            else if(tmp%10==5) cnt[1]++;
            else if(tmp%10==7) cnt[2]++;
            tmp /= 10;
        }
        if((cnt[0]==0 || cnt[1]==0) || cnt[2]==0) sft[i]=LLONG_MAX;
    }
    
    int n;
    cin >> n;
    
    //処理
    
    int anscnt = 0;
    REP(i,0,sft.size()){
        if(sft[i]<=n) anscnt++;
    }
    
    
    
    //出力
    cout << anscnt << ENT;
    return 0;
}

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


Measured memory_bytes: 6256
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();

        if(N <A){
            System.out.println(0);
            return;
        }
        System.out.println(10);

    }

}


Measured memory_bytes: 21844