akhauriyash/Code-Regression huggingface dataset:
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, R = get_ints

if N < 10
  puts R + 100 * (10 - N)
else
  puts R
end


Measured memory_bytes: 14372
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;

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

	ll N, K;
	cin >> N >> K;

	ll ans = 1 + floor((log2(N) / log2(K)));

	cout << ans << endl;

	//system("pause");
}


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

int main(){
    int N = 0;
    int K = 0;

    cin >> N >> K;

    long long counter = 0;

    for(long long i=K; i< N+2; i++){
        counter += N*i - i*(i-1) + 1;
        counter %=((int)1e9 + 7); 
    }
    cout << counter << endl;
}

Measured memory_bytes: 3628
arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
a_j.to_i
end

if arr[0] == arr[1]
    puts "Draw"
elsif 
   arr[0] == 1
    puts "Alice"
elsif
    arr[1] == 1
    puts "Bob"
elsif
    arr[0] > arr[1]
    puts "Alice"
else
    puts "Bob"
end

Measured memory_bytes: 1788
#include<cstdio>

// Aにkeyがあるなら1，ないなら0を返す
int binarySearch(int A[],int n,int key){
  int left=0;
  int right = n;
  int mid;
  while(left<right){
    mid = (left+right)/2;
    if(key==A[mid]){
      return 1;
    }
    if(key>A[mid]){
      left = mid+1;
    }
    else if(key<A[mid]){
      right = mid;
    }
  }
  return 0;
}

int main(){
  int n,q;
  scanf("%d",&n);
  int S[n];
  for(int i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  int t;
  int sum=0;
  for(int i=0;i<q;i++){
    scanf("%d",&t);
    if(binarySearch(S,n,t)){
      sum++;
    }
  }
  printf("%d\n",sum);

}



Measured memory_bytes: 3136
n, m = map(int, input().split())


def is_ok(A, B):
    for i in range(n - m + 1):
        for j in range(n - m + 1):
            C = []
            for k in range(i, i + m):
                line = ""
                for l in range(j, j + m):
                    line += A[k][l]
                C.append(line)
            # print(C)
            if C == B: return True
    return False


A = []
B = []
for i in range(n):
    A.append(input())

for i in range(m):
    B.append(input())
# print(A)
# print(B)
if is_ok(A, B):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=1e5+9;
int main()
{
    FASTINOUT;
    int y[3];
    cin>>y[0]>>y[1]>>y[2];
    sort(y,y+3);
    if (y[0]==y[1]&&y[1]!=y[2])
        cout<<"Yes\n";
    else if (y[1]==y[2]&&y[1]!=y[0])
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0; x=0; char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) f|=(ch=='-');
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	if(f) x=-x;
}

const int N=205,mod=1e9+7;
int pa[N],c[26],h,w,n,m,pw,ans=1;
char s[N][N];

int gp(int x){
	return pa[x]==x?x:pa[x]=gp(pa[x]);
}

int main(){
	read(h),read(w);
	rep(i,1,h) scanf("%s",s[i]+1);
	n=h/2,m=w/2,pw=n+m;
	rep(i,1,n+m) pa[i]=i;
	int fac[5]={1,1,2,6,24};
	rep(i,1,n) rep(j,1,m){
		fill(c,c+26,0);
		c[s[i][j]-'a']++;
		c[s[h+1-i][j]-'a']++;
		c[s[i][w+1-j]-'a']++;
		c[s[h+1-i][w+1-j]-'a']++;
		int res=24;
		REP(i,26) res/=fac[c[i]];
		if(res==24) ans=12ll*ans%mod,pa[gp(i)]=gp(n+j);
		else ans=(ll)res*ans%mod;
	}
	rep(i,1,n+m) if(pa[i]==i) pw--;
	while(pw--) ans=2*ans%mod;
	if(h&1){
		int p=n+1,l=1,r=w,flag=0;
		while(l<r) flag|=(s[p][l]!=s[p][r]),l++,r--;
		if(flag) ans=2*ans%mod;
	}
	if(w&1){
		int p=m+1,l=1,r=h,flag=0;
		while(l<r) flag|=(s[l][p]!=s[r][p]),l++,r--;
		if(flag) ans=2*ans%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
use proconio::fastout;
use proconio::input;

#[fastout]
fn main() {
    input! {
        n: usize,
        ns: [usize; n],
    }
    let mut sum = 1000;
    for i in 0..n - 1 {
        if ns[i] < ns[i + 1] {
            let cnt = sum / ns[i];
            sum %= ns[i];
            sum += cnt * ns[i + 1];
        }
    }
    println!("{}", sum);
}


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

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }
        Arrays.sort(nums);
        int ans = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (nums[j] == nums[i]) continue;
                for (int k = j + 1; k < n; k++) {
                    if (nums[k] == nums[j] || nums[k] == nums[i]) continue;
                    long sum = nums[i] + nums[j];
                    if (sum > nums[k] && nums[k] - nums[j] < nums[i]) {
                        ans++;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 36512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int cnt=0;
	map<string,int> m;	
	while(n--){
		string s;
		cin>>s;
		m[s]=1;
	}
	cout<<m.size();
	return 0;
}

Measured memory_bytes: 19204
n = int(raw_input())
a, b = map(int, raw_input().split())
p = sorted(map(int, raw_input().split()))

ar = [0, 0, 0]
for i in p:
	if i <= a: ar[0] += 1
	elif i <= b: ar[1] += 1
	else: ar[2] += 1

print min(ar)

Measured memory_bytes: 28012
package main

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

func main() {
	var n int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	as := make([]int, n)
	bs := make([]int, n)
	for i := range as {
		sc.Scan()
		x, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		y, _ := strconv.Atoi(sc.Text())
		as[i] = x + y
		bs[i] = x - y
	}
	sort.Ints(as)
	sort.Ints(bs)
	fmt.Println(max(as[n-1]-as[0], bs[n-1]-bs[0]))
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


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

public class Main{
    public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	int num = in.nextInt();
	int[] a = new int[num];
	long sum=0;
	
	for(int i=0;i<num;i++){
	    a[i] = in.nextInt();
	}

	Arrays.sort(a);

	int max = a[a.length-1];
	int min = a[0];

	for(int i=0;i<a.length;i++){
	    sum += a[i];
	}

	System.out.println(min + " " + max + " " +sum);
    }
}




Measured memory_bytes: 41344
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  string s, t;
  cin >> s >> t;
  map<char, vector<int>> m;

  REP(i, s.length())
  {
    m[s[i]].push_back(i);
  }

  int current = 0;
  ll ans = 0;
  REP(i, t.length())
  {
    if (m[t[i]].size() == 0)
    {
      cout << -1 << endl;
      return 0;
    }

    auto it = lower_bound(m[t[i]].begin(), m[t[i]].end(), current);
    if (it == m[t[i]].end())
    {
      ans += s.length() - current;
      current = (m[t[i]][0] + 1) % s.length();
      ans += current;
    }
    else
    {
      //cout << *it << endl;
      ans += *it - current + 1;
      current = (*it + 1) % s.length();
    }
    //cout << current << " " << ans << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1216
#!/usr/bin/env python3
s = input()
Q = int(input())
q = [input().split() for _ in range(Q)]
reverse = 0
start = ""
end = ""
for i in q:
    if i[0] == "1":
        reverse ^= 1
    else:
        if (int(i[1]) + reverse) % 2:
            start += i[2]
        else:
            end += i[2]
s = start[::-1] + s + end
print(s[::1 - reverse * 2])


Measured memory_bytes: 43420
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string str;
	while (true)
	{
		getline(cin, str);
		if (str == "0")
			break;
		int sum = 0;
		for (int i = 0; i < str.length(); i++)
		{
			int n = str[i] - '0';
			sum += n;
		}
		cout << sum << endl;
	}
}


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


int main(){
  string s;
  cin >> s;
  if(s.length() < 26){
    vector<int> alpha(26, 0);
    for(int i=0; i<s.length(); i++){
      alpha[s[i]-'a']++;
    }
    for(int i=0; i<26; i++){
      if(alpha[i] == 0){
        cout << s << (char)(i+'a') << endl;
        return 0;
      }
    }
  }else{
    string ans = "";
    for(int i=25; i>=1; i--){
      if(s[i] > s[i-1]){
        char tmp;
        for(int j=25; j>=i; j--){
          if(s[i-1] < s[j]){
            tmp = s[j];
            break;
          }
        }
        ans = s.substr(0, i-1) + tmp;
        break;
      }
    }
    if(ans == ""){
      cout << -1 << endl;
    }else{
      cout << ans << endl;
    }
  }
  return 0;
}


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
 *
 * @author AEroui
 */
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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int tmp = in.nextInt() * 100 + in.nextInt() * 10 + in.nextInt();

            out.println(tmp % 4 == 0 ? "YES" : "NO");
        }

    }
}



Measured memory_bytes: 21588
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

int main(){
    int n;
    cin>>n;
    vector<int> p(n),q(n);
    for(int i=0;i<n;i++) cin>>p[i],p[i]--;
    for(int i=0;i<n;i++) cin>>q[i],q[i]--;

    vector<int> ids(n);
    iota(ids.begin(),ids.end(),0);
    int a,b;
    int num=0;
    do{
        if(p==ids) a=num;
        if(q==ids) b=num;
        num++;
    }while(next_permutation(ids.begin(),ids.end()));
    
    cout<<abs(b-a)<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = [int(x) for x in readline().split()]
ans = float('inf')
for x in a:
    ans = min(ans, len(bin(x)) - bin(x).rfind('1') - 1)
print(ans)

Measured memory_bytes: 38512
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

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

int main()
{
  int k,a,b;
  cin >> k >> a >> b;
  bool ans = false;

  for(int i = a; i <= b; i++){
      if(i % k == 0){
          ans = true;
          break;
      } 
  }

  if(ans) cout << "OK" << endl;
  else cout << "NG" << endl;
  
  return 0;
}

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

//BEGIN CUT HERE
//Binary Indexed Tree
//1-indexed!!
//1-indexed!!!!
//1-indexed!!!!!!
//区間に対する更新と区間に対する和を求めることが出来ます
//ある区間[l,r]にwを加えたいとき、add(l,r,w)としてください
//ある区間[0,r]の和を求めたいとき、sum(r)としてください(prefixです)
//ある区間[l,r]の和(v[l]+...+v[r])を求めたい時、sum(r)-sum(l-1)としてください
class RAQ_RSQ{
public:
    explicit RAQ_RSQ(int n):size(n+1){//意図的にbitのsizeは1多くしてあります(書き換えないでください)
        tbl1.resize(static_cast<unsigned long>(size + 10), 0);
        tbl2.resize(static_cast<unsigned long>(size + 10), 0);
    }
    void add(int l,int r,ll w){//v[l]...v[r]にwを加える , 1-indexed!!!
        add(l,-w*l,tbl1);
        add(r+1,w*(r+1),tbl1);
        add(l,w,tbl2);
        add(r+1,-w,tbl2);
    }
    ll sum(int r){//v[1]+...+v[r]を求めます , 1-indexed!!!
        ll res=0;
        res+=sum(r+1,tbl1);
        res+=sum(r+1,tbl2)*(r+1);
        return res;
    }
private:
    vector<ll> tbl1,tbl2;
    int size;
    void add(int a,ll w,vector<ll> &v){
        for(int i=a;i<=size;i+=i&-i)v[i]+=w;
    }
    ll sum(int a,vector<ll> &v){
        ll res=0;
        for(int i=a;i>0;i-=i&-i)res+=v[i];
        return res;
    }
};
//END CUT HERE

int main(){
    int n,q;cin>>n>>q;
    RAQ_RSQ bit(n);
    for(int i=0;i<q;i++){
        int a;cin>>a;
        if(a==0){
            int s,t,x;cin>>s>>t>>x;
            bit.add(s,t,x);
        }else{
            int s,t;cin>>s>>t;
            cout<<bit.sum(t)-bit.sum(s-1)<<endl;
        }
        //for(int j=1;j<=n;j++)cout<<bit.sum(j)<<endl;
    }
    return 0;
}


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

static const int maxsize = 40;
struct card {
	char mark;
	int number;
	bool operator==(const card& a) {
		if (a.mark == this->mark && a.number == this->number)
			return true;
		else
			return false;
	}
};

void showSeq(int a[],int n) {
	for (int i = 0; i < n; i++) {
		if (i > 0)cout << " ";
		cout << a[i];
	}
	cout << endl;
}

void showCard(card a[], int n) {
	for (int i = 0; i < n; i++) {
		if (i > 0) cout << " ";
		cout << a[i].mark << a[i].number;
	}
	cout << endl;
}

int selectionSort(int a[],int n) {
	int swapCount = 0;
	for (int i = 0; i < n; i++) {
		int minValueIndex = i;
		for (int j = i + 1; j < n; j++) {
			if (a[minValueIndex] > a[j])
				minValueIndex = j;
		}
		if (i != minValueIndex) {
           swap(a[i], a[minValueIndex]);
		   swapCount++;
		}		     		
	}
	return swapCount;
}

void selectionSort(card a[], int n) {
	for (int i = 0; i < n; i++) {
		int minIndex = i;
		for (int j = i + 1; j < n; j++) {
			if (a[minIndex].number > a[j].number)
				minIndex = j;
		}
		if (i != minIndex)swap(a[i], a[minIndex]);
	}
}

void bubbleSort(card a[], int n) {
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j > i; j--) {
			if (a[j].number < a[j - 1].number)
				swap(a[j], a[j - 1]);
		}
	}
}

bool isStable(card in[], card out[],int n) {
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = 0; k < n; k++) {
				for (int l = k + 1; l < n; l++) {
					if (in[i].number == in[j].number && out[l] == in[i] && out[k] == in[j])
						return false;
				}
			}
		}
	}
	return true;
}

int main()
{

	int n;
    card a[maxsize],b[maxsize],c[maxsize];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].mark >> a[i].number; 
		b[i] = a[i];
		c[i] = a[i];
	}

	bubbleSort(b, n);
	showCard(b, n);
    if (isStable(a,b,n)) cout << "Stable" << endl;
	else cout << "Not stable" << endl;

	selectionSort(c,n);
	showCard(c, n);
	if (isStable(a,c,n)) cout << "Stable" << endl;
	else cout << "Not stable" << endl;

    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int a[105][105],val[105],x[105][105],y[105][105],n,m,p[105*105],q[105*105],vis[105*105],v[105],to[105],ans;

bool dfs(int u){
	for (int i=1;i<=n;i++)
	    if (a[u][i]&&!v[i]){
	    	v[i]=true;
	    	if (to[i]==-1||dfs(to[i])){
	    		to[i]=u; val[i]=a[u][i];
	    		return true;
	    	}
	    }
    return false;
}
int main(){
    cin >> n >> m;
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
            cin >> x[i][j];
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
            y[i][j]=(i-1)*m+j;
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
            p[x[i][j]]=i,q[y[i][j]]=i;

    for (int t=1;t<=m;t++){
        memset(a,0,sizeof(a));
        for (int i=1;i<=n*m;i++) if (!vis[i]) a[p[i]][q[i]]=i;
        memset(to,-1,sizeof(to)); ans=0;
        for (int i=1;i<=n;i++){
            memset(v,0,sizeof(v));
            if (dfs(i)) ans++;
        }
        assert(ans==n);
        for (int i=1;i<=n;i++){
            y[i][t]=val[i];
            x[to[i]][t]=val[i];
            vis[val[i]]=1;
        }
    }
    for (int i=1;i<=n;i++){
        for (int j=1;j<m;j++) printf("%d ",x[i][j]);
        printf("%d\n",x[i][m]);
    }
    for (int i=1;i<=n;i++){
        for (int j=1;j<m;j++) printf("%d ",y[i][j]);
        printf("%d\n",y[i][m]);
    }
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

const int INF = 1001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int price, n;
    cin >> price >> n;
    vector<int> coins(n);
    rep(i, n) cin >> coins[i];

    vector<vector<int>> dp(n+1, vector<int>(price+1, INF));
    rep(i, n+1) dp[i][0] = 0;
    rep(i, n) {
        rep(j, price+1) {
            chmin(dp[i+1][j], dp[i][j]);
            if (j-coins[i] >= 0) chmin(dp[i+1][j], dp[i+1][j-coins[i]] + 1);
        }
    }   
    cout << dp[n][price] << endl;
}


Measured memory_bytes: 7172
def I(): return int(input())
def LI(): return list(map(int,input().split()))
K = I()
A,B = LI()
Sequence = [i for i in range(A,B+1)]
for i in range(B//K+1):
    if K*i in Sequence:
        print('OK')
        break
else:
    print('NG')


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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, b[125];
	cin>>n;
	REP(i, n-1){
		cin>>b[i];
	}
	int ans=b[0]+b[n-2];
	REP(i, n-2){
		ans+=min(b[i], b[i+1]);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
from itertools import product
N, M = map(int, input().split())
SW = []
for _ in range(M):
    k, *s = map(int, input().split())
    SW.append([*s])
p = list(map(int, input().split()))

Onoffs = product([0, 1], repeat=N)

cnt = 0
for onoff in Onoffs:
    for i, sw in enumerate(SW):
        tmp = 0
        for j in sw:
            if onoff[j-1]:
                tmp += 1
        if tmp % 2 != p[i]:
            break
    else:
        cnt += 1

print(cnt)


Measured memory_bytes: 9160
def modpow(a, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        halfP = p // 2
        half = modpow(a, halfP)
        return half * half % mod
    else:
        return a * modpow(a, p-1) % mod

def comb(a, b):
    if b > a:
        return 0
    if b > a - b:
        return comb(a, a-b)
    ansMul = 1
    ansDiv = 1
    for i in range(b):
        ansMul *= a - i
        ansDiv *= i + 1
        ansMul %= mod
        ansDiv %= mod

    ans = ansMul * modpow(ansDiv, mod-2) % mod
    return ans

N, K = map(int, input().split())
mod = 10 ** 9 + 7
for i in range(1, K+1):
    ans = comb(N-K+1, i) * comb(K-1, i-1)
    ans %= mod
    print(ans)


Measured memory_bytes: 3316
h,w = map(int, input().split())

if h%2 == 0:
    ans = (h//2) * w
elif w%2 == 0:
    ans = h * (w//2)
else:
    ans = h * (w//2) + h//2 + 1

if h == 1 or w == 1:
    ans = 1
print(ans)

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n;
    cin >> n;
    unordered_map<ll, ll> h;
    rep(i,0,n)
    {
        ll a;
        cin >> a;
        ++h[a];
    }

    bool is_uniq(true);
    for (auto i: h) 
        if (i.second > 1)
            is_uniq = false;

    if (is_uniq)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


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

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef long long ll;

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

	vector< vector<int> > v(200001);
	vector<int> a(n);

	REP(i, n){
		cin >> a[i];
		v[a[i]].push_back(i);
	}

	ll pos = 0, cnt = 1;
	vector<int> ans;
	while(1){
		//cout << pos << ' ' << cnt << endl;
		int num = a[pos];
		bool flg = true;
		REP(i, v[num].size()){
			if(v[num][i] > pos){
				pos = v[num][i]+1;
				flg = false;
				break;
			}
		}
		if(flg){
			if(cnt < k){
				pos = v[num][0]+1;
				cnt++;
			}else{
				ans.push_back(a[pos]);
				pos++;
			}
		}

		if(pos == n) cnt *= k/cnt;
		if(pos == n && cnt == k) break;
		if(pos == n){
			pos = 0;
			cnt++;
		}
	}

	REP(i, ans.size()){
		cout << ans[i] << ' ';
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 14200
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  //
  ll n;
  cin >> n;
  vl l(n);
  ll s = 0;
  rep(i, n) {
    cin >> l[i];
    s += l[i];
  }
  sort(ALL(l), greater<ll>());
  if (l[0] < s - l[0])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 32

ll POW[NUM];
int table[NUM];


int main(){

	POW[0] = 1;
	for(int i = 1; i < NUM; i++){
		POW[i] = 2*POW[i-1];
	}

	ll num;
	scanf("%lld",&num);

	int index = 0;

	for(int i = NUM-1; i >= 0; i--,index++){
		if(POW[i] <= num){

			table[index] = 1;
			num -= POW[i];

		}else{

			table[index] = 0;
		}
	}

	//そのまま
	for(int i = 0; i < NUM; i++){
		printf("%d",table[i]);
	}
	printf("\n");

	//反転
	for(int i = 0; i < NUM; i++){
		printf("%d",1-table[i]);
	}
	printf("\n");

	//左シフト
	for(int i = 1; i < NUM; i++){
		printf("%d",table[i]);
	}
	printf("0\n");

	//右シフト
	printf("0");
	for(int i = 0; i < NUM-1; i++){
		printf("%d",table[i]);
	}
	printf("\n");

	return 0;
}



Measured memory_bytes: 3192
n = int(input())
dic = {}

while True:
    try:
        b, f, r, v = map(int, input().split())
        bfr = 100*b + 10*f + r
        if dic.get(str(bfr)) == None:
            dic[str(bfr)] = v
        else:
            dic[str(bfr)] += v
    except:
        break

for b2 in range(1, 5):
    for f2 in range(1, 4):
        l = " "
        for r2 in range(1, 11):
            bfr2 = 100*b2 + 10*f2 + r2
            if dic.get(str(bfr2)) == None:
                l += "0"
            else:
                l += str(dic[str(bfr2)])
            if r2 < 10:
                l += " "
        print(l)
    if b2 < 4:
        print("#" * 20)



Measured memory_bytes: 5612
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;


int main(){
    int n;
    cin>>n;
    vector<int> l(n);
    for (int i=0; i<n; i++) {
        cin>>l[i];
    }
    sort(l.begin(), l.end());
    cout<<l[n-1]-l[0]<<endl;
    return 0;
}

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

ans = None
diff = 1000

if X not in p:
    ans = X
else:
    for i in range(-1, max(max(p), X)+2):
        if i in p:continue
        if abs(X - i) < diff:
            diff = abs(X - i)
            ans = i

print(ans)


Measured memory_bytes: 9104
n = int(input())
xu = [input().split() for i in range(n)]
x = [float(xu[i][0]) for i in range(n)]
total=0
for i in range(n):
  if xu[i][1] == 'BTC':
    x[i] = x[i] * 380000.0
  total+=x[i]
print(total)

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

int main(){
    string s;
    cin>>s;
    int n=s.size();
    vector<int>ans(n+1,0);
    rep(i,n){
        if(s[i]=='<'){
            if(ans[i]>=ans[i+1])ans[i+1]=ans[i]+1;
        }
    }
    for(int i=n-1; i>=0; --i){
        if(s[i]=='>'){
            if(ans[i]<=ans[i+1])ans[i]=ans[i+1]+1;
        }
    }
    ll sum=0;
    rep(i,n+1){
        sum+=ans[i];
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 2820
import Foundation

let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")
let a = Int(split[0])!
let b = Int(split[1])!
let c = Int(split[2])!

if (c * b >= a) {
    print("Yes")
}else{
    print("No")
}

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

public class Main{
    public static void main(String[] args){
     
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        int k = sc.nextInt();
        
        long a[] = new long[x];
        long b[] = new long[y * x];
        
        int maxIndex = b.length > 3000 ? 3000 : b.length;
        long c[] = new long[maxIndex * z];

        for(int i = 0; i < x; i++){
            a[i] = sc.nextLong();
        }
        
        int count = 0;
        for(int i = 0; i < y; i++){
            long yTmp = sc.nextLong();
            for(int j = 0; j < x; j++){
                b[count] = yTmp + a[j];
                count++;
            }
        }
        
        Arrays.sort(b);
        count = 0;
        for(int i = 0; i < z; i++){
            long zTmp = sc.nextLong();
            for(int j = 0; j < maxIndex; j++){
                c[count] = zTmp + b[x * y - 1 - j];
                count++;
            }
        }
        
        Arrays.sort(c);
        
        for(int i = 0; i < k; i++){
            System.out.println(c[c.length - 1 - i]);
        }
    }
}


Measured memory_bytes: 61996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int a[N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	while(m--){
		int k;
		cin>>k;
		for(int i=0;i<k;i++){
			int t;
			cin>>t;
			a[t]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(a[i]==0)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define int long long

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

signed main(){

  int a,b; cin >> a >> b;
  if((a+b)%2 == 1) cout << "IMPOSSIBLE" << endl;
  else cout << (a + b) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
int main (void) {
    long long   ans=1;
    long long   temp;
    long long   n;
    int         k;
 
    scanf("%lld%d", &n, &k);
    temp = k;
 
    while ( temp <= n ) {
        temp *= k;
        ans++;
    }
 
    printf("%lld\n", ans);
    return EXIT_SUCCESS;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int N, a, b;
    vector<pair<int, int>> axis;
    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> a >> b;
        axis.push_back({a, b});
    }
    sort(axis.begin(), axis.end());
    map<pair<int, int>, int> cnt;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < i; j++) {
            int x = axis[i].first - axis[j].first;
            int y = axis[i].second - axis[j].second;
            cnt[{x, y}] += 1;
            ans = max(ans, cnt[{x, y}]);
        }
    }
    cout << N - ans << endl;
    return 0;
}



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

int main(){
  int n;
  cin >> n;
  vector<int> ord(n),p(n),q(n);
  for (int i = 0; i < n; i++)
  {
    cin >> p[i];
    ord[i] = i+1;
  }
  for (int i = 0; i < n; i++)
  {
    cin >> q[i];
  }

  int a,b;
  int cnt = 1;
  do{
    for(int i=0; i<n; i++){
      if(p[i] != ord[i]){
        break;
      }
      if(i==n-1) a=cnt;
    }

    for(int i=0; i<n; i++){
      if(q[i] != ord[i]){
        break;
      }
      if(i==n-1) b=cnt;
    }
    cnt++;
  }while(next_permutation(ord.begin(),ord.end()));

  cout << abs(a-b) << endl;
  
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.1415926535 
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

int main()
{ 
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    s[k-1]=s[k-1]-'A'+'a';
    cout<<s;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main() {
	std::string s; cin >> s;
	
	int c = -1, d = -1, e = -1;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] == '.') c = i;
		if(s[i] == '(') d = i;
		if(s[i] == ')') e = i;
	}
	
	if(~d) {
		i64 B = 1, C = 1;
		for(int i = 0; i < e - d - 1; i++) B *= 10; --B;
		for(int i = 0; i < d - c - 1; i++) C *= 10; B *= C;
		std::string t = "";
		for(int i = 0; i < d; i++) if(s[i] != '.') t += s[i];
		std::string X = t + s.substr(d + 1, e - d - 1);
		std::string Y = t;
		i64 x = std::stoll(X), y = std::stoll(Y);
		i64 A = (x - y);
		i64 G = std::__gcd(A, B);
		
		cout << A / G << "/" << B / G << endl;	
	} else {
		i64 B = 1;
		for(int i = 0; i < s.size() - c - 1; i++) {
			B *= 10;
		}
		std::string t = "";
		for(auto v : s) if(v != '.') t += v;
		i64 A = std::stoll(t);
		i64 G = std::__gcd(A, B);
		
		cout << A / G << "/" << B / G << endl;
	}
	return 0;
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
    int a,b,c,d,k;    cin>>a>>b>>c>>d>>k;
    cout<<c*60+d-a*60-b-k<<endl;


    return 0;
}



Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<cstring>

using namespace std;

int main(){
  string s,t[1000];
  int m,cnt = 0;
  while(1){
    cin >> s;
    if(s == "-") break;
    cin >> m;
    int h[m];
    for(int i=0;i < m;i++){
      cin >> h[i];
      string str1 = s.substr(0,h[i]);
      string str2 = s.substr(h[i],s.size()-h[i]);
      s = str2 + str1;
    }
    t[cnt] = s;
    cnt++;
  }
  for(int i=0;i < cnt;i++){
    cout << t[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC40(void);
void ABC41(void);
void ABC42(void);
void ABC43(void);
void ABC44(void);
void ABC45(void);
void ABC46(void);
void ABC47(void);
void ABC48(void);
void ABC49(void);

int main(void){
    ABC47();
}

void ABC47(){
    int minx=0,maxx,miny=0,maxy,n,x,y,i,a;
    cin>>maxx>>maxy>>n;
    for(i=0;i<n;i++){
        cin>>x>>y>>a;
        if(a==1&&x>minx)minx=x;
        if(a==2&&x<maxx)maxx=x;
        if(a==3&&y>miny)miny=y;
        if(a==4&&y<maxy)maxy=y;
    }
    int s=-1;
    if((maxx-minx)>=0&&(maxy-miny)>=0)s=(maxx-minx)*(maxy-miny);
    if(s>=0)cout<<s<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 256
#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>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	vector<pair<int, int> > ans;
	int target;
	if(n % 2 == 0) target = n + 1;
	else target = n;
	for(int i = 1; i <= n; i++){
		for(int j = i + 1; j <= n; j++){
			if(i + j == target) continue;
			ans.push_back(make_pair(i, j));
		}
	}
	cout << ans.size() << endl;
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i].first << " " << ans[i].second << endl;
	}
}

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

int n,m;
int t[110],p[110],x[110];

int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>t[i];
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>p[i]>>x[i];
    }
    for(int i=0;i<m;i++){
        int ans=0;
        for(int j=0;j<n;j++){
            if(j==p[i]-1)ans+=x[i];
            else ans+=t[j];
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <functional>
using namespace std;

int apple_taste(int L,int i){
	return (L + i - 1);
}

int pie_taste(int L,vector<int> apples){
	int taste = 0;
	for(int i=0; i<apples.size(); i++){
		taste += apple_taste(L, apples[i]);
	}
	return taste;
}


int main(){
	int N;
	int L;
	cin >> N;
	cin >> L;
	vector<int> apples;
	vector<int> all_apples;
	int min_taste_sa = 99999;
	int min_sa_apple = -1;
	int all_taste = 0;
	for(int i=1; i<=N; i++){
		all_apples.push_back(i);
	}
	all_taste = pie_taste(L, all_apples);
	for(int x=1; x<=N; x++){
		apples.clear();
		for(int i=1; i<=N; i++){
			if(i != x){
				apples.push_back(i);
			}
		}
		int i_taste = pie_taste(L, apples);
		if(abs(i_taste-all_taste) <= min_taste_sa){
			min_taste_sa = abs(i_taste-all_taste);
			min_sa_apple = x;
		}
	}
	apples.clear();
	for(int i=1; i<=N; i++){
		if(i != min_sa_apple){
			apples.push_back(i);
		}
	}
	int ans = pie_taste(L, apples);
	cout << ans;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int fld[10][5];
int Counter(int y,int x){
    int cnt=0,t=fld[y][x];
    while(fld[y][x]==t&&x<5){
        cnt++;
        x++;
    }
    return cnt;
}
void Deleter(int y,int x){
    int t=fld[y][x];
    while(fld[y][x]==t&&x<5){
        fld[y][x]=0;
        x++;
    }
}
void Droper(){
    for(int i=0;i<10;i++){
        for(int j=0;j<5;j++){
            if(fld[i][j]==0)continue;
            int y=i-1;
            while(y>=0&&fld[y][j]==0)y--;
            y++;if(y==i)continue;
            fld[y][j]=fld[i][j];
            fld[i][j]=0;
        }
    }
}
void debug(int h){
    cout<<endl;
    for(int i=0;i<h;i++){
        for(int j=0;j<5;j++)cout<<fld[i][j]<<" ";
        cout<<endl;
    }
}
int main(){
    int h;
    while(cin>>h,h){
        fill_n(*fld,50,0);
        for(int i=h-1;i>=0;i--)
            for(int j=4;j>=0;j--)
                cin>>fld[i][j];
        int Point=0;
        while(true){
            bool update=false;
            for(int i=0;i<h;i++){
                for(int j=0;j<5;j++){
                    if(fld[i][j]==0)continue;
                    int cnt=Counter(i,j);
                    if(cnt<3)continue;
                    Point+=cnt*fld[i][j];
                    Deleter(i,j);
                    update=true;
                    //debug(h);
                }
            }
            Droper();
            if(update==false)break;
           // debug(h);
        }
        cout<<Point<<endl;
    }
}

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

using namespace std;

int main()
{
	int k;
	cin >> k;
	long n = 0, m = 1;
	for (int i = 0; i < k; i++) {
		int s = 0, t = 0;
		for (long j = n + m; j; j /= 10)
			s += j % 10;
		for (long j = n + m * 10; j; j /= 10)
			t += j % 10;
		if ((n + m)*t > (n + m * 10)*s)
			m *= 10;
		n += m;
		cout << n << '\n';
	}
	cout << flush;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
	int n,k,i;
  	char alpha1[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
    char alpha2[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  	scanf("%d %d\n",&n,&k);
  	char array[51];
  	for(i=0;i<n;i++){
  		scanf("%c",&array[i]);
    }
  	for(i=0;i<26;i++){
    	if(array[k-1] == alpha1[i]){
        	array[k-1] = alpha2[i];
          	break;
        }
    }
  	for(i=0;i<n;i++){
   		printf("%c",array[i]); 
    }
  	printf("\n");
  	return 0;
}


Measured memory_bytes: 128
<?php
list($a, $b) = ints();
echo max($a+$b, $a-$b, $a*$b);

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array:";
            echo implode(" ", $val)."\n";
        }else{
            echo "array:array\n";
            foreach($val as $row){
                echo implode(" ", $row)."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}

Measured memory_bytes: 4856
import std;
import core.bitop;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "B", long, "W");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

class UnionFind
{
    long n;
    long[] par;

    this(long init)
    {
        n = init;
        par = iota(n).array();
    }

    long root(long x)
    {
        if (par[x] == x)
            return x;
        else
            return par[x] = root(par[x]);
    }

    void unit(long x, long y)
    {
        if (root(x) != root(y))
            par[root(x)] = root(y);
    }

    bool same(long x, long y)
    {
        return (root(x) == root(y));
    }
}

void main()
{
    long n, m;
    scan(n, m);

    auto uf = new UnionFind(n);
    foreach (i; iota(m))
    {
        long a, b;
        scan(a, b);
        uf.unit(a - 1, b - 1);
    }
    iota(n).map!(x => uf.root(x)).array.sort.array.group.assocArray.reduce!(max).writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


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

typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) (in),(in)+(K)

#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

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; } //最小公倍数

ll input(){
  ll a;
  cin >> a;
  return a;
}

int main(){
  ll n,k;
  cin >> n >> k;
  ll ans = 0;
  REP(i,n)if(k<=input())ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>

using namespace std;

#define PB push_back
#define ALL(v) (v).begin(), (v).end()
#define SZ size()
#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define REP(i, n) FOR((i), 0, (n))
#define GET(a) cin >> (a)
#define GET2(a, b) cin >> (a) >> (b)
#define GET3(a, b, c) cin >> (a) >> (b) >> (c)
#define SHOW(v) cout << (v) << endl
#define SHOW2(a, b) cout << (a) << " " << (b) << endl
#define SHOW3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl
#define MOD 1000000007
template<class T> void GETV(T &v) { REP(i, v.size()) { GET(v[i]); } }
template<class T> void SHOWV(T &v) { REP(i, v.size()) { SHOW(v[i]); } }

typedef long long ll;


int main()
{
	vector<int> a(6);
	for(int i = 0; i < 6; i++) {
		cin >> a[i];
	}
	
	vector<int> cnt(6, 0);
	for(int i = 0; i < 6; i++) {
		cnt[a[i] - 1]++;
	}
	
	int tmp = 0;
	for(int i = 0; i < 6; i++) {
		if(cnt[i] % 2 != 0) {
			tmp++;
		}
	}
	
	if(tmp == 2 || tmp == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std; 
typedef long  long ll;
ll MOD=1e9+7;
const ll MAX=1e5+2;
 
void solve(){
     ll n,m;cin>>n>>m;
     cout<<n*m<<endl;
}
 
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;t=1;
    // cin>>t;
    // cin.ignore();
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		System.out.printf("%d %d %.10f\n", a/b,a%b,(double)a/(double)b);
	}
}





Measured memory_bytes: 26456
a = []
a = input().split()
S = a[0]
T = a[1]
b = []
b = input().split()
A = int(b[0])
B = int(b[1])
U = input()

#print('S, T = ', S, T)
#print('A, B = ', A, B)
#print('U = ', U)

if S == U:
  print(A-1, B)
if T == U:
  print(A, B-1)













Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1e9+7;
using namespace std;

int main(){
    string s; cin >> s;
    ll k; cin >> k;
    for(ll i = 0; i < s.length() && i< k; i++){
        if(s[i] != '1'){
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<functional>
#include<algorithm>

using namespace std;

int main(){
	priority_queue<int,vector<int>,greater<int> > que;
	int ans = -50;
	int self;
	for(int i=0;i<3;i++){
		scanf("%d",&self);
		que.push(self);
	}
	ans += que.top();
	que.pop();que.pop();que.pop();
	for(int i=0;i<2;i++){
		scanf("%d",&self);
		que.push(self);
	}
	ans += que.top();
	printf("%d\n",ans);
}

Measured memory_bytes: 0