akhauriyash/Code-Regression huggingface dataset:
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI=3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//#define rnd(x, y) uniform_int_distribution<ll>(x, y)(rng)

//struct custom_hash {
//    static uint64_t splitmix64(uint64_t x) {
//        // http://xorshift.di.unimi.it/splitmix64.c
//        x += 0x9e3779b97f4a7c15;
//        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
//        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
//        return x ^ (x >> 31);
//    }
//    size_t operator()(uint64_t x) const {
//        static const uint64_t FIXED_RANDOM = 
//            chrono::steady_clock::now().time_since_epoch().count();
//        return splitmix64(x + FIXED_RANDOM);
//    }
//};

#define fi first
#define se second

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	vector<ll>arr(n);
	map<ll,ll>mm;
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
		mm[arr[i]]++;
	}
	ll ans=0;
	for(auto &x:mm)
	{
		ll val=x.se;
		ans+=(((val)*(val-1))/2 );
	}
	for(ll i=0;i<n;i++)
	{
		ll val=mm[arr[i]];
		ll val1=val-1;
		ll hehe=(val*(val-1))/2;
		ll hehe1=(val1*(val1-1))/2;
		cout<<(ans-hehe+hehe1)<<"\n";
	}
    return 0;
}


//252908XL

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

namespace V0043{
    public class Program{
        public static void Main(string[] args){
            string input;
            while((input = Console.ReadLine()) != null){
                var pai = new int[9 + 1];
                input.ToList().ForEach(c => pai[c - '0']++);

                Func<int, int[], bool> func = null;
                func = (x, _pai) =>{
                    if(x >= 8) return _pai.Count(i => i == 2) == 1 && _pai.All(i => i == 0 || i == 2 || i == 3);
                    for(var i = 0; i <= _pai[x]; i++) {
                        for(var j = 0; j < 3; j++) _pai[x + j] -= i;
                        if(func(x + 1, _pai)) return true;
                        for(var j = 0; j < 3; j++) _pai[x + j] += i;
                    }
                    return false;
                };

                var result = new bool[9 + 1];
                for(var i = 1; i <= 9; i++){
                    var tmp = new int[12];
                    pai.CopyTo(tmp, 0);
                    if(++tmp[i] != 5) result[i] = func(1, tmp);
                }

                var str = string.Empty;
                for(var i = 1; i <= 9; i++) if(result[i]) str += i + " ";
                Console.WriteLine(str == string.Empty ? "0" : str.Trim());
            }
        }
    }
}

Measured memory_bytes: 9256
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

pair<int, int> calc(string S){
    int mn = 0;
    int cnt = 0;
    for(auto c : S){
        if(c == '(') cnt++;
        else{
            cnt--;
            mn = min(mn, cnt);
        }
    }
    return make_pair(mn, cnt);
}

int exec(vector<pair<int, int>> &pos){
    sort(pos.begin(), pos.end(), greater<pair<int, int>>());
    int cnt = 0;
    for(auto x : pos){
        int mn = cnt + x.first;
        if(mn < 0) return -1;
        cnt += x.second;
    }
    return cnt;
}

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    REP(i, N) cin >> S[i];
    {
        int cnt = 0;
        for(auto s : S){
            for(char c : s){
                if(c=='(') cnt++;
                else cnt--;
            }
        }
        if(cnt != 0){
            cout << "No" << endl;
            return 0;
        }
    }
    vector<pair<int, int>> v(N);
    REP(i, N) v[i] = calc(S[i]);
    vector<pair<int, int>> pos, nonpos;
    for(int i=0; i<N; i++){
        int mn = v[i].first;
        int cnt = v[i].second;
        if(cnt > 0) pos.push_back(make_pair(mn, cnt));
        else nonpos.push_back(make_pair(-cnt+mn, -cnt));
    }
    int hoge = exec(pos);
    int fuga = exec(nonpos);
    if(hoge == -1 || fuga == -1 || hoge != fuga){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 50392
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(){
  char s1[10],s2[10],s3[10];
  scanf("%s %s %s", &s1,&s2,&s3);
  
  char RYAKUGO[3+1];
  memset(RYAKUGO,'\0',sizeof(RYAKUGO));
  RYAKUGO[0] = toupper(s1[0]);
  RYAKUGO[1] = toupper(s2[0]);
  RYAKUGO[2] = toupper(s3[0]);
  printf("%s",RYAKUGO);
}

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

// N = 頂点数
int prim(int N) {
    vector<bool> used(N, false);
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, 0));
    int ret = 0;
    while (!que.empty()) {
        P p = que.top(); que.pop();
        if (used[p.second]) continue;
        used[p.second] = true;
        ret += p.first;
        rep(i, G[p.second].size()) {
            que.push(P(G[p.second][i].first, G[p.second][i].second));
        } 
    }
    return ret;
}
int main()
{
    int V, E;
    cin >> V >> E;

    rep(i, E) {
        int s, t, w;
        cin >> s >> t >> w;
        G[s].push_back(P(w, t));
        G[t].push_back(P(w, s));
    }

    cout << prim(V) << endl;
    return 0;
}


Measured memory_bytes: 9880
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b = LI()
    if a == b:
        print(2*a)
    else:
        print(2*max(a,b)-1)
    return

#B
def B():
    n = I()
    h = LI()
    m = h[0]
    ans = 1
    for i in range(1,n):
        if m <= h[i]:
            ans += 1
            m = h[i]
    print(ans)
    return

#C
def C():
    s = S()
    ans = 0
    n = len(s)
    t = ["1" if i%2 else "0" for i in range(n)]
    for i in range(n):
        if t[i] != s[i]:
            ans += 1
    ans2 = 0
    t = ["0" if i%2 else "1" for i in range(n)]
    for i in range(n):
        if t[i] != s[i]:
            ans2 += 1
    print(min(ans,ans2))
    return

#D
def D():
    n,k = LI()
    s = S()
    f = [0 for i in range(n)]
    if s[0] == "0":
        f[0] = 1
    for i in range(1,n):
        if s[i] ==  "0" and s[i-1] == "1":
            f[i] = 1
    for i in range(n-1):
        f[i+1] += f[i]
    ans = 0
    for l in range(n):
        r = bisect.bisect_right(f,k+f[l]*int(s[l]))
        ans = max(ans, r-l)
    print(ans)
    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 50936
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;

signed main() {
int N,ans;
string S;
cin >> N >> ans;
ans = N*ans;
answer(ans);

}


Measured memory_bytes: 3596
#if 1
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <set>
#include <map>
#include <numeric>
#include <cassert>

using namespace std;
#define int long long
#define uint unsigned long long
constexpr int MOD = 1000000007;
constexpr int INF = 1145141919810893;

#define LOADVEC(type,name,N) std::vector<type>name(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name[nnn]; \
}

#define LOADVEC2(type,name0,name1,N) std::vector<type>name0(N),name1(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn]; \
}

#define LOADVEC3(type,name0,name1,name2,N) std::vector<type>name0(N),name1(N),name2(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn];cin >> name2[nnn]; \
}

#define LOAD(type,name) type name; \
cin >> name;


void proc();

signed main() {
	ios::sync_with_stdio(false);
	proc();
	return 0;
}

/*
--------------------------------------------------------
--------------------------------------------------------
---------------    template      ----------------------
--------------------------------------------------------
--------------------------------------------------------
*/



void proc() {
	LOAD(int, N);
	std::vector<std::string> s(N);
	for (int i = 0; i < N; ++i) {
		cin >> s[i];
	}
	int res = 0;
	int nA = 0, nB = 0, nBA = 0;
	for (int i = 0; i < N; ++i) {
		int flag = 0;
		for (int j = 0; j < s[i].size(); ++j) {
			if (s[i][j] == 'A') {
				flag = 1;
			}
			else if (s[i][j] == 'B') {
				if (flag == 1) {
					++res;
				}
				flag = 0;
			}
			else {
				flag = 0;
			}
		}
		if (s[i].back() == 'A' && s[i].front() == 'B') {
			++nBA;
		}
		else {
			if (s[i].back() == 'A') {
				++nA;
			}
			if (s[i].front() == 'B') {
				++nB;
			}
		}
	}
	int rrr = std::min({ nA + nBA ,nB + nBA });
	if (nA == 0 && nB == 0 && rrr >= 1)--rrr;
	cout << rrr + res << endl;
}


#endif


Measured memory_bytes: 1144
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>

typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 1e18;
const ll N = 2e5+1;
const ll bits = 20;
const ld pi = 3.14159265358979323846;
const ll mod = 1e9+7;
const ll p = 29;

ll fact[N];

ll power(ll x, ll n){
    ll res = 1;
    x%=mod;
    while(n){
        if(n&1) res = (res*x)%mod;
        x = (x*x)%mod;
        n>>=1;
    }
    return res;
}

ll ncr(ll n,ll r){
    ll num = fact[n];
    ll denom = (fact[r]*fact[n-r])%mod;
    return (num*power(denom,mod-2))%mod;  
}

ll sf(ll n){
    return ((n*(n+1))/2)%mod;
}

ll solve(ll n,ll m){
    ll ans = 0;
    for(ll x=0;x<n;x++){
        ll up = x;
        ll down = n-1-x;

        // cout<<x<<" "<<sf(x)<<" "<<sf(down)<<" "<<((sf(up)+sf(down))*m)<<"\n";
        if(up>down) swap(up,down);
        ans+=(((sf(up)+sf(down))%mod)*m)%mod;
        ans%=mod;
    }

    return (ans*m)%mod;
}

int main(){

    FASTIO;
    PRECISION; 

    fact[0] = 1;
    for(int i=1;i<N;i++){
        fact[i] = (i*fact[i-1])%mod;
    }

    ll n,m,k;
    cin>>n>>m>>k;

    ll cost = ncr(n*m-2,k-2);


    ll xans = solve(n,m);
    // return 0;
    ll yans = solve(m,n);

    ll ans = (xans+yans)%mod;
    
    ans = (ans*cost)%mod;
    ans*=power(2,mod-2);
    ans%=mod;
    cout<<ans<<"\n";

    
}


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

using namespace std;

int main(){
  vector<int> N(4);
  cin >> N[0] >> N[1] >> N[2] >> N[3];
  sort(N.begin(), N.end());
  //1974
  int n = 1000*N[0] + 100*N[1] + 10*N[2] + N[3];
  if(n == 1479){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


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

int main(){
    std::string A, B;
    std::cin >> A >> B;
    int outputFlag;
    if(A.size() > B.size()) outputFlag = 1;
    else if(A.size() < B.size()) outputFlag = 2;
    else{
        if(A > B) outputFlag = 1;
        else if(A < B) outputFlag = 2;
        else outputFlag = 3;
    }

    if(outputFlag == 1) std::cout << "GREATER" << std::endl;
    else if(outputFlag == 2) std::cout << "LESS" << std::endl;
    else if(outputFlag == 3)std::cout << "EQUAL" << std::endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
fac = [0] * 8
# 1番目の桁
fac[1] = 1
for i in range(2, N):
    # 最上位の桁が7の場合7!の6周目終わりが30240番目が先頭になる。
    fac[i] = i * fac[i - 1]

a = 0
l = list(range(1, N + 1))
# l=3の時fac[2] 2!の2周目終わった時点え次のスタートが5になる
# 5の1番目のルートとなる
for i in range(N):
    a += l.index(P[i]) * fac[len(l) - 1]
    l.remove(P[i])

b = 0
l = list(range(1, N + 1))
for i in range(N):
    b += l.index(Q[i]) * fac[len(l) - 1]
    l.remove(Q[i])

print(abs(a - b))

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

int main() {
  
  int n;
  cin >> n;
  vector<string> s(n);
  vector<int> t(n);
  string x;

  for (int i = 0; i < n; i++) {
    cin >> s.at(i);
    cin >> t.at(i);
  }

  cin >> x;
  int lol = 1;

  for (int i = 0; i < n; i++) {
      if(x == s.at(i)) {
      lol = lol + i;
      break;
  } }

  int ans = 0;
  
  for (int i = lol; i < n; i++) {
    ans = ans + t.at(i);
      }

        cout << ans << endl;
}
    

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
typedef vector<tint> vtint;
typedef vector<vint> vvint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//↑templete
signed main(){

    double L;
    cin>>L;

    double l=L/3.;
    cout<<setprecision(20)<<fixed<<l*l*l<<endl;

    return 0;
}


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

int main(){
  int a,b,c;
  int x=1;
  cin>>a>>b;
  while(b/x!=0){
    x*=10;}
  c=a*x+b;
  int y=1;
  while(y*y<c){
    y+=1;
  }
  if(y*y==c){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
N = int(input())
A = [ int(input()) for i in range(N)]

d = [0]*N
dd = [0]*N
d[0] = A[0]
dd[-1] = A[-1]

for i in range(1,N):
    d[i] = max(d[i-1], A[i])

for i in range(2,N+1):
    dd[-i] = max(dd[-i+1],A[-i])


print(dd[1])

for i in range(N-2):
    print(max(d[i],dd[i+2]))
print(d[-2])


Measured memory_bytes: 72664
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

class UnionFind{
public:
    //親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<int> Parent;

    //作る時はParentの値を全て-1にする
    //こうするとずべてバラバラになる
    UnionFind(int N){
      Parent = vector<int>(N,-1);
    }

    //Aがどのグループに属しているのか調べる
    int root(int A){
      if(Parent[A]<0) return A;
      return Parent[A] = root(Parent[A]);
    }

    //自分のいるグループの頂点数を調べる
    int size(int A){
      return -Parent[root(A)];//親を取ってきたい
    }

    //AとBをくっつける
    bool connect(int A,int B){
      //AとBを直すつつなぐのではなく、root(A)にroot(B)をくっつける)
      A = root(A);
      B = root(B);
      if(A==B){
        //すでにくっついているからくっつけない
        return false;
      }
      //大きい方(A)に小さい方(B)をくっつけたい
      //大小が逆だったらひっくり返しちゃう
      if(size(A)<size(B)) swap(A,B);

      //Aのサイズを更新する
      Parent[A] += Parent[B];
      //Bの親をAに変更する
      Parent[B] = A;

      return true;
    }
  };

int main(){
  ll N,M;cin>>N>>M;
  vector<ll> p(N);
  rep(i,N){
    cin>>p[i];
    p[i]--;
  }

  vector<ll> x(M),y(M);
  rep(i,M){
    cin>>x[i]>>y[i];
    x[i]--;y[i]--;
  }

  UnionFind Uni(N);

  rep(i,M){
    Uni.connect(x[i],y[i]);
  }

  ll cnt=0;
  rep(i,N){
    if(Uni.root(p[i])!=Uni.root(i)){
      cnt++;
    }
  }
  cout<<N-cnt<<endl;
}


Measured memory_bytes: 2944
#n=int(input())
a,b,c,d=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

while True:
    c-=b
    if c<=0:
        ans="Yes"
        break
    a-=d
    if a<=0:
        ans="No"
        break
print(ans)


Measured memory_bytes: 9036
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

vector<pair<int, int>> daily;

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

    int N, M;
    int A, B;
    cin >> N >> M;

    rep (i, N)
    {
        cin >> A >> B;
        if (A > M) continue;
        daily.push_back(pair<int, int>(A, B));
    }

    sort(daily.begin(), daily.end(), [](const pair<int, int>& x, const pair<int, int>& y) {return x.first < y.first; });

    u64 ret = 0;
    int left = 0;
    priority_queue<int> pque;
    for (int i = 1; i <= M; ++i)
    {
        for (int j = left; j < daily.size(); ++j)
        {
            if (daily[j].first == i)
            {
                pque.push(daily[j].second);
            }
            else if (daily[j].first > i)
            {
                left = j;
                break;
            }
        }
        if (pque.empty()) continue;
        ret += pque.top();
        pque.pop();
    }

    cout << ret << "\n";

    return 0;
}



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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll x;
    ll co=100;
    cin >> x;
    ll ans=0;
    while(co<x){
        co=co*1.01;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
import sys; readline = sys.stdin.readline
from collections import deque
from collections import Counter
 
N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
 
A, B = zip(*sorted(zip(A, B), key=lambda x:x[1]))
 
A_s = sorted(A)
B_s = sorted(B)
 
no = "No"
yes = "Yes"
 
for i in range(len(A_s)):
    if A_s[i] > B_s[i]:
        print(no)
        exit(0)
 
for i in range(1, len(A_s)):
    if A_s[i] < B_s[i - 1]:
        print(yes)
        exit(0)
 
si2i = sorted(range(len(A)), key=lambda x:A[x])
 
a = 0
count = 0
while True:
    a = si2i[a]
    if a == 0:
        break
    count += 1
 
if count <= N - 2:
    print(yes)
else:
    print(no)

Measured memory_bytes: 27380
#include<iostream>
#include<deque>
using namespace std;
int main(){
  int n; cin >> n;
  deque<int> v;
  for(int i=0;i<n;i++){
    int a; cin >> a;
    if((n-i)%2==0) v.push_back(a);
    else v.push_front(a);
  }
  
  for(int i=0;i<n-1;i++) cout << v[i] << " ";
  cout << v[n-1] << endl;
  return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
# define M_PI  3.14159265358979323846

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	long long ans = INT_MIN;
	ans = max((long long)(a * c), (long long)(a * d));
	ans = max(ans, (long long)(b * c));
	ans = max(ans, (long long)(b * d));
	cout << ans << "\n";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int INF(1e7);
int main()
  {int N, T, m{INF}, c, t; cin >> N >> T;
  while (cin >> c >> t) if (t <= T) m = min(m, c);
  if (m < INF) cout << m; else puts("TLE");}

Measured memory_bytes: 3620
#include<stdio.h>

int main(void){
        int N,N1,a[8],i,num,j,n;
        scanf("%d",&N);
        N1=N;
        for(i=0;i<=8;i++){
                n=1;
                for(j=0;j<i;j++)        n*=10;
                a[i]=0;
                for(j=1;j<=9;j++){
                        if((N-j*n)%(n*10)==0){
                                N=N-j*n;
                                a[i]=j;
                                break;
                        }
                }
        }
        n=0;
        for(i=0;i<=8;i++)               n+=a[i];
                
        if(N1%n==0)     puts("Yes");
        else            puts("No");
        
        return 0;
}   

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,l,m=0;
    cin >> a >> b;
    string s;
    bool c=false;
    for(int i=a;i<=b;i++){
        s = to_string(i);
        l=s.length() - 1;
        for(int j=0;j<l;j++){
            if(j==l-j){
                c=true;
                break;
            }
            if(s[j] != s[l-j]) break;
        }
        if(c) m++;
        c=false;
    }
    cout << m << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
typedef long long ll;
using namespace std;
const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long

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

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cassert>
#include <deque>
#include <map>
#include <queue>
#include <climits>
#include <set>
#include <stack>

using namespace std;

#define ll long long
#define MAX 100000
#define MAX1 10000
#define MAX2 100000
#define inf 1000000000
#define eps 1e-12
#define MOD 1000000007

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, i, cnt;
    ll dis, x, y, d;
    cin >> n >> d;
    d *= d;
    cnt = 0;
    for (i = 1; i <= n; ++i) {
        cin >> x >> y;
        dis = x * x + y * y;
        cnt += dis <= d;
    }
    cout << cnt;

    return 0;
}


Measured memory_bytes: 3192
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
        t: String,
    }
    println!("{}{}", t, s);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf=0x3f3f3f3f;
const int MOD=1e9+7;
int main()
{
	int mapp[3][3];
	int n,x;
	for(int i=0;i<3;i++)
	for(int j=0;j<3;j++)
	cin>>mapp[i][j];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
		if(mapp[i][j]==x)
		mapp[i][j]=-1;
	}
	int flag=0;
	for(int i=0;i<3;i++)
	{
		if(mapp[i][0]==mapp[i][1]&&mapp[i][1]==mapp[i][2]&&mapp[i][2]==-1)
		flag=1;
		if(mapp[0][i]==mapp[1][i]&&mapp[1][i]==mapp[2][i]&&mapp[2][i]==-1)
		flag=1;
	}
	if(mapp[0][0]==mapp[1][1]&&mapp[1][1]==mapp[2][2]&&mapp[1][1]==-1)
	flag=1;
	if(mapp[0][2]==mapp[1][1]&&mapp[1][1]==mapp[2][0]&&mapp[1][1]==-1)
	flag=1;
	if(flag)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int X,Y;
    for(;;){
        scanf("%d %d\n",&X,&Y);
        if(X==0&&Y==0) break;
        vector<vector<pair<int,int> > > monpos(5,vector<P>());
        int sy,sx,gy,gx;
        for(int i=0;i<Y;i++){
            for(int j=0;j<X;j++){
                char nc;
                scanf("%c",&nc);
                if('1'<=nc&&nc<='5'){
                    monpos[nc-'1'].push_back(make_pair(i,j));
                }else if(nc=='S'){
                    sy=i;
                    sx=j;
                }else if(nc=='G'){
                    gy=i;
                    gx=j;
                }
            }
            scanf("\n");
        }

        int type,md=INT_MAX;

        for(int i=0;i<5;i++){
            int fir=(i+1)%5;
            vector<int> befmind(monpos[fir].size()),nowmind;
            if(monpos[fir].size()==0) continue;
            for(int j=0;j<monpos[fir].size();j++){
                befmind[j]=abs(sy-monpos[fir][j].first)+abs(sx-monpos[fir][j].second);
            }
            int now=fir,bef;
            bool iscont=false;
            for(int ix=0;ix<3;ix++){
                bef=now;
                now=(now+1)%5;
                if(monpos[now].size()==0){
                    iscont=true;
                    break;
                }
                nowmind=vector<int>(monpos[now].size());
                for(int j=0;j<monpos[now].size();j++){
                    nowmind[j]=INT_MAX;
                    for(int k=0;k<monpos[bef].size();k++){
                        nowmind[j]=min(nowmind[j],befmind[k]+abs(monpos[now][j].first-monpos[bef][k].first)+abs(monpos[now][j].second-monpos[bef][k].second));
                    }
                }
                befmind=nowmind;
            }
            if(iscont) continue;
            int lmind=INT_MAX;
            for(int j=0;j<monpos[now].size();j++){
                lmind=min(lmind,nowmind[j]+abs(monpos[now][j].first-gy)+abs(monpos[now][j].second-gx));
            }
            if(lmind<md){
                md=lmind;
                type=i+1;
            }
        }
        if(md==INT_MAX) printf("NA\n");
        else printf("%d %d\n",type,md);
    }
}

Measured memory_bytes: 996
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		ArrayList<Integer> arrayMax = new ArrayList<Integer>();
		ArrayList<Integer> arraySum = new ArrayList<Integer>();

		int intCount = 0;
		int intMax;
		int intSum;
		int intLine = 0;
		//int intInput[][];
		//intInput = new int[intLine + 1000][2];

		while (true) {

			// 最大値intMaxと和intSumを定義
			intMax = scanner.nextInt();
			intSum = scanner.nextInt();

			// intMaxとintSumが0のとき中断
			if (intMax == 0 && intSum == 0) {
				break;
			}

			// 配列に入力した数値を格納
			arrayMax.add(intMax);
			arraySum.add(intSum);


		// 1～intMaxの数字をすべて試行

		for (int intI = 1; intI <= arrayMax.get(intLine) - 2; intI++) {
			for (int intJ = intI + 1; intJ <= arrayMax.get(intLine) - 1; intJ++) {
				for (int intK = intJ + 1; intK <= arrayMax.get(intLine); intK++) {
					// それぞれ異なる数値の時
					if (!(intI == intJ) || !(intI == intK) || !(intJ == intK)) {
						int intSumIJK = intI + intJ + intK;
						if (arraySum.get(intLine) == intSumIJK) {
							intCount++;
						}
					}
				}
			}
		}
		System.out.println(intCount);
		intCount = 0;
		intLine++;
		}
	}
}



Measured memory_bytes: 27524
#include <iostream>
using namespace std;
int main(void){
    int x, y, s;
    while(cin >> x >> y >> s && x) {
        int ans = 0;
        for(int i=1; i<s; ++i) {
            for(int j=1; ; ++j) {
                int p = i*(100+x)/100 + j*(100+x)/100;
                if(p > s) break;
                if(p == s) {
                    ans = max(ans, i*(100+y)/100 + j*(100+y)/100);
                }
            }
        }
        cout << ans << endl;
    }
}


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

using namespace std;
int main(){
    int n;
    long long fal= 1e18;
    cin >> n;
    long long  ans=1;
    vector<long long> a(n);
  	vector<double> b(n);

    for(int i=0; i < n ;i++){
        cin >> a[i];
        b[i] = log10(a[i]);
    }
    if(find((a).begin(),(a).end(),0) != a.end()){
      cout<< 0 << endl;
      return 0;
    }
    double logans = 0;
    for(int i=0;i<n;i++){
      ans *= a[i];
      logans += b[i];
    }
    if(logans > 18){
      cout << -1 << endl;
      return 0;
    }
    if(ans > fal){
      cout << -1 << endl;
      return 0;  
    }
    cout << ans << endl;

}

Measured memory_bytes: 4684
#include <bits/stdc++.h>
#include <math.h>
#define lli long long int
#include <limits.h>
#include <fstream>

using namespace std;

lli gcd(lli a,lli b)
{
	if(a==0)return b;
	return gcd(b%a,a);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i,j,tt=1;
    //cin>>tt;
    while(tt--)
    {
        lli n,m,k,ans=0;
        cin>>n>>m>>k;
        lli a[n],b[m];
        vector<lli> suma(n+1),sumb(m+1);
        for(i=0;i<n;i++)
        {
            cin>>a[i];
            suma[i+1]=a[i];
            suma[i+1]+=suma[i];
        }
        for(i=0;i<m;i++)
        {
            cin>>b[i];
            sumb[i+1]=b[i];
            sumb[i+1]+=sumb[i];
        }
        for(i=0;i<=n;i++)
        {
            lli temp=k-suma[i];
            if(temp<0)
                continue;
            lli tempans=i;
            auto itr=lower_bound(sumb.begin(),sumb.end(),temp);
            if(itr==sumb.end())
            {
                tempans+=m;
            }
            else if((*itr)==temp)
            {
                tempans+=(itr-sumb.begin());
            }
            else
            {
                tempans+=(itr-sumb.begin());
                tempans--;
            }
            ans=max(ans,tempans);
        }
        cout<<ans<<"\n";
    }
    return 0;
}



Measured memory_bytes: 9512
#include <iostream>
#include <algorithm>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl


int main() {
    ll x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
    return 0;
}

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

const int mxN = 1e5 + 5;
int N, mod;
vector<int> adj[mxN];
ll dp[mxN], answer[mxN];

void dfs(int u, int p)
{
	dp[u] = 1;
	for (int v : adj[u])
	{
		if (v == p)
			continue;
		dfs(v, u);
		dp[u] = (dp[u] * dp[v]) % mod;
	}
	dp[u] = (dp[u] + 1) % mod;
}

void rec(int u, int p, ll ways)
{
	vector<ll> pref, suff;
	pref.push_back(1);
	for (int v : adj[u])
	{
		if (v == p)
			continue;
		pref.push_back(dp[v]);
		suff.push_back(dp[v]);
	}
	suff.push_back(1);
	for (int i = 1; i < (int)pref.size(); i++)
	{
		pref[i] = pref[i] * pref[i - 1] % mod;
	}
	for (int i = (int)suff.size() - 2; i >= 0; i--)
	{
		suff[i] = suff[i] * suff[i + 1] % mod;
	}
	answer[u] = pref.back() * ways % mod;
	int i = 0;
	for (int v : adj[u])
	{
		if (v == p)
			continue;
		ll new_ways = pref[i] * suff[i + 1] % mod;
		new_ways = new_ways * ways % mod;
		new_ways = (new_ways + 1) % mod;
		rec(v, u, new_ways);
		i++;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);

	cin >> N >> mod;
	for (int i = 0; i < N - 1; i++)
	{
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	dfs(0, -1);
	rec(0, -1, 1);
	for (int i = 0; i < N; i++)
	{
		cout << answer[i] << '\n';
	}

	return 0;
}

Measured memory_bytes: 28912
import numpy as np

dat0 = input().split()
N = int(dat0[0])
T = int(dat0[1])

dat1 = [input().split() for i in range(N)]

dat = np.array(dat1)
dat = dat.astype(np.int64)



lt_T = dat.T[1] <= T

ans = dat.T[0][lt_T]

if len(ans) == 0:
    print("TLE")
else:
    print(ans.min())


Measured memory_bytes: 12404
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;cin>>n;
    if(n==1){
        cout<<"Hello World"<<endl;
    }
    else {
        int x,y;
        cin>>x>>y;
        cout<<x+y<<endl;
    }
    return 0;
}




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

typedef long long ll;
int main(){
  int maxx, miny;
  int n,m;
  cin >> n >> m >> maxx >> miny;
  
  for(int i = 0; i < n; i++){
    int tmp;
    cin >> tmp;
    if(tmp > maxx){
      maxx = tmp;
    }
  }
  
  for(int i = 0; i < m; i++){
    int tmp;
    cin >> tmp;
    if(tmp < miny){
      miny = tmp;
    }
  }
  
  if(miny > maxx){
    cout << "No War" << endl;
  } else { 
    cout << "War" << endl;
  }
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXN (1<<15)+3
int n,m,a,b,c,sum[MAXN],f[MAXN][21],p[21][21],res,ans;
int main(){
	scanf("%d%d",&n,&m);
	int maxs=(1<<n)-1;
	for(int i=1;i<=m;i++){
		scanf("%d%d%d",&a,&b,&c);
		p[a][b]=p[b][a]=c;
		res+=c;
	}
	for(int s=0;s<=maxs;s++){
		for(int i=1;i<=n;i++)
		  if(s&(1<<(i-1))){
			for(int j=1;j<=n;j++)
			  if(s&(1<<(j-1))){
			  	sum[s]+=p[i][j];
			  }
		}
		sum[s]>>=1;
	}
	memset(f,-1,sizeof(f));
	f[1][1]=0;
	for(int s=0;s<=maxs;s++){
		for(int i=1;i<=n;i++){
			if(f[s][i]==-1) continue;
			for(int j=1;j<=n;j++){
				if(s&(1<<(j-1))) continue;
				if(!p[i][j]) continue;
				f[s|(1<<(j-1))][j]=max(f[s|(1<<(j-1))][j],f[s][i]+p[i][j]);
			}
			int rest=(maxs^s)|(1<<(i-1));
			for(int ss=rest;ss;ss=rest&(ss-1)){
				f[s|ss][i]=max(f[s|ss][i],f[s][i]+sum[ss]);
			}
		}
	}
	int ans=0;
	for(int i=0;i<=maxs;i++)
	  ans=max(ans,f[i][n]);
	printf("%d\n",res-ans);
}

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

const int N = 1e5 + 10;
typedef long long ll;
int n, m, fa[N];
ll dis[N];

int getfa(int w) {
    if (fa[w] == w) return w;
    int tmp = fa[w];
    fa[w] = getfa(fa[w]);
    dis[w] += dis[tmp];
    return fa[w];
}

int get_dis(int w) {
    return fa[w] == w ? 0 : get_dis(fa[w]) + dis[w];
}

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 0; i <= n; i++) fa[i] = i;
    for (int i = 1; i <= m; i++) {
        int L, R, D;
        scanf("%d%d%d", &L, &R, &D);
        int fl = getfa(L), fr = getfa(R);
        if (fl == fr) {
            if (dis[L] + D != dis[R]) {
                puts("No"); return 0;
            }
        } else {
            fa[fr] = fl;
            dis[fr] = get_dis(L) - get_dis(R) + D;
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const LL INF=1<<17;


LL dp[51];
LL p[51];

LL dfs(LL x,LL k){
    LL ret=0;
    if(x<0) return 0;
    if(k==0) return 1;
    if(x>dp[k]/2){
        ret=dfs(x-dp[k]/2-1,k-1)+p[k-1]+1;
    }
    else if(x==dp[k]/2){
        ret=p[k-1]+1;
    }
    else{
        ret=dfs(x-1,k-1);
    }
    return ret;
}


int main(){
    LL N,X;cin >> N >> X;
    dp[0]=1;
    p[0]=1;
    for (int i = 0; i < N; i++) {
        dp[i+1]=2*dp[i]+3;
        p[i+1]=2*p[i]+1;
    }
    if(X==1){
        cout << 0 << endl;
        return 0;
    }
    cout << dfs(X-1,N) << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main (String [] args){
        Scanner sc =new Scanner(System.in);
        int a =sc.nextInt();
        int b =sc.nextInt();
        int c =sc.nextInt();
        int d;
        if((a-b)>0){
            d=a;
            a=b;
            b=d;
        }
        if((b-c)>0){
            d=b;
            b=c;
            c=d;
        }
        if((a-b)>0){
            d=a;
            a=b;
            b=d;
        }
        System.out.println(a+" "+b+" "+c);
        
        sc.close();
   }
 
}


Measured memory_bytes: 26112
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

int gcd(int a, int b) {
	if (a == 0 || b == 0)return max(a, b);
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

signed main(void) {
	int n;
	cin >> n ;
	vector<int>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	vector<int>l(n+1), r(n + 1);
	l[0] = 0;
	r[n] = 0;
	rep(i, n) {
		l[i + 1] = gcd(l[i], a[i]);
		r[n - i - 1] = gcd(r[n - i], a[n - i-1]);
	}
	int ans = 0;
	rep(i, n) {
		ans = max(ans, gcd(l[i],r[i+1]));
	}
	print(ans);
}

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


int main(){
    ll N, L;
    cin>> N >> L;
    vector<int> aps(N);
    ll total = 0;
    rep(i, N){
        aps[i] = L + i;
        total += aps[i];
    }
    int mini = INF;
    rep(i, N){
        mini = min(mini, abs(aps[i]));
    }
    if(aps[0] < 0 && aps[N - 1] < 0){
        cout << total + mini << endl;
        return 0;
    }else {
        cout << total - mini << endl;
        return 0;
    }
}


Measured memory_bytes: 256
import java.util.*;
public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int max = 0;
        int cnti = 0;
        int cntz = 0;

        for(int i = 0;i<s.length()-1;i++){
            if(s.charAt(i)=='A'){
                cnti=i;
                break;
            }
        }
        for(int i = s.length()-1;i>0;i--){
            if(s.charAt(i)=='Z'){
                cntz=i;
                break;
            }
        }
        System.out.println(cntz-cnti+1);

    }
}






Measured memory_bytes: 28244
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
//combination(Nが小さい時はこれを使う
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

// 二項係数計算
long long COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight(int n) {
	int ans = 1;
	while (n >= 10) {
		n /= 10;
		ans++;
	}
	return ans;
}
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
int dight_min(int n) {
	int ans = 9;
	while (n >= 10) {
		ans = min(ans, n % 10);
		n /= 10;
	}
	ans = min(ans, n);
	return ans;
}
int dight_max(int n) {
	int ans = 0;
	while (n >= 10) {
		ans = max(ans, n % 10);
		n /= 10;
	}
	ans = max(ans, n);
	return ans;
}
signed main() {
	double r;
	cin >> r;
	cout << fixed << setprecision(10) << r * r * acos(-1) << " " << 2 * r * acos(-1) << endl;
	ggr
}



Measured memory_bytes: 3284