akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
using Graph = vector<vector<int>>;

int main() {
int n;

ll sw;cin >> n >> sw;
ll  w[n],v[n];
for (int i = 0; i < n; ++i)
{
    cin >> w[i] >> v[i];
}
ll dp[110][sw+3];

for (int i = 0; i <= sw; ++i)
{
        dp[0][i] = 0;
}

for (int i = 0; i < n; ++i)
{
    for (int weight = 0; weight <= sw; ++weight)
    {
      if (weight>=w[i]) dp[i+1][weight] = max(dp[i][weight-w[i]] + v[i], dp[i][weight]);
      else dp[i+1][weight] = dp[i][weight];
    }
}


cout << dp[n][sw];

 return 0;

}




Measured memory_bytes: 80256
#include <stdio.h>
int main(){
  int h,w,i,j,p=1,q=1;
  while(1){
    scanf("%d %d",&h,&w);
    if(h==0 && w==0){
      break;
 }
    for(i=1;i<=h;i++){ 
      if(i%2==0){
    for(j=1;j<=w;j++){
      if(j%2==0){
        printf("#");
      }else{
        printf(".");
        }
    }
      } else {
    for(j=1;j<=w;j++){
      if(j%2==0){
        printf(".");
      }else{
        printf("#");
      }
    }
      }
      printf("\n");
    }
    printf("\n"); 
  }
  return 0;
}
 

 

Measured memory_bytes: 572
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 1e5;

int n;
int a[N + 2], ans;

inline bool compare(int x, int y)
{
	return x > y;
}
int main()
{
	n = read();
	for (int i = 1; i <= n; i++)
		a[i] = read();
	sort(a + 1, a + n + 1, compare);

	for (int i = 0; i <= n; i++) {
		if (i + 1 > a[i + 1]) {
			for (int j = i + 1; a[j] == i; j++)
				ans ^= 1;
			ans |= (a[i] - i) & 1;
			if (ans)
				printf("First\n");
			else
				printf("Second\n");
			break;
		}
	}

	return 0;
}


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

using namespace std;

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

struct uni
{
  vector<int> data;
  uni(int s) : data(s, -1) { }
  void unite(int x, int y) {
    x = root(x), y = root(y);
    if(x != y) {
      if(data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
  }
  
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
};

struct edges {
  int u, v, c;
  bool operator < (const edges& e) const {
    return c < e.c;
  }
};

int const INF = 1<<29;

int main() {
  
  int N, M;
  while(cin >> N >> M && (N|M)) {
    vector<edges> es;
    rep(i, M) {
      int a, b, c;
      cin >> a >> b >> c; a--, b--;
      es.push_back((edges){a, b, c});
    }
    sort(es.begin(), es.end());
    int ret = INF;
    
    for(; (int)es.size() >= N-1;) {
      uni uf(N);
      int last = -1;
      int s = 0;
      rep(i, es.size()) {
	if(!uf.same(es[i].u, es[i].v)) {
	  uf.unite(es[i].u, es[i].v);
	  last = i;
	  s++;
	  if(s == N-1) break;
	}
      }
      rep(i, N) REP(j, i+1, N) {
	if(!uf.same(i, j)) { goto exit; }
      }
      ret = min(ret, es[last].c-es[0].c);
      es.erase(es.begin());
    }
    
  exit:;
    cout << (ret < INF ? ret : -1) << endl;
    
  }
  
  return 0;
}

Measured memory_bytes: 1352
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
/////////

void solve(){
  ini(N , H);
  vp v(N); in(v);

  sort(all(v));
  int ma = v.back().first;

  priority_queue<int> Q;
  ll cur = 0;
  rep(i , N){
    if(v[i].se > ma) {
      Q.push(v[i].se);
      cur += v[i].se;
    }
  }
  trc(ma , cur);

  if(cur < H){
    out(Q.size() + (H - cur + ma - 1) / ma);
  }
  else{
    int cnt = 0;
    while(H > 0){
      int a = Q.top(); Q.pop();
      H -= a; cnt++;
    }
    out(cnt);
  }

  

  

}

Measured memory_bytes: 1660
move = [[1,4],[0,2,5],[1,3,6],[2,7],[0,5],[4,1,6],[5,2,7],[6,3]]

def swap(ls,p,q):
    res = list(ls)
    res[p],res[q] = res[q],res[p]
    return "".join(res)

ans = {"01234567":0}
que = [["01234567",0]]
while que:
    pzl,count = que.pop(0)
    p = pzl.find("0")
    for q in move[p]:
        tmp = swap(pzl,p,q)
        if tmp not in ans:
            ans[tmp] = count+1
            que.append([tmp,count+1])

while 1:
    try:
        print ans[raw_input().replace(" ","")]
    except:
        break

Measured memory_bytes: 6076
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	string S;
	cin >> S;

	int consecutive = 0;
	for (int i = 1; i < S.size(); i++)
	{
		if (S[i] == S[i - 1]) consecutive++;
	}

	if (consecutive > 0)
	{
		cout << "Bad";
	}
	else
	{
		cout << "Good";
	}

	return 0;
}


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

vector<int> A(3);

void solve(){
    if(A[0] + A[1] + A[2] >= 22) cout << "bust";
    else cout << "win";
}
int main(){
    for(int i = 0; i < 3; ++i){
        cin >> A[i];
    }
    solve();
    return 0;
}

Measured memory_bytes: 256
let readIntArray _ =
    stdin.ReadLine().Split(" ") |> Array.map int

let readInt _ = stdin.ReadLine() |> int

()
|> readIntArray
|> fun [| n; p; q |] ->
    let map =
        q
        |> Seq.init
        <| readInt
        |> Seq.fold (fun (map: Map<int, int>) x ->
            match map.TryFind x with
            | None -> map.Add(x, 1)
            | Some y -> map.Add(x, y + 1)) Map.empty

    for x in 1 .. n do
        match map.TryFind x with
        | None -> if p - q > 0 then printfn "Yes" else printfn "No"
        | Some y -> if (p + y - q) > 0 then printfn "Yes" else printfn "No"


Measured memory_bytes: 45844
s = "0" + gets.chomp
n = s.length
dp = Array.new(n+1){[10**9]*2}
dp[0][0] = 0
n.times do |i|
  d = s[i].to_i
  dp[i+1][0] = [dp[i][0] + d, dp[i][1] + 10 - d].min
  dp[i+1][1] = [dp[i][0] + d + 1, dp[i][1] + 9 - d].min
end
p dp[n][0]

Measured memory_bytes: 93104
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

S = input()
N = len(S)
ans = 0
for i in range(N):
    for j in range(N - i + 1):
        if all(c in 'AGCT' for c in S[i:i + j]):
            ans = max(ans, j)
print(ans)

Measured memory_bytes: 66028
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define F first
#define S second

string out[]={"',.!?","abcABC","defDEF","ghiGHI","jklJKL","mnoMNO","pqrsPQRS","tuvTUV","wxyzWXYZ"};

main(){
  string in;
  while(cin>>in){
    int re=0;
    rep(i,in.size()){
      //cout<<i<<endl;
      if(in[i]=='0' && (i==0 || in[i-1]=='0'))re=1,cout<<" ";
      else if(!i || in[i]==in[i-1])++re;
      else if(in[i]=='0'){
        cout<<out[in[i-1]-'1'][--re%out[in[i-1]-'1'].size()];
        re=1;
      }else if(in[i-1]!='0'){
        cout<<out[in[i-1]-'1'][--re%out[in[i-1]-'1'].size()];
        re=1;
      }else re=1;
    }
    if(in.size() && in[in.size()-1]-'0')cout<<out[in[in.size()-1]-'1'][--re%out[in[in.size()-1]-'1'].size()];
    cout<<endl;
  }
}

Measured memory_bytes: 0
L, R = map(int, input().split())
MOD = 2019

if R - L >= 2019:
    print(0)
    exit()
ans = (L * (L + 1)) % MOD
for i in range(L, L + 5000):
    for j in range(L + 1, L + 5000):
        if (i >= j) or (i > R) or (j > R):
            continue
        ans = min(ans, (i * j) % MOD)

print(ans)

Measured memory_bytes: 41324
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)


Measured memory_bytes: 69736
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 1000010, LOG=20;

ll n, m, k, u, v, x, y, t, a, b, ans;
ll F[MAXN], I[MAXN];
ll A[MAXN];

ll powmod(ll a, ll b){
	ll res=1;
	for (; b; b>>=1, a=a*a%mod) if (b&1) res=res*a%mod;
	return res;
}

ll C(ll n, ll r){
	if (r<0 || r>n) return 0;
	return F[n]*I[r]%mod*I[n-r]%mod;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	F[0]=1;
	for (int i=1; i<MAXN; i++) F[i]=F[i-1]*i%mod;
	I[MAXN-1]=powmod(F[MAXN-1], mod-2);
	for (int i=MAXN-1; i; i--) I[i-1]=I[i]*i%mod;
	
	cin>>n;
	for (int i=1; i<n; i++){
		A[i]=C(i-1, n-i-1)*F[i]%mod;
		A[i]=A[i]*F[n-1-i]%mod;
	}
	for (int i=1; i<n; i++) ans=(ans + i*(A[i]-A[i-1]))%mod;
	if (ans<0) ans+=mod;
	cout<<ans<<'\n';
	
	return 0;
}


Measured memory_bytes: 23680
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      static final long MOD = 1000000007L;
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int M = Integer.parseInt(st.nextToken());
         int A = Integer.parseInt(st.nextToken());
         int B = Integer.parseInt(st.nextToken());
         
         long[] fac = new long[200001];
         long[] invfac = new long[200001];
         fac[0] = invfac[0] = 1L;
         for(int i=1; i <= 200000; i++)
            fac[i] = (fac[i-1]*i)%MOD;
         invfac[200000] = power(fac[200000], MOD-2, MOD);
         for(int i=199999; i >= 1; i--)
            invfac[i] = (invfac[i+1]*(i+1))%MOD;
            
         long res = (fac[N+M-2]*invfac[N-1])%MOD;
         res = (res*invfac[M-1])%MOD;
         for(int c=0; c < B; c++)
         {
            long temp = (fac[A-1+M-c-1]*invfac[A-1])%MOD;
            temp = (temp*invfac[M-c-1])%MOD;
            long above = (fac[N-A-1+c]*invfac[c])%MOD;
            above = (above*invfac[N-A-1])%MOD;
            res -= (temp*above)%MOD;
            if(res < 0)
               res += MOD;
         }
         System.out.println(res);
      }
      public static long power(long x, long y, long p) 
      { 
         //0^0 = 1
         long res = 1L;      
         x = x%p;  
         while(y > 0) 
         { 
            if((y&1)==1) 
               res = (res*x)%p;
            y >>= 1;
            x = (x*x)%p;  
         } 
         return res; 
      } 
   }

Measured memory_bytes: 36264
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;
 
const int mod = 1e9 + 7;
vector<long long int> fac;
long long int mypow(long long int a, long long int b) {
    if (b == 0) return 1;
    if (b == 1) return a;
    long long int res = mypow(a, b / 2);
    res = res * res % mod;
    if (b % 2 == 1) res = res * a % mod;
    return res;
}
 
 
long long int myc(long long int a, long long int b) {
    return fac[a] * mypow(fac[b], mod - 2) % mod * mypow(fac[a - b], mod - 2) % mod;
}
 
int main() {
	int n, k;
    cin >> n >> k;
    fac.push_back(1);
    for (int i = 1; i <= k; i++) {
        fac.push_back(fac.back() * i % mod);
    }
    vector<unordered_set<int>> v(n + 1, unordered_set<int>());
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        v[a].insert(b);
        v[b].insert(a);
    }
    vector<pair<int, int>> v1, v2;
    long long int res = k;
    v1.push_back(make_pair(1, 1));
    while (v1.size() > 0) {
        v2.clear();
        for (auto p : v1) {
            int index = p.first, root = p.second;
            if (v[index].size() == 0) continue;
            if (v[index].size() > k - 1 - (1 - root)) {
                cout << 0 << endl;
                return 0;
            }
            res *= myc(k - 1 - (1 - root), v[index].size());
            res %= mod;
            res *= fac[v[index].size()];
            res %= mod;
            for (auto next : v[index]) {
                v[next].erase(index);
                v2.push_back(make_pair(next, 0));
            }
        }
        v1 = v2;
    }
    cout << res << endl;
}

Measured memory_bytes: 21568
#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>
#include<assert.h>
#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;

int main() {
	int k;
	string s;
	cin >> k >> s;
	if (s.length() > k) {
		rep(i, k)cout << s[i];
		cout << "..." << endl;
	}
	else cout << s << endl;
	return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		if(a==b) System.out.println(c);
		else if(a==c) System.out.println(b);
		else System.out.println(a);
	}

}


Measured memory_bytes: 27036
#include <bits/stdc++.h>
using namespace std;
 
int func(int a);
 
int main() {
	int s,i=1,k;
	cin>>s;k=s;
	set<int> p;
	while(true){
		p.insert(k);
		k=func(k);
		i++;
		if(p.find(k)!=p.end()){
			break;
		}
	}
	cout<<i<<endl;
	return 0;
}
 
int func(int a){
	if(a%2){
		return 3*a+1;
	}else{
		return a/2;
	}
}

Measured memory_bytes: 256
from sys import stdin
import itertools
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N,M= list(map(int, stdin.readline().strip().split()))
so=make_divisors(M)
so.sort(reverse=True)
for i in so:
    if M>=i*N:
        print(i)
        exit()

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
int  a[maxn];
int dp[maxn];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n/2;i++)
    swap(a[i],a[n-i+1]);
     dp[1]=a[1];
    int k=1;
    for(int i=2;i<=n;i++)
    {
        if(a[i]+1>dp[k])
        dp[++k]=a[i];
        else
        {
            dp[upper_bound(dp+1,dp+1+k,a[i])-dp]=a[i];
        }
    }
    cout<<k<<endl;

    return 0;
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
string s;
  cin>>s;
  bool ans=true;
  rep(i,3){
    if(s[i]==s[i+1]) ans=false;
  }
  if(ans) puts("Good");
  else puts("Bad");
}

Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

N,A,B = map(int,input().split())
v = [int(i) for i in input().split()]


dp = [[0 for j in range(B+1)] for i in range(N)]
for i in range(N):
    dp[i][0] = max(v[:i+1])

for i in range(N-1):
    for j in range(min(B,i+1)):
        dp[i+1][j+1] = max(dp[i][j+1],(dp[i][j]*(j+1)+v[i+1])/(j+2))

ans = max(dp[-1][A-1:B+1])
# v.sort()
# v.reverse()
# ans = 0
# for i in range(A):
#     ans += v[i]
# ans /= A
print(ans)

v.sort()
v.reverse()

cnt = 0
if v[0] != v[A-1]:
    m = v.count(v[A-1])
    n = v[:A].count(v[A-1])
    cnt = math.factorial(m)//(math.factorial(n)*math.factorial(m-n))
else:
    m = v.count(v[0])
    n = A
    for i in range(n,B+1):
        if m-i < 0:
            pass
        else:
            cnt += math.factorial(m)//(math.factorial(i)*math.factorial(m-i))

print(cnt)


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

int main (){
string n ;
cin >> n ;
bool nine = false;
for(int i =0;i<n.size();i++){
if(n.at(i) == '9') nine = true;
}
  if(nine) cout << "Yes" << endl;
else cout << "No" << endl;
}
    


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();
        double x = a * 12.5;
        double y = x + 11.25;
        int m = b * 10;
        int n = m + 9;
        int r;
        if(x <= m && m < y){
            r = m;
        }else if(m <= x && x < n){
            if((int)x == x){
                r = (int)x;
            }else {
                r = (int) (x + 1);
            }
        }else{
            r = -1;
        }
        System.out.println(r);
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
const int C = 1046527;

char baca[C][13];

int hs(int key, int i) {
	return (key % C + i * (1 + key % (C - 1))) % C;
}

int cToI(char ch) {
	if (ch == 'A')
		return 1;
	else if (ch == 'C')
		return 2;
	else if (ch == 'G')
		return 3;
	else if (ch == 'T')
		return 4;
	else
		return 0;
}
int getKey(string tmp) {
	int sum = 0, p = 1, l = tmp.length();
	for (int i = 0; i < l; i++) {
		sum += p * cToI(tmp[i]);
		p *= 5;
	}
	return sum;
}

void ins(string str) {
	int key = getKey(str);
	for (int i = 0; i < C; i++) {
		int h = hs(key, i);
		if (strlen(baca[h]) == 0) {
			strcpy(baca[h], str.c_str());
			break;
		}
	}
}

int find(string str) {
	int key = getKey(str);
	for (int i = 0;; i++) {
		int h = hs(key, i);
		if (strlen(baca[h]) == 0) {
			return 0;
		} else if (strcmp(baca[h], str.c_str()) == 0) {
			return 1;
		}
	}
}

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

	int cnt;
	cin >> cnt;
	string tmp;
	string key;
	for (int i = 0; i < cnt; i++) {
		cin >> tmp >> key;

		if (tmp[0] == 'i') {
			ins(key);
		} else {
			find(key) == 1 ? cout << "yes" << endl : cout << "no" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 16480
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+10;
int a[N],b[N],n;
struct cmp{
	bool operator()(const int x,const int y){
		return b[x]>b[y];
	}
};
priority_queue<int,vector<int>,cmp>q;
void pl(){
	printf("%d\n",-1); exit(0);
}
int nxt(int x){return x==n?b[1]:b[x+1];}
int pre(int x){return x==1?b[n]:b[x-1];}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++) scanf("%d",&b[i]);
	for (int i=1;i<=n;i++) 
	if (b[i]<a[i]) pl(); else if (b[i]>a[i]&&b[i]>pre(i)+nxt(i)) q.push(i); 
	int k=0;
	ll ans=0;
	while (!q.empty()) {
		int t=q.top(); q.pop();
//		cout << t << endl;
		if (t==k) pl(); k=t;
		int sum=pre(t)+nxt(t);
		if ((b[t]-a[t])%sum==0) ans+=(b[t]-a[t])/sum,b[t]=a[t];
		else {
			ans+=b[t]/sum;
			b[t]%=sum;
			if (b[t]<a[t]) pl();
		}
		int x=t-1; if (x<=0) x=n;
		if (b[x]>pre(x)+nxt(x)&&b[x]>a[x]) q.push(x);
		x=t+1; if (x>n) x=1;
		if (b[x]>pre(x)+nxt(x)&&b[x]>a[x]) q.push(x);
	}
	for (int i=1;i<=n;i++) if (a[i]!=b[i]) pl();
	printf("%lld\n",ans);
}

Measured memory_bytes: 2428
n, x = map(int, input().split())
m = []
sum = 0
for i in range(n):
    a = int(input())
    m.append(a)
    sum += a
m = sorted(m)
#print(m)
x -= sum

cnt = n
while x >= m[0]:
    cnt += 1
    x -= m[0]

print(cnt)


Measured memory_bytes: 3060
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int max(int a,int b){
	return (a<b)?b:a;
}

int main(){
	int n,tmp;
	cin>>n;
	int a[n+1],b[n+1],c[n+1];
	rep(i,n)cin>>a[i]>>b[i]>>c[i];
	a[n]=b[n]=c[n]=0;
	int dp[n+1][3];
	rep(i,n+1)rep(j,3)dp[i][j]=0;
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	rep(i,n){
		rep(j,3){
			rep(k,3){
				if(j==k)continue;
				if(j==0)dp[i+1][j]=max(dp[i+1][j],dp[i][k]+a[i+1]);
				if(j==1)dp[i+1][j]=max(dp[i+1][j],dp[i][k]+b[i+1]);
				if(j==2)dp[i+1][j]=max(dp[i+1][j],dp[i][k]+c[i+1]);
			}
		}
	}
	int ans=0;
	rep(i,3)ans=max(ans,dp[n-1][i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <numeric>
#include <iterator>
using namespace std;


int main()
{
    string s;
    cin >> s;
    int a = 0, b = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '0') a++;
        else b++;
    }
    cout << min(a, b)*2 << endl;
}


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

int main(void){
    string s;
    cin >> s;

    int n = s.size();
    int p = 2019;

    ll ans = 0;
    if(10 % p == 0){
        for(int i=0;i<n;i++){
            if((s[i]-'0')%p==0) ans += i+1; 
        }
    }else{
        vector<int> d(n+1,0);
        int ten = 1;
        for(int i=n-1;i>=0;i--){
            int tmp = (s[i]-'0')*ten % p;
            d[i] = (d[i+1]+tmp)%p;
            ten *= 10; ten %= p;
        }

        map<int,ll> mp;
        for(int i=0;i<=n;i++) mp[d[i]]++;
        for(auto p: mp){
            ll k = p.second;
            k *= k-1; k /= 2;
            ans += k;
            //cout << "mod:" << p.first << ", num:" << p.second << endl;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 4368
#include<iostream>
#include<math.h>
using namespace std ;

int main(){
  int n ; cin>>n ;
  int a[n] ;
  long int sum = 0 ;
  long int ans = 0, ans2 = 0 ;
  for(int i=0;i<n;i++){
    cin>>a[i] ;
    sum += a[i] ;
  }
  int med = ceil(sum/(n*1.0)) ;
  int med2 = sum/n ;
  for (int i=0;i<n;i++){
    ans += (med-a[i])*(med-a[i]) ;
    ans2 += (med2-a[i])*(med2-a[i]) ;
  }
  cout<<min(ans,ans2)<<endl;
  return 0 ;
}


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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n, k;
    cin >> n >> k;
    vector<i64> snuke(n);
    for (i64 i = 0; i < k; i++) {
        i64 d;
        cin >> d;
        for (i64 j = 0; j < d; j++) {
            i64 a;
            cin >> a, a--;
            snuke[a]++;
        }
    }

    cout << count(begin(snuke), end(snuke), 0) << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 3660
#include<vector>
#include<queue>
#include<stdio.h>
#include<map>
#include<set>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
#define mp make_pair
using namespace std;
typedef long long ll;
inline ll in()
{
    ll res=0,p=1;
    char c=getchar();
    while(c<'0'||c>'9') {if(c=='-') p=-1; c=getchar();}
    while(c>='0'&&c<='9') res=res*10+c-48,c=getchar();
    return p*res;
}
void out(ll x)
{
    if (x>9) out(x/10);
    putchar(x%10+48);
}
void outn(ll x)
{
    if (x<0){
        putchar('-');
        out(-x);
    }else out(x);
    putchar(10);
}
const double eps = 1e-6;
const int mod = 1e9 + 7, inf = 0x3f3f3f3f;
//const double pi = acos(-1.0);
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll quickpow(ll x, ll k)
{
    ll res = 1;
    while(k){
        if(k & 1) res = (res * x) % mod;
        k >>= 1, x = (x * x) % mod;
    }
    return res;
}
//ll C(int n, int m){return (fac[n] * quickpow((fac[m] * fac[n - m]) % mod, mod - 2)) % mod;}
const int maxn = 1e5 + 10;
int a[maxn];

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int m, d;
    cin >> m >> d;
    int ans = 0;
    for (int i = 1; i <= m; ++i){
        for (int j = 1; j <= d; ++j){
            if ((j / 10) >= 2 && (j % 10) >= 2 && (j / 10) * (j % 10) == i) ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T>using onset=tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
void solve(){
  #ifndef ONLINE_JUDGE    
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
}
signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    //*comment for all except cc/cf   
    char a;
    cin>>a; 
    if(a>='A' and a<='Z'){
      cout<<'A'; 
    }
    else{
      cout<<'a'; 
    }
    
    //printclock;
    return 0;
}
    

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>

using namespace std;

typedef int long long;

const int q = 10000000007;

int main() {
	
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	int sum = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		sum += a[i];
	}

	vector<int> yakusuu;
	for (int i = 1; i < sum; i++)
	{
		if (i * i == sum) {
			yakusuu.push_back(i);
			break;
		}
		else if (i * i > sum) {
			break;
		}
		else if (sum % i == 0) {
			yakusuu.push_back(i);
			yakusuu.push_back(sum / i);
		}
	}
	sort(yakusuu.begin(), yakusuu.end(), greater<int>());
	
	int i = 0;
	int r;
	bool yes = false;
	while (true) {
		r = yakusuu[i];
		vector<int> amari(n);
		for (int i = 0; i < n; i++)
		{
			amari[i] = a[i] % r;
		}
		sort(amari.begin(), amari.end());
		int index1, index2;
		index1 = -1; // ここまでいける
		index2 = n;
		int s = 0;
		for (int i = 0; i < n; i++)
		{
			s += amari[i];
			if (s <= k) {
				index1 = i;
			}
			else {
				s = 0;
				break;
			}
		}

		for (int i = n-1; i >= 0; i--)
		{
			s += r - amari[i];
			if (s <= k)
			{
				index2 = i;
			}
			else {
				s = 0;
				break;
			}
		}

		if (index2 - index1 <= 1) {
			// OK
			break;
		}

		i++;
	}
	
	cout << r << endl;

	return 0;
}

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

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end() //使うときはsort(all())という感じで
#define PI 3.14159265359

using ll = long long;

#define NNE 998244353

vector<ll> facto_n(300001); // nCkの計算用 facto_n[n_i]には(n_i)!が
vector<ll> facto_n_pow(300001); // nCkの計算用 facto_n_pow[n_j]には(n_j)!^(NNE-2)が

ll nnepow(ll x, ll n){ 
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % NNE;
        x = x*x % NNE;
        n = n >> 1;
    }
    return ans;
}

ll combi(ll a, ll b){
    if(a==0 && b==0){
        return 1;
    }
    if(a < b || a < 0 || b < 0){
        return 0;
    }
    ll ans = ( (facto_n[a] * facto_n_pow[b]) % NNE ) * facto_n_pow[a-b] % NNE;
    return ans;
}

int main() {
    ll n,a,b,k;
    cin >> n >> a >> b >> k;
    facto_n[0] = 1;
    facto_n_pow[0] = 1;
    rep(i,n){
        facto_n[i+1] = facto_n[i]*(i+1) % NNE;
        facto_n_pow[i+1] = facto_n_pow[i]*nnepow((i+1),NNE-2) % NNE;  
    }
    ll ans = 0;
    rep(i,n+1){
        if((k-i*a)%b == 0){
            if(((k-i*a)/b)>=0 && ((k-i*a)/b) <=n){
                ll n_a = i;
                ll n_b = (k-i*a)/b;
                ans += combi(n,n_a) * combi(n,n_b) % NNE;
            }
        }
    }
    cout << ans % NNE << endl;
    return 0;
}

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

ll f(ll x){
  if(x==1)return 1;
  return f(x/2)*2+1;
}

int main() {
  ll h;cin>>h;
  cout<<f(h)<<endl;
}

Measured memory_bytes: 3616
n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
for i in a:
  c = []
  for j in zip(*b):
    c.append(sum([k * l for k, l in zip(i, j)]))
  print(*c)


Measured memory_bytes: 6584
#include <algorithm>
#include <cmath>
#include <ctype.h>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define ENDL '\n'
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FOR_EACH(i, v) for (auto&& i : v);

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

	int N;
	int L;
	int T;
	cin >> N >> L >> T;
	multiset<int> goal;
	goal.clear();

	int X1;
	int w;
	int W1;
	cin >> X1 >> w;
	W1 = -2 * w + 3;

	int x1Goal = (X1 + W1 * T) % L;
	if (x1Goal < 0) {
		x1Goal += L;
	}
	multiset<int>::iterator it = goal.insert(x1Goal);

	long long rap = 2 * T / L;
	int rem = 2 * T % L;
	long long conflictNum = 0LL;

	FOR(i, N - 1) {
		int X;
		int w;
		int W;
		cin >> X >> w;
		W = -2 * w + 3;

		int xGoal = (X + W * T) % L;
		if (xGoal < 0) {
			xGoal += L;
		}
		goal.insert(xGoal);

		if (W != W1) {
			conflictNum += rap;
			if (W1 == 1) {
				if (X - X1 < rem) {
					conflictNum++;
				}
			}
			else {
				if (L - X + X1 <= rem) {
					conflictNum++;
				}
			}
			conflictNum %= N;
		}
	}

	if (W1 == 1) {
		FOR(i, conflictNum) {
			if (it == goal.begin()) {
				it = goal.end();
			}
			it--;
		}
	}
	else {
		FOR(i, conflictNum) {
			it++;
			if (it == goal.end()) {
				it = goal.begin();
			}
		}
	}

	FOR(i, N) {
		cout << *it << ENDL;
		it++;
		if (it == goal.end()) {
			it = goal.begin();
		}
	}

	return 0;
}

Measured memory_bytes: 5888
#include<stdio.h>

int main(){
	
	double a,b,c;
	int dw;
	
	scanf("%lf %lf",&a,&b);
	
	c=(a+b)/2;
	dw=(a+b)/2;
	
	if(c>dw)dw++;
	
	printf("%d",dw);
	
	return 0;
}

Measured memory_bytes: 128
import sys
import math
from copy import deepcopy
from collections import deque
sys.setrecursionlimit(20000000)


def main():
    N, D = map(int, input().split())

    p = D*2 + 1
    ans = math.floor(N / p)

    if ans * p >= N:
        print(ans)
    else:
        print(ans+1)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3700
#include<bits/stdc++.h>
#define ll long long
 
using namespace std;
 
int main()
{
    ll i,n;
    cin>>n;
    vector<ll> v(n);
    for(i=0;i<n;i++)
    {
             cin>>v[i];  
    }
    ll cnt=0 ;
    for(i=1;i<n;i++)
    {
          if(v[i-1]>v[i])
          {
                   ll x = abs( v[i-1] - v[i]) ;
                    cnt +=x;
                    v[i] +=  x;
          }     
          
    } 
    cout<<cnt<<endl;
    return 0; 
}

Measured memory_bytes: 4836
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
using namespace std;


int main()
{
    vector<int> num(3);
    cin >>num[0] >> num[1] >> num[2];
    sort(num.begin(),num.end(),greater<int>());
    cout << 10*num[0] + num[1] + num[2] << endl;



}

Measured memory_bytes: 256
import itertools
n = int(input())
a = input()
b = range(1,n+1)

prev = ""
ans1 = ""
ans2 = ""
flag = False
for x in itertools.permutations(b):
	y = " ".join(list(map(str, x)))
	if flag:
		ans2 = y
		break
	if a==y:
		ans1 = prev
		flag = True
	prev = y
	
if ans1 != "":
	print(ans1)
print(a)
if ans2 != "":
	print(ans2)



Measured memory_bytes: 5636
#!/usr/bin/env python3
from queue import PriorityQueue
n, m = map(int, input().split())
jobs = [[] for _ in range(m)]
for i in range(n):
    a, b = map(int, input().split())
    if a > m:
        continue
    jobs[m - a].append(b)
pq = PriorityQueue()
ans = 0
for i in range(m)[::-1]:
    for b in jobs[i]:
        pq.put(-b)
    if not pq.empty():
        ans += -pq.get()
print(ans)


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

ll MOD = 1000000007; ll HALF = 500000004;
ll n;
ll ans = 0;
vector<ll> pows(200000);
vector<vector<ll> > adj(200000);

ll dfs(ll x, ll p, ll &ans) {
	ll cnt = 1LL;
	ll tmp = 1LL - pows[n-1] + MOD*2;
	for (auto v : adj[x])
	{
		if (v == p) continue;
		ll w = dfs(v, x, ans);
		tmp -= pows[n-1-w] - pows[n-1] - MOD*2;
		cnt += w;
	}
	if (n > cnt) tmp -= pows[cnt-1] - pows[n-1] - MOD*2;
	tmp %= MOD;
	tmp = (tmp * HALF) % MOD;
	ans = (ans + tmp) % MOD;

	return cnt;
}


int main() {
	cin >> n;
	pows[0] = 1LL;
	for (int i = 0; i < 199999; ++i) pows[i+1] = (pows[i] * HALF) % MOD;
	for (int i = 0; i < n-1; ++i)
	{
		ll a, b; cin >> a >> b;
		adj[a-1].push_back(b-1);
		adj[b-1].push_back(a-1);
	}

	dfs(0, -1, ans);

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 24192
#include <cstdio>

int main(){
    int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0;
    int k = 0, l = 0, m = 0, n = 0, o = 0, p = 0, q = 0, r = 0, s = 0, t = 0;
    int u = 0, v = 0, w = 0, x = 0, y = 0, z = 0, Y = 0;
    int I = 0;
    char W[1000] = "abcdefghijklmnopqrstuvwxyz"; 
    char Z;
    while(scanf("%c", &Z) != EOF){
        if (Z == 'a' || Z == 'A'){
            a += 1;
        } else if (Z == 'b' || Z == 'B') {
            b += 1;
        } else if (Z == 'c' || Z == 'C') {
            c += 1;
        } else if (Z == 'd' || Z == 'D') {
            d += 1;
        } else if (Z == 'e' || Z == 'E') {
            e += 1;
        } else if (Z == 'f' || Z == 'F') {
            f += 1;
        } else if (Z == 'g' || Z == 'G') {
            g += 1;
        } else if (Z == 'h' || Z == 'H') {
            h += 1;
        } else if (Z == 'i' || Z == 'I') {
            i += 1;
        } else if (Z == 'j' || Z == 'J') {
            j += 1;
        } else if (Z == 'k' || Z == 'K') {
            k += 1;
        } else if (Z == 'l' || Z == 'L') {
            l += 1;
        } else if (Z == 'm' || Z == 'M') {
            m += 1;
        } else if (Z == 'n' || Z == 'N') {
            n += 1;
        } else if (Z == 'o' || Z == 'O') {
            o += 1;
        } else if (Z == 'p' || Z == 'P') {
            p += 1;
        } else if (Z == 'q' || Z == 'Q') {
            q += 1;
        } else if (Z == 'r' || Z == 'R') {
            r += 1;
        } else if (Z == 's' || Z == 'S') {
            s += 1;
        } else if (Z == 't' || Z == 'T') {
            t += 1;
        } else if (Z == 'u' || Z == 'U') {
            u += 1;
        } else if (Z == 'v' || Z == 'V') {
            v += 1;
        } else if (Z == 'w' || Z == 'W') {
            w += 1;
        } else if (Z == 'x' || Z == 'X') {
            x += 1;
        } else if (Z == 'y' || Z == 'Y') {
            y += 1;
        } else if (Z == 'z' || Z == 'Z') {
            z += 1;
        } 
    }
    int V[1000] = {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z};
    while(I <= 25){
        printf("%c : %d\n", W[I], V[I]);
        I += 1;
    }
}



Measured memory_bytes: 2768
#include<set>
#include<map>
#include<ctime>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>    
using namespace std;
#define LL long long
LL read(){
    LL f=1,x=0;char s=getchar();   
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}  
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
    return x*f;
}
#define INF 0x3f3f3f3f
#define MAXN 100
int main(){
	LL n=read(),k=read(),ans=k;
	for(int i=2;i<=n;i++)
		ans*=(k-1);
	printf("%lld\n",ans);
	return 0;
}/***/

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

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

  int n;
  cin >> n;
  double a, ans=0;
  rep(i, n){
    cin >> a;
    ans+=1/a;
  }

  printf("%.6lf\n", 1/ans);

  return 0;
}

Measured memory_bytes: 3804
A,B,C = list(map(int,input().split()))
K = int(input())

saidai = max(A,B,C)

if saidai == A:
    print(A * 2 ** K + B + C)
elif saidai == B:
    print(B * 2 ** K + A + C)
elif saidai == C:
    print(C * 2 ** K + A + B)

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

int main(){
  int r, c;
  cin >> r >> c;
  vector<vector<int>> spreadsheet(r + 1, vector<int>(c + 1));
  for(int i = 0 ; i < r; i++){
    for(int j = 0; j < c; j++){
      cin >> spreadsheet.at(i).at(j);
    }
  }
  int k, l;
  for(int i = 0; i < r; i++){
    k = 0;
    for(int j = 0; j < c; j++){
      k += spreadsheet.at(i).at(j);
    }
    spreadsheet.at(i).at(c) = k;
  }
  for(int i = 0; i <= c; i++){
    l = 0;
    for(int j = 0; j < r; j++){
      l += spreadsheet.at(j).at(i);
    }
    spreadsheet.at(r).at(i) = l;
  }
  for(int i = 0; i <= r; i++){
    for(int j = 0; j <= c; j++){
      if(j != c) cout << spreadsheet.at(i).at(j) << " ";
      else cout << spreadsheet.at(i).at(j);
    }
    cout << endl;
  }
}



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

using namespace std;

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

int H, W;
vector<string> B;

struct State {
  int x, y, turn;
};

int main() {
  cin >> H >> W;
  B.resize(H);
  for (int y = 0; y < H; y++) {
    cin >> B[y];
  }

  int countFreeSpace = 0;
  for (int y = 0; y < H; y++) {
    for (int x = 0; x < W; x++) {
      if (B[y][x] == '.') countFreeSpace++;
    }
  }

  vector<vector<int>> turns(H, vector<int>(W, -1));

  queue<State> q;
  q.emplace(State{0, 0, 1});

  while (!q.empty()) {
    auto s = q.front();
    q.pop();
    if (s.y == H - 1 && s.x == W - 1) {
      printf("%d\n", countFreeSpace - s.turn);
      return 0;
    }

    for (int d = 0; d < 4; d++) {
      int x2 = s.x + dx[d];
      int y2 = s.y + dy[d];
      int t2 = s.turn + 1;
      if (y2 < 0 || H <= y2 || x2 < 0 || W <= x2) continue;
      if (B[y2][x2] == '#') continue;
      if (turns[y2][x2] != -1) continue;

      turns[y2][x2] = t2;
      q.emplace(State{x2, y2, t2});
    }
  }

  printf("-1\n");

  return 0;
}


Measured memory_bytes: 256
# nは跳ねる回数　d1 = 1 dn+1 = dn + ln

n,x = map(int,input().split())
l = list(map(int,input().split()))

d = 0
count = 1

for y in range(n):
  d = d + l[y]
  if d <= x:
    count += 1
  else:
    break
    
print(count)
  

Measured memory_bytes: 9104
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 2000000)

	s := scanString()
	s = string('0') + s
	n := len(s)
	dp := make([][2]int, n+1)
	for i := 0; i < n+1; i++ {
		dp[i][0] = 1 << 31-1
		dp[i][1] = 1 << 31-1
	}

	dp[0][0] = 0

	for i := 0; i < n; i++ {
		for j := 0; j < 2; j++ {
			num := int(s[n-1-i]-'0')
			num += j

			for k := 0; k < 10; k++ {
				x := k-num
				if x < 0 {
					x += 10
					dp[i+1][1] = min(dp[i+1][1], dp[i][j]+k+x)
				} else {
					dp[i+1][0] = min(dp[i+1][0], dp[i][j]+k+x)
				}
				// fmt.Println(k,k+x,dp[i+1])
			}
		}
	}

	fmt.Println(dp[n][0])

}


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

#define mod 1000000007

using namespace std;
typedef long long ll; 
 
int main(void){
	
	int N;
	
	cin >> N;
	
	int A[N], B[N];
	
	for(int i=0; i<N; i++){
		cin >> A[i];
		B[i] = A[i];
	}
	
	sort(B, B+N, greater<int>());
	
	int max1 = B[0], max2 = B[1];
	
	for(int i=0; i<N; i++){
		if(A[i] == max1)
			cout << max2 << endl;
		else
			cout << max1 << endl;
	}
	
	return 0;
}

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

using namespace std;
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define i64 int64_t
#define tos(x) to_string(x)

int main() {
	double a, b, x;
	cin >> a >> b >> x;
	double c = 0;
	double ans = 0;
	double tan = 0;
	if ((x / a) > b* a/2) {
		//cout << "paturn a" << endl;
		c = 2 * (b * a - (x / a)) / a;
		tan = c / a;
		//cout << "tan=" << tan << endl;
		ans = atan(c / a)*180/3.14159265359;
	}
	else {
		//cout << "paturn b" << endl;
		c = 2*(x / a)/b;
		tan = b / c;
		//cout << "tan=" << tan << endl;
		ans = atan(b / c)*180/3.14159265359;
	}
	cout << setprecision(10) << ans << endl;
	return 0;
}


Measured memory_bytes: 384
// abc092-b.scala
object Main extends App {
  val n = io.StdIn.readInt
  val ps = io.StdIn.readLine.split(" ").map(_.toInt)
  val qs = io.StdIn.readLine.split(" ").map(_.toInt)

  val permutations = (1 to n).permutations.toArray
  val result = (permutations.indexOf(ps) - permutations.indexOf(qs)).abs
  println(result)
}

Measured memory_bytes: 66040
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    String s = sc.nextLine();
    int count1 = 0;
    int count2 = 0;
    for (int i = 0; i < s.length(); i++) {
      if (((i & 1) == 0 && s.charAt(i) == '0') || ((i & 1) == 1 && s.charAt(i) == '1')) continue;
      count1++;
    }
    for (int i = 0; i < s.length(); i++) {
      if (((i & 1) == 0 && s.charAt(i) == '1') || ((i & 1) == 1 && s.charAt(i) == '0')) continue;
      count2++;
    }
    System.out.println(Math.min(count1, count2));
  }
}


Measured memory_bytes: 23124
import numpy as np


def main():
    N = int(input())
    TXY = [[int(x) for x in input().split()] for _ in range(N)]
    TXY.insert(0, [0, 0, 0])
    d = np.diff(TXY, 1, 0)
    dd = d[:, 0] - np.abs(d[:, 1]) - np.abs(d[:, 2])
    b1 = np.all(dd >= 0)
    b2 = np.all(dd % 2 == 0)
    if b1 and b2:
        print('Yes')
    else:
        print('No')


main()


Measured memory_bytes: 34808