akhauriyash/Code-Regression huggingface dataset:
###############################################################################

from bisect import bisect_left as binl

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return map(int, input_tuple)


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


###############################################################################

counts_3 = {
  "CAA": 1,
  "CTT": 1,
  "TTT": 1,
  "GGC": 1,
  "CGT": 1,
  "GTG": 1,
  "ACC": 1,
  "GCA": 1,
  "TTC": 1,
  "TCA": 1,
  "GGT": 1,
  "GTT": 1,
  "CAG": 1,
  "AAT": 1,
  "TAA": 1,
  "TAG": 1,
  "CCA": 1,
  "GCT": 1,
  "CTA": 1,
  "TCT": 1,
  "TTG": 1,
  "ATT": 1,
  "CAT": 1,
  "GAA": 1,
  "ATA": 1,
  "CCC": 1,
  "GCG": 1,
  "TTA": 1,
  "ACA": 1,
  "AGT": 1,
  "AGG": 1,
  "AGA": 1,
  "CCG": 1,
  "ATG": 1,
  "GAG": 1,
  "AAA": 1,
  "TCC": 1,
  "AAG": 1,
  "GCC": 1,
  "ACT": 1,
  "TGG": 1,
  "CTC": 1,
  "TCG": 1,
  "TGT": 1,
  "CGC": 1,
  "TAC": 1,
  "TAT": 1,
  "CGG": 1,
  "GGG": 1,
  "TGA": 1,
  "CCT": 1,
  "AAC": 1,
  "CGA": 1,
  "GTC": 1,
  "ATC": 1,
  "GGA": 1,
  "CAC": 1,
  "CTG": 1,
  "GAT": 1,
  "TGC": 1,
  "GTA": 1
}


def main():
    n = intin()
    mod = 10**9 + 7

    all_ok = []
    not_c = []
    not_g = []
    for suffix in counts_3:
        if suffix == 'ATG' or suffix == 'AGG' or suffix == 'AAG':
            not_c.append(suffix)
        elif suffix == 'AGT':
            not_c.append(suffix)
        elif 'T' in suffix[1:]:
            #print(suffix)
            all_ok.append(suffix)
        elif suffix[1:] == 'AA' or suffix[1:] == 'GG' or suffix[1:] == 'CC':
            #print(suffix)
            all_ok.append(suffix)
        elif suffix[1:] == 'AG' or suffix[1:] == 'GA':
            not_c.append(suffix)
        elif suffix[1:] == 'AC':
            not_g.append(suffix)
        else:
            #print(suffix)
            all_ok.append(suffix)

    suffix_counts = {3: counts_3}

    for i in range(4, 101):
        prev_count = suffix_counts[i-1]
        suffix_count = {}
        for suffix, count in prev_count.items():
            if suffix in all_ok:
                charlist = ['A', 'C', 'G', 'T']
            if suffix in not_c:
                charlist = ['A', 'G', 'T']
            if suffix in not_g:
                charlist = ['A', 'C', 'T']
            for c in charlist:
                new_suffix = suffix[1:] + c
                suffix_count.setdefault(new_suffix, 0)
                suffix_count[new_suffix] += count
                suffix_count[new_suffix] %= mod
        suffix_counts[i] = suffix_count

    suffix_count = suffix_counts[n]

    #print(suffix_count)

    ans = 0
    for i, count in suffix_count.items():
        ans += count
        ans %= mod

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3828
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

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

    int a[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int count[n];
    fill(count, count+n, 0);

    for (int i = 0; i < n; i++) {
        count[a[i]-1]++;
    }

    sort(count, count+n);

    int ans = 0;
    for (int i = 0; i < n-k; i++) {
        ans += count[i];
    }

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

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<cstring>
#include<map>
#include<sstream>
#include<math.h>
 
using namespace std;

string a,b;


int main(){
  
  cin>>a>>b;
  
  double num = atoi((a+b).c_str());
  
  for(int i=1; i <= 100100; ++i){
  if(i*i == num){
  	cout<<"Yes"<<endl;
    return 0;
  }
  }
  
  cout << "No" << endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

l = []
ans = 0

for x in range(n):
    for _ in range(10000000):
        if a[x]%2 == 0 and a[x] > 0:
            a[x] = a[x]//2
            ans += 1
            continue
        else:
            l.append(ans)
            ans = 0
            break

print(min(l))

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

const int MOD = 1e9 + 7;

int modpow(int a, int n){
    int ret = 1;
    while(n>0){
        if(n&1) ret = (ret*a) % MOD;
        a = (a*a) % MOD;
        n >>= 1;
    }
    return ret;
}

signed main() {
    int n; cin >> n;
    vector<int> a(n), b(n);
    rep(i,n) cin >> a[i];
    if(n % 2 == 0){
        rep(i,n) b[i] = i/2 * 2 + 1;
    }else{
        rep(i,n) b[i] = ceiv(i,2) * 2;
    }
    
    sort(ALL(a));
    if(a == b){
        cout << modpow(2, n/2) << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 1792
N, K = map(int,input().split())

arr = [list(map(int,input().split())) for i in range(N)]

test = {}

for i in arr:
    if i[0] in test:
        test[i[0]] += i[1]
    else:
        test[i[0]] = i[1]

test = sorted(test.items())

tmp = 0
ans = 0
for i in test:
    if tmp >= K:
        break
    else:
        tmp += i[1]
        ans = i[0]
print(ans)

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

int main() {
    string s, t;
    cin >> s;
    cin >> t;

    int ans = 1000000000;
    for (size_t i = 0; i <= s.length() - t.length(); i++) {
        int sum = 0;
        for (size_t j = 0; j < t.length(); j++) {
            // tがsの部分文字列となるためには，sを何回書き換えれば良いか
            if (t.at(j) != s.at(i + j)) ++sum;
        }
        ans = min(ans, sum);
    }

    cout << ans << "\n";

    return 0;
}


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

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if(n == 0 && m == 0)
				break;
			double [][] data = new double[n][n];
			for(int i=0; i < n; i++){
				for(int j=0; j < n; j++){
					data[i][j] = sc.nextDouble();
				}
			}
			double [][] dp = new double[n][m];
			for(int i=0; i < n; i++){
				dp[i][0] = 1.0;
			}

			for(int i=1; i < m; i++){
				for(int j=0; j < n; j++){
					double max = 0;
					for(int k=0; k < n; k++){
						max = Math.max(max, dp[k][i-1] * data[k][j]);
					}
					dp[j][i] = max;
				}
			}

			//print
			double ans = 0;
			for(int i=0; i < n; i++){
				ans = Math.max(ans, dp[i][m-1]);
			}
			System.out.printf("%1.2f\n",ans);
		}
	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doIt();
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
using namespace std ;
int main()
{
    double  x , y , d , c ;
    cin >> x >> y ;
    c = x / 2 ;
    if(x >= (y*2))
        cout << x - (y*2) ;
    else
        cout << 0 ;

    return 0 ;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n >> s;
  bool ok = 1;
  if(n%2 != 0){
    cout << "No";
    return 0;
  }
  for(int i = 0;i<n/2;i++){
    if(s[i]!=s[i+n/2]){
      ok  = 0;
      break;
    }
  }
  if(ok == 0){cout << "No";}
  else cout << "Yes";
  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [0 for _ in range(n)]
for _ in range(m):
  a, b = map(int, input().split())
  l[a-1] = max(l[a-1], h[b-1])
  l[b-1] = max(l[b-1], h[a-1])

ans = 0
for i in range(n):
  if(h[i] > l[i]):
    ans += 1
print(ans)

Measured memory_bytes: 20108
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1000000007;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecb vector<bool>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, size_t second_itr) {
	std::string tmp;
	for (size_t i = first_itr; i < second_itr + 1; i++) {
		tmp.push_back(str.at(i));
	}
	return tmp;
}


int main() {
	int n, m; cin >> n >> m;
	int sum = 0;
	rep(i, m) {
		int tmp; cin >> tmp;
		sum += tmp;
	}
	int ans = n - sum;
	cout << (ans < 0 ? -1 : ans) << endl;


	return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MAX max<ll>
#define MIN min<ll>
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define drop(x) cout << (x) << '\n', exit(0)
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
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; }
ll devc(ll x, ll y) { return (x + y - 1) / y; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll N;
    cin >> N;
    string S;
    cin >> S;
    map<char, ll> mp;
    for(auto s : S) ++mp[s];
    ll ans = mp['R'] * mp['G'] * mp['B'];

    rep(i, N) rep(j, N) if(i < j){
        ll k = 2 * j - i;
        if(k < N) if(S[i] != S[j] and S[j] != S[k] and S[k] != S[i]) --ans;
    }

    print(ans);

    return 0;
}

Measured memory_bytes: 3644
package main

import "fmt"

func main() {
	var A, B, C, D, E, F, WW, WS int
	fmt.Scan(&A, &B, &C, &D, &E, &F)
	var max, d float64 = 0.0, 0.0
	for i := 0; 100*A*i <= F; i++ {
		for j := 0; 100*B*j+100*A*i <= F; j++ {
			ww := 100 * (A*i + B*j)
			mws := (A*i + B*j) * E
			for k := 0; C*k <= mws && C*k <= F-ww; k++ {
				for l := 0; C*k+D*l <= mws && D*l <= F-ww-C*k; l++ {
					ws := C*k + D*l
					if k == 0 && l == 0 {
						d = 0.0
					} else {
						d = float64(ws) / float64(ww+ws)
					}
					if d > max {
						max = d
						WW = ww
						WS = ws
					}
				}
			}
		}
	}
	if max == 0.0 {
		fmt.Println(100*A, 0)
	} else {
		fmt.Println(WW+WS, WS)
	}
}


Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;

class A {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final int[] abcd = new int[4];
        Arrays.setAll(abcd, i -> sc.nextInt());
        Arrays.sort(abcd);
        System.out.println(Math.abs(abcd[0] + abcd[3] - abcd[1] - abcd[2]));
    }
}

public class Main {
    public static void main(String... args) {
        A.main();
    }
}



Measured memory_bytes: 32032
while True:
  a,b = map(int,input().split())
  if a == 0 and b ==0:
    break
  else:
     for i in range(a):
        if i % 2 == 0:
          l = []
          for j in range(b):
            if j % 2 == 0:
              l.append( '#')
            else :
              l.append('.')
          for x in l:
            print(x, end = '')
          print()  
        
        
        if i % 2 == 1:
          l = []
          for j in range(b):
            if j % 2 == 0:
              l.append( '.')
            else :
              l.append('#')
          for x in l:
            print(x, end = '')
          print()  
     print()      




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

int a[20004],b[20004],p[20004];

int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>p[i];

    int f=30000;
    for(int i=1;i<=n;i++)
    {
        a[i]=f*i;
        b[i]=(n-i+1)*f;
    }

    for(int i=1;i<=n;i++)
    {
        //cout<<p[i]<<" ";
        a[p[i]]+=i;
    }

    for(int i=1;i<=n;i++)
        cout<<a[i]<<" ";
    cout<<"\n";
    for(int i=1;i<=n;i++)
        cout<<b[i]<<" ";
    return 0;
}


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

int main() {
  int64_t a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  if (v * t >= w * t + max(a - b, b - a)) {
    cout << "YES" << endl;
  }
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 3624
#define pb push_back
#define MX 1e3
#define ll long long
#define mod 1000000009
#define ff first
#define ss second
#define for1(i,n) for(int i=1;i<=n;i++)
#define for0(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[]) {
  ll a,b,c,k,t;
  cin>>a>>b>>c>>k;
  t = a-b;
  if(k%2){
    t*=-1;
    cout<<t<<endl;
  }
  else{
    cout<<t<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
  int n,k,i,mx=0,p;
  cin>>k>>n;
  vector<int> V(n);
  for(i=0;i<n;i++)
    cin>>V[i];
  sort(V.begin(),V.end());
  for(i=0;i<n-1;i++)
  {
    if(mx<V[i+1]-V[i])
      mx=V[i+1]-V[i];
  }
  p=V[n-1]-V[0];
  p=k-p;
  mx=max(mx,p);
  cout<<k-mx;
}

Measured memory_bytes: 1152
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//aとbの大きい方

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//aとbの小さい方

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//aとbの差の絶対値

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	ll r;
	r = b%a;
	if (r == 0)return a;
	else return gcd(r, a);

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

int main() {

	int N;
	cin >> N;
	if (N % 3 == 0)cout << N / 3 << endl;
	else if (N % 3 == 1)cout << (N - 1) / 3 << endl;
	else cout << (N - 2) / 3 << endl;

	return 0;
}

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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                     \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(NULL);
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...)       \
	F_ORC(__VA_ARGS__) \
	(__VA_ARGS__)

#define E_ACH2(x, a) for (auto &x : a)
#define E_ACH3(x, y, a) for (auto &[x, y] : a)
#define E_ACH4(x, y, z, a) for (auto &[x, y, z] : a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...)       \
	E_ACHC(__VA_ARGS__) \
	(__VA_ARGS__)

template <typename A, typename B>
inline void chmin(A &a, B b)
{
	if (a > b)
		a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b)
{
	if (a < b)
		a = b;
}

int main()
{
	fast;
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans = max({b * d, a * d, a * c, b * c});
	if (ans < 0 && (a <= 0 && b >= 0 || c <= 0 && d >= 0))
	{
		ans = 0;
	}
	cout << ans;
}

Measured memory_bytes: 3656
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll N;cin>>N;
	ll head_b = 0, tail_a = 0, ab_cnt = 0, double_ab = 0;
	rep(i,N){
		string s; cin>>s;
		if(s[0] == 'B' && s[s.size()-1] == 'A') ++double_ab;
		else if(s[0] == 'B') ++head_b;
		else if(s[s.size()-1] == 'A') ++tail_a;
		rep(j,s.size()-1){	
			if(s[j] == 'A' && s[j+1] == 'B') ++ab_cnt;
		}
	}
	if((tail_a != 0 || head_b != 0) && double_ab>0){tail_a++; head_b++;}
	ll ans = ab_cnt + max(double_ab-1LL,0LL) + min(tail_a, head_b);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
	if (!b)return a;
	return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
	return (a * b) / ll_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
//	long i, r;
//	if (a % 2 == 0) {
//		pf[pc] = 2; pc++;
//		return(_pfact(a / 2));
//	}
//	r = sqrt(a);
//	for (i = 3; i <= r; i += 2) {
//		if (a % i == 0) {
//			pf[pc] = i; pc++;
//			return(_pfact(a / i));
//		}
//	}
//	if (a != 1) {
//		pf[pc] = a; pc++;
//	}
//	return 0;
//
//}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
	int bit;

	for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
		if (0 != (uc & 1))++bit;

	return bit;
}//bitco

#pragma endregion

// ABC086 A-Product

int main(void) {
	int a,b;
	
	scanf("%d %d", &a, &b);
	(a*b%2)?printf("Odd\n"):printf("Even\n");
	return 0;
}

Measured memory_bytes: 1648
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    S = ns()
    ans = 0
    for i in range(1, n - 1):
        X = S[:i]
        Y = S[i:]
        tmp = len(set(X) & set(Y))
        ans = max(ans, tmp)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9076
#include <iostream>

int main() {
  int N, Y;
  std::cin >> N >> Y;

  if ([&] {
    for (int i = 0; i * 10000 <= Y && i <= N; i++) {
      for (int j = 0; i * 10000 + j * 5000 <= Y && i + j <= N; j++) {
        for (int k = 0; i * 10000 + j * 5000 + k * 1000 <= Y && i + j + k <= N; k++) {
          if (i * 10000 + j * 5000 + k * 1000 == Y && i + j + k == N) {
            std::cout << i << " " << j << " " << k << std::endl;
            return false;
          }
        }
      }
    }

    return true;
  }()) {
    std::cout << "-1 -1 -1" << std::endl;
  }
}


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

using namespace std;

#define INF ((1<<30)-1)  //int32_t
#define MOD 1000000007
#define MOD2

#define all(a)  (a).begin(),(a).end()

#define mkp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main(){

    bool flag=true;
    ll ans=0,sum=0;

    int h,w;
    cin >>h>>w;
    vector<string> s(h);
    vector<vector<int>> num(h,vector<int>(w,0));

    for (int i = 0; i < h; i++){
        cin >>s[i];
    }
    

    for (int i = 0; i < h; i++){
        int st=0,j = st,count=0;

        while(j < w){
            //cout << i << " " << j << endl;
            
            count=0;
            st = j;

            if(s[i][j] == '.'){
                while(s[i][j] == '.' && j < w){
                    ++count;
                    if(++j >= w)break;
                }

                for (int k = st; k < j; k++){
                    num[i][k] += count;
                }

            }else{
                num[i][j] += count;
                ++j;
            }

        }
    }
    
    for (int j = 0; j < w; j++){
        int st=0,i = st,count=0;

        while(i < h){
            //cout << i << " " << j << endl;

            count=0;
            st = i;

            if(s[i][j] == '.'){
                while(s[i][j] == '.'){
                    //cout << i << " " << j << endl;
                    ++count;
                    if(++i >= h)break;
                }

                for (int k = st; k < i; k++){
                    num[k][j] += count;
                }

            }else{
                num[i][j] += count;
                ++i;
            }

        }
    }

    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            //cout << num[i][j] << " ";
            ans = max(ans,(ll)num[i][j]);
        }
    }
    

    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans-1 << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 20096
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF=1e9+7;
typedef long long ll;
typedef pair<ll,ll> P;

int main() {
	ll N,A,r=0;
	cin >> N;
	vector<P> c(N);

	rep(i,N) {
		cin >> A;
		if(i-A >= 0)
			++c.at(i-A).second;
		if(i+A < N)
			++c.at(i+A).first;
	}

	rep(i,N)
		r += c.at(i).first*c.at(i).second;
	cout << r << endl;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> number1(M);
  vector<int> number2(M);
  vector<int> sum(N);
  for(int i = 0; i < M; i++){
    cin >> number1.at(i) >> number2.at(i);
  }
  for(int i = 0; i < N; i++){
    for(int a = 0; a < M; a++){
      if(number1.at(a) == i + 1){
        sum.at(i)++;
      }
      if(number2.at(a) == i + 1){
        sum.at(i)++;
      }
    }
    cout << sum.at(i) << endl;
  }
}


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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MAX_N = 20;
int n;
int h[MAX_N];

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n;
  forn(i,n) cin >> h[i];

  int res = 0;
  int max_h = 0;
  forn(i,n) {
    if (max_h <= h[i]) res++;
    chmax(max_h,h[i]);
  }

  cout << res << endl;


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

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

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

ll soin(ll n){
    ll s=0;
    while(n%2==0){
        n/=2;
        s++;
    }
    return s;
}

int MAX_N=10000;

int main(){
    ios::sync_with_stdio(false);
    ll n,ans=0;
    ll a[MAX_N];
    cin >> n;
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        ans+=soin(a[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
/********************************************//**
 ****** Handle: techno_phyle    *****************
 ***********************************************/

#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;
#define mod 1000000007
#define N 100010
#define M 200010
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto it:a) cout << it << " "; cout << endl
#define adbp(a) for(auto it:a) cout << it.first << " " << it.second << endl
#define pb push_back
#define mp make_pair
#define endline "\n"
#define in(x) scanf("%d",&x);
const ll INF = 1e18L + 5;
const int inf = 1e9 + 5;
typedef pair<double, long> key;
struct comp {
	bool operator()(pair<int, int> p1, pair<int, int> p2) {
		if (p1.first < p2.first) return false;
		if (p2.first < p1.first) return true;
		return p1.second < p2.second;
	};
};
//greater<pair<int,int> , greater<int>>
//ll a[M];

ll power(ll x, ll y , ll m)
{
	ll temp;
	if ( y == 0)
		return 1;
	temp = power(x, y / 2 , m);
	if (y % 2 == 0)
		return (temp * temp) % m;
	else
		return (x * (temp * temp) % m) % m;
}

int main() {
	fastIO;
	int test = 1;
	//cin >> test;
	while (test--) {
		string s;
		cin >> s;
		if (s[s.length() - 1] == 's') s += "es";
		else s += 's';
		cout << s << endl;
	}
	return 0;
}





Measured memory_bytes: 3616
#!/usr/bin/python3
#coding: utf-8

S = input()
ret = 0

# 山を下る
i = 0
while i < len(S) and S[i] == ">":
    i += 1
    ret += i

# 山を登って降りる
n_up = 0
n_down = 0
while i < len(S):
    n_up = 0
    n_down = 0
    while i < len(S) and S[i] == "<":
        n_up += 1
        i += 1
        if i >= len(S):
            break
    while i < len(S) and S[i] == ">":
        n_down += 1
        i += 1
        if i >= len(S):
            break
    if n_up < n_down:
        n_up, n_down = n_down, n_up

    ret += ((n_up+1) * n_up) // 2
    ret += (n_down * (n_down-1)) // 2
    
print(ret)

Measured memory_bytes: 9880
N = int(input())
P = list(map(int,input().split()))
A = []
for n in range(N):
  A.append(n+1)

count = 0
for n in range(N):
  if A[n] != P[n]:
    count += 1
if count == 0 or count == 2:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;


int main(){
  int n;  cin >> n;
  vector<ll> a(n);
  for(int i=0; i<n; i++)  cin >> a.at(i);
  sort(a.begin(), a.end());

  ll ans=1e+15;
  for(int i=a[0]; i<=a.back(); i++){
    ll tmp=0;
    for(auto x: a)
      tmp += pow(x-i, 2.0);
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626 
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;
// vector<int> arr[100010],children[100010];
// int n,mod;
// pair<int,int> down[100010],up[100010];
// vector<pair<int,int>> downs[100010],pref[100010],suff[100010];
// pair<int,int> merge(pair<int,int> arr,pair<int,int>arr2)
// {
// 	int a=(arr.ff*arr2.ff)%mod;
// 	int b=(((arr.ss*(arr2.ff+arr2.ss))%mod)+arr.ff*arr2.ss)%mod;	
// 	return make_pair(a,b);
// }
// pair<int,int> process(pair<int,int> a)
// {
// 	return mp(a.ff,(a.ff+a.ss)%mod);
// }
// void dfs_one(int v,int par)
// {
// 	pair<int,int> res{1,0};

// 	for(auto itr:arr[v])
// 	{
// 		if(itr!=par)
// 		{
// 			//do something
// 			children[v].pb(itr);
// 			dfs_one(itr,v);
// 			res=merge(res,down[itr]);
// 			downs[v].pb(down[itr]);
// 		}
// 	}
// 	down[v]=process(res);
// }
// void dfs_two(int v,int par)
// {
// 	pair<int,int> res{1,0};
// 	for(int i=0;i<arr[v].size();i++)
// 	{

// 	}
// }

// cin>>n>>mod;
// 	for(int i=1;i<n;i++)
// 	{
// 		int x,y;
// 		cin>>x>>y;
// 		arr[x].pb(y);
// 		arr[y].pb(x);
// 	}

// 	dfs_one(1,-1);	

// 	// suffix sum and prefix sum
// 	for(int i=1;i<=n;i++)
// 	{
// 		pair<int,int> a{1,0};
// 		for(int j=0;j<downs[i].size();j++)
// 		{
// 			a=merge(a,downs[i][j]);
// 			pref.pb(a);
// 		}
// 		a={1,0};
// 		for(int j=(downs[i].size()-1);j>=0;j--)
// 		{
// 			a=merge(a,downs[i][j]);
// 			suff.pb(a);
// 		}
// 		reverse(all(suff));
// 	}
// 	dfs_two(1,-1);


// const int nax=2e5+5;
// vector<pair<int,int>> arr[nax];
	
	//https://leetcode.com/problems/word-ladder-ii/
	//https://leetcode.com/problems/sum-of-subarray-minimums/
	//https://leetcode.com/problems/subsets-ii/discuss/30168/C%2B%2B-solution-and-explanation	

	// int n,m;
	// cin>>n>>m;
	// for(int i=0;i<m;i++)
	// {
	// 	int a,b,c;
	// 	cin>>a>>b>>c;
	// 	arr[b].pb(mp(a,c));
	// }
	// for(int i=1;i<=n;i++)
	// {
		
	// }
int dp[100010],dp1[100010];
signed main() {

	fastio();
	//#define LOCAL_DEFINE	
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	int n,k,q;
	cin>>n>>k>>q;
	for(int i=0;i<q;i++)
	{
		int a;
		cin>>a;
		dp1[a]++;
		dp[0]--;
		dp[n+1]++;
	}	
	for(int i=1;i<=n;i++)
	{
		dp[i]+=dp[i-1];
		
		
		if(abs(dp[i]+dp1[i])>=k)
		{
			cout<<"No"<<endl;
		}else{
			cout<<"Yes"<<endl;
		}
	}
 	return 0;
}


Measured memory_bytes: 2176
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.Set;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskA {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int[] a = new int[3];
			for (int i = 0; i < 3; i++) {
				a[i] = in.nextInt();
			}
			Arrays.sort(a);
			Set<String> was = new HashSet<>();
			for (int step = 0; ; step++) {
				for (int i = 0; i < 3; i++) {
					if (a[i] % 2 != 0) {
						out.println(step);
						return;
					}
				}
				int[] na = new int[3];
				for (int i = 0; i < 3; i++) {
					na[i] = (a[(i + 1) % 3] + a[(i + 2) % 3]) / 2;
				}
				a = na;
				String key = a[0] + " " + a[1] + " " + a[2];
				if (was.contains(key)) {
					out.println(-1);
					return;
				}
				was.add(key);
			}
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

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

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

	}
}



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

int main() {
    long w, h, x, y;
    cin>>w >>h >>x >>y;
    if(w%2==0 || h%2==0){
        if(x*2==w && y*2==h){
            cout<<w*h/2<<" "<<1<<endl;
        }else{
            cout<<w*h/2<<" "<<0<<endl;
        }
    }else{
        cout<<w*h/2<<".5 "<<0<<endl;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
const int maxn = 1<<20, mod = 924844033;
int c[maxn], r[maxn], n, m;
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> m;
	for(int i = 1; i <= n; i++) c[i] = 1;
	r[1] = 1;
	for(int x, y, i = 0; i < m; i++) {
		cin >> x >> y;
		r[y] |= r[x];
		if(--c[x] == 0) {
			r[x] = 0;
		}
		c[y]++;
	}
	int ans = 0;
	for(int i = 1; i <= n; i++) ans += r[i];
	cout << ans;
}


Measured memory_bytes: 2688
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion


void Main();
void solve(long long N, std::vector<long long> A, long long Q, std::vector<long long> B, std::vector<long long> C);

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> B(Q);
    std::vector<long long> C(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&B[i]);
        scanf("%lld",&C[i]);
    }
    solve(N, std::move(A), Q, std::move(B), std::move(C));
}

void solve(long long N, std::vector<long long> A, long long Q, std::vector<long long> B, std::vector<long long> C){
    vec<int> memo(100000+100);
    ll sum = 0;
    REP(i, N){
        memo[A[i]]++;
        sum += A[i];
    }
    REP(i, Q){
        sum -= B[i] * memo[B[i]];
        sum += C[i] * memo[B[i]];
        memo[C[i]] += memo[B[i]];
        memo[B[i]] = 0;
        cout << sum << el;
    }
}



Measured memory_bytes: 5836
n = gets.chomp.to_i
a_b = []
n.times do
  a, b = gets.chomp.split.map(&:to_i)
  a_b << [a,b]
end
# p a_b
a_b_s = a_b.sort do  |x, y|
  if x[1] == y[1]  then
    y[0] <=> x[0]
  else
    x[1] <=> y[1]
  end
end
sum = 0
f = true
a_b_s.each do |x|
  sum = sum + x[0]
  if sum > x[1] then
    f = false
  end
end
if f then
  puts 'Yes'
else
  puts 'No'
end

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

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MX = 0; //最大値

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define PB push_back
#define F first
#define S second

int main(){
    ll A; long double B; cin >> A >> B;
    ll c = B*100 + 0.1;
    ll ans = A * c / 100;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3728
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val ta = List.fill(n)((sc.nextInt(), sc.nextInt()))
  var tNow = 1L
  var aNow = 1L
  for ((t, a) <- ta) {
    val tf = (tNow+t-1) / t
    val af = (aNow+a-1) / a
    tNow = t * tf.max(af)
    aNow = a * tf.max(af)
  }

  println(tNow + aNow)
}


Measured memory_bytes: 55696
n = int(input())
s = [int(input()) for _ in range(n)]
notten = sorted([i for i in s if i%10]) 
ten = [i for i in s if i%10==0] 
if notten:
    for j in range(len(notten)):
        if sum(notten[j:])%10:
            print(sum(ten)+sum(notten[j:]))
            break
        
else:
    print(0)

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

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

//read_kaisetu
int main() {
    string s;cin>>s;
    int n = s.size();
    int ans = n + 1;
    rep(i,n-1){
        if(s[i+1]!=s[i])ans = min(ans, max(i + 1, n - i -1));
    }
    if(ans == n + 1)ans = n;
    cout<<ans<<endl;
	return 0;
}

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

// ---------------------------template starts here-------------------------- 

#define int long long int
#define pb push_back
#define MAX LLONG_MAX
#define endl "\n"
#define precise std::cout << std::fixed;std::cout << std::setprecision(6); 
#define zerobits(x) __builtin_ctzll(z)
#define print(v) for(int x : v) cout << x << endl;
#define F first
#define S second  
#define mp make_pair
#define MIN LLONG_MIN
#define MOD 1000000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

set <int> s;
bool ar[100001];
void seive() {
    ar[0] = ar[1] = true;

    for(int p=2; p*p<=100001; p++) {
        if(ar[p] == false) {
            for(int i=p*p;i<=100001;i+=p)
                ar[i] = true ;
        }
    }

    for(int p=2;p<=100001;p++) {
        if(ar[p] == false)
            s.insert(p);
    }
}

bool is_palindrome(string str) {
    int len = str.length();
    for(int i=0;i<=len/2;i++) {
        if(str[i] != str[len-1-i])
            return false;
    }
    return true;
}

int binexpo(int x, int y, int p) {    
    int res = 1;     // Initialize result  
    x = x % p; // Update x if it is more than or  
                // equal to p  

    while (y > 0)  {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;
}

bool is_prime(int n) {
    if(n < 2)
        return false;
    if(n == 2 || n == 3)
        return true;
    for(int i=2;i*i<=n;i++) {
        if(n%i == 0)
            return false;
    }
    return true;
}

bool sortbydec(const pair <int, int> &a, const pair <int, int> &b) {
    return (a.first > b.first);
}

// --------------------------template ends here------------------------------

void solve() {
    
    int t;
    // cin >> t;
    t = 1;
    while(t--) {
        int n, k;
        cin >> n >> k;

        int count = 0;

        for(int i=k;i<=n;i++) {
            
            int minval = (i*(i-1))/2;
            
            int a = (n*(n+1))/2;
            
            int b = ((n-i)*(n-i+1))/2;
            
            int maxval = (a - b);

            count = count % MOD + ((maxval - minval) + 1) % MOD;
        
            count = count % MOD; 
        
            // cout << minval << " " << maxval << endl;
        }

        count++;
        cout << count % MOD << endl;
    }    

    return;    
}

int32_t main() {
    
    FO;
    
    auto start = std::chrono::high_resolution_clock::now();

    solve();
    
    auto finish = std::chrono::high_resolution_clock::now();  
    std::chrono::duration<double> elapsed = finish - start;
    cerr << "Elapsed time: " << elapsed.count() << " s\n";

}

Measured memory_bytes: 3812
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func floatSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	l := iSScan(n)
	ans := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			for k := j + 1; k < n; k++ {
				if l[i] != l[j] && l[j] != l[k] && l[k] != l[i] {
					x := max([]int{l[i], l[j], l[k]})
					if x < sum([]int{l[i], l[j], l[k]})-x {
						ans++
					}
				}
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1776
N = int(input())

list = input().split(" ")
num_list = []

for num in list:
    num_list.append(int(num))

num_list.sort(reverse=True)
total = 0
count = 0
for i in range(N*3):
    if i % 2 == 1 and count < N:
        total += num_list[i]
        count += 1
        
print(total)

Measured memory_bytes: 41156
import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }

void main() {
  auto N = readln.chomp;

  void solve() {
    ulong answer;
    bool nextKetaUp;
    auto keta = N.length;
    foreach(i; 0..keta) {
      auto num = N[$-1-i..$-i].to!(int) + (nextKetaUp ? 1 : 0);
      if (num == 10) continue;

      nextKetaUp = false;

      if (i < keta-1) {
        auto next = N[$-2-i..$-1-i].to!(int);
        if (num >= 5 && next >= 5) {
          answer += 10 - num;
          nextKetaUp = true;
          continue;
        }
      }

      if (num >= 6) {
        answer += 10 - num;
        nextKetaUp = true;
        continue;
      }

      answer += num;
    }
    if (nextKetaUp) answer++;

    writeln(answer);
  }

  solve();
}


Measured memory_bytes: 4092
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class ECrestedIbisVsMonster {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int h, n; cin >> h >> n;
      vector<int> a(n), b(n);
      rep(i, n) {
        cin >> a[i] >> b[i];
      }

      vector<int> dp(30001, INT_MAX/2);
      dp[0] = 0;
      rep(i, n) {
        for(int j=0; j+a[i]<=30000; j++) {
          chmin(dp[j+a[i]], dp[j]+b[i]);
        }
      }

      int ans = INT_MAX/2;
      debug(dp[10]);
      for(int i=h; i<=30000; i++) {
        chmin(ans, dp[i]);
      }

      cout << ans << endl;
    }
};

signed main() {
  ECrestedIbisVsMonster solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 1020
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
using namespace std;
#define FOR(S,F) for(int i=S;i<F;i++)
#define FOR2(S,F) for(int j=S;j<F;j++)
using ull=long long int;
int main() {
	int m, n;
	cin >> m;
	cout << !m << endl;
	return 0;
}

Measured memory_bytes: 3632