akhauriyash/Code-Regression huggingface dataset:
import Data.List

p 0 = [0,1,1,1,1,1,1]
p 1 = [0,0,0,0,1,1,0]
p 2 = [1,0,1,1,0,1,1]
p 3 = [1,0,0,1,1,1,1]
p 4 = [1,1,0,0,1,1,0]
p 5 = [1,1,0,1,1,0,1]
p 6 = [1,1,1,1,1,0,1]
p 7 = [0,1,0,0,1,1,1]
p 8 = [1,1,1,1,1,1,1]
p 9 = [1,1,0,1,1,1,1]

uniq [] = []
uniq (a:[]) = [a]
uniq (a:b:xs) =
  if a == b
  then uniq (a:xs)
  else a:uniq (b:xs)

xor [] [] = []
xor (a:as) (b:bs) = ((a+b)`mod`2):xor as bs

ans _ [] = []
ans st (i:is) =
  let c = xor st $ p i
  in
    c:ans (p i) is

play [] = []
play i = 
  let n = i!!0
      j = take n $ drop 1 i
      r = drop (n+1) i
  in
    (ans [0,0,0,0,0,0,0] j) ++ (play r)

main = do
  c <- getContents
  let i = map read $ lines c :: [Int]
      i'= takeWhile (/= -1) i
      o = play i'
  mapM_ putStrLn $ map (intercalate "") $ map (map show) o
  

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

int a[200005];

int main()
{
    int n;
    while(cin>>n)
    {
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        int j=1,flg=0;
        for(int i=0;i<n;i++)
        {
            if(a[i]==j)
            {
                j++;
                flg=1;
            }
        }
        if(flg)
            cout<<n-j+1<<endl;
        else
            cout<<"-1"<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

class A {
    static final int S = 1_000_000;

    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final long N = sc.nextLong();
        final long P = sc.nextLong();
        final boolean[] notPrime = new boolean[S + 1];
        for (int i = 2; i * i <= S; i++)
            if (!notPrime[i])
                for (int j = i * i; j <= S; j += i)
                    notPrime[j] = true;
        final List<Integer> primes = new ArrayList<>();
        for (int i = 2; i <= S; i++)
            if (!notPrime[i])
                primes.add(i);
        final Map<Long, Integer> map = new HashMap<>();
        long l = P;
        for (final int prime : primes)
            if (l % prime == 0) {
                int power = 0;
                while (l % prime == 0) {
                    power++;
                    l /= prime;
                }
                map.put((long) prime, power);
            }
        if (l > 0)
            map.put(l, 1);
        long ans = 1l;
        for (final long prime : map.keySet())
            for (int i = 0; i < map.get(prime) / N; i++)
                ans *= prime;
        System.out.println(ans);
    }
}
public class Main {
    public static void main(String...args) {
        A.main();
    }
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int a,b,c,d;
void solve(){
	cin >> a >> b >> c >> d;
	if(abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d)){
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

# AtCoder Beginner Contest
# Problem C


def is_visited(graph):
    visited = [False] * len(graph[0])

    def dfs(x: int):
        if visited[x]:
            return

        visited[x] = True

        for i in range(n):
            if graph[x][i]:
                dfs(i)

    dfs(0)
    return visited


if __name__ == '__main__':
    n, m = list(map(int, input().split()))
    a = [0 for _ in range(m)]
    b = [0 for _ in range(m)]
    graph = [[0 for i in range(n)] for j in range(n)]

    # See:
    # https://img.atcoder.jp/abc075/editorial.pdf
    # https://www.youtube.com/watch?v=VJntQuR2zNI
    for i in range(m):
        line = list(map(int, input().split()))
        a[i] = line[0] - 1
        b[i] = line[1] - 1
        graph[a[i]][b[i]] = True
        graph[b[i]][a[i]] = True

    bridge_count = 0

    for j in range(m):
        graph[a[j]][b[j]] = False
        graph[b[j]][a[j]] = False

        if False in is_visited(graph):
            bridge_count += 1

        graph[a[j]][b[j]] = True
        graph[b[j]][a[j]] = True

    print(bridge_count)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n == 1) {
            System.out.println("Hello World");
            return;
        } else {
            int a = sc.nextInt();
            int b = sc.nextInt();
            System.out.println(a + b);
        }
    }
}

Measured memory_bytes: 35660
package main

import "fmt"

func main(){
	var a,b,c int
	fmt.Scan(&a, &b, &c)

	if a != b && a != c && b != c {
		fmt.Println("No")
	} else {
		if a == b && a == c {
			fmt.Println("No")
		} else {
			fmt.Println("Yes")
		}
	}
	return
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    int D,T,S;
    cin >> D >> T >> S;
    if(D>S*T) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main() {
  int N, T, A;
  cin >> N;
  long t = 1, a = 1;
  while(N--) {
    cin >> T >> A;
    long mul = max((t - 1) / T + 1, (a - 1) / A + 1);
    t = T * mul;
    a = A * mul;
  }
  cout << t + a;
  return 0;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> x(m);
  vector<int> y(m);
  for(int i = 0; i < m; i++) cin >> x.at(i) >> y.at(i);
  
  map<int, int> cnt;
  for(int i = 0; i < n; i++) cnt[i+1]++;
  set<int> ans;
  ans.insert(1);
  for(int i = 0; i < m; i++){
    int nx = x.at(i), ny = y.at(i);
    cnt[nx]--, cnt[ny]++;
    if(ans.count(nx)){
      ans.insert(ny);
      if(cnt.at(nx) == 0) ans.erase(nx);
    }
  }
  
  cout << ans.size() << endl;
}

Measured memory_bytes: 10368
/* be name khoda */

#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
using namespace std;

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl

const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;

#define XL (x << 1)
#define XR (XL | 1)
#define MD ((l + r) >> 1)
#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

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

const ll maxn = 200010;

ll n, A[maxn];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    // ifstream cin(".in");

    cin >> n;
    fori (i, n) cin >> A[i];
    sort(A, A + n, greater<ll>());
    ll ans = A[0];
    ll i = 1; n -= 2;
    while (n) {
        if (n > 1) n -= 2, ans += A[i++] * 2;
        else --n, ans += A[i++];
    }
    cout << ans << '\n';

}


Measured memory_bytes: 5216
open System


module List =
    let rec inserts x = function
        | [] -> [[x]]
        | z::zs as ys-> (x::ys) :: [for ys in inserts x zs -> z::ys]
    let rec perms = function
        | [] -> [[]]
        | x::xs -> List.collect (inserts x) (perms xs)

let n = stdin.ReadLine() |> int
let p = stdin.ReadLine().Split() |> Array.map int |> List.ofArray
let q = stdin.ReadLine().Split() |> Array.map int |> List.ofArray
            
let perms = List.perms [1 .. n] |> List.sort

let a = Seq.findIndex ((=) p) perms
let b = Seq.findIndex ((=) q) perms

a - b
|> abs
|> printfn "%d"


Measured memory_bytes: 32552
#include <bits/stdc++.h>
using namespace std;
int main() 
{
  int n;
  cin>>n;
  if(n>81)
  {
    cout<<"No";
    return 0;
  }
  else if(n<10)
  {
    cout<<"Yes";
    return 0;
  }
  else
  {
    for(int i=2; i<=sqrt(n); i++)
    {
      if(n%i==0)
      {
        if(i<10 && n/i<10)
        {
          cout<<"Yes";
          return 0;
        }
        else
        {
          continue;
        }
      }
    }
    cout<<"No";
  }
}

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

using namespace std;

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

    int tot = 0;
    int longest = 0;
    for (int i = 0; i < n; ++i) {
        int l;
        cin >> l;
        tot += l;
        longest = max(longest, l);
    }

    if (tot > 2 * longest) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A')
            cout<<'T';
        if(s[i]=='T')
            cout<<'A';
        if(s[i]=='G')
            cout<<'C';
        if(s[i]=='C')
            cout<<'G';
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String s = scan.next();
        String t1 = s.substring(0, n / 2);
        String t2 = s.substring(n / 2);
        System.out.println(t1.equals(t2) ? "Yes" : "No");
        scan.close();
    }
}

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

string s, t; int q;

struct SuffixArray {
    string str;
    vector<int> sa, rnk;

    SuffixArray (string &str) : str(str) {
        int n = (int)str.size(), itr = 1;

        auto comp = [&](int a, int b) {
            if(rnk[a] != rnk[b]) return rnk[a] < rnk[b];
            return (a + itr < n ? rnk[a + itr] : -1) < (b + itr < n ? rnk[b + itr] : -1);
        };

        for(int i = 0; i < n; ++i) sa.push_back(i), rnk.push_back(str[i]);

        vector<int> tmp(n);
        for(; itr <= n; itr *= 2) {
            sort(sa.begin(), sa.end(), comp);

            tmp[sa[0]] = 0;
            for(int i = 1; i < n; ++i) tmp[sa[i]] = tmp[sa[i-1]] + comp(sa[i-1], sa[i]);
            rnk = tmp;
        }
    }

    bool find(string &t) {
        int ng = -1, ok = (int)str.size()-1;
        while(ok - ng > 1) {
            int mid = (ok + ng) / 2;
            if(str.substr(sa[mid], t.size()) < t) ng = mid;
            else ok = mid;
        }
        return str.substr(sa[ok], t.size()) == t;
    }
};

int main(){
    cin >> s >> q;
    SuffixArray sa(s);

    while(q--) {
        cin >> t;
        cout << sa.find(t) << '\n';
    }
    return 0;
}


Measured memory_bytes: 17232
x, k,d = map(int, input().split(" "))
m = abs(x) // d
p,q= k%2, m%2
if k<=m or p==q:
    if x < 0:
        x += d * min(m,k)
    else:
        x -= d * min(m,k)
else:
    if x < 0:
        l = x + d * m - d
        r = x + d * m + d

        x = min(abs(l), abs(r))

    else:
        l = x - d * m - d
        r = x - d * m + d
        x=min(abs(l),abs(r))


print(abs(x))

Measured memory_bytes: 9084
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, x, t; cin >> n >> x >> t;
    long long ans = t;
    n -= x;
    if(n > 0)
    {
        n = ceil((double)n/(double)x);
        ans += (n*t);
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int N;
    int h[100000];
    cin >> N;
    for(int i=0; i<N; ++i) cin >> h[i];
    int dp[100000];
    fill(dp, dp+N, 1001001001);
    dp[0] = 0;
    for(int i=0; i+1<N; ++i) {
        dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]));
        if(i+2<N) dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]));
    }
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        for(int i = 0;i<3;i++){
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int result = a[2] - a[0];
        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 20948
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#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<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    string s;cin >> s;
    int n = s.length();
    LL ans = 0;
    LL k = 0;
    vector<LL> a(n+1,0);
    a[0] = 0;
    for (int i = 1; i <= s.length(); i++) {
        if(s[i-1]=='<'){
            k++;
        }
        else{
            k = 0;
        }
        a[i] = k;
    }
    k=0;
    for (int i = s.length(); i >= 1; i--) {
        if(s[i-1]=='>') {
            k++;
        }
        else{
            k = 0;
        }
        a[i-1] = max(k,a[i-1]);

    }
    for (int i = 0; i < n+1; i++) {
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4740
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        String s = "1x1=1";
        String tmp = "x=";
        IntStream.range(1, 10).forEach(
                n1 -> {
                    IntStream.range(1, 10).forEach(
                            n2 -> {
                                System.out.println(n1 + "x" + n2 + "=" + (n1 * n2));
                            }
                    );
                }
        );
    }
}

Measured memory_bytes: 30584
#include <iostream>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    ll k;
    cin >> k;
    if(k % 2 == 0){
        cout << a - b << endl;
    }else{
        cout << b - a << endl;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

ans = 0

for i in range(1, N):
    x = S[:i]
    y = S[i:N]

    cnt = 0

    for j in range(ord('a'), ord('z') + 1):
        if chr(j) in x and chr(j) in y:
            cnt += 1
    ans = max(ans, cnt)

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int n;
bool dp[100010];
bool used[100010];
int a[110];

bool isWinFirst(int k) {
    if(used[k]) return dp[k];
    used[k] = true;
    bool ret = false;
    rep(i, n) if(k >= a[i]) {
        if(!isWinFirst(k - a[i])) return dp[k] = true;
    }
    return dp[k] = false;
}

int main(){
    int k;
    cin >> n >> k;
    rep(i, n) cin >> a[i];
    cout << (isWinFirst(k)?"First":"Second") << endl;
    return 0;
}

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

const int MAX = 101000;


int main() {
    int N;
    cin >> N;
    vector<int> dp(MAX,-1);
    dp[0]=0;
    queue<int> q;
    q.push(0);

    while(!q.empty()) {
        int v = q.front();
        q.pop();
        
        for(int i=1;v+i<=N;i*=6) {
            if(dp[v+i] == -1) {
                dp[v+i] = dp[v]+1;
                q.push(v+i);
            }
        }

        for(int i=9;v+i<=N;i*=9) {
            if(dp[v+i] == -1) {
                dp[v+i] = dp[v] + 1;
                q.push(v+i);
            }
        }
    }
    cout << dp[N] << endl;
}


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

int main(){
  int N;
  cin >> N;
  int s=N,x=0;
  while(s>0){
    x+=s%10;
    s=s/10;
  }
  if(N%x == 0){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np

if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC
    cc = CC('my_module')

    @cc.export('solve', 'i4(i4, i4[:])')
    def solve(N, P):
        minDist = np.ones((N, N), dtype=np.int32)
        isFilled = np.ones((N, N), dtype=np.int32)

        for h in range(N):
            for w in range(N):
                minDist[h][w] = min(h, N - h - 1, w, N - w - 1)

        ans = 0
        for p in P:
            h, w = divmod(p, N)
            ans += minDist[h][w]
            isFilled[h][w] = False

            st = [(h, w)]
            while st:
                h, w = st.pop()
                dist = minDist[h][w] + isFilled[h][w]

                if h + 1 < N and minDist[h + 1][w] > dist:
                    minDist[h + 1][w] = dist
                    st.append((h + 1, w))
                if h - 1 >= 0 and minDist[h - 1][w] > dist:
                    minDist[h - 1][w] = dist
                    st.append((h - 1, w))
                if w + 1 < N and minDist[h][w + 1] > dist:
                    minDist[h][w + 1] = dist
                    st.append((h, w + 1))
                if w - 1 < N and minDist[h][w - 1] > dist:
                    minDist[h][w - 1] = dist
                    st.append((h, w - 1))
        return ans

    cc.compile()
    exit(0)

from my_module import solve

N = int(input())
P = np.asarray(list(map(lambda a: int(a) - 1, input().split())), dtype=np.int32)

print(solve(N, P))


Measured memory_bytes: 56900
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
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)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

ll dp[55][55][3000];

int main()
{
    int N,A; 
    cin >> N >> A;
    int x[N];
    for (int i=0; i<N; ++i) cin >> x[i];

    // ll dp[55][55][2500];// 一定数を超えるとエラー？main()外ならば定義可能．
    for (int i=0; i<55; ++i)
    {
        for (int j=0; j<55; ++j)
        {
            for (int k=0; k<3000; ++k)
            {
                dp[i][j][k] = 0;
            }
        }
    }

    dp[0][0][0] = 1;
    for (int i=0; i<N; ++i)
    {
        for (int j=0; j<N; ++j)
        {
            for (int k=0; k<2500; ++k)
            {
                // if(dp[i][j][k] == 0) continue;
                dp[i+1][j][k] += dp[i][j][k];
                dp[i+1][j+1][k + x[i]] += dp[i][j][k];
                // cout << "i j k :" << i << " " << j << " " << k << " " << dp[i][j][k] << endl;
            }
        }
    }

    long long res = 0;
    for (int j = 1; j <= N; ++j) {
        res += dp[N][j][A*j];
    }
    cout << res << endl;
    return 0;
}

// long long dp[55][55][2550];
// int N, A;
// int x[55];
 
// int main() {
//     cin >> N >> A;
//     for (int i = 0; i < N; ++i) cin >> x[i];
//     // memset(dp, 0, sizeof(dp));
//     dp[0][0][0] = 1;
    
//     for (int i = 0; i < N; ++i) {
//         for (int j = 0; j <= N; ++j) {
//             for (int k = 0; k <= 2550; ++k) {
//                 dp[i+1][j][k] += dp[i][j][k];
//                 dp[i+1][j+1][k + x[i]] += dp[i][j][k];
//             }
//         }
//     }
//     long long res = 0;
//     for (int j = 1; j <= N; ++j) {
//         res += dp[N][j][A*j];
//     }
//     cout << res << endl;
//     return 0;
// }

Measured memory_bytes: 71168
#include<cstdio>


int main(void)
{
	int a, b;

	while(scanf("%d%d", &a, &b)==2)
	{
		int ans=b;
		if(a<=12) ans/=2;
		if(a<=5) ans=0;
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define FOR(i,n,a) for(int i = a;i<n;i++)
#define rep(i,n) FOR(i,n,0)
#define UNFOR(i,n,a) for(int i = a;i>n;i--)
#define unrep(i,n) UNFOR(i,0.n)
typedef long long ll;
using namespace std;

vector<int> x;
vector<int> y;
int X, Y;
bool DP[8001][35000][2];


int main() {
	char old = 'F';
	bool now = false;
	int count = 0;
	string s;
	std::cin >> s;
	rep(i, s.size()) {
		if (old == s[i] && old == 'F') {
			count++;
		}
		else if (old == s[i] && old == 'T') {
			if (now)now = false;
			else now = true;
		}
		else if (old == 'F') {
			if (now) {
				y.push_back(count);
				now = false;
			}
			else {
				x.push_back(count);
				now = true;
			}
			count = 0;
		}
		else {
			count++;
		}
		old = s[i];
	}
	if (old = 'F') {
		if (now) {
			y.push_back(count);
			now = false;
		}
		else {
			x.push_back(count);
			now = true;
		}
	}
	std::cin >> X >> Y;
	DP[0][17000][0] = true;
	DP[0][17000][1] = true;
	DP[1][17000 + x[0]][0] = true;
	for (int i = 2; i <= x.size(); i++) {
		for (int j = 9001; j < 25001; j++) {
			DP[i][j][0] = max(DP[i - 1][j + x[i - 1]][0], DP[i - 1][j - x[i - 1]][0]);
		}
	}
	for (int i = 1; i <= y.size(); i++) {
		for (int j = 9001; j < 25001; j++) {
			DP[i][j][1] = max(DP[i - 1][j + y[i - 1]][1], DP[i - 1][j - y[i - 1]][1]);
		}
	}
	if (DP[x.size()][17000 + X][0] && DP[y.size()][17000 + Y][1])cout << "Yes" << endl;
	else cout << "No" << endl;
	std::cin >> X;
	return 0;
}


Measured memory_bytes: 183552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
  int N, K;
  cin >> N >> K;
  ll h[100110];
  for(int i=0; i<N; i++) cin >> h[i];
  ll dp[100110];
  for(int i=0; i<100110; i++) dp[i] = 1e15;
  dp[0] = 0;
  for(int i=0; i<N; i++){
    for(int j=1; j<=K; j++){
      dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j]-h[i]) );
    }
  }
//  for(int i=0; i<N-1; i++) cout << dp[i] << endl;  
  cout << dp[N-1] << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int n,m,ans=10000000;
int b[10000];
int p[1000];


void f(int t[]){
    int res=0;
    int s[1000]={};
    for(int i=0;i<n;i++){
        s[i]=t[i];
    }

    for(int i=0;i<n;i++){
        int j=i;

        while(j<n && b[i]!=s[j]){
           j++;
        }
        if(j==n) return;
        for(int k=j;k>i;k--){
            int c = s[k];
            s[k] = s[k-1];
            s[k-1] = c;
            res++;
        }
   }

    ans = min(ans,res);
}


signed main(){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        int c;
        cin>>c;
        b[i] = c;
    }
    for(int i=0;i<m;i++){
        cin>>p[i];
    }

    int t[1000]={};
    int sum=0;
    for(int i=0;i<m;i++){
        for(int j=0;j<p[i];j++){
            if(i%2)
                t[sum+j]=1;
            else
                t[sum+j]=0;
        }
        sum+=p[i];
    }

    f(t);
    for(int i=0;i<n;i++){
        if(t[i]==1) t[i]=0;
        else t[i]=1;
    }
    f(t);

    cout<<ans<<endl;

}


Measured memory_bytes: 3124
n = int(input())
a, b = map(int, input().split())
p_list = list(map(int, input().split()))
p1 = [p for p in p_list if p <= a]
p2 = [p for p in p_list if p <= b and p > a]
p3 = [p for p in p_list if p > b]
print(min(len(p1), len(p2), len(p3)))

Measured memory_bytes: 3064
#include<stdio.h>
int main(){
    int a,b,c,x;
    scanf("%d %d %d",&a,&b,&c);
    if(a > b){
        x = a;
        a = b;
        b = x;
    }
     if(b > c){
        x = b;
        b = c;
        c = x;
    }
     if(a > b){
        x = a;
        a = b;
        b = x;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstdio>
using namespace std;
typedef unsigned long long int ull;

main(){
	int i,j,n,m;
	string s, q;
	cin >> n >> m >> s;
	int l=0,r=0;
	const ull b = 29;
	ull binv = 3816567739388183093ULL;//mod_inverse(b, 1LL<<32);
	for(int i=0;i<s.size();i++) s[i] -='a'-11;
	ull B = s[0], lb = b;
	set<ull> dic;
	while(m--){
		cin >> q;
		if(q == "L++") lb*=binv, B -= lb*s[l++];
		if(q == "L--") B += lb*s[--l], lb*=b;
		if(q == "R++") B = B*b+s[++r], lb*=b;
		if(q == "R--") B = (B-s[r--])*binv, lb*=binv;
		dic.insert(B);
	}
	cout << dic.size() << endl;
	return 0;
}

Measured memory_bytes: 15536
#include<iostream>

using namespace std;
int z[205], b;

int main() {
    int n, i, x, m[2],t;
    while (1){
        cin >> n;
        if (n == 0){ break; }
        for (i = 1; i <= n*2; i++){
            z[i] = 1;
        }
        for (i = 1; i <= n; i++){
            cin >> t;
            z[t] = 0;
        }
        m[0] = m[1] = n;
        x = 0;
        b = 0;
        while (m[0] > 0 && m[1] > 0){
            for (i = b+1; i <=n*2; i++){
                if (x == z[i]){
                    b = i;
                    z[i] = 2;
                    m[x]--;
                    break;
                }
            }
            if (i > n * 2){
                b = 0;
            }
            x = !x;
        }
        cout << m[1] << endl << m[0] << endl;
    }
    return 0;
}


Measured memory_bytes: 3068
hoge=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n=int(input())
print(hoge[n-1])

Measured memory_bytes: 2940
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include<string.h>
#include <math.h>
#include <stack>
#define ll long long
using namespace std;

int main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (b / a <= c)
		printf("%d\n", b / a);
	else
		printf("%d\n", c);
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

int main(void){
    long double a, b, h, m;
    std::cin >> a >> b >> h >> m;
    long double cos = std::cos((30 * h - 5.5 * m) / 180 * 3.141592653589793238462643383279);
    if(cos < 0.5) std::cout << std::fixed << std::setprecision(15) << std::sqrt((a - b) * (a - b) + 2 * a * b * (1 - cos)) << std::endl;
    else std::cout << std::fixed << std::setprecision(15) << std::sqrt(a * a + b * b - 2 * a * b * cos) << std::endl;
    return 0;
}

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

int main() {
	std::string str = "abcdefghijklmnopqrstuvwxyz";
	long long n;
	std::cin >> n;

	std::string name;

	while (n > 0)
	{
		--n;
		name = str.at(n % 26) + name;
		n /= 26;
	}
	std::cout << name << std::endl;
}

Measured memory_bytes: 3092
/*
ID: zhaowei10
TASK:
LANG: C++
*/
#include <algorithm>
#include <array>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define MOD 1000000007
#define FOR(i, j, k, l) for (s32 i = j; i < k; i += l)
#define RFOR(i, j, k, l) for (s32 i = j; i >= k; i -= l)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(x) x.begin(), x.end()
#define MEAN(a, b) min(a, b) + (abs(b - a) >> 1)
#define FASTIO()    \
  cin.tie(nullptr); \
  ios::sync_with_stdio(false);

typedef int64_t s64;
typedef uint64_t u64;
typedef int32_t s32;
typedef uint32_t u32;
typedef float f32;
typedef double f64;
typedef pair<s32, s32> II;
typedef pair<s64, s64> LL;
typedef vector<s32> VI;
typedef vector<II> VII;
typedef vector<char> VC;
typedef vector<VII> VVII;
typedef priority_queue<s32> PQI;
typedef priority_queue<s32, VI, greater<s32>> PQIA;
typedef priority_queue<s64> PQL;
typedef priority_queue<II> PQII;
typedef priority_queue<II, VII, greater<II>> PQIIA;
typedef priority_queue<LL> PQLL;
typedef unordered_set<s32> USI;
typedef unordered_set<s64> USL;
typedef set<II> SII;
typedef multiset<s32> MSI;

template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}

template <typename T>
inline s32 ndigits(T x) {
  s32 r = 0;
  while (x) {
    x /= 10;
    ++r;
  }
  return r;
}

int main() {
  FASTIO();

  int k, x;
  cin >> k >> x;

  cout << (k * 500 >= x ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n, m;
    cin >> n >> m;
    vint a(n);
    rep(i, n) cin >> a[i];
    sort(rall(a));
    int sum = accumulate(all(a), 0);
    int b = (sum + ((4*m) - 1)) / (4*m);
    bool c = true;
    rep(i, m) {
        if (a[i] < b) c = false;
    }

    yns(c);
    return 0;
}

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

#define int long long
int n, k, tmp, comps, ans;
string s;

signed main(){
    tmp = 1;
    cin >> n >> k >> s;
    if(n >= 2 && s[1] == '1' && s[0] == '0') comps = 1;
    for(int i = 0; i < s.length(); i++){
        if(tmp < n - 1) tmp++;
        if(i >= 1 && s[i] == '1' && s[i - 1] == '0') comps--;
        //cout << comps << " ";
        while(comps <= k && tmp < n){
            if(s[tmp] == '0' && s[tmp - 1] == '1' && comps == k){
                //cout << tmp << " ";
                tmp--;
                break;
            }
            if(s[tmp] == '1' && s[tmp - 1] == '0') comps++;
            tmp++;
        }
        if(tmp == n) tmp--;
        //cout << tmp << " ";
        ans = max(ans, tmp - i + 1);
        //cout << tmp - i + 1 << "\n";
    }
    cout << ans;
}

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

int main()
{
  int n, m;
  cin >> n >> m;
  
  int roads[n][n];
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n; j++){
      roads[i][j] = 0;
    }
  }
  for (int i = 0; i < m; i++){
    int a, b;
    cin >> a >> b;
    a--; b--;
    roads[a][b]++;
    roads[b][a]++;
  }
  for (int i = 0; i < n; i++){
    int sum = 0;
    for (int j = 0; j < n; j++){
      sum += roads[i][j];
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 256
def solve():
    N = int(input())
    value = []
    for i in range(N):
        a,b,c = map(int,input().split())
        value.append([a,b,c])
    
    dp = [[0] * 3 for i in range(N)]
    dp[0][0] = value[0][0]
    dp[0][1] = value[0][1]
    dp[0][2] = value[0][2]

    for i in range(1,N):
        for j in range(3):
            for k in range(3):
                if j == k:
                    continue
                dp[i][j] = max(dp[i][j], value[i][j] + dp[i-1][k])
    
    print(max(dp[-1]))

if __name__ == '__main__':
    solve()

Measured memory_bytes: 75352
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
#define N 200002
struct edge{int to,nxxt;}e[N<<1];
int n,H,a[N][4],head[N],cnt=1,b[N][2],f[N],rd[N],cd[N],ct[N];
vector<int>v[N];
inline void ins(int u,int v){e[cnt].to=v;e[cnt].nxxt=head[u];head[u]=cnt++;}
int getroot(int t){return f[t]==-1?t:f[t]=getroot(f[t]);}
int main()
{
    scanf("%d%d",&n,&H);
    memset(f,-1,sizeof(f));
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d%d%d",&a[i][0],&a[i][1],&a[i][2],&a[i][3]);
        int x,y;
        if(a[i][2]==0)x=a[i][0];else x=H+a[i][2];
        if(a[i][3]==0)y=H+a[i][1];else y=a[i][3];
        b[i][0]=x,b[i][1]=y;
        if(x==y)ct[x]++;
        ins(x,y),rd[y]++,cd[x]++;
        x=getroot(x);y=getroot(y);
        if(x^y)f[x]=y;
    }
    for(int i=1;i<=2*H;i++)v[getroot(i)].push_back(i);
    //for(int i=1;i<=2*H;i++)printf("%d ",getroot(i));puts("rt");
    //for(int i=1;i<=2*H;i++)printf("%d ",cd[i]);puts("cd");
    //for(int i=1;i<=2*H;i++)printf("%d ",rd[i]);puts("rd");
    for(int i=1;i<=2*H;i++)
    {
        bool flag=false;
        if(v[i].size()==1){if(ct[v[i][0]]){puts("NO");return 0;}}
        if(v[i].size()<=1)continue;
        //printf("%d:",i);
        for(int j=0;j<v[i].size();j++)
        {
            int x=v[i][j];
            if(rd[x]^cd[x]){flag=true;break;}
        }//puts("");
        if(!flag){puts("NO");return 0;}
    }
    bool flag=true;
    for(int i=1;i<=H;i++)
    {
        if(cd[i]<rd[i]){flag=false;break;}
    }
    for(int i=H+1;i<=2*H;i++)
    {
        if(rd[i]<cd[i]){flag=false;break;}
    }
    if(flag)puts("YES");else puts("NO");
}
/*
3 4
1 1 0 0
2 2 0 1
3 3 1 0
*/

Measured memory_bytes: 12316
/*
 * シカのAtCoDeerくんは二つの正整数 a,b を見つけました。 a と b の積が偶数か奇数か判定してください。
 */

import java.util.*;
    public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            // 入力
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            // 出力
            if((a*b)%2==0){
            	System.out.println("Even");
            }else{
            	System.out.println("Odd");
            }
            sc.close();
        }
    }
	

Measured memory_bytes: 23764
N,K=map(int,input().split())
num = [0]*(int(1e5)+1)
for _ in range(N):
  a,b=map(int,input().split())
  num[a] += b
for i in range(int(1e5)+1):
  K -= num[i]
  if K <= 0:
    print(i)
    break

Measured memory_bytes: 11760
#include <algorithm>
#include <array>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
constexpr int INF = 100100100;

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

using namespace std;

int main() {
  // cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<string> strs;
  int mid = 0;
  int p = 0, q = 0, r = 0, s = 0;
  REP(i, N) {
    string S;
    cin >> S;
    strs.push_back(S);
    REP(i, S.length()) {
      if (S.substr(i, 2) == "AB") {
        ++mid;
      }
    }
    bool ae = S[S.length()-1] == 'A', bt = S[0] == 'B';
    p += !ae && !bt;
    q += !ae && bt;
    r += ae && !bt;
    s += ae && bt;
  }
  int ans = mid + min(q, r);
  if (s == 0) {
    cout << ans << endl;
    return 0;
  }
  ans += s - 1;
  if (q > 0 || r > 0) {
    ++ans;
  }
  cout << ans << endl;
  return 0;
}


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

// #define int long long
#define pb push_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vii;

template <class X> void print(X Target){ cout << Target << '\n'; }

bool isprime(int num)
{
  if (num == 2){
    return (true);
  }
  else if (num == 1 || num % 2 == 0){
    return (false);
  }
  for (int i = 3; i <= num / i; i += 2){
    if (num % i == 0){
      return (false);
    }
  }
  return (true);
}

signed main()
{
  ios::sync_with_stdio(false);

  int x;
  vi prime;

  cin >> x;
  for (int i = 2; i <= sqrt(x); i++){
    if (isprime(i)){
      prime.pb(i);
    }
  }
  cout << x << ":";
  for (int i = 0; i < prime.size();){
    if (x % prime[i] == 0){
      x /= prime[i];
      cout << " " << prime[i];
    }
    else i++;
  }
  if (x != 1){
    cout << " " << x;
  }
  print("");

  return (0);
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D)
    cout << "Left" << endl;
  else if (A + B == C + D)
    cout << "Balanced" << endl;
  else if  (A + B < C + D)  
    cout << "Right" << endl;
}

Measured memory_bytes: 256
from collections import*
import sys
input = sys.stdin.readline


class UnionFind(object):
    def __init__(self, n):
        # 親の番号を格納する。親だった場合は-(その集合のサイズ)
        # 作るときはParentsの値を全て-1にする
        # こうすると全てバラバラになる
        self.parents = [-1 for i in range(n)]

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
        return


# n, k, l = map(int, input().split())
# w = [list(map(int, input().split())) for i in range(k+l)]
# ro = w[:k]
# ra = w[l:]

# ro_cl = UnionFind(n)
# ra_cl = UnionFind(n)
# d = defaultdict(int)

# for p, q in ro:
#     ro_cl.union(p-1, q-1)
# for p, q in ra:
#     ra_cl.union(p-1, q-1)

# for i in range(n):
#     d[(ro_cl.find(i), ra_cl.find(i))] += 1
# print(*[d[(ro_cl.find(i), ra_cl.find(i))]for i in range(n)])

n, k, l = map(int, input().split())
ro_cl = UnionFind(n)
ra_cl = UnionFind(n)
d = defaultdict(int)
for i in range(k):
    p, q = map(int, input().split())
    ro_cl.union(p-1, q-1)
for i in range(l):
    p, q = map(int, input().split())
    ra_cl.union(p-1, q-1)
for i in range(n):
    d[(ro_cl.find(i), ra_cl.find(i))] += 1
print(*[d[(ro_cl.find(i), ra_cl.find(i))]for i in range(n)])

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

  double ans = N / 2 + N % 2;
  ans = ans / N;
  cout << setprecision(10) << ans << endl;

  return 0;
}

Measured memory_bytes: 256
/**
 *    Author:   Jay Sabale
 *	       
**/

#include<bits/stdc++.h>

using namespace std;
 
// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef vector <lli> vl;
typedef vector <string> vs;
typedef vector < pair <long, long> > vll;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define gcd __gcd
#define maxe *max_element
#define mine *min_element
#define deb debug
 
#define forz(i,n) for(lli i=0; i<n; i++)
#define rep(i,k,n) for (lli i = k; i < n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;
#define p1(i) cout<<i<<endl;
#define p2(i, j) cout<<i<<" "<<j<<endl;
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl;
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl;

typedef pair <lli,lli> pll;
 
// CODE BEGINS :

int main()
{
    kira;

    lli R; cin>>R;

    cout<<deci(10)<<(2*3.141592653589793238*R)<<endl;

    return 0;
}




















































Measured memory_bytes: 3808
import sys
from itertools import accumulate
import bisect

input = lambda: sys.stdin.readline().rstrip()
n, m, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = [0] + a
b = [0] + b
# 累積和を利用
a_accum = list(accumulate(a))
b_accum = list(accumulate(b))

# print(a_accum, b_accum)

ans = 0
for i in range(len(a_accum)):
    nokori = k - a_accum[i]
    if nokori < 0:
        break
    # にぶたん
    b_pos = bisect.bisect(b_accum, nokori) - 1
    ans = max(ans, i + b_pos)
    # print(nokori,ans,b_pos)
print(ans)


Measured memory_bytes: 49048
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 
  int n;
  cin >>n;
  
  if(n<105) cout << 0 << endl;
  else if(n<135) cout << 1 << endl;
  else if(n<165) cout << 2 << endl;
  else if(n<189) cout << 3 << endl;
  else if(n<195) cout << 4 << endl;
  else cout << 5 << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<set<int>> is(26);
	rep(i, n) {
		is[s[i] - 'a'].insert(i);
	}
	int q;
	cin >> q;
	while (q--) {
		int f;
		cin >> f;
		if (f == 1) {
			int i; char c;
			cin >> i >> c;
			i--;
			is[s[i] - 'a'].erase(i);
			s[i] = c;
			is[s[i] - 'a'].insert(i);
		}
		else {
			int l, r;
			cin >> l >> r;
			l--; r--;
			int ans = 0;
			rep(i, 26) {
				auto itr = is[i].lower_bound(l);
				if (itr != is[i].end() && *itr <= r) ans++;
			}
			printf("%d\n", ans);
		}
	}
	return 0;
}


Measured memory_bytes: 24220
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(dead_code)]

use std::collections::BinaryHeap;
use std::io::Read;

const U32_LARGE: u32 = 1 << 30;

fn read<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let m: u32 = read();
    let a: Vec<u64> = (0..n).map(|_| read()).collect();

    let mut heap = BinaryHeap::new();
    for &v in a.iter() {
        heap.push(v);
    }

    for _ in 0..m {
        let v = heap.pop().unwrap();
        heap.push(v / 2);
    }

    let mut res: u64 = 0;
    for v in heap {
        res += v;
    }

    println!("{}", res);
}


Measured memory_bytes: 6396