akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 200005;

int n, m, p, q, a[MAXN];
LL tag, v[3][MAXN << 2];

inline void Build(int x, int l, int r)
{
	if (l == r)
	{
		if (l == p)
			v[0][x] = abs(q - a[1]), v[1][x] = v[0][x] + l, v[2][x] = v[0][x] - l;
		else if (l == q)
			v[0][x] = abs(p - a[1]), v[1][x] = v[0][x] + l, v[2][x] = v[0][x] - l;
		else
			v[0][x] = v[1][x] = v[2][x] = 1LL << 40;
		return ;
	}
	int mid = l + r >> 1;
	Build(x << 1, l, mid), Build(x << 1 | 1, mid + 1, r);
	for (int i = 0; i < 3; i ++)
		v[i][x] = min(v[i][x << 1], v[i][x << 1 | 1]);
}

inline void Modify(int x, int l, int r, int p, LL t)
{
	if (l == r)
		return (void)(v[0][x] = t, v[1][x] = t + l, v[2][x] = t - l);
	int mid = l + r >> 1;
	if (p <= mid)
		Modify(x << 1, l, mid, p, t);
	else
		Modify(x << 1 | 1, mid + 1, r, p, t);
	for (int i = 0; i < 3; i ++)
		v[i][x] = min(v[i][x << 1], v[i][x << 1 | 1]);
}

inline LL Query(int x, int l, int r, int ql, int qr, int t)
{
	if (l == ql && r == qr)
		return v[t][x];
	int mid = l + r >> 1;
	if (qr <= mid)
		return Query(x << 1, l, mid, ql, qr, t);
	if (ql > mid)
		return Query(x << 1 | 1, mid + 1, r, ql, qr, t);
	return min(Query(x << 1, l, mid, ql, mid, t), Query(x << 1 | 1, mid + 1, r, mid + 1, qr, t));
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), m = Read(), p = Read(), q = Read();
	for (int i = 1; i <= m; i ++)
		a[i] = Read();
	Build(1, 1, n);
	for (int i = 2; i <= m; i ++)
	{
		LL val = min(Query(1, 1, n, a[i], n, 1) - a[i], Query(1, 1, n, 1, a[i], 2) + a[i]) + tag;
		tag += abs(a[i] - a[i - 1]);
		LL cur = Query(1, 1, n, a[i - 1], a[i - 1], 0) + tag;
		if (cur > val)
			Modify(1, 1, n, a[i - 1], val - tag);
	}
	return printf("%lld\n", v[0][1] + tag), 0;
}


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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}

long long src[100001], tgt[100001];

vector<pair<int, pair<int, int>>> adj[100001];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, m, s, t;
    cin >> n >> m >> s >> t;

    for(int i = 0; i < n; ++i)
        src[i] = tgt[i] = 100000000000000LL;

    for(int i = 0; i < m; ++i){
        int x, y, a, b;
        cin >> x >> y >> a >> b;
        --x; --y;
        adj[x].push_back(make_pair(y, make_pair(a, b))); adj[y].push_back(make_pair(x, make_pair(a, b)));
    }

    // Source

    priority_queue<pair<long long, int>> q;
    q.push(make_pair(0, s - 1));

    while(!q.empty()){
        pair<long long, int> state = q.top();
        q.pop();
        long long cost = -state.first;
        int node = state.second;
        if(cost >= src[node])
            continue;
        src[node] = cost;
        for(auto nx : adj[node]){
            if(cost + nx.second.first >= src[nx.first])
                continue;
            q.push(make_pair(-(cost + nx.second.first), nx.first));
        }
    }

    q.push(make_pair(0, t - 1));

    while(!q.empty()){
        pair<long long, int> state = q.top();
        q.pop();
        long long cost = -state.first;
        int node = state.second;
        if(cost >= tgt[node])
            continue;
        tgt[node] = cost;
        for(auto nx : adj[node]){
            if(cost + nx.second.second >= tgt[nx.first])
                continue;
            q.push(make_pair(-(cost + nx.second.second), nx.first));
        }
    }

    priority_queue<pair<long long, int>> best;

    for(int i = 0; i < n; ++i){
        best.push(make_pair(-(src[i] + tgt[i]), i)); // cost, year it closes
    }

    for(int i = 0; i < n; ++i){ // year we start
        while(best.top().second < i)
            best.pop();
        cout << 1000000000000000LL + best.top().first << "\n";
    }

    return 0;
}


Measured memory_bytes: 12144
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    double a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int is_involve(int w, int h, int x, int y, int r)
{
    if(x-r < 0)
		return 0;
	if(x+r > w)
		return 0;
    if(y-r < 0)
		return 0;
	if(y+r > h)
		return 0;
    return 1;
}
 
 
int main()
{
    int w,h,x,y,r;
 
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
 
    if(is_involve(w,h,x,y,r))
		printf("Yes\n");
	else
		printf("No\n");
    return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define FASTIO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll int
#define vi vector<ll>
#define all(a) (a).begin(), (a).end()
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define tr(it, a)   for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define endl  "\n"
const ll MAX=1e5+3;
map<ll,vector<ll>>m;
vi visited(MAX,-1);
void dfsHolder(ll src,vector<bool> &onpath)
{
    visited[src]=1;
    onpath[src]=1;
    ll val=0;
    for(auto nbr:m[src])
    {

        if(onpath[nbr]==0 && visited[nbr]==-1)
        {
            dfsHolder(nbr,onpath);
        }
         val=max(val,visited[nbr]);
    }
    visited[src]+=val;
    onpath[src]=0;
}
ll dfs(ll v)
{
    vector<bool> onpath(v+1,false);
 for(ll i=1;i<=v;i++)
 {
     if(visited[i]==-1){

     dfsHolder(i,onpath);
     }
 }
 ll ans=*max_element(all(visited));
 return ans-1;
}
int main()
{
   FASTIO
   int t=1;
   //cin>>t;
   while(t--)
  {
      ll v,e,x,y;
    cin>>v>>e;
    rep(i,0,e)
    {
        cin>>x>>y;
        m[x].pb(y);
    }
    ll ans=dfs(v);
    cout<<ans;
   }
 return 0;
}


Measured memory_bytes: 15744
#include<bits/stdc++.h>
#define pow3(x) ((x)*(x)*(x))
using namespace std;
struct node{int x,y,w;};
vector<node>vct;
int main()
{
    int L,n=0,m=0,mx=0;
    scanf("%d",&L);int l=L;
    while(l)mx++,l>>=1;mx--;
    //for(int i=mx-1;i>-1;i--)if(L&(1<<i))m++;
    n=mx+1;
    for(int i=1;i<=mx;i++)vct.push_back((node){i,i+1,1<<(i-1)});
    L-=(1<<mx);
    int tmp=1<<mx;
    for(int i=0;i<=n;i++)if(((L>>i)&1))vct.push_back((node){i+1,n,tmp}),tmp+=1<<i;
    printf("%d %d\n",n,vct.size()+mx);
    for(int i=1;i<=mx;i++)printf("%d %d 0\n",i,i+1);
    for(vector<node>::iterator iter=vct.begin();iter!=vct.end();iter++)
        printf("%d %d %d\n",iter->x,iter->y,iter->w);
    return 0;
}
/*5
2 5
1 2 1
1 2 0
2 3 2
2 3 0
2 3 4

Process returned 0 (0x0)   execution time : 1.220 s
Press any key to continue.

*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int ok[200010];

int main()
{
  int64_t N;
  cin >> N;
  if (N == 1)
  {
    cout << "Yes" << endl;
    cout << 2 << endl;
    cout << 1 << ' ' << 1 << endl;
    cout << 1 << ' ' << 1 << endl;
    return 0;
  }
  int64_t n = 3, k = 3;
  for (int64_t i = 3; i < 200010; i++)
  {
    ok[n] = k;
    if (n >= 200010)
    {
      break;
    }
    n += i;
    k++;
  }
  if (ok[N] == 0)
  {
    cout << "No" << endl;
    return 0;
  }
  else
  {
    cout << "Yes" << endl;
  }
  int64_t K = ok[N];
  cout << K << endl;
  vector<queue<int64_t>> S(K);
  int64_t id = 1;
  for (int64_t i = 0; i < K - 1; i++)
  {
    for (int64_t j = i + 1; j < K; j++)
    {
      S.at(i).push(id);
      S.at(j).push(id);
      id++;
    }
  }
  for (int64_t i = 0; i < K; i++)
  {
    cout << S.at(i).size();
    while (S.at(i).size())
    {
      cout << ' ' << S.at(i).front();
      S.at(i).pop();
    }
    cout << endl;
  }
}


Measured memory_bytes: 5900
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
using namespace std;

int main(){
    int n,m,memo = 0,test = 0;
    cin >> n >> m;
    int cell[n+1][m+1] = {0};
  
  	rep(i,0,n+1){ 
        rep(j,0,m+1){
            cell[i][j] = 0;
        }
    }
    
    rep(i,0,n){
        rep(j,0,m){
            cin >> cell[i][j];
        }
    }
    
    rep(i,0,n){
        rep(j,0,m){
          	test = cell[i][j];
            cell[i][m] += test;
            memo += test;
        }
    }
    
    rep(i,0,m){
        rep(j,0,n){
          	test = cell[j][i];
            cell[n][i] += test;
        }
    }
    
    cell[n][m] = memo;
    
    rep(i,0,n+1){ 
        rep(j,0,m+1){
            cout << cell[i][j];
            if(j != m) cout << " ";
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3144
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	int n, d, x;
	cin >> n >> d >> x;
	int ans = x;
	rep(i, n) {
		int a;
		cin >> a;
		ans += (d - 1) / a + 1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

x = int(input())
if 400 <= x <= 599:
    print(8)
elif x <= 799:
    print(7)
elif x <= 999:
    print(6)
elif x <= 1199:
    print(5)
elif x <= 1399:
    print(4)
elif x <= 1599:
    print(3)
elif x <= 1799:
    print(2)
else:
    print(1)

Measured memory_bytes: 61852
import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));// ??\????????????????????????
            String line = br.readLine(); // ??\???????????????????????\???
            int i = line.length();
            StringBuilder sb = new StringBuilder();
            	while(i > 0){
            		sb.append(line.substring(i-1, i));
            		i--;
            	}
            	System.out.println(sb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 24288
N, H = map(int, input().split())
Kft, maxa = [], 0
for _ in range(N):
    a, b = map(int, input().split())
    if a > maxa:
        maxa = a
    Kft.append(b)

Kft = sorted([b for b in Kft if b > maxa])
ans = 0
while H > 0 and len(Kft) > 0:
    H -= Kft.pop(-1)
    ans += 1
if H > 0:
    if H % maxa == 0:
        ans += H // maxa
    else:
        ans += H // maxa + 1
print(ans)

Measured memory_bytes: 9052
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B, count=0;
  cin >>A >>B;  
  for(int i=A; i<=B; i++) if(i/10000==i%10 && i/1000%10==i/10%10) count++;
  cout << count;
  return 0;
}


Measured memory_bytes: 256
/*4_3 hightierra*/
#include <stdio.h>
int snowfalls(int west, int east);

int main(void){
    int west,east;
    scanf("%d %d",&west,&east);

    // snowfallsに代入してプリント
    printf("%d\n",snowfalls(west,east));

    return 0;

}

int snowfalls(int west, int east){
    // 塔の差を計算
    int gap = east - west;

    // for文で真の西の塔の高さを計算
    int truewest=0,i;
    for(i=1; i<gap; i++){
        truewest += i;
    }
    
    // 積雪を計算
    int snow = truewest - west;
    return snow;
}

Measured memory_bytes: 128
#include <iostream>

#define inf 20000000000
using namespace std;
long long N;
int a;
bool e[1000];
char ans[1000];

int main(){
    cin>>N;
    a=0;
    if(N==0){
        cout << "0"<<endl;
    }else{
        a=0;
        while(N!=0){
            switch((N+inf)%4){
                case 2:
                    e[a]=0;
                    e[a+1]=1;
                    N+=2;
                    break;
                case 3:
                    e[a]=1;
                    e[a+1]=1;
                    N+=1;
                    break;
                case 0:
                    e[a]=0;
                    e[a+1]=0;
                    break;
                case 1:
                    e[a]=1;
                    e[a+1]=0;
                    N-=1;
                    break;
            }
            N/=4;
            a+=2;
        }
        
        if(e[a-1]==0){
            for(int i=0;i<a-1;i++){
                ans[a-i-2]=e[i]==0?'0':'1';
            }
            ans[a-1]='\0';    
        }else{
            for(int i=0;i<a;i++){
                ans[a-i-1]=e[i]==0?'0':'1';
            }   
            ans[a]='\0';
        }
        
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n;
    int a,b,c;
    cin >> n >> a >> b >> c;
    vector<int>d(n);
    for(int i = 0;i < n;i++){
        cin >> d[i];
    }
    sort(d.begin(),d.end());
    reverse(d.begin(),d.end());
    int r = c / a;
    int i = 0;
    int k = c;
    int p = a;
    //cout << r << " " << k << " " <<  p << endl;
    while(1){
        if(i == n)break;
        k += d[i];
        p += b;
        int r2 = k / p;
        //cout << i << " " <<r2 << " *"<< endl;
        if(r2 >= r){
            r = r2;
        }
        else{
            break;
        }
        i ++ ;
    }
    cout << r << endl;
    return 0;
}


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

using namespace std;
using   ll=long long;

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define pll				pair<int , int>
#define int             long long int
#define endl            "\n"

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			998244353

ll mod_pow(ll a,ll b,ll m)
{
    ll res = 1;
    while(b)
    {
        if(b&1)
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(int a , int m)
{
	return mod_pow(a , m - 2 , m);
}

void solve() {
	
	int n , k;
	
	cin >> n >> k;
	
	int a[2*k];
	
	for(int i = 0; i < 2*k; i += 2) {
		cin >> a[i] >> a[i+1];
	}
	
	int dp[n+1] {};
	
	dp[1] = 1;
	int now = 0;
	
	for(int i = 1; i < n; ++i) {
		int tot = now + dp[i];
		for(int j = 0; j < 2*k; j += 2) {
			int p = dp[i] + a[j];
			int q = dp[i] + a[j+1];
			
			if(i + a[j] <= n) {
				dp[i + a[j]] += tot;
				dp[i + a[j]] %= mod;
			}
			
			if(i + a[j+1] < n) {
				dp[i + a[j+1] + 1] -= tot;
				dp[i + a[j+1] + 1] += mod;
				dp[i + a[j+1] + 1] %= mod;
			}
		}
		now += dp[i];
		now %= mod;
	}
	
	cout << dp[n];
}

signed main() {
	fast;
   
    int t = 1;

	//cin >> t;

    while(t--) {
        solve();
    }

    return 0;
}


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

using namespace std;

int main(){
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    for(int i = 0; i < s.length(); ++i){
        if(s[i] != t[i]){
            cout << "No" << '\n';
            return 0;
        }
    }
    cout << "Yes" << '\n';
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int len,a[4],ok = 0;
char s[100010],ch;
int main(){
	scanf("%s",s+1);
	len=strlen(s+1);
	for(int i=1;i<=len;i++){
		if(s[i]=='a') a[1]++; 
		else if(s[i]=='b') a[2]++;
		else a[3]++;
	}
	sort(a+1,a+3+1);
	if(a[1]==a[2]&&a[2]==a[3]) ok=1;
	if((a[1]==(a[2]-1))&&a[2]==a[3]) ok=1;
	if(a[1]==a[2]&&a[2]==a[3]-1) ok=1;
	if(ok) puts("YES");
	else puts("NO");
	return 0;
}


Measured memory_bytes: 384
n=int(input())
a=list(map(int,input().split()))
print(2*n-1)
if abs(max(a))>=abs(min(a)):
    b=a.index(max(a))
    for i in range(n):
        print(b+1,i+1)
    for j in range(n-1):
        print(j+1,j+2)
    
else:
    b=a.index(min(a))
    for i in range(n):
        print(b+1,i+1)
    for j in range(n-1,0,-1):
        print(j+1,j)

Measured memory_bytes: 39732
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	string S, T;
	int N, M, A, B, C;
	cin >> N;
	int a = N % 10;
	if (a == 2)cout << "hon" << endl;
	if (a == 4)cout << "hon" << endl;
	if (a == 7)cout << "hon" << endl;
	if (a == 5)cout << "hon" << endl;
	if (a == 9)cout << "hon" << endl;

	if (a == 0)cout << "pon" << endl;
	if (a == 1)cout << "pon" << endl;
	if (a == 8)cout << "pon" << endl;
	if (a == 6)cout << "pon" << endl;

	
	if (a == 3)cout << "bon" << endl;
	return 0;
}



Measured memory_bytes: 3648
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl_int(): return list(map(int, input().split()))
def inpl_str(): return list(map(int, input().split()))

def Comb(n):
    gyakugen = [1]*(n+1)
    fac = [1]*(n+1)

    for i in range(1,n+1):
        fac[i] = (fac[i-1]*i)%mod

    gyakugen[n] = pow(fac[n],mod-2,mod)

    for i in range(n,0,-1):
        gyakugen[i-1] = (gyakugen[i]*i)%mod

    com = [1]*(n+1)

    for i in range(1,n+1):
        com[i] = (fac[n]*gyakugen[i]*gyakugen[n-i])%mod

    return com

N = int(input())
aa = inpl_int()

i = 1
dd = defaultdict(int)
for i,a in enumerate(aa):
	if dd[a] == 0:
		dd[a] = i+1
	else:
		X1 = dd[a]-1
		X2 = i

L,R = X1,N-X2
ALL = 1

ALL = Comb(N+1)
daburi = Comb(L+R)

for i in range(1,N+2):
	if L+R+1 >= i:
		print((ALL[i]-daburi[i-1])%mod)
	else:
		print(ALL[i]%mod)


Measured memory_bytes: 33264
# include <bits/stdc++.h>
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#include <tr1/unordered_map>
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end()
#include <map>
using namespace std;

double fact(ll n)
{
	if(n==1)
	{
		return 1;

	}
	else
	{
		return n*fact(n-1);
	}
}

int main()
{



     flash;
     ///////////////////////////////////////////////////////////////////////////////////////


     ll n;
     cin>>n;
     ll x[n],y[n];

     double sum=0;
     for(ll i=0;i<n;i++)
     {
     	cin>>x[i]>>y[i];
     }
     for(ll i=0;i<n;i++)
     {
     	for(ll j=0;j<n;j++)
     	{
     		sum+=sqrt((x[i]-x[j])*(x[i]-x[j])+((y[i]-y[j])*(y[i]-y[j])));
     	}
     }
     double val=sum/n;
    cout<<std::setprecision(30)<<val;






    ///////////////////////////////////////////////////////////////////////////////////////

     return 0;

}


Measured memory_bytes: 764
def intnum(str):
  n = 0
  if str in range(10):
    n=int(str)
  elif str in {'A'}:
    n=10
  elif str in {'B'}:
    n=11
  elif str in {'C'}:
    n=12
  elif str in {'D'}:
    n=13
  elif str in {'E'}:
    n=14
  elif str in {'F'}:
    n=15
  return n
    

x,y = map(intnum,input().split())
r='='
if x > y:
  r = '>'
elif x < y:
  r ='<'
print(r)

Measured memory_bytes: 38256
/*
 
 Author : Bisma
 
 */
#include<algorithm>
#include <assert.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define ll long long
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pii pair <int, int>
#define pll pair <long long, long long >
#define plp pair <int, pll >
#define pb push_back
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define ll long long 
#define sum(a,b) a=a+b
#define repn(a,b,c) for(int a = b ; a>=c ; a--)
#define mem(a, b) memset(a, (b), sizeof(a))



ll max(ll a , ll b){
  if(a>b) return a;
  return b;
}

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
}


ll a[6];

int main(){
    
    fast();
  
    ll n = 5;

    rep(i,1,n) cin>>a[i];

    ll k ;
    cin>>k;
    bool ok = true;
    rep(i,1,n){
      rep(j,i+1,n){
        ll sel = abs(a[j] - a[i]);
        if(sel > k) ok = false;
      }
    }

    if(ok){
      cout<<"Yay!"<<endl;
    }else{
      cout<<":("<<endl;
    }


    return 0;

}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    Int N; string S1, S2;
    cin >> N >> S1 >> S2;
    vector<char> pattern; // v:|, h:=

    rep(i, 0, N) {
        if (S1[i] == S2[i]) pattern.emplace_back('v');
        else {
            pattern.emplace_back('h');
            ++i;
        }
    }

    Int res = (pattern[0] == 'v' ? 3 : 6);
    rep(i, 1, pattern.size()) {
        if (pattern[i-1] == 'v' and pattern[i] == 'v') res *= 2;
        if (pattern[i-1] == 'v' and pattern[i] == 'h') res *= 2;
        if (pattern[i-1] == 'h' and pattern[i] == 'v') res *= 1;
        if (pattern[i-1] == 'h' and pattern[i] == 'h') res *= 3;
        res %= 1000000007;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = LLONG_MAX;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
int main() {
    int h,w;cin >> h >> w;
    int n;cin>>n;
    vi a(n);
    rep(i, n)cin >> a[i];
    /*vvi ans(h, vi(w));
    int k = 0;
    rep(i, n) {
        rep(j, v[i]) {
            if()
            ans[]
        }
    }*/
    /*vvi ans(n);
    int k = 1;
    rep(i, n) {
        rep(j, a[i]) ans[i].pb(k);
        k++;
    }
    rep(i, h) */
    vvi ans(h, vi(w));
    int k = 1;
    int count = 0;
    int i = 0;
    int j = 0;
    int flag = 0;//０が前へ、１が後ろへ
    for(auto p:a) {
        rep(m, p) {
            if(flag==0&&j==w) {
                j--;
                flag = 1;
                i++;
            }
            else if(flag==1&&j==-1) {
                j++;
                flag = 0;
                i++;
            }
            ans[i][j] = k;
            if(flag==0) j++;
            else if(flag == 1) j--;
        }
        k++;
    }
    /*for(int q = 1;q<=h/2;q+=2) {
        reverse(ans[q].begin(),ans[q].end());
    }*/
    rep(m, h) {
        rep(r, w) {
            cout << ans[m][r];
            if(r==w-1)cout << endl;
            else cout << ' ';
        }
    }
    return 0;
}

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

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

signed main(){

  int n;
  cin>>n;
  vector<ll> a(n);
  cin>>a;

  multiset<ll> st;
  rep(i,n){
    auto itr = st.upper_bound(a[i]);
    if(itr==begin(st)){
      st.emplace(a[i]);
    }else{
      auto itr2 = st.lower_bound(a[i]);
      if(itr2==begin(st))st.emplace(a[i]);
      else{
        --itr2;
        st.erase(itr2);
        st.emplace(a[i]);
      }
    }
  }
  cout<<(st.size())<<endl;

}

Measured memory_bytes: 5760
N = gets.to_i
S = gets.chomp
R = []
G = []
B = []
N.times{|n|
	case S[n]
	when "R"
		R << n
	when "G"
		G << n
	when "B"
		B << n
	end
}
#warn R.inspect
#warn G.inspect
#warn B.inspect
s = 0
R.each{|r|
	G.each{|g|
		s += B.size
		if r < g
			d = g - r
			if g + d < N and S[g + d] == "B"
				s -= 1
			end
			if r - d >= 0 and S[r - d] == "B"
				s -= 1
			end
			if d % 2 == 0 and S[r + d / 2] == "B"
				s -= 1
			end
		else
			d = r - g
			if r + d < N and S[r + d] == "B"
				s -= 1
			end
			if g-  d >= 0 and S[g - d] == "B"
				s -= 1
			end
			if d % 2 == 0 and S[g + d / 2] == "B"
				s -= 1
			end
		end
	}
}
puts s


Measured memory_bytes: 14412
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int a,b,c,d,a1,a2,b1,b2,q1,q2;
  cin>>a1>>a2>>b1>>b2>>a>>b>>c>>d;
  q1=a1*a+a2*b+a1/10*c+a2/20*d;
  q2=b1*a+b2*b+b1/10*c+b2/20*d;
  if(q1==q2)cout<<"even"<<endl;
  else if(q1<q2)cout<<"kenjiro"<<endl;
  else cout<<"hiroshi"<<endl;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int maxn = 234567;
int mul(long long a, long long b){
	return a * b % mod;
}
int inv(int x){
	int r = 1, m = mod - 2;
	for(; m; m >>= 1, x = mul(x, x)) if(m&1) r = mul(r, x);
	return r;
}
int fat[maxn], ifat[maxn];
void init(){
	fat[0] = 1;
	for(int i = 1; i < maxn; i++) fat[i] = mul(fat[i - 1], i);
	ifat[maxn - 1] = inv(fat[maxn - 1]);
	for(int i = maxn - 2; i >= 0; i--) ifat[i] = mul(ifat[i + 1], i + 1);
}
int ncr(int n, int r){
	if(n < r) return 0;
	return mul(fat[n], mul(ifat[r], ifat[n - r]));
}
int main(){
	init();
	int n, m; cin >> n >> m;
	map<int,int> foo;
	for(int i = 2; i * i <= m; i++){
		while(m%i == 0){
			foo[i]++;
			m /= i;
		}
	}
	if(m != 1) foo[m]++;
	int ans = 1;
	for(auto it : foo) ans = mul(ans, ncr(n + it.second - 1, it.second));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
 
int main(){
    fast;
    ll n;
    cin >> n;
    ll ans = 0;
    ll r = n%3;
    ll An = n-r;
    ll e = n%5;
    ll Dn = n-e;
    ll q = n-(n%15);
    ll Sn = ((n/3)*(3+An))/2;
    ll sn = ((n/5)*(5+Dn))/2;
    ans = (n*(1+n))/2;
    ll t = ((n/15)*(15+q))/2;
    cout << (ans - ((Sn + sn)-t));
    return 0;
}
//                                     #!!{*[$um1t_Kum@r]*}!!#

Measured memory_bytes: 3636
#include <stdio.h>
#define MAX_INDEX (100)
int main(){
    int N;
    int a[MAX_INDEX];
    int i;
    
    scanf("%d", &N);
    for(i=0;i<N;i++){
        scanf("%d", &a[i]);
    }

    int cnt=0;
    for(i=0;i<N;i++){
        if(i%2 == 0 && a[i]%2 != 0){
            cnt++;
        }
    }

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

    return 0;
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using ll = long long;
template <typename T>
T sq(T x){
  return x * x;
}

signed main (){
  int K ,S;
  cin >> K >> S;
  int ans =0;

rep(X,K+1){
rep(Y,K+1){
if(0 <= S-X-Y&& S- X - Y <= K){
ans++;
}
}
}
cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
import fractions
n,x=map(int,input().split())
t=list(map(int,input().split()))
d=set()
for t_ in t:
    d.add(abs(t_-x))
if len(d)==1:
    print(d.pop())
else:
    g=fractions.gcd(d.pop(),d.pop())
    while(d):
        g=fractions.gcd(g,d.pop())
    print(g)

Measured memory_bytes: 18928
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

template<typename V>
constexpr string join(const V &v, const string &sep) {
  stringstream ss;
  if (v.size()) ss << v[0];
  loop(i, 1, v.size()) ss << sep << v[i];
  return ss.str();
}

void solve() {
  int q;
  cin >> q;
  while (q--) {
    int c, a, n;
    cin >> c >> a >> n;
    int s1 = min({c, a, n});
    c -= s1;
    a -= s1;
    n -= s1;
    int s2 = min(c / 2, a);
    c -= s2 * 2;
    a -= s2;
    int s3 = c / 3;
    cout << s1 + s2 + s3 << endl;
  }
}

Measured memory_bytes: 3092
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var d = new Dictionary<char, int>() {{'I', 1}, {'V', 5}, {'X', 10}, {'L', 50}, {'C', 100}, {'D', 500}, {'M', 1000}};
        string s;
        while ((s = Console.ReadLine()) != null)
        {
            int a = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (i + 1 < s.Length && d[s[i]] < d[s[i + 1]]) a -= d[s[i]];
                else a += d[s[i]];
            }
            Console.WriteLine(a);
        }
    }
}


Measured memory_bytes: 9528
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
    int v,s;
    cin >> v >> s;
    int h,w;
    cin >> h >> w;
    cout <<  s*v - ((s * h + v * w) - h * w);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;
// ||

int main() {
  ll a, b; cin >> a >> b;
  cout << (a + b) % 24 << endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math

a, b, h, m = (int(x) for x in input().split())

if h == 0: #1時まで
    angle = math.radians(5.5*m)
else:
    angle = math.radians(h*30-5.5*m)

x = math.sqrt(a**2+b**2-2*a*b*math.cos(angle))

print(x)

Measured memory_bytes: 9344
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<int> a(n);

    int maxm = 0;
    int res = 0;
    rep(i, n) {
        cin >> a[i];
        res += a[i] - 1;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144 * 4LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}


#define int ll

unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

int dp[1 << 16];

void solve() {
    int n;
    cin >> n;
    dp[0] = 1;
    vector<tuple<long double, complex<long double>, complex<long double>>> inputs;
    REP(i, n) {
        long double a, b, c, d, e;
        cin >> a >> b >> c >> d >> e;
        inputs.push_back(make_tuple(a, complex<long double>{b, c}, complex<long double> {d, e}));
    }
    int ans = 0;
    REP(i, (1 << n)) {
        if (dp[i] == 0) continue;
        int cnt = 0;
        REP(q, n) {
            if ((1 << q) & i) {
                cnt++;
                continue;
            }
            if (dp[i + (1 << q)] == 1) continue;
            int ok = 1;
            REP(j, n) {
                if (q == j) continue;
                complex<long double> basics;
                if ((1 << j) & i) {
                    basics = get<2>(inputs[j]);
                }
                else {
                    basics = get<1>(inputs[j]);
                }
                long double bot = 0;
                long double top = 1;
                REP(tea, 20) {
                    long double mid1 = (bot + bot + top) / 3.0L;
                    long double mid2 = (bot + top + top) / 3.0L;
                    complex<long double> a = get<1>(inputs[q]) + mid1 * (get<2>(inputs[q]) - get<1>(inputs[q]));
                    complex<long double> b = get<1>(inputs[q]) + mid2 * (get<2>(inputs[q]) - get<1>(inputs[q]));
                    if (abs(a - basics) < abs(b - basics)) {
                        top = mid2;
                    }
                    else {
                        bot = mid1;
                    }
                }
                complex<long double> a = get<1>(inputs[q]) + bot * (get<2>(inputs[q]) - get<1>(inputs[q]));
                if (abs(a - basics) < get<0>(inputs[q]) + get<0>(inputs[j])) {
                    ok = 0;
                    break;
                }
            }
            if (ok == 0) continue;
            dp[i + (1 << q)] = 1;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 3796
N = int(input())
A = list(map(int, input().split()))
A = map( lambda x:x//400, A)
A = list(map( lambda x:x if x<8 else 8, A))
cnt8 = A.count(8)
A = list(set(A))
if 8 in A:
    A.remove(8)
sum = len(A)
if sum == 0:
    print(1, end=' ')
else:
    print(sum, end=' ')
sum += cnt8
print(sum)

Measured memory_bytes: 9208
#Satoooh
from fractions import gcd

A, B, C, D = map(int, input().split())
l = C * D // gcd(C, D)
x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l
y = B - B // C - B // D + B // l
print(y - x)

Measured memory_bytes: 5048
#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <map>

using namespace std;
using ll = long long;

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

	cout << 180 * (n - 2) << endl;

	return 0;
}

Measured memory_bytes: 256
import math
import itertools
import statistics
#import numpy as np
import collections

n = int(input())
#a, b, x = list(map(int, input().split()))

l = [2, 1]

if n==1:
    print(1)
    exit()
else:
    for i in range(2, n+1):
        l.append(l[i-1]+l[i-2])

print(l[-1])

    


Measured memory_bytes: 5148
import sys
input = sys.stdin.readline
import heapq

n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=-a[i]

heapq.heapify(a)
for i in range(m):
    c=-(-heapq.heappop(a)//2)
    heapq.heappush(a,c)
#print(a)
print(-sum(a))


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


def main():
    N, Y = [int(x) for x in input().split()]

    for i in range(N + 1):
       for j in range(N + 1):
            k = N - i - j
            if k < 0:
                continue
            if i * 10000 + j * 5000 + k * 1000 == Y:
                print(i, j, k)
                exit()

    print(-1, -1, -1)


if __name__ == '__main__':
    main()



Measured memory_bytes: 40556
#include<bits/stdc++.h>
using namespace std;
inline int Read()
{
    int x = 0, f = 1, c = getchar();
    for (; !isdigit(c); c = getchar())
        if (c == '-')
            f = -1;
    for (;  isdigit(c); c = getchar())
        x = x * 10 + c - '0';
    return x * f;
}

int main()

{

    char a[20];
    int sum = 0;
    scanf("%s",a);
    for(int i=0;i<strlen(a);++i)
    {
        if(a[i]=='o')
            sum++;
    }
    if(sum+15-strlen(a)>=8)
        cout<<"YES";
    else
        cout<<"NO";
}


Measured memory_bytes: 256
import scala.io.StdIn.readLine
import scala.reflect.ClassTag
case class Queue[T](len: Int)(implicit m: ClassTag[T]) {
    var que = m.newArray(len)
    var size = 0
    var headPtr = len - 1
    var tailPtr = len - 1
    
    def isEmpty(): Boolean = if (size == 0) true else false
    def isFull(): Boolean = if (len == size) true else false
    def enque(e: T): Unit = {
        if (!isFull) {
            size += 1
            que(headPtr) = e
            if (headPtr - 1 < 0) headPtr = len - 1
            else headPtr -= 1
        } else {
            throw new RuntimeException("error...")
        }
    }
    def deque(): T = {
        if (!isEmpty) {
            val ret = que(tailPtr)
            size -= 1
            if (tailPtr - 1 < 0) tailPtr = len - 1
            else tailPtr -=1
            ret
        } else {
            throw new RuntimeException("error...")
        }
    }
}
case class Proc(name: String, time: Int) {
    def exec(t: Int): (Proc, Int) = {
        if (time - t < 0) (new Proc(name, 0), time)
        else (new Proc(name, time - t), t)
    }
    def finished(): Boolean = if (time == 0) true else false
}
object Main {
    def main(args: Array[String]): Unit = {
        val line = readLine.split(" ").map(_.toInt)
        val procNum = line(0)
        val quantum = line(1)
        val que: Queue[Proc] = new Queue[Proc](procNum)
        for (i <- (1 to procNum)) {
            val p = readLine.split(" ")
            que.enque(new Proc(p(0), p(1).toInt))
        }
        println(process(que, quantum).mkString("\n"))
    }
    
    def process(que: Queue[Proc], quantum: Int): List[String] = {
        def go(total: Int, result: List[String]): List[String] = {
            if (que.isEmpty) result
            else {
                val (pProc, time) = que.deque.exec(quantum)
                if (pProc.finished) {
                    go(total + time, s"${pProc.name} ${total + time}" :: result)
                } else {
                    que.enque(pProc)
                    go(total + time, result)
                }
            }
        }
        go(0, Nil).reverse
    }
}


Measured memory_bytes: 108544
def modComb(n,r,mod):
    nume=1
    deno=1
    for i in range(r):
        nume=nume*(n-i)%mod
        deno=deno*(i+1)%mod
    return nume*pow(deno,mod-2,mod)%mod

def power_func(a,n,p):
    bi = str(format(n,"b"))
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res

def main():
    n,a,b=map(int,input().split())
    mod=10**9+7
    ans=(power_func(2,n,mod)-modComb(n,a,mod)-modComb(n,b,mod)-1)%mod
    print(ans)
if __name__=="__main__":
    main()

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

int main(){
  int N;
  cin >> N;
  string s;
  cin >> s;
  int count = 1;
  for(int i = 1;i < N;i++){
    if(s[i - 1] != s[i]){
      count++;
    }
  }

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


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
    int n;
    cin >> n;
    V<V<int>> g(n,V<int>(n));
    rep(i,n) {
        int u, k;
        cin >> u >> k;
        u--;
        rep(j,k) {
            int a;
            cin >> a;
            a--;
            g[u][a]++;
        }
    }
    rep(i,n)rep(j,n) cout << g[i][j] << (j==n-1 ? '\n' : ' ');
}


Measured memory_bytes: 3156
/***
 *      __  __            _    _       _
 *     |  \/  |          | |  | |     | |
 *     | \  / |_ __      | |  | |_ __ | | ___ __   _____      ___ __
 *     | |\/| | '__|     | |  | | '_ \| |/ / '_ \ / _ \ \ /\ / / '_ \
 *     | |  | | |     _  | |__| | | | |   <| | | | (_) \ V  V /| | | |
 *     |_|  |_|_|    (_)  \____/|_| |_|_|\_\_| |_|\___/ \_/\_/ |_| |_|
 *
 *
***/
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for (int i=a;i<=b;i++)
#define f_(i,a,b) for (int i=a;i>=b;i--)
#define MP make_pair
#define ii pair<int,int>
#define iii pair<int,ii>
const ll mod=1000000007;

string s;
int main() {
//	freopen("","r",stdin);
//	freopen("","w",stdout);
	cin>>s;
	sort(s.begin(),s.end());
	if (s.size()==4&&s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2]) cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>
int max(int a, int b){return a>b?a:b;}
int min(int a, int b){return a<b?a:b;}
int gcd(int a, int b){return min(a,b)==0?max(a,b):gcd(min(a,b),max(a,b)%min(a,b));}
long long llmax(long long a, long long b){return a>b?a:b;}
long long llmin(long long a, long long b){return a<b?a:b;}
long long llgcd(long long a, long long b){return min(a,b)==0 ?llmax(a,b):llgcd(llmin(a,b),llmax(a,b)%llmin(a,b));}
int assort(const void *a, const void *b){return *(int*)a-*(int*)b;}
int dessort(const void *a, const void *b){return *(int*)b-*(int*)a;}
int llassort(const void *a, const void *b){return *(long long*)a-*(long long*)b;}
int lldessort(const void *a, const void *b){return *(long long*)b-*(long long*)a;}
int charassort(const void *a, const void *b){return strcmp((char*)a ,(char*)b);}
int chardessort(const void *a, const void *b){return strcmp((char*)b ,(char*)a);}
char lowcmp[26]="abcdefghijklmnopqrstuvwxyz";
char upcmp[26]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int ntoi(char c){return c-'0';}
int ltoi(char c){return c-'a';}
int utoi(char c){return c-'A';}
long long mod=1000000007;

int main(void){
    char s[4];
    scanf("%s",s);
    for (int i=0; i<strlen(s); i++){
        if (s[i]=='1'){
            s[i]='9';
        } else if (s[i]=='9'){
            s[i]='1';
        }
    }
    printf("%s\n",s);
	return 0 ;
}

Measured memory_bytes: 128