akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int x =  sc.nextInt();
		int y =  sc.nextInt();
		int z =  sc.nextInt();

		int a = x / (y + z);
		int b = x % (y + z);
		if(b >= z) { 
			System.out.println(a);
		} else {
			System.out.println(a-1);
		}
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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

}


Measured memory_bytes: 21204
using System;

	class Program
	{
		static double Distance(int[] pos1, int[] pos2)
		{
			int dx = pos1[0] - pos2[0];
			int dy = pos1[1] - pos2[1];
			return Math.Sqrt((dx * dx + dy * dy));
		}

		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[][] pos = new int[n][];
			for (int i = 0; i < n; i++)
			{
				string[] input = Console.ReadLine().Split();
				int[] p = new int[2];
				p[0] = int.Parse(input[0]);
				p[1] = int.Parse(input[1]);
				pos[i] = p;
			}
			double sum = 0;
			for (int i = 0; i < n; i++)
			{
				for (int j = i + 1; j < n; j++)
				{
					double distance = Distance(pos[i], pos[j]);
					sum += distance;
				}
			}
			Console.WriteLine(sum / n * 2);
		}
	}


Measured memory_bytes: 11220
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const n: number = +input[0]
const a = input[1].split(' ').map((x: string): number => +x);
const b = input[2].split(' ').map((x: string): number => +x);
const c = input[3].split(' ').map((x: string): number => +x);

let ans: number = 0;
for(let i = 0; i < n-1; i++){
    if(a[i+1]-1 ===a[i]){
        ans+=c[a[i]-1];
    }
}
for(let i = 0; i < n; i++){
    ans+=b[i];
}
console.log(ans);

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

signed main() {
    string S;
    cin >> S;
    char c = S[0];
    int cnt = 0;
    FOR(i, 1, S.size()) {
        if(S[i]!=c) {
            c = S[i];
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 512
import bisect
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
time = 0
cnt = 0
C = []
SA =[0]
SB =[0]
for a in A:
    SA.append(SA[-1] + a)
for b in B:
    SB.append(SB[-1] + b)
for x in range(N+1):
    L = K - SA[x]
    if L < 0:
        break
    y_max = bisect.bisect_right(SB, L) - 1

    C.append(y_max + x)
print(max(C))

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

int main() {
  int n,a,b,x;

  // 変数aで入力を受け取る
  cin >> n >> a >> b;
  x = n * a;
  if(x <= b) {
     cout << x << endl;
  } else {
    cout << b << endl;
  }
}


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

// alias templates
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

// alias declaration
using ll = long long;
using str = string;

using vll = V<ll>;
using vvll = V<vll>;
using vs = V<str>;

// loops
#define FOR(i, a, b)  for (ll i = (a); i <= (ll)(b); i++) // [a,b]
#define rFOR(i, a, b) for (ll i = (b); i >= (ll)(a); i--) // [b,a]
#define REP(i, a) FOR((i), 0, (ll)(a)-1) // [0,a-1]

// for debug
#define dbg(a) cerr << "  " << (#a) << ": " << (a) << "\n";

// procon common constants
const ll MOD_BIG = 1e9 + 7;

int main(void){
    ll n,c;
    cin >> n;
    vll a(n+1),b(n);

    REP(i,n+1){
        cin >> a[i];
    }
    REP(i,n){
        cin >> b[i];
    }

    ll taosita = 0;

    REP(i,n){
        c = min(a[i], b[i]);
        taosita += c;
        a[i] -= c;
        b[i] -= c;
        //cout << "t1 : " << c << endl;

        c = min(a[i+1], b[i]);
        taosita += c;
        //cout << "t2 : " << c << endl;
        a[i+1] -= c;
        b[i] -= c;
    }
    cout << taosita << endl;
}

Measured memory_bytes: 1792
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var ans = new int[3];
            var a = cin.ReadInt;
            var b = cin.ReadInt;
            ans[0] = a + b;
            ans[1] = a - b;
            ans[2] = a * b;
            WriteLine(ans.Max());

        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 13396
solove::[Int] -> Int
solove (l:r:_)
    | r-l >= 2019 = 0 
    |otherwise = minimum [(i*j) `mod` 2019| i<-[l..r-1],j<-[i+1..r]]

main::IO ()
main = do
    lr <- map read . words <$> getLine
    print $ solove lr

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N, cnt;

int main() {
	cin >> N;
	for (int i = 1; i <= N; ++i) {
		int c = 0;
		int p = i;
		while (p) {
			p /= 10;
			++c;
		}
		if (c & 1)++cnt;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
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
 */
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);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long A = in.nextLong();
            long B = in.nextLong();

            if (Math.abs(A - B) % 2 > 0) {
                out.println("IMPOSSIBLE");
                return;
            }
            long ans = Math.min(A, B) + Math.abs((A - B) / 2);
            out.println(ans);
        }

    }
}



Measured memory_bytes: 23764
while True:
    n = input().split()
    a,b = int(n[0]),int(n[2])
    if n[1] == '+':
        print(a + b)
    elif n[1] == '-':
        print(a - b)
    elif n[1] == '*':
        print(a * b)
    elif n[1] == '/':
        print(a // b)
    else:
        if n[1] == '?':
            break

Measured memory_bytes: 7624
import java.util.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入
		int h = sc.nextInt();
		int w = sc.nextInt();
		int smallH = sc.nextInt();
		int smallW = sc.nextInt();

        System.out.println((h-smallH)*(w-smallW));
 
	}
}


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

const int MOD = (int)1e9+7;

int main(){
	int N,A,B,C,D;
	string S;
	cin >> N >> A >> B >> C >> D >> S;
	A--;
	B--;
	C--;
	D--;
	S+="...";

	bool ans=true;
	for(int i=B;i<D;i++){
		if(S.at(i+1)=='#' && S.at(i+2)=='#')	ans=false;
	}
	for(int i=A;i<C;i++){
		if(S.at(i+1)=='#' && S.at(i+2)=='#')	ans=false;
	}

	if(ans==false){
		cout << "No" << endl;
		return 0;
	}
	if(C<D){
		cout << "Yes" << endl;
		return 0;
	}

	ans=false;
	for(int i=B-2;i<D-1;i++){
		if(S.at(i+1)=='.' && S.at(i+2)=='.' && S.at(i+3)=='.')	ans=true;
	}

	if(ans)	cout << "Yes" << endl;
	else	cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Math;

class Program
{
    static List<Edge>[] g;
    static void Main()
    {
        var s = new Dictionary<string, int> { ["SUN"] = 7, ["MON"] = 6, ["TUE"] = 5, ["WED"] = 4, ["THU"] = 3, ["FRI"] = 2, ["SAT"] = 1 };
        var N = int.Parse(ReadLine());
        var S = ReadLine();
        WriteLine(new string(S.Select(x => (char)((x - 'A' + N) % 26 + 'A')).ToArray()));
    }
    static int[] ans;
    void DFS(int v, int p, int c)
    {
        var k = 0;
        foreach (var u in g[v])
        {
            if (k == c) k++;
            if (u.to != p)
            {

                ans[u.id] = k;
                DFS(u.to, v, k);
            }
            k++;
        }
    }
}

public struct Edge
{
    public int to;
    public int clr;
    public int id;

    public Edge(int t, int c, int i)
    {
        to = t;
        clr = c;
        id = i;
    }
}


Measured memory_bytes: 13408
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        char[] S = in.s().toCharArray();
        String ans = S[0] == S[1] && S[1] == S[2] ? "No" : "Yes";
        out.println(ans);  
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 1002
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
int sum[MAXN][MAXN];
int cntIt(int l, int r, int u, int d, int k) {
    int c = sum[d][r] - sum[u - 1][r] - sum[d][l - 1] + sum[u - 1][l - 1];
    if (c > k && (l == r)) return -1;
    if (c > k) return inf;
    return c;
}
int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int h, w, k;
    cin >> h >> w >> k;
    char c;
    int res = inf;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> c;
            sum[i][j] = (c - '0') + sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
        }
    }
    for (int i = 1; i < (1 << (h + 1)) - 1; i++) {
        vector<int> indexs;
        indexs.pb(1);
        for (int j = 2; j <= h; j++) {
            if ((i & (1 << j)) != 0) {
                indexs.pb(j);
            }
        }
        indexs.pb(h + 1);
        int cur = 0;
        int lastIndex = 1;
        bool found = true;
        for (int j = 1; j <= w; j++) {
            int mx = 0;
            for (int kk = 0; kk < sz(indexs) - 1; kk++) {
                int c = cntIt(lastIndex, j, indexs[kk], indexs[kk + 1] - 1, k);
                if (c == -1) {
                    mx = -1;
                    found = false;
                    break;
                }
                mx = max(mx, c);
            }
            if (!found) break;
            if (mx == inf) {
                cur++;
                lastIndex = j;
            }
        }
        if (found)
            res = min(res, cur + sz(indexs) - 2);
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        ArrayList<Integer> a = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            a.add(scan.nextInt());
        }
        Collections.reverse(a);
        for (int i = 0; i < n; i++) {
            if (i == a.size() -1) System.out.print(a.get(i));
            else System.out.print(a.get(i) + " ");
        }
        System.out.println();
    }

}

Measured memory_bytes: 26080
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <fstream>
#include <stdint.h>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define FOR(i, l, r) for(int i = l; i < r; i++)
#define RFOR(i, l,r) for(int i= (l)-1; i>= (r) ; i--)

int main()
{
    ios::sync_with_stdio(false);
    int n;
    vector<int> l;
    cin >> n;
    int n2 = n * 2;
    REP(i, n2)
    {
        int tmp;
        cin >> tmp;
        l.push_back(tmp);
    }

    sort(l.begin(), l.end());

    int ans = 0;
    REP(i, n)
    {
        ans += l[2 * i];
    }

    cout << ans << '\n';
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
#define printd(x) printf("%.12f\n", ans);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
    int h, w, a, b;
    cin >> h >> w >> a >> b;

    rep (i, b) {
        rep (j, w) {
            if (j < a) cout << 1;
            else cout << 0;
        }
        cout << endl;   
    }

    rep (i, h - b) {
        rep (j, w) {
            if (j < a) cout << 0;
            else cout << 1;
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1280
#include "bits/stdc++.h"

#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
#define ll long long

int main()
{
  IOS;
  int k, n, i;
  cin >> n >> k;
  int arr[n], ans=0;
  for (i=0; i<n; i++)
    {
      cin >> arr[i];
    }
  sort (arr, arr+n);
  for (i=0; i<k; i++)
    {
      ans+=arr[i];
    }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3608
# abc102_a.py
# https://atcoder.jp/contests/abc102/tasks/abc102_a

# A - Multiple of 2 and N /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 100点

# 問題文
# 正整数 Nが与えられます。 2 と Nのどちらでも割り切れる最小の正整数を求めてください。

# 制約
#     1≤N≤109
#     入力はすべて整数である。

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N

# 出力
# 2と Nのどちらでも割り切れる最小の正整数を出力せよ。

# 入力例 1
# 3

# 出力例 1
# 6

# 6は 2 と 3 のどちらでも割り切れる数です。 
# また、6 未満の正整数であって、2 と 3 のどちらでも割り切れるような数はありません。 よって、答えは 6です。

# 入力例 2
# 10

# 出力例 2
# 10

# 入力例 3
# 999999999

# 出力例 3
# 1999999998


def calculation(lines):
    N = int(lines[0])
    if N % 2 == 0:
        result = N
    else:
        result = N*2
    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3']
        lines_export = [6]
    if pattern == 2:
        lines_input = ['10']
        lines_export = [10]
    if pattern == 3:
        lines_input = ['999999999']
        lines_export = [1999999998]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 8964
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=2000010;
const ll mod=1e9+7;


int main(){
  ll x,y;
  cin >> x >> y;
  ll k = y/x;
  ll ans=1;
  while(powl(2LL,ans)<=k){ans++;}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> x(5);
  for(int i=0;i<5;i++)cin>>x[i];
  int ans=0;
  for(int i=0;i<5;i++){
    if(x[i]==0)ans=i+1;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3520
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
	int T,h,m;
	vector<int>v;
	for(;~scanf("%d",&T);){
		for(;T--;)scanf("%d%d",&h,&m),v.push_back(h*60+m);
	}
	sort(v.begin(),v.end());
	printf("%d:%02d",v[0]/60,v[0]%60);
	int prev=v[0];
	for(int i=0;i<v.size();i++){
		if(prev==v[i])continue;
		prev=v[i];
		printf(" %d:%02d",v[i]/60,v[i]%60);
	}
	puts("");
}

Measured memory_bytes: 1072
#include <iostream>
#include <algorithm>

using namespace std;

typedef int x;
x n,a[101101],s;

x main(){
    cin>>n;
    for(x i = 1;i <= n;i++){
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    for(x i = 1;i <= n;i++){
        if(a[i] == a[i-1])s++;
    }
    if(s % 2)s++;
    cout<<n-s<<' ';
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll INF=2305843009213693951;//巨大な定数
const int dx[]={0,1,0,-1};//x方向のベクトル
const int dy[]={1,0,-1,0};//y方向のベクトル

int main(){
    //入力
    ll h,w,ch,cw,dh,dw;
    cin>>h>>w>>ch>>cw>>dh>>dw;
    vector<vector<char>> S(h,vector<char>(w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>S[i][j];
        }
    }
    //1-indexedなので0-indexedに直す
    ch--;
    cw--;
    dh--;
    dw--;
    //BFS用のqueue
    //HとWには現在の場所から魔法を使わずに行ける場所のH座標とW座標
    //H2とW2には魔法を使って行ける場所のH座標とW座標
    queue<ll> H,H2,W,W2;
    //初期地点をH,Wに追加
    H.push(ch);
    W.push(cw);
    //最低何回の魔法でたどり着けるかを記録する二次元配列T
    //巨大な数INFで初期化する
    vector<vector<ll>> T(h,vector<ll>(w,INF));
    //初期地点は0回の魔法でたどり着く
    T[ch][cw]=0;
    //BFSをする
    while(!H.empty()){
        //現在の島
        while(!H.empty()){
            //現在の座標
            ll nh=H.front();
            ll nw=W.front();
            //queueから削除
            H.pop();
            W.pop();
            //移動A
            for(int i=0;i<4;i++){
                //移動先の座標
                ll th=nh+dx[i];
                ll tw=nw+dy[i];
                //範囲外になってないかチェック
                if(th>=h||th<0||tw>=w||tw<0){
                    continue;
                }
                //
                if(T[th][tw]<=T[nh][nw]){
                    continue;
                }
                //
                if(S[th][tw]=='.'){
                    T[th][tw]=T[nh][nw];
                    H.push(th);
                    W.push(tw);
                }
            }
            //移動B
            for(int i=-2;i<=2;i++){
                for(int j=-2;j<=2;j++){
                    //移動先の座標
                    ll th=nh+i;
                    ll tw=nw+j;
                    //範囲外になってないかチェック
                    if(th>=h||th<0||tw>=w||tw<0){
                        continue;
                    }
                    //
                    if(T[th][tw]<=T[nh][nw]+1){
                        continue;
                    }
                    //
                    if(S[th][tw]=='.'){
                        T[th][tw]=T[nh][nw]+1;
                        H2.push(th);
                        W2.push(tw);
                    }
                }
            }
        }
        //
        swap(H,H2);
        swap(W,W2);
    }
    //ゴールに到達出来ない場合
    if(T[dh][dw]==INF){
        cout<<-1<<endl;
    }
    //到達できる場合
    else{
        cout<<T[dh][dw]<<endl;
    }
}

Measured memory_bytes: 12588
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  int mi, ma;
  mi = INF;
  ma = -101;
  rep (i, n) {
    cin >> v[i];
    mi = min(mi, v[i]);
    ma = max(ma, v[i]);
  }
  ll ans = LINF;
  for (int i = mi; i <= ma; i++) {
    ll tmp = 0;
    rep (j, v.size()) {
      tmp += pow(v[j] - i, 2);
    }
    // cout << i << "=>" << tmp << endl;
    ans = min(ans, tmp);
  }
  P(ans);


  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 10000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n], b[n], c[n];
	REP(i, n) cin >> a[i];
	REP(i, n) cin >> b[i];
	REP(i, n) cin >> c[i];
	sort(a, a+n);
	sort(b, b+n);
	sort(c, c+n);
	int x[n] = { };
	int y[n] = { };
	int j = n-1;
	for(int i = n-1; i >= 0; i--){
		while(j != -1 && b[i] < c[j]) j--;
		x[n-1-i] = n - 1 - j;
	}
	j = n-1;
	for(int i = n-1; i >= 0; i--){
		while(j != -1 && a[i] < b[j]) j--;
		y[n-1-i] = n - 1 - j;
	}
	ll tmp = x[0];
	ll z[n] = { };
	z[0] = x[0];
	FOR(i, 1, n){
		tmp += x[i];
		z[i] = tmp;
	}
	ll ans = 0;
	REP(i, n){
		if(y[i] != 0) ans += z[y[i]-1];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;
    int h[n];rep(i,n)cin>>h[i];
    reverse(h,h+n);
    rep(i,n-1){
        if(h[i]<h[i+1]-1){co("No");return 0;}
        if(h[i]==h[i+1]-1)h[i+1]--;
    }
    co("Yes");
}

Measured memory_bytes: 640
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import numpy as np
MOD = 998244353
N = int(input())
A = [int(input()) for _ in range(N)]
S = sum(A)
dp = np.zeros(S+1, dtype=np.int64)
dp[0] = 1
for a in A:
    prev = dp
    dp = prev * 2
    dp[a:] += prev[:-a]
    dp %= MOD
ans = pow(3,N,MOD) - dp[(1+S)//2:].sum() * 3
if S % 2 == 0:
    dp = np.zeros(S+1, dtype=np.int64)
    dp[0] = 1
    for a in A:
        dp[a:] += dp.copy()[:-a]
        dp %= MOD
    ans += dp[S//2] * 3
ans %= MOD
print(ans)


Measured memory_bytes: 28784
import java.util.*;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int h=sc.nextInt();
		int a=sc.nextInt();
		int sum=0;
		for(int i=1; i<=h; i++){
			sum=h-a*i;
			if(sum<=0){
				System.out.println(i);
				break;
			}
		}
	}
}

Measured memory_bytes: 21844
import sys

class Queue:
    class Cell:
        def __init__(self, x, y = None):
            self.data = x
            self.next = y

    def __init__(self):
        self.size = 0
        self.rear = None

    def enqueue(self, x):
        if self.size == 0:
            self.rear = Queue.Cell(x)
            self.rear.next = self.rear
        else:
            new_cell = Queue.Cell(x, self.rear.next)
            self.rear.next = new_cell
            self.rear = new_cell
        self.size += 1

    def dequeue(self):
        if self.size == 0: raise IndexError
        front = self.rear.next
        self.rear.next = front.next
        self.size -= 1
        if self.size == 0: self.rear = None
        return front.data

    def isEmpty(self):
        return self.size == 0

def generator(n1, n2, step=1):
    n = n1
    while n<n2:
        yield n
        n+= step

n, q = map(int, raw_input().split())
TASK=[]
A = Queue()
for i in generator(0,n):
    name, time = raw_input().split()
    TASK.append([name, int(time)])
    A.enqueue(i)

stime = 0
while not A.isEmpty():
    p = A.dequeue()
    if q>= TASK[p][1]:
        stime += TASK[p][1]
        print TASK[p][0], stime
    else:
        stime += q
        TASK[p][1] -= q
        A.enqueue(p)

Measured memory_bytes: 30796
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int l = Integer.parseInt(sc.next());
    int r = Integer.parseInt(sc.next());
    int d = Integer.parseInt(sc.next());
    int ans = 0;
    for (int i = l; i <= r; i++) {
      if (i % d == 0) {
        ans++;
      }
    }
    pw.println(ans);
  }
}


Measured memory_bytes: 35756
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;
const ll INF = 100;  // numeric_limits<ll>::max();
const int MOD = 1000000007;

void chmin(ll &a, ll b) {
  if (a > b) {
    a = b;
  }
}
void chmax(ll &a, ll b) {
  if (a < b) {
    a = b;
  }
}

int main() {
  string s, t;
  cin >> s >> t;
  vector<vector<ll>> dp =
      vector<vector<ll>>(s.length() + 1, vector<ll>(t.length() + 1, 0));

  for (int j = 0; j <= t.length(); j++) {
    dp[0][j] = 0;
  }
  for (int i = 0; i <= s.length(); i++) {
    dp[i][0] = 0;
  }

  for (int i = 1; i <= s.length(); i++) {
    for (int j = 1; j <= t.length(); j++) {
      if (s[i - 1] == t[j - 1]) {
        if (i == 0 || j == 0) {
          dp[i][j] = 1;
        } else {
          dp[i][j] = dp[i - 1][j - 1] + 1;
        }
      } else {
        if (dp[i - 1][j] > dp[i][j - 1]) {
          dp[i][j] = dp[i - 1][j];
        } else {
          dp[i][j] = dp[i][j - 1];
        }
      }
    }
  }
  //   for (auto row : dp) {
  //     for (auto cell : row) {
  //       cout << (cell == "" ? "-" : cell) << " ";
  //     }
  //     cout << endl;
  //   }

  // 復元
  ll i = s.length();
  ll j = t.length();
  string res = "";
  while (i > 0 && j > 0) {
    if (dp[i][j] == dp[i - 1][j]) {
      i--;
      continue;
    }
    if (dp[i][j] == dp[i][j - 1]) {
      j--;
      continue;
    }
    res = s[i - 1] + res;
    i--;
    j--;
  }

  cout << res << endl;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll n, m;
  cin >> n >> m;

  vector<ll> a(m);
  for (ll i = 0; i < m; ++i) {
    cin >> a[i];
  }

  ll ans = n;
  for (ll i = 0; i < m; ++i) {
    ans -= a[i];
  }

  cout << max(ans, ll(-1)) << endl;

  return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<queue>
#include<string>
using namespace std;

void bfs(int s);

int n_user,m,*deg;
vector<int> *G; 

int main(void){
	cin>>n_user>>m;
	deg = new int[n_user];
	G = new vector<int>[n_user];
	for(int i=0;i<n_user;i++)
		deg[i] = -1;

	int user1,user2;
	for(int i=0;i<m;i++){
		cin>>user1>>user2;
		G[user1].push_back(user2);
		G[user2].push_back(user1);
	}

	for(int i=0;i<n_user;i++) bfs(i);

	int question,s,t;
	cin>>question;
	for(int i=0;i<question;i++){
		cin>>s>>t;
		if(deg[s]!=-1){
			if(deg[s]==deg[t])
				cout<<"yes"<<endl;
			else
				cout<<"no"<<endl;
		}
	}

	delete [] G; delete [] deg;
}

void bfs(int s){
	queue<int> q;
	q.push(s);
	if(deg[s]==-1) deg[s] = s;
	else return ;

	int u;
	while(!q.empty()){
		u = q.front();
		q.pop();
		for(int v=0;v<G[u].size();v++){
			if(deg[G[u][v]]==-1){
				deg[G[u][v]] = deg[u];
				q.push(G[u][v]);
			}
		}
	}
}

Measured memory_bytes: 8596
fun main(args: Array<String>){
  val n: Long = readLine()!!.toLong()
  print(if(n%2==1L) 0 else f(n))
}

fun f(x: Long) : Long{
  var ret: Long = 0
  var k: Long = 10
  while(k <= x){
    ret += x/k
    k *= 5
  }
  return ret
}


Measured memory_bytes: 31812
#include <iostream>

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    int res=n/k;
    int mod=n%k;
    if(mod==0)
    {
        cout<<0<<endl;
        return 0;
    }
    else
    {
        cout<<1<<endl;
        return 0;
    }
    
    return 0;
}


Measured memory_bytes: 256
import math
A, B, H, M = map(int,input().split())
Ad = H * 30 + M * 0.5
Bd = M * 6
Ax, Ay = A * math.cos(math.radians(Ad)), A * math.sin(math.radians(Ad))
Bx, By = B * math.cos(math.radians(Bd)), B * math.sin(math.radians(Bd))
D = ((Ax-Bx)**2+(Ay-By)**2)**0.5
print(D)


Measured memory_bytes: 9568
console.log((args=>{
  const [A,B,C,D,E,F] = args.trim().split` `.map(v=>0|v);
  const W = new Set(), S = new Set();
  for ( let a = 0; a < F; a=a+A*100 ) {
    for ( let b = 0; a+b < F; b=b+B*100 ) W.add(a+b);
  }
  const R = E * F / ( 100 + E );
  for ( let c = 0; c < R; c=c+C ) {
    for ( let d = 0; c+d < R; d=d+D ) S.add(c+d);
  }
  let max = [0,0,0];
  for ( const w of W ) {
    for ( const s of S ) {
      const d = s*100/(s+w);
      if ( s*100 > E*w || s+w > F ) continue;
      if ( d > max[0] ) max = [d,s+w,s];
    }
  }
  if ( max[0] === 0 ) return `${A*100} 0`;
  return `${max[1]} ${max[2]}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 30232
#include<iostream>
#include<vector>
#include<algorithm>
#include<deque>
#include<set>
#include<map>
#include<string>
#include<math.h>

using namespace std;
#define ll long long
#define pb push_back
#define ld long double
#define mod 1000000007
ll cd(ll a,ll b)
{
	if(a==0)return b;
	else if (b==0)return a;
	else return cd(b,a%b);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll p[n+5];
	for(int i=1;i<=n;i++)cin>>p[i];
	ll c[n+5];
	for(int i=1;i<=n;i++)cin>>c[i];
	ll ans=-1e10;
	ll dp[n+5],curr;
	vector<ll>v;
	for(int i=0;i<n+5;i++)dp[i]=-1;
	for(int ii=1;ii<=n;ii++)
	{
		if(dp[ii]==-1)
		{
			v.clear();
			curr=p[ii];
			v.pb(c[curr]);
			dp[ii]=1;
			while(curr!=ii)
			{
				dp[curr]=1;
				curr=p[curr];
				v.pb(c[curr]);
			}
			ll sum=0,tem=0;
			for(int i=0;i<v.size();i++)sum+=v[i];
			ll rem=v.size();
			if(rem>k)rem=k;
			if(sum>=0)
			{
				tem+=(k/v.size())*sum;
				
			}
			rem=k%v.size();
			ll tem2=0,f=-1,fin=-1e10,tt=-1e10;
			for(int i=0;i<v.size();i++)
			{
				tem2=0;
				for(int j=i;j<i+rem;j++)
				{
					f=1;
					tem2+=v[j%v.size()];
					fin=max(fin,tem2);
				}
			}
		    if(f==-1&&sum>=0)fin=0;
			rem=v.size();
			if(rem>k)rem=k;
			for(int i=0;i<v.size();i++)
			{
				tem2=0;
				for(int j=i;j<i+rem;j++)
				{
					tem2+=v[j%v.size()];
					tt=max(tt,tem2);
				}
			}
			if(tt>sum&&sum>0)
			{
				if(k/v.size()>1)
				{
					ll nn=k/v.size();
					ans=max(sum*(nn-1)+tt,ans);
				}
			}
			ans=max(ans,max(tem+fin,tt));
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
  int N; cin>>N;
  int Ans=N;
  int m;
  REP(i,N) {
    int now; cin>>now;
    if (i==0) {
      m=now;
    }
    if (now>m) Ans--;
    m=min(now,m);
  }
  cout << Ans << "\n";
  return 0;
}


Measured memory_bytes: 3608
N = int(input())
C = input()

"""
RRRWWWになれば幸せ

8
WRWW RWRR
Csum = [0, 1, 1, 2, 3x, 3, 4, 4, 4]

"""

Csum = [0] * (N+1)
for i in range(N):
  Csum[i+1] = Csum[i] + (1 if C[i] == 'W' else 0)
  
# 赤白の個数
CW = Csum[N]
CR = N - CW

ans = 200001
# iを含む右を全部Wに、含まない左をRにする
for i in range(N+1):
  leftR = i - Csum[i]
  leftW = Csum[i]
  rightR = CR - leftR
  rightW = CW - leftW
  #print(i,leftR,leftW,rightR,rightW)
  cnt = 0
  # irekae
  cnt += min(leftW, rightR)
  leftW -= cnt
  leftR += cnt
  rightR -= cnt
  rightW += cnt
  cnt += leftW + rightR
  #print(cnt)
  ans = min(ans,cnt)
  
print(ans)


Measured memory_bytes: 17108
#include<stdio.h>
int main(){
  int a[4][13],n,i,j,k,x;
  char m;
  for(i=0;i<4;i++){
    for(j=0;j<13;j++){
      a[i][j]=0;
    }
  }
 
  scanf("%d",&n);
 
  for(k=0;k<4*n;k++){
    scanf("%c %d",&m,&x);
    if(m=='S')a[0][x-1]=1;
    else if(m=='H')a[1][x-1]=1;
    else if(m=='C')a[2][x-1]=1;
    else if(m=='D')a[3][x-1]=1;
  }
 
  for(i=0;i<4;i++){
    for(j=0;j<13;j++){
      if(a[i][j]==0){
    if(i==0)printf("S %d\n",j+1);
    else if(i==1)printf("H %d\n",j+1);
    else if(i==2)printf("C %d\n",j+1);
    else if(i==3)printf("D %d\n",j+1);
      }
    }
  }
  return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> X(M);
  
  for (int i=0; i<M; i++) {
    cin >> X[i];
  }
  
  sort(X.begin(), X.end());
  
  vector<int> Y(M-1);
  
  for (int i=0; i<M-1; i++) {
    Y[i] = X[i+1] - X[i];
  }
  
  sort(Y.begin(), Y.end());
  
  int ans = 0;
  
  for (int i=0; i<M-N; i++) {
    ans += Y[i];
  }
  
  cout << ans << endl;
  
  
  
  
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
int main(){
  int n,ans1=0,ans2;
  scanf("%d",&n);
  if(n<=0||n>10000)return 0;
  int a,i,j;
  for(i=0;i<n;i++){
    scanf("%d",&a);
    if(a<2||a>100000000)return 0;
    if(a==2){
      ans1++;
    }
    if(a==3){
      ans1++;
    }
    if(a==5){
      ans1++;
    }
    if(a%2==0);
    else if(a%3==0);
    else if(a%5==0);
    else{
      ans2=0;
      for(j=7;j<=sqrt(a);j=j+2){
	if(a%j==0)ans2++;
      }
      if(ans2==0){ans1++;
      }
      }
  }
  printf("%d\n",ans1);
  return 0;
}



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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    vector<int> vec(16);
    for (int i = 0; i < 16; i++) {
        if (i & 1) {
            vec[i] = (a <= 0 ? -1 : 1);
            --a;
        } else {
            vec[i] = (b <= 0 ? -1 : 1);
            --b;
        }
    }
    cout << (a <= 0 && b <= 0 ? "Yay!" : ":(") << '\n';
    return 0;
}


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

int main() {
    int N, M;
    cin >> N >> M;

    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(M);
    vector<int> D(M);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    for (int i = 0; i < M; i++) {
        cin >> C[i] >> D[i];
    }

    for (int i = 0; i < N; i++) {
        int res = pow(10, 9);
        int cnt = 0;
        for (int j = 0; j < M; j++) {
            if (res > abs(A[i] - C[j]) + abs(B[i] - D[j])) {
                res = abs(A[i] - C[j]) + abs(B[i] - D[j]);
                cnt = j + 1;
            }
        }
        cout << cnt << endl;
    }
}

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

using namespace std;

int main(void){
  vector<int> a(3);
  cin>>a[0]>>a[1]>>a[2];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int ans=0;
  ans+=abs(a[0]-a[1]);
  ans+=abs(a[1]-a[2]);
  cout<<ans<<endl;
  return 0;
}


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

typedef long long ll;
// #define int ll
#define pb push_back
const int INF = 1e9;

signed main(){

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





	int s,w;
	cin>>s>>w;
	if (w>=s)
		cout<<"unsafe";
	else
		cout<<"safe";
	

	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	a--;
	ll e = c * d / __gcd(c, d);
	ll ans = b - (b / c) - (b / d) + (b / e)
		- a + (a / c) + (a / d) - (a / e);
	cout << ans << endl;
}

Measured memory_bytes: 256
def solve():
    H.sort()
#    print(H)
    if K == 0:
        print(sum(H))
    else:
        print(sum(H[0:-K]))


if __name__ == "__main__":
    N,K = list(map(int, input().split()))
    H = list(map(int, input().split()))
    solve()


Measured memory_bytes: 31580
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 505
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

const ll mod = 1e9 + 7;
int sum[maxn];
int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    int n,x;
    cin >> n >> x;
    int cnt = 1;
    sum[0] = 0;
    for(int i = 1; i <= n; i++){
        int a;
        cin >> a;
        sum[i] += sum[i - 1] + a;
        //cerr << sum[i] << endl;
        if(sum[i] <= x) cnt++;
    }
    cout << cnt << endl;

    //double end_time = clock();
    //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);

    return 0;
}


Measured memory_bytes: 256
//http://tutuz.hateblo.jp/entry/2018/10/28/085507
#include <bits/stdc++.h>
#define pb push_back
using namespace std;

int n,m,cnt;

vector<int>a[1000];

int main() {
	scanf("%d",&n);
	
	for(int i=1;i*(i-1)<=2*n;i++) if(i*(i-1)==n*2) m=i;
	
	if(!m) {
		puts("No");return 0;
	}
	
	puts("Yes");printf("%d\n",m);
	
	for(int i=1;i<=m;i++) for(int j=i+1;j<=m;j++) cnt++,a[i].pb(cnt),a[j].pb(cnt);
	
	for(int i=1;i<=m;i++) {
		printf("%d ",a[i].size());

		for(int j=0;j<a[i].size();j++) printf("%d%c",a[i][j],j==a[i].size()-1?'\n':' ');
	}
	
	return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
int a;
int b;
int main()
{
    cin >> a >> b;
    int n = a+b;
    int m = a*b;
    if (n == 15&&m != 15)   cout << "+" << endl;
    if (n != 15&&m == 15)   cout << "*" << endl;
    if (n != 15&&m != 15)   cout << "x" << endl;
    return 0;
}

Measured memory_bytes: 256
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
#define biggest(A,B) A=max(A,B)
#define smallest(A,B) A=min(A,B)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
#define int LL
int n;
LL mon=1000;
int a[220];
signed main(){
	fastio;
	int n;
	cin>>n;
	rb(i,1,n){
		cin>>a[i];
	}	
	a[n+1]=0;
	int s=0;
	rb(i,1,n){
		if(a[i]<a[i+1]){
			s+=mon/a[i];
			mon%=a[i];//
//			while(mon>=a[i]){
//				mon-=a[i];
//				s++;	
//			}
		}
		if(a[i]>a[i+1]){
			mon+=s*a[i];
			s=0;
		}
//		cout<<mon<<" "<<s<<endl;
	} cout<<mon<<endl;
	return 0;
}


Measured memory_bytes: 3612