akhauriyash/Code-Regression huggingface dataset:
BTC_RATE = 380000.0

N = input()
N = int(N)

x_list, u_list = [],[]
for i in range(N):
	x, u = list(input().split())
	x_list.append(float(x))
	u_list.append(u)

ans = 0.0
for x,u in zip(x_list, u_list):
	if u == "JPY":
		ans += x
	else:
		ans += x * BTC_RATE

print(ans)

Measured memory_bytes: 3064
n = int(input())
p = list(map(int,input().split()))

flag = True
for i in range(n):
    for j in range(i+1,n):
        tmp = p[i]
        p[i] = p[j]
        p[j] = tmp
        if p == sorted(p):
            print('YES')
            flag = False
            tmp = p[i]
            p[i] = p[j]
            p[j] = tmp
            break
        tmp = p[i]
        p[i] = p[j]
        p[j] = tmp

if p == sorted(p):
    print('YES')
    flag = False

if flag:
    print('NO')


Measured memory_bytes: 3064
n, x = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)

ans = 0
if a[0] > x
    ans += a[0] - x
    a[0] -= a[0] - x
end
for i in 0..(n-2)
    if a[i] + a[i+1] > x
        ans += a[i] + a[i+1] - x
        a[i+1] -= a[i] + a[i+1] - x
    end
end

puts ans

Measured memory_bytes: 9612
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  int n;
  cin>>n;
  if(n%1000==0)
  {
    cout<<"0";
  }
  else
  {
    int temp=n/1000;
  	cout<<(temp+1)*1000-n;
  }
  return 0;
}

Measured memory_bytes: 3468
n = int(input())
adj = [[0 for i in range(n)] for j in range(n)]

for i in range(n):
    tmp = list(map(int, input().split()))
    u = tmp[0]
    u = u -1
    k = tmp[1]
    v = tmp[2:]
    for j in range(k):
        adj[u][v[j]-1] = 1
        
for i in range(n):
        print(" ".join(list(map(str, adj[i]))))

Measured memory_bytes: 7732
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

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

  int count = 1;
  rep(i, n - 1) {
    if (s.at(i) != s.at(i + 1)) {
      count++;
    }
  }
  cout << count;
  return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(p => int.Parse(p)).ToArray();

        var N = line[0];
        var K = line[1];

        var S = Console.ReadLine().ToArray();

        S[K - 1] = S[K-1].ToString().ToLower()[0];
        string ans = "";
        for(int i = 0;i<N;i++)
        {
            ans = ans + S[i];
        }
        Console.WriteLine(ans);
    }
}




Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
constexpr long long INF = 1e18;

int main() {
  int n;
  cin >> n;
  long long cur = 1;
  vector<long long> a(n);
  for(int i = 0; i < n; ++i) cin >> a.at(i);
  sort(a.begin(), a.end());
  for(int i = 0; i < n; ++i) {
    if (a.at(i) == 0) {
      cur = 0;
      break;
    }
    else if (cur <= INF / a.at(i)) {
      cur *= a.at(i);
    }
    else {
      cur = -1; 
      break;
    }
  }
  cout << cur << endl;
}


Measured memory_bytes: 4052
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int l, r;
            int[] arr1 = new int[n + 1], arr2 = new int[n + 1];

            for (int i = 0; i < m; i++) {
                l = in.nextInt();
                r = in.nextInt();
                if (l == 1) {
                    arr2[r] = 1;
                }
                if (r == n) {
                    arr1[l] = 1;
                }
            }
            int index = -1;
            for (int i = 2; i < n; i++) {
                if (arr1[i] == 1 && arr2[i] == 1) {
                    out.println("POSSIBLE");
                    index = 1;
                }
            }
            if (index == -1) {
                out.println("IMPOSSIBLE ");
            }
        }

    }
}



Measured memory_bytes: 98768
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <set>
#include <map>
#include <math.h>
#include <bitset>
#include <vector>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

typedef long long ll;

const ll INF = 1e18, MOD = 1e9 + 7;
const int INT_MAX = 1e9;

ll n, k;

ll d[100000][3], a[100000][3];

int main () 
{
	cin >> n;

	for (int i = 0; i < n; i++)
		for (int j = 0; j < 3; j++)
			scanf ("%lld", &a[i][j]);

	for (int i = 0; i < 3; i++)
		d[0][i] = a[0][i];

	for (int i = 1; i < n; i++)
	{
		d[i][0] = a[i][0] + max (d[i-1][1], d[i-1][2]);
		d[i][1] = a[i][1] + max (d[i-1][0], d[i-1][2]);
		d[i][2] = a[i][2] + max (d[i-1][0], d[i-1][1]);
	}

	cout << max (d[n-1][0], max (d[n-1][1], d[n-1][2]));
}

Measured memory_bytes: 4992
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

sum = math.ceil(a/10)+math.ceil(b/10)+math.ceil(c/10)+math.ceil(d/10)+math.ceil(e/10)
sum = sum*10

a = min((a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10)+1

sum = sum - (10-a)
print(sum)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { cout << "ERROR" << num << endl; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};


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

    int N;
    cin >> N;
    vector<int> h(N);
    rep(i,N) cin >> h[i];

    vector<int> dp(N+5, INF32);
    dp[0] = 0;

    for(int i = 1; i < N; i++){
        if(i-1>=0) dp[i] = min(dp[i], dp[i-1]+abs(h[i]-h[i-1]));
        if(i-2>=0) dp[i] = min(dp[i], dp[i-2]+abs(h[i]-h[i-2]));
    }

    cout << dp[N-1] << endl;

}

Measured memory_bytes: 3992
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int i;
	int arr[n];
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	int ans[n];
	ans[0]=0;
	ans[1]=abs(arr[1]-arr[0]);
	if(n>2)
	{
		ans[2]=abs(arr[2]-arr[0]);
	}
	for(i=3;i<n;i++)
	{
		int x=abs(arr[i]-arr[i-1])+ans[i-1];
		int y=abs(arr[i]-arr[i-2])+ans[i-2];
		ans[i]=min(x,y);
	}
	cout<<ans[n-1];
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


//ABC081_b
int main() {
	int N;
	cin >> N;

	vector<int> vec(N);
	rep(i, N) {
		cin >> vec.at(i);
	}

	int cnt = 0;
	bool divide = true;
	while (divide) {

		rep(i, N) {
			if (vec.at(i) % 2 == 0) {
				vec.at(i) /= 2;
			}
			else {
				divide = false;
			}
		}
		if (divide) {
			cnt += 1;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
 
void solve(){
    int n,k;
    cin >> n >> k;
    if(n == 0){
        cout << 1;
        return;
    }
    int cnt = 0;
    while(n > 0){
        cnt ++; 
        n /= k;
    }
    cout << cnt;
}
 
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1000000007
#define PI 3.14159265

#define MAX 100001


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n , k;
    cin >> n >> k;
    if (n % k == 0) {
        cout << "0" << endl;
    }
    else {
        cout << "1" << endl;    
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int         long long
#define endl        "\n"
#define pii         pair<int, int>

const int mod = 1e9+7;

unsigned long long power(unsigned long long x, 
                         int y, int p) 
{ 
    unsigned long long 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; 
} 
  
// Returns n^(-1) mod p 
unsigned long long modInverse(unsigned long long n, int p) 
{ 
    return power(n, p - 2, p); 
} 
  
// Returns nCr % p using Fermat's little 
// theorem. 
unsigned long long C(unsigned long long n, 
                                 int r, int p) 
{ 
    // Base case 
    if (r == 0) 
        return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    long long fac[n + 1]; 
    fac[0] = 1; 
    for (int i = 1; i <= n; i++) 
        fac[i] = (fac[i - 1] * i) % p; 
  
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p; 
}
 
 
void solve(int TC) { 
    int x, y; cin >> x >> y;
    int sum = x+y;
    if(sum%3) {
        cout << 0 << endl; return;
    }
    int n = sum/3;
    int h = x-n;
    int v = y-n;
    if(h<0 || v<0) {
        cout << 0 << endl; return;
    }
    cout << C(n, h, mod) << endl;

}
 
signed main() {
 
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);
 
 
    int T = 1;
    //cin >> T;
    for(int i=1; i<=T; i++) {
        solve(i);
    }
    return 0;
 
}

Measured memory_bytes: 8852
#include <iostream>
using namespace std;
int main(void){

	double x1,x2,x3,x4,y1,y2,y3,y4, tmp1, tmp2, tmp3, tmp4;
	char c;
	while (cin>>x1>>c>>y1>>c>>x2>>c>>y2>>c>>x3>>c>>y3>>c>>x4>>c>>y4){
		tmp1 = (y2-y1)*(x3-x1)-(y3-y1)*(x2-x1);
		tmp2 = (y4-y1)*(x3-x1)-(y3-y1)*(x4-x1);
		
		tmp3 = (y1-y2)*(x4-x2)-(y4-y2)*(x1-x2);
		tmp4 = (y3-y2)*(x4-x2)-(y4-y2)*(x3-x2);
		if (tmp1*tmp2<0 && tmp3*tmp4<0) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

int main(){
	int h,w,k; cin>>h>>w>>k;
	vector<string> C(h);
	rep(i, h) cin>>C[i];
	int ans = 0;
	rep(bit, 1<<(h+w)){
		int c = 0;
		for(int i=w; i<h+w; ++i) rep(j,w)
			if(bit>>i & 1 && bit>>j & 1 && C[i-w][j] == '#') c++;
		if(c == k) ans++;
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<math.h>
#include<vector>
#include <iostream>
#include <algorithm>

using namespace std;

int N;
int k;
vector<int> L;
int sum=0;

int main(){
scanf("%d",&N);
for(int i=0;i<N*2;i++){
scanf("%d",&k);
L.push_back(k);
}
sort(L.begin(),L.end());
for(int i=0;i<N;i++){
sum+=L[i*2];
}
printf("%d",sum);

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define Rrep(i,y,x) for(ll i=y;i>x;i--)
#define SIZE(a) ll(a.size())
#define vll vector<ll>
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define print(x) cout << (x) << endl;
typedef long long ll;
using namespace std;
ll mod=1e9+7;

int main(){
    ll N,A,B;
    ll inf=1e15;
    cin>>N>>A>>B;
    vector<vector<ll>> dp(N+1,vector<ll>(N+1,inf));
    dp[0][0]=0;
    vector<ll> P(N);
    rep(i,0,N){
        ll b;
        cin>>b;
        P.at(i)=b;
    }
    rep(i,1,N+1){
        rep(j,0,N+1){
            if (j < P[i-1]){
                dp[i][P[i-1]]=min(dp[i][P[i-1]],dp[i-1][j]);
                dp[i][j]=min(dp[i][j],dp[i-1][j]+A);
            }
            else{
                dp[i][j]=min(dp[i][j],dp[i-1][j]+B);
            }
        }
    }
    ll ans=inf;
    rep(i,0,N+1){
        ans=min(ans,dp[N][i]);
    }
    print(ans);

}

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

int main(void)
{
    int n;
    cin >> n;
    vector<int> w(n);
    for (int i = 0; i < n; i++)
    {
        cin >> w[i];
    }

    int s1, s2, sum;
    sum = accumulate(w.begin(), w.end(), 0);
    s1 = w[0];     // 0
    s2 = sum - s1; // 1 - n-1

    int min_ = abs(s1 - s2);
    for (int t = 1; t < n - 1; t++)
    {
        s1 += w[t];
        s2 -= w[t];
        min_ = min(min_, abs(s1 - s2));
    }

    cout << min_ << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        long total = 0;
        for (long i = 1; i <= n; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                total += i;
            }
        }

        System.out.println(total);
    }
}


Measured memory_bytes: 35808
//ITP1_6_A
//????????????  

using System;
using System.Collections.Generic;

class ITP1_6_A
{
    static void Main(string[] args)
    {
        //n???int?????????????????????????????£??\

        int n = int.Parse(Console.ReadLine());

        //iarray???????????????a?????£??\

        int[] iarray = Array.ConvertAll<string, int>((Console.ReadLine().Split(' ')), delegate (string value)
        {
            return int.Parse(value);
        });

        //??????????????????????????????
        for(int i = n-1;i >= 0; i--)
        {
            Console.Write(iarray[i]);
            if (i != 0)
                Console.Write(" ");
        }

        Console.Write("\r\n");

    }
}

Measured memory_bytes: 9172
package main

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

func main() {
	fsc := NewFastScanner()
	S := fsc.Next()
	fmt.Println("2018" + S[4:])
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}

func (s *FastScanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


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

using namespace std;

typedef long long LL;

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define fin "\n"


#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

template <typename T>
inline void chmin(T &l,T r){l=min(l,r);}

template <typename T>
inline void chmax(T &l,T r){l=max(l,r);}

typedef vector<LL> V;
typedef vector<V> VV;
const LL MOD=1e9+7;
int main(){
    LL N,M;
    cin>>N>>M;
    VV dp(N+1,V(N+1,0));
    dp[1][1]=1;
    REP(i,M){
        auto nxt=VV(N+1,V(N+1,0));
        FOR(j,1,N+1)FOR(k,1,N+1)if(j>=k&&k>=1){
            (nxt[j][j]+=dp[j][k]*k%MOD)%=MOD;
            (nxt[j][k]+=dp[j][k]*(j-k)%MOD)%=MOD;
            if(j<N)(nxt[j+1][k]+=dp[j][k]*(N-j)%MOD)%=MOD;
        }
        swap(dp,nxt);
    }
    cout<<dp[N][N]<<endl;
    return 0;
}


Measured memory_bytes: 1748
#include<stdio.h>

int main(){

  int n;
  scanf("%d",&n);

  int p[n],i,m,s;

  m=0;
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
    if(2*m<p[i]){
      m=p[i]/2;
      s=i;
    }
  }
  
  p[s]=0;
  
  for(i=0;i<n;i++)
    m=m+p[i];
    
  printf("%d",m);
  
  
}

Measured memory_bytes: 128
const MOD: i64 = 1000000007;

fn solve(aa: Vec<i64>) -> i64 {
    let mut ans: i64 = 1;
    let mut cs = vec![0i64, 0, 0];

    for i in 0..aa.len() {
        ans *= cs.iter().filter(|&c| *c == aa[i]).count() as i64;
        ans %= MOD;
        for j in 0..3 {
            if cs[j] == aa[i] {
                cs[j] += 1;
                break;
            }
        }
    }

    ans
}

#[test]
fn solve_test() {
    assert_eq!(solve(vec![0, 1, 2, 3, 4, 5]), 3);
    assert_eq!(solve(vec![0, 0, 0]), 6);
    assert_eq!(
        solve(vec![
            0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 3, 4, 4, 5, 4, 6, 5, 7, 8, 5, 6, 6, 7, 7, 8, 8, 9, 9,
            10, 10, 11, 9, 12, 10, 13, 14, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 16, 16, 16,
            17, 17, 17
        ]),
        115295190
    );
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let _n = parse_line!(usize);
    let aa = parse_vec!(i64);
    println!("{}", solve(aa));
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
#define pb push_back
#define all(c) c.begin(),c.end()
#define MOD 998244353
typedef double ld;
#define PI 3.14159265

int f[10] = {0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 2};
int s[10] = {1 , 1 , 1 , 2 , 2 , 3 , 2 , 2 , 3 , 3};
int t[10] = {2 , 3 , 4 , 3 , 4 , 4 , 3 , 4 , 4 , 4};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    string str;
    int m = 0 , a = 0 , r = 0 , c = 0 , h = 0;
    ll occurence[5];
    memset(occurence , 0 , sizeof(occurence));
    for(int i = 0 ; i < n ; i++) {
        cin >> str;
        if(str[0] == 'M') occurence[0]++;
        else if(str[0] == 'A') occurence[1]++;
        else if(str[0] == 'R') occurence[2]++;
        else if(str[0] == 'C') occurence[3]++;
        else if(str[0] == 'H') occurence[4]++;
    }
    ll ans = 0;
    for(int i = 0 ; i < 10 ; i++) {
        ans += (occurence[f[i]] * occurence[s[i]] * occurence[t[i]]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma region
#include <bits/stdc++.h>
#pragma GCC optimize ("-O3")
using namespace std;

// repr(i,10,13) -> 10,11,12
#define repr(i,a,b) for(int i=a;i<b;i++)
// rep(i,3) -> 0,1,2
#define rep(i,n) for(int i=0;i<n;i++)
// reprrev(i,10,13) -> 12,11,10
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
// reprev(i,3) -> 2,1,0
#define reprev(i,n) reprrev(i,0,n)
#define all(x) x.begin(),x.end()

/*
vector<vector<int>> x = vector<vector<int>>(i, vector<int>(n));
// 末尾を取得
x.back()
// 末尾に挿入
x.push_back()
*/
typedef pair<int,int> pint;
// for sort(a.begin(), a.end());
bool cmp(int a, int b) { return a < b; }
bool pcmp(pint a, pint b) { return a.second < b.second; }
using ll = long long;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
const int inf = 1 << 29;
typedef tuple<int, int> T;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
#pragma endregion

void _main() {
    int n;
    cin >> n;
    vector<ll> a = vector<ll>(n);
    rep(i,n) {cin >> a[i];}
    sort(a.begin(), a.end());
    vector<ll> b = vector<ll>(n);
    rep(i,n) {cin >> b[i];}
    sort(b.begin(), b.end());
    vector<ll> c = vector<ll>(n);
    rep(i,n) {cin >> c[i];}
    sort(c.begin(), c.end());

    ll ans = 0;
    rep(i,n) {
        auto a_iter = lower_bound(all(a), b[i]);
        ll a_dist = distance(a.begin(), a_iter);
        auto c_iter = upper_bound(all(c), b[i]);
        ll c_dist = distance(c.begin(), c_iter);
        ans += a_dist * (n - c_dist);
    }
    cout << ans << endl;
}

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

const ll inf = 1e10;

int main() {
    int N;
    cin >> N;
    vector<pair<ll, ll>> P(N);
    ll maxl = 0;
    ll minr = inf;
    for (int i = 0; i < N; i++) {
        ll L, R;
        cin >> L >> R;
        L--;
        maxl = max(maxl, L);
        minr = min(minr, R);
        P[i] = {L, R};
    }

    ll ans = 0;
    for (auto ne : P) {
        ans = max(ans, max(0LL, minr - maxl) + ne.second - ne.first);
    }

    vector<pair<ll, ll>> ti;
    for (auto ne : P) {
        ll a = max(0LL, ne.second - maxl);
        ll b = max(0LL, minr - ne.first);
        ti.push_back({a, -b});
    }

    sort(ti.begin(), ti.end());
    ll w = inf;
    int cnt = 0;
    for (auto z : ti) {
        if (cnt) {
            ans = max(ans, w + z.first);
        }
        w = min(w, -z.second);
        cnt++;
    }
    cout << ans << endl;
}


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

using namespace std;

int main(void){
	int x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int dx = x1 - x2;
	int dy = y1 - y2;
	cout << x2 + dy << " ";
	cout << y2 - dx << " ";
	cout << x1 + dy << " ";
	cout << y1 - dx << endl;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  l2=[]
  for i,x in enumerate(l):
    l2.append([i+1,x])

  l2=sorted(l2,key=lambda x:x[1])

  ans=[]
  for x in l2:
    ans.append(x[0])

  return ' '.join([str(x) for x in ans])

# main()
print(main())


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

#define fast ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define fl(i,a,n) for(int i=a; i<n; i++)
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define test()  int tt;  cin>>tt;  while(tt--)
#define nl  cout<<"\n"
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)    {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}
const int mod = 1e9+7;
const ll INF = 1e18L + 5;
int main()  {
    fast;
    ll n,w;    cin>>n>>w;
    vector<ll> weight(n),value(n);
    int sum_val=0;
    fl(i,0,n)   {
        cin>>weight[i]>>value[i];
        sum_val+=value[i];
    }
    //cout<<sum_val<<"\n";
    vector<ll> dp(sum_val+1,INF);
    //dp[i] -> the minimum total weight of items with total value exactly i
    dp[0]=0;
    fl(i,0,n)   {
        for(int j=sum_val;j>=value[i];j--)  {
            dp[j]=min(dp[j],dp[j-value[i]]+weight[i]);
        }
    }
    for(int i=sum_val;i>=0;i--) {
        //cout<<dp[i]<<"\t";
        if(dp[i]<=w)    {
            cout<<i;    return 0;
        }
    }
    cout<<0;
}

Measured memory_bytes: 1024
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(ll __x = __start; __x < __end; __x++)

typedef pair<int, int> P;
int main() {
  int n; cin >> n;
  vector<int> C(100001, 0);
  loop(i,0,n) {
    int a;
    cin >> a;
    C[a]++;
  }
  
  priority_queue<P> Q;
  loop(i,0,100001) {
    if (C[i] == 0) continue;
    Q.push({ C[i], i });
  }
  
  while (Q.size()) {
    auto p = Q.top(); Q.pop();
    if (p.first == 1) {
      Q.push(p);
      break; // 最大のが1なら全部１つずつ
    }
    if (p.first >= 3) {
      p.first -= 2;
      Q.push(p);
      continue;
    }
    
    // 2個の場合には奇数個残っているはずなのでもう１つある
    auto p2 = Q.top(); Q.pop();
    p2.first--;
    p.first = 1;
    Q.push(p);
    if (p2.first > 0) Q.push(p2);
  }
  cout << Q.size() << endl;
  return 0;
}


Measured memory_bytes: 4580
N, W = map(int, input().split())
item = [list(map(int, input().split())) for i in range(N)]
dp = [0 for i in range(W+2)]
for v in item:
  for i in range(1, W+2):
    if W + 1 - i + v[1] <= W:
      dp[W + 1 - i + v[1]] = max(dp[W + 1 - i + v[1]] , dp[W + 1 - i] + v[0])
print(dp[W])


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

int main(){
  int n; cin>>n;
  long long x,ans = 0; cin>>x;
  vector<long long> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  
  sort(a.begin(),a.end());
  
  for(int i=0;i<n;i++){
    if(x>=a[i]){
      x-=a[i];
      ans++;
    }
  }
  
  if(ans==n&&x>0)ans--; //全て配らなければいけないので、余ると誰か一人がちょうどよくもらえなくなるから
  
  cout<<ans<<endl;
  return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int N = Integer.parseInt(st.nextToken());
		int X = Integer.parseInt(st.nextToken());
		int T = Integer.parseInt(st.nextToken());
		
		int i = 1;
		int ans = 0;
		while(true) {
			ans += T;
			if(N <= (X * i))
				break;
			i++;
		}
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 32584
n, d = map(int, input().split())

mat = list()
for i in range(n):
    mat.append(list(map(int, input().split())))

total = 0
for a in range(n-1):
    for b in range(a+1, n):
        dist2 = 0
        for dx in range(d):
            d2 = mat[a][dx]-mat[b][dx]
            dist2 += d2*d2
        dist = dist2**0.5
        # print(dist)
        if dist - int(dist) < 10**-6:
            total += 1
print(total)


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

#include <bits/stdc++.h>

using namespace std;

class UnionFind
{
    vector<int> data;
public:
    UnionFind(int n)
    {
        data.resize(n, -1);
    }
    int Find(int x)
    {
        if (data[x] < 0)
        {
            return x;
        }
        return data[x] = Find(data[x]);
    }
    void Unite(int x, int y)
    {
        x = Find(x);
        y = Find(y);
        if (x == y)
        {
            return;
        }
        if (data[x] > data[y])
        {
            swap(x, y);
        }
        data[x] += data[y];
        data[y] = x;
    }
    int Size(int x)
    {
        return -data[x];
    }
};

class DFriends {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n, m;
        in >> n >> m;
        UnionFind uf(n);
        for (int i = 0; i < m; ++i) {
            int a, b;
            in >> a >> b;
            --a; --b;
            uf.Unite(a, b);
        }
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            ans = max(ans, uf.Size(i));
        }
        out << ans << '\n';
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    DFriends solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}

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

int main(){
    int64_t N;
    cin >> N;
    int64_t t = 26;
    int digit = 1;
    while(N > t){
        N -= t;
        t *= 26;
        digit ++;
    }
    N--;
    vector<int64_t> vec;
    while(N >= 26){
        vec.push_back(N % 26);
        N /= 26;
    }
    vec.push_back(N);
    while(vec.size() != digit) vec.push_back(0);
    reverse(vec.begin(), vec.end());
    for(int i=0; i<vec.size(); i++) cout << (char)('a' + vec.at(i));
    cout << endl;
}

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

using namespace std;
typedef long long ll;

ll N, K;
char S[60] = {};

int main() {
	cin >> N >> K;
	cin >> S;
	S[K - 1] += 'a' - 'A';
	cout << S << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{   
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      long n = sc.nextLong();
      if(n%2==1){
        System.out.println(0);
        return;
      }
      long x = n/2;
      long sum = 0;
      while(x>0){
        sum+=x/5;
        x/=5;
      }
      System.out.println(sum);
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}
class Pair{
    int a,b;

    Pair(int a, int b){
      this.a = a;
      this.b = b;
    }
}

Measured memory_bytes: 24916
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;

signed main() {
	int n; cin >> n;
	int ans(0);
	while (n != 1) {
		if (n % 3 == 0)n = n / 3;
		else if (n % 3 == 1)n = n / 3 + 1;
		else if (n % 3 == 2)n = n / 3 + 1;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i,n) cin >> a[i];

	REP(i,n){
		if(a[i]%2==0){
			if(a[i]%3!=0 && a[i]%5!=0){
				cout << "DENIED\n";
				return 0;
			}
		}
	}
	cout << "APPROVED\n";
	return 0;
}



Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define vecin(n, a) rep(i, n)scanf("%d", &a[i])

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	char a, b;
	scanf("%c%*c%c", &a, &b);
	if (a == 'H') {
		printf("%c\n", b);
	}
	else {
		if (b == 'D')b = 'H';
		else b = 'D';
		printf("%c\n", b);
	}

	Please AC;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <list>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std; 

int
main(int argc, char const *argv[])
{
    int64_t a, b, t;
    cin >> a >> b >> t;
    cout << b * (t / a) << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static string Convert(string S)
        {
            char i = 'a';
            var dict = new Dictionary<char, char>();
            foreach (char c in S)
            {
                if (!dict.ContainsKey(c)) { dict[c] = i++; }
            }
            return new string(S.Select(c => dict[c]).ToArray());
        }
        static bool Solve(string S, string T)
        {
            return Convert(S) == Convert(T);
        }
        static void Main(string[] args)
        {
            var S = Read();
            var T = Read();
            Console.WriteLine(Solve(S, T) ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 18528
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

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

int main(){
    int N;
    int A[21],B[21],C[21];

    cin>>N;
    rep(i,1,N+1)cin>>A[i];
    rep(i,1,N+1)cin>>B[i];
    rep(i,1,N)cin>>C[i];

    long long ans=0;
    int prev=A[1];
    ans=B[prev];

    rep(i,2,N+1){
        if((prev+1)==A[i])ans+=C[prev];

        prev=A[i];
        ans+=B[prev];
    }

    cout<<ans;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int X, A;

  cin >> X >> A;

  if (X < A) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
N = int(input())
As = list(map(int,input().split()))

sum = 1

if any(b == 0 for b in As):
	sum = 0
else:
	for a in As:
		sum*=a
		if sum > 1000000000000000000:
			sum = -1
			break
print(sum)


#A,B=map(int,input().split())

#print(A*B)




Measured memory_bytes: 21640
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define powerof2 ()
#define mp make_pair
#define pi acos(-1)
using ll = long long;
const ll M = 1000000007;
const ll M1= 998244353;
using vl = vector<ll>;
using pll =  pair<ll,ll>;
ll power(ll x,ll y){
	if(y==0)
		return 1;
	ll res=power(x,y/2);
	res=(res*res);
	if(y&1)
		res=(res*x);
	return res;
}
 
ll powermod(ll x,ll y,ll mod){
	if(y==0)
		return 1;
	ll res=powermod(x,y/2,mod);
	res=(res*res)%mod;
	if(y&1)
		res=(res*x)%mod;
	return res;
}
/*ll binarysearch(ll va)
{
	ll n=1;
	ll l=va+1,u=n;
	ll st=num.order_of_key(va);
	while(l+1<u)
	{
		m=(l+u)/2;
		ll in=num.order_of_key(m);
		if(in-st==m-va)
		{
			l=m;
		}
		else
		{
            u=m;
		}
	}
	if(num1.find(l)==num1.end())
		return l;
	return u;
}*/
void solve(){
	int a,b;
	cin>>a>>b;
	cout<<max(0,(a-2*b))<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
 
    for(int i=1;i<=t;i++)
    {//cout<<"Case #"<<i<<": ";
    solve();}
    return 0;
}

Measured memory_bytes: 3612
inputted = list(map(int, input().split()))
A = int(inputted[0])
B = int(inputted[1])

age = A
full_price = B

is_full_price = age >= 13
is_half_price = 6 <= age <= 12

price = 0
if is_full_price:
    price = full_price
elif is_half_price:
    price = int(full_price / 2)

print(price)


Measured memory_bytes: 3060
hash = Hash.new(0)
sentence = gets.chomp.split
sentence.each do |word|
  hash[word] += 1
end

arr = hash.sort{|a,b| b[1]<=>a[1]}
arr2 = hash.sort{|a,b| b[0].length <=> a[0].length }
puts "#{arr[0][0]} #{arr2[0][0]}"

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

using namespace std;

#define sp ' '
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define forn(YY, yy) for(long long int yy = 0; yy < YY; ++yy)
#define prn(XX) cout << XX << endl
#define prs(XX) cout << XX << " "

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;

const long long int MOD = 1e9 + 7;
const long long int INF = 2e9 + 13;
const long long int mINF = -2e9 - 13;
const double PI = 3.14159265358979;
const double EPS = 1e-9;

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int a, b; cin >> a >> b;
    if(a+b == 3){ cout << 3 << endl; }
    if(a+b == 4){ cout << 2 << endl; }
    if(a+b == 5){ cout << 1 << endl; }

    return 0;
}

//cikisir



Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()


S = input()

y = S[:4]
m = S[5:7]
d = S[8:10]

new_S = y + m + d

if int(new_S) > 20190430:
    print("TBD")
else:
    print("Heisei") 

Measured memory_bytes: 38256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	int nownum = 0;
	for(int i = 0; i < n; i++){
		if(s[i] == 'I') nownum++;
		else nownum--;
		ans = max(ans, nownum);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
S = list(input())
res = 'Yes'
if len(S)%2 == 0:
  for i in range(int(len(S)/2)):
    if S[2*i] == 'h' and S[2*i+1] == 'i':
      res = 'Yes'
    else:
      res = 'No'
      break
else:
  res = 'No'

print(res)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
/* #define int long long */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define MOD 1000000007
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; }

signed main(){
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    ll rect = w * h;
    long double ans = rect / 2.0;
    int res;
    if(x == w / 2.0 && y == h / 2.0) res = 1;
    else res = 0;

    printf("%.10Lf %d\n", ans, res);
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 50;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, m;
	cin >> n >> m;
	str s, t;
	cin >> s >> t;
	ll lcm = (n * m) / __gcd(n, m);
	if(s[0] != t[0]) return cout << -1, 0;
	ll p;
	for(int i = 1;i<n;i++){
		p = i*(lcm/n);
		if(p % (lcm/m) == 0) if(s[i] != t[ p / (lcm / m) ]) return cout << -1, 0;
	}
	cout << lcm;
	return 0;
}


/*
                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/



Measured memory_bytes: 640
n = int(input())
li = [list(map(int,input().split())) for _ in range(n)]
li = sorted(li,key = lambda x:-x[2])

for i in range(101):
  for j in range(101):
    h = li[0][2] + abs(i-li[0][0]) + abs(j-li[0][1])
    for k in range(1,n):
      if li[k][2] != max(0,h - abs(i-li[k][0]) -abs(j-li[k][1])):
        break
    else:
      print("{} {} {}".format(i,j,h))
      exit()

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<int, string> P;


int main(){
    int a, b, c;
    cin >> a >> b  >> c;
    if(a == b && b == c){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);


int main(){
  FAST_IO  
  
  string s; cin >> s;
  s[3] = '8';
  cout << s << "\n";
  return 0;
}

Measured memory_bytes: 256