akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

  int l = 0;
  int r = 1e9; // 指数表記 1 * 10**9

  // ### 二分探索
  //
  //     f(x) = 一番長い丸太を x 以下にできるかどうか
  // --> 全部を x 以下にするために切る回数 <= K であるかどうか
  while (r-l > 1) {
    // 真ん中あたりの座標をとる
    int x = (l+r) / 2;

    // &: 参照で変数をキャプチャ
    //
    // ### データ例1
    // * n = 7
    // * a = [1, 2, 3, 4, 5, 6, 7]
    //
    // これより x = (7+0) / 2 = 3
    // 丸太の長さを3以下にするために必要な、丸太の切断回数は以下で算出する。
    //
    // * 丸太:     1 2 3 4 5 6 7
    // * 切断回数: 0 0 0 1 1 1 2
    // --> (a[i]-1) / 2
    //
    // これより、x=3 の時の切断回数は 5 となる。
    //
    // ### データ例2
    // * n = 2
    // * k = 3
    // * a = [7, 9]
    //
    // ##### ループ1回目
    // * x = (0+1e9) / 2 = 5e8
    // * now = (7-1) / 5e8 + (9-1) / 5e8;
    //       = 0
    // * f(5e8) --> true
    //   * 2本の丸太を 5e8 以下の長さにすることは k=3 以下の切断回数で実現できる
    //   * これより x >= 5e8 && x <= 1e9 も同様に実現できる
    // * r = 5e8 に狭めて、二分探索を継続する
    //
    // ##### ループ2回目
    // * x = (0+5e8) / 2 = 25e7
    // * now = (7-1) / 25e7 + (9-1) / 25e7;
    //       = 0
    // * f(25e7) --> true
    // * r = 25e7
    //
    // ##### ループn回目
    // * 3回目 ... x = 125,000,000
    // * 4回目 ... x = 62,500,000
    // * 5回目 ... x = 15,625,000
    // (省略)
    // * 25回目 ... x = 29
    // * 26回目 ... x = 14
    //
    // ##### ループ27回目
    // * x = (0+14) / 2 = 7
    // * now = (7-1) / 7 + (9-1) / 7 = 1
    // * f(7) --> true
    // * r = 7
    //
    // ##### ループ28回目
    // * x = (0+7) / 2 = 3
    // * now = (7-1) / 3 + (9-1) / 3
    //       = 2 + 2
    //       = 4
    // * f(3) --> false
    // * l = 3
    //
    // ##### ループ29回目
    // * x = (3+7) / 2 = 5
    // * now = (7-1) / 5 + (9-1) / 5
    //       = 1 + 1
    //       = 2
    // * f(5) --> true
    // * r = 5
    //
    // ##### ループ30回目
    // * x = (3+5) / 2 = 4
    // * now = (7-1) / 4 + (9-1) / 4
    //       = 1 + 2
    //       = 3
    // * f(4) --> true
    // * r = 4
    //
    // r=4, l=3 より、r-l > 1 を満たさなくなったため、while ループを終了する
    //
    auto f = [&](int x) {
      ll now = 0;
      for (int i = 0; i < n; i++) {
        now += (a.at(i)-1) / x;
      }
      return (now <= k);
    };
    if (f(x)) {
      r = x;
    } else {
      l = x;
    }
  }

  cout << r << endl;
  return 0;
}


Measured memory_bytes: 4024
r,c=map(int,input().split())
mat=[list(input()) for i in range(r)]

r_chk=[0]*r
c_chk=[0]*c

for i in range(r):
	for j in range(c):
		if mat[i][j]=='#':
			r_chk[i]=1
			c_chk[j]=1

for i in range(r):
	chk=0
	for j in range(c):
		if r_chk[i]==1 and c_chk[j]==1:     
			print(mat[i][j],end='')
			chk=1
	if chk==1:
		print('') 

Measured memory_bytes: 4596
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#define STR 10
int main(){
    char a;
    scanf("%c",&a);
    if(isupper(a)==0){
        printf("a");
    }else{
        printf("A");
    }
    return 0;
}

Measured memory_bytes: 1656
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC return 0;
using namespace std;
int a, b;
int main() {
    DAU
    cin >> a >> b;
    if (a == b)
        cout << "Yes";
    else cout << "No";
    PLEC
}


Measured memory_bytes: 256
from heapq import heappop,heappush
inf = float("inf")
white = 0; gray = 1; black =2

def prim():
    mindist[0] = 0 
    PQ = [(0,0)]
    while PQ:
        minw,s = heappop(PQ)
        color[s] = black
        if mindist[s] < minw: continue
        for t,w in G[s]:
            if color[t] == black: continue
            if w < mindist[t]:
                mindist[t] = w
                color[t] = gray
                heappush(PQ,(w,t))
    return sum(mindist)

V,E = map(int,input().split())
G = [[] for _ in range(V)]
for _ in range(E):
    s,t,w = map(int,input().split())
    G[s].append((t,w))
    G[t].append((s,w))
color = [white]*V
mindist = [inf]*V
print(prim())


Measured memory_bytes: 32948
from sys import setrecursionlimit
setrecursionlimit(10**9)

from sys import stdin
#入力
readline=stdin.readline
n,m=map(int,readline().split())
G=[[] for _ in range(n)]
for i in range(m):
    a,b=map(lambda x:int(x)-1,readline().split())
    G[a].append(b)
    G[b].append(a)

flags=[False]*n
ans=0
def dfs(now,cnt):
    global ans
    cnt+=1
    flags[now]=True
    if cnt==n:
        ans+=1
    else:
        for nex in G[now]:
            if flags[nex]==False:
                dfs(nex,cnt)
    flags[now]=False

dfs(0,0)
print(ans)

Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))
list = [0]*8
cnt =0
for i in range(n):
    if a[i]//400 >= 8:
        cnt += 1
    else:
        list[a[i]//400] += 1
if cnt == n:
    print(1,min(cnt,8))
else:
    print(8-list.count(0),8-list.count(0)+cnt)

Measured memory_bytes: 61932
n=int(input())
a=[]
s1=0
s2=0
for i in range(n):
    t=int(input())
    a.append(t)
a.sort()
if n==2:
    print(a[1]-a[0])
elif n%2==0:
    m=(n-2)//2
    
    for i in range(m):
        s1=s1-2*a[i]
    s1=s1-a[m]
    s1=s1+a[m+1]
    for i in range(m+2,n):
        s1=s1+2*a[i]
    print(max(s1,s2))
elif n==3:
    print(max((a[2]-a[0]+a[1]-a[0]),(a[2]-a[1]+a[2]-a[0])))
elif n%2==1:
    m=(n-2)//2
    
    for i in range(m):
        s1=s1-a[i]*2
    s1=s1-a[m]
    s1=s1-a[m+1]
    for i in range(m+2,n):
        s1=s1+2*a[i]
    
    for i in range(m+1):
        s2=s2-a[i]*2
    s2=s2+a[m+1]
    s2=s2+a[m+2]
    for i in range(m+3,n):
        s2=s2+2*a[i]
    
    print(max(s1,s2))

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

int main()
{
  int n, array[100];

  cin >> n;

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

  for(int i = n - 1; i >= 0; i--)
  {
    if(i != n -1) cout << " ";
    cout << array[i];
  }

  cout << endl;

  return 0;
}

Measured memory_bytes: 3112
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
const ll MAX_B = 63;
const ll MAX = (1ll<<MAX_B);
bool add_v(vector<ll> &base,ll nv){
  sort(base.begin(),base.end(),greater<ll>());
  for(auto b:base){
    nv = min(nv,nv^b);
  }
  if(nv==0){
    return false;
  }else{
    base.push_back(nv);
    return true;
  }
}
void solve(){
  ll n;
  string s;
  cin >> n;
  vector<ll> a(n),base;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  cin >> s;
  base.push_back(0);
  for(int i=n-1;i>=0;i--){
    bool res = add_v(base,a[i]);
    if(!res) continue;
    if(s[i]=='1'){
      cout <<"1\n";
      return;
    }
  }
  cout << "0"<<endl;
}
signed main(){
  init_io();
  ll t;
  cin >> t;
  while(t--) solve();
}


Measured memory_bytes: 3548
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

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

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

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	h := make([]int, N)
	for i := 0; i < N; i++ {
		h[i] = getInt()
	}
	dp := make([]int, N)
	dp[0] = 0
	for i := 1; i < N; i++ {
		dp[i] = math.MaxUint32
	}
	for i := 0; i < N; i++ {
		if i+1 < N {
			c1 := asub(h[i+1], h[i])
			dp[i+1] = min(dp[i+1], dp[i]+c1)
		}
		if i+2 < N {
			c2 := asub(h[i+2], h[i])
			dp[i+2] = min(dp[i+2], dp[i]+c2)
		}
	}
	out(dp[N-1])
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pairSS
#define int long long
#define MOD 1000000007
int gcd(int a,int b){
  if(a==0){
    return b;
  }
  return gcd(b%a,a);
}
int lcm(int a,int b){
  return a*b/gcd(a,b);
}
signed main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(c-(a-b)<0){
    cout << 0  << endl;
  } else {
  cout << c-(a-b) << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
D = {
    'gray': 0,
    'brown': 0,
    'green': 0,
    'lightblue': 0,
    'blue': 0,
    'yellow': 0,
    'orange': 0,
    'red': 0,
}
ultimate = 0

for a in A:
    if a < 400:
        D['gray'] += 1
    elif a < 800:
        D['brown'] += 1
    elif a < 1200:
        D['green'] += 1
    elif a < 1600:
        D['lightblue'] += 1
    elif a < 2000:
        D['blue'] += 1
    elif a < 2400:
        D['yellow'] += 1
    elif a < 2800:
        D['orange'] += 1
    elif a < 3200:
        D['red'] += 1
    else:
        ultimate += 1

smallest = sum(map(bool, D.values()))
biggest = smallest + ultimate
print(max(1, smallest), biggest)


Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstdlib>
#define cmax(a,b) (a<(b)?a=(b),1:0)
#define cmin(a,b) (a>(b)?a=(b),1:0)
#define dmin(a,b) ((a)<(b)?(a):(b))
#define dmax(a,b) ((a)>(b)?(a):(b))
#define regsiter register
#define CL fclose(stdin),fclose(stdout)
namespace io
{
	int F()
	{
		int n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
	long long G()
	{
		long long n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
}
int a[511111];
int d[511111];
int ab(int x)
{
	return x>0?x:-x;
}
int r[511111];
int main()
{
	int n=io::F(),D=io::F();
	for(register int i=1;i<=n;++i)a[i]=io::F();
	d[0]=D;
	for(register int i=1;i<=n;++i)d[i]=dmin(d[i-1],ab(d[i-1]-a[i]));
	r[n+1]=0;
	for(register int i=n;i;--i)
	{
		int cc=a[i]/2;
		if(r[i+1]>=cc)r[i]=r[i+1]+a[i];
			else r[i]=r[i+1];
	}
	int q=io::F();
	for(register int i=1;i<=q;++i)
	{
		int x=io::F();
		if(d[x-1]>r[x+1])puts("YES");
			else puts("NO");
	}
	return 0;
}




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

using namespace std;

int n,k,t[1005],sm,i;

int main() {
    cin>>n>>k;
    for (i=1; i<=n; i++) cin>>t[i];
    sort(t+1,t+n+1);
    for (i=1; i<=k; i++) sm+=t[i];
    cout<<sm;
}

Measured memory_bytes: 3632
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static         Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static long mod =1000000007;
	public static void main(String[] args) {
		long Q=sc.nextLong();//0.25 0.5 1 2
		long H=sc.nextLong();
		long S=sc.nextLong();
		long D=sc.nextLong();
		long N=sc.nextLong();
		
		long ans=0;
		
		long t2=Math.min(Q*8, Math.min(H*4, Math.min(S*2, D)));
		//p("t2"+t2);
		ans+=N/2*t2;
		N%=2;
		
		long t1=Math.min(Q*4, Math.min(H*2, S));
		//p("t1"+t1);
		ans+=N*t1;
		N%=1;
		p(ans);
		//System.out.println(cc);
	}
	//N==S
	//E==W
//83 S 
	//69E
	//78N
	//87W
	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 21844
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
#define ONE (ii-1)
#define TWO (ii)
#define THREE (ii+1)
using namespace std;
int main(){
  int n,ii,jj;
  vector<int> a;
  vector<long> cost;
  long tmp;
  cin >> n;
  a.resize(n+2);
  a[0] = 0;
  a[n+1] = 0;
  
  for(ii=1;ii<=n;ii++){
	cin >> a[ii];
  }


  tmp =0;

  for(jj=1;jj<=n+1;jj++){
	tmp += abs(a[jj] - a[jj-1]);
	//if(jj==ii){
	//
	//}
	//else if(jj==ii+1){
	//  tmp += abs(a[jj] - a[jj-2]);
	//}
	//else{
	//
	//}
  }

  //cout << "tmp:" << tmp << endl;
  for(ii=1;ii<=n;ii++){
	// a[ii]とa[ii+1]の方向確認
	//if(a[ii] * a[ii+1] == 0){
	//
	//}
	//else if(a[ii] * a[ii+1] > 0){
	//  if(abs(a[ii]) <= abs(a[ii+1])){
	//	  cost.push_back(tmp);
	//	}
	//	else{
	//	  cost.push_back(tmp - abs(a[ii] - a[ii-1]));
	//	}
	//}
	//else if(a[ii] * a[ii+1] < 0){
	//  cost.push_back(tmp - abs(a[ii] - a[ii-1]));	  
	//}
	//else{
	//
	//}

	if(a[ONE] <= a[TWO] && a[TWO] <= a[THREE]){
	  cost.push_back(tmp);
	}
	else if(a[ONE] <= a[THREE] && a[THREE] <= a[TWO]){
	  cost.push_back(tmp - abs(a[ii+1]-a[ii]) * 2);
	}

	else if(a[TWO] <= a[ONE] && a[ONE] <= a[THREE]){
	  cost.push_back(tmp - abs(a[ii-1]-a[ii])*2);
	}
	else if(a[TWO] <= a[THREE] && a[TWO] <= a[ONE]){
	  cost.push_back(tmp - abs(a[ii+1]-a[ii]) * 2);
	}

	else if(a[THREE] <= a[ONE] && a[ONE] <= a[TWO]){
	  cost.push_back(tmp - abs(a[ii-1]-a[ii])*2);
	}
	
	else if(a[THREE] <= a[TWO] && a[TWO] <= a[ONE]){
	  cost.push_back(tmp);
	}
	else{
	  cout << "kokonihaこないはず" << endl;
	}
  }

  //if(ii!=n){
  //  tmp+=abs(a[n]);
  //}
  //else{
  //  tmp+=abs(a[n-1]);
  //}



  for(ii=0;ii<n;ii++){
	cout << cost[ii] << endl;
  }
  return 0;
}


Measured memory_bytes: 2548
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s[2]==s[3] && s[4]==s[5]){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

const int INF = 0x3f3f3f3f;
const double pi = acos(-1.0);

LL up[100123]{1}, a[100123];

int main()
{
    int n;
    cin >> n;
    rep(i, n+1) scanf("%lld", a+i);
    if(a[0] > 1) {
        puts("-1");
        return 0;
    }
    int p = n;
    LL cur = 1 - a[0];
    Rep(i, n) {
        up[i] = cur * 2;
        cur = up[i] - a[i];
        if(cur < 0) {
            puts("-1");
            return 0;
        }
        if(up[i] > 1e18) {
            p = i;
            break;
        }
    }
    for(int i = n; i > p; --i) a[i-1] += a[i];
    for(int i = p; i; --i) a[i-1] = min(a[i-1] + a[i], up[i-1]);
    cout << accumulate(a, a+n+1, 0ll) << endl;
    return 0;
}



Measured memory_bytes: 5256
#include <math.h>
#include <utility>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main(){
	int n;
	int M;
	vector<int> p;
	vector<int> q;
	while(true) {
		cin >> n >> M;
		if ( n == 0 ) break;
		p.clear();
		int k;
		for ( int i = 0; i < n; i++ ) {
			cin >> k;
			p.push_back(k);
		}
		p.push_back(0);
		n++;
		sort(p.begin(),p.end());
		q.clear();
		int u = 0;
		for ( int i = 0; i < n; i++ ) {
			for ( int j = i; j < n; j++ ) {
				q.push_back( p[i]+p[j] );
				u++;
			}
		}
		sort(q.begin(),q.end());
		int s = 0;
		for ( int i = 0; i < n; i++ ) {
			for ( int j = i; j < n; j++ ) {
				int c = p[i] + p[j];
				if ( c > M ) continue;
				if ( c == M ) {
					s = M;
					break;
				}
				if ( M - c < q[0] ) {
					s = max( s, c );
					continue;
				}
				if ( q[u-1] <= M - c ) {
					s = max( s, c + q[u-1] );
					continue;
				}
				s = max( s, c );
				int x = 0;
				int y = u - 1;
				while(true) {
					int k = ( x + y ) / 2;
					if ( q[k] < M - c ) {
						s = max( s, c + q[k] );
						if ( k == y ) break;
						x = k + 1;
						continue;
					}else if ( q[k] == M - c ) {
						s = M;
						break;
					}else {
						if ( x == k ) break;
						y = k - 1;
						continue;
					}
				}
			}
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 3172
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>

using namespace std;

int main(){
	double args[1001]; args[0] = 0;
	for (int i = 0; i < 1000; i++){
		args[i+1] = args[i] + atan(1.0/sqrt((double)i+1));
	}

	int n;
	while(cin>>n,~n){
		double l = sqrt((double)n);
		printf("%lf\n%lf\n",l * cos(args[n-1]),l * sin(args[n-1]));
	}

    return 0;
}

Measured memory_bytes: 0
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int K, N;
    cin >> K >> N;

    vector<int> elems;
    for (int i = 1; i * i <= K; i++) {
        int j = K / i;
        if (i == j) {
            elems.push_back(i);
        } else {
            elems.push_back(i);
            elems.push_back(j);
        }
    }
    sort(elems.begin(), elems.end());

    auto M = (int) elems.size();

    vector<int> elem_nums(M);
    elem_nums[0] = 1;
    for (int i = 1; i < M; i++) {
        elem_nums[i] = elems[i] - elems[i-1];
    }

    vector<vector<int>> dp(N, vector<int>(M, 0));
    for (int j = 0; j < M; j++) dp[0][j] = elem_nums[j];

    for (int i = 1; i < N; i++) {
        vector<int> S(M, 0);
        for (int j = 0; j < M; j++) {
            if (j >= 1) S[j] = S[j-1];
            (S[j] += dp[i-1][j]) %= MOD;
        }

        for (int j = 0; j < M; j++) {
            dp[i][j] = (elem_nums[j] * S[M - j - 1]) % MOD;
        }
    }

    int ans = 0;
    for (int j = 0; j < M; j++) (ans += dp[N-1][j]) %= MOD;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 51448
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int a, b;
  cin >> a >> b;
  int sum = 1;
  int cnt = 0;
  while(true){
    if(sum >= b){ 
      cout << cnt << endl;
      break;
    }
    cnt++;
    if(sum == 1){
      sum = a;
    }else{
      sum += a-1;
    }
  }
  return 0;
}



Measured memory_bytes: 256
N = int(input())
A = [list(map(int,input().split())) for _ in range(2)]
ans = []
max = 0
for i in range(1,N):
    s = sum(A[0][0:i])+sum(A[1][i-1:N])
    if s > max:
        max = s

if N == 1:
    print(A[0][0]+A[1][0])
else:
    print(max)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll i,j,n,c=0;
    char a;
    cin>>n;
    string str1="",str2="",st;
    for(i=0;i<n;i++)
    {
        cin>>a;
        str1=str1+a;
    }
    st=str1;
    for(j=0;j<n;j++)
    {
        cin>>a;
        str2=str2+a;
    }
   // cout<<str1<<" "<<str2;
   sort(st.begin(),st.end());
   do
   {
       if(st==str1)
       {
           i=c;

       }
       if(st==str2)
       {
           j=c;
       }
       c++;
   }while(next_permutation(st.begin(),st.end()));
   cout<<abs(i-j);
   return 0;
}


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

using namespace std;

int main(){
    int i, res=0, s=0, e=0;
    string S, T;

    cin >> S;
    
    T = "keyence";
    if (S==T) res = 1;
    else{
        for (i=0; i<7; i++){
            if (S[i] == T[i]) s++;
            else break;
        }
        for (i=0; i<7; i++){
            if (T[6 - i] == S[S.size() - 1 - i]) e++;
            else break;
        }

        if (s+e >= 7) res = 1;
    }

    if (res) cout << "YES" << '\n';
    else cout << "NO" << '\n';
}

   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll N, K;
ll ans = LONG_MAX;
ll x[51], y[51];
vector<ll> X, Y;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    for(int i = 1; i <= N; i++) {
        cin >> x[i] >> y[i];
        X.push_back(x[i]);
        Y.push_back(y[i]);
    }
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    for(int i = 0; i < X.size(); i++) {
        ll x1 = X[i];
        for(int j = i; j < X.size(); j++) {
            ll x2 = X[j];
            for(int k = 0; k < Y.size(); k++) {
                ll y1 = Y[k];
                for(int l = k; l < Y.size(); l++) {
                    ll y2 = Y[l];
                    ll dx = x2 - x1;
                    ll dy = y2 - y1;
                    chmax(dx, 1LL);
                    chmax(dy, 1LL);
                    ll counter = 0;
                    for(int m = 1; m <= N; m++) {
                        if(x1 <= x[m] && x[m] <= x2 && y1 <= y[m] && y[m] <= y2) counter++;
                    }
                    if(counter >= K) chmin(ans, dx * dy);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

    auto result = false;

    for (auto i = 0; i < 3; i++, N /= 10) {
        if (N % 10 == 7) {
            result = true;
            break;
        }
    }

    std::cout << (result ? "Yes" : "No") << std::endl;

    return 0;
}

Measured memory_bytes: 3580
MOD = 10**9+7
N = int(input())
S = input()
S2 = input()
lst = []
i = 0
while i < N:
    if i == N-1 or S[i] != S[i+1]:
        lst.append(1)
        i += 1
    else:
        lst.append(2)
        i += 2
if lst[0] == 1:
    ans = 3
else:
    ans = 6
for j in range(1, len(lst)):
    if lst[j-1] == 1:
        ans *= 2
    elif lst[j-1] == 2 and lst[j] == 2:
        ans *= 3
    ans %= MOD
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

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

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    ll a, b, x;
    cin >> a >> b >> x;

    if (a % x == 0) {
        cout << b / x - a / x + 1 << endl;
    } else {
        cout << b / x - a / x << endl;
    }
    return 0;
}


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

int main() {
    string s;
    cin >>s;
    int cn=0, cw=0, cs=0, ce=0;
    for (int i=0; i < s.size(); i++) {
        if (s.at(i)=='N') cn++;
        if (s.at(i)=='W') cw++;
        if (s.at(i)=='S') cs++;
        if (s.at(i)=='E') ce++;
    }
    string ret = "No";

    if (cn>0  && cs>0  && cw>0  && ce>0)  {ret = "Yes";}
    if (cn==0 && cs==0 && cw>0  && ce>0)  {ret = "Yes";}
    if (cn>0  && cs>0  && cw==0 && ce==0) {ret = "Yes";}

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define all(n) (n).begin(),(n).end()
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}

ll ruijou(ll a,ll b){
  ll s = 1;
  while(b > 0){
    if(b & 1)s=s*a%MOD;
    a=a*a%MOD;
    b >>=1;
  }
  return s;
}

int main(){
	ll n;
	bool vv=1;
	cin >> n;
	ll a[100010];
	ll d[10],v[10];
	FOR(i,10)v[i]=0;
	d[0]=0;
	d[1]=0;
	d[2]=0;
	FOR(i,n){
		cin >> a[i];
	}
	if(a[0]!=0)vv=0;

	FOR(i,n){
		ll cnt=0;
		bool k=1;
		FOR(j,3){
			if(a[i]==d[j]){
				if(k)d[j]++;
				k=0;
				cnt++;
				
			}
		}
		v[cnt]++;
		if(cnt==0)vv=0;

	}

	ll ans=1;
	ans=ans*ruijou(2ll,v[2]);
	ans=ans*ruijou(3ll,v[3])%MOD;

	sort(d,d+3);
	int y=0;
	FOR(i,2){
		if(d[i]==d[i+1])y++;
	}
	if(!vv)ans=0;
	cout << ans << endl;
	


}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 200000
#define add(x,y) (e[++ee].nxt=lnk[x],e[lnk[x]=ee].to=y)
using namespace std;
int n,c[N+5],sz[N+5],Mx[N+5],s[N+5],d[N+5],fa[N+5];
int ee,lnk[N+5];struct edge {int to,nxt;}e[N<<1];
I void Walk(CI x,CI v)
{
	s[x]=1;for(RI i=lnk[x];i;i=e[i].nxt)
		e[i].to^fa[x]&&e[i].to<v&&(Walk(e[i].to,v),s[x]+=s[e[i].to]);
}
I void dfs1(CI x)
{
	RI i;for(sz[x]=1,Mx[x]=max(Mx[fa[x]],fa[x]),i=lnk[x];i;i=e[i].nxt)
		e[i].to^fa[x]&&(fa[e[i].to]=x,dfs1(e[i].to),sz[x]+=sz[e[i].to],d[x]+=d[e[i].to]);
	Mx[fa[x]]<x&&(Walk(x,Mx[x]),d[x]=-sz[x]),Mx[fa[x]]<fa[x]&&(d[x]+=sz[x]);
}
I void dfs2(CI x)
{
	fa[x]&&(Mx[fa[x]]<x?c[x]+=s[x]:Mx[fa[x]]<fa[x]&&(c[x]+=d[x]-s[x]),c[x]+=c[fa[x]]);
	for(RI i=lnk[x];i;i=e[i].nxt) e[i].to^fa[x]&&(dfs2(e[i].to),0);
}
int main()
{
	RI i,x,y;for(scanf("%d",&n),i=1;i^n;++i) scanf("%d%d",&x,&y),add(x,y),add(y,x);
	for(dfs1(1),dfs2(1),i=2;i<=n;++i) printf("%d%c",c[i]," \n"[i==n]);return 0;
}

Measured memory_bytes: 34068
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  
  int x,a;
  cin>>x>>a;
  
  if(x<a){
    
    cout<<"0"<<endl;
  }
  
  else{
  
  cout<<"10"<<endl;
  }
  
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

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

  int count = 0;
  for (auto i = 0; i < s.length(); ++i) {
    if (s.at(i) != t.at(i)) {
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3408
program onedimensional_worlds_tale
  implicit none
  integer n, m, x, y
  integer,allocatable :: xs(:)
  integer,allocatable :: ys(:)

  read *, n, m, x, y
  allocate(xs(n + 1))
  allocate(ys(m + 1))
  read *, xs(1:n)
  read *, ys(1:m)
  xs(n + 1) = x
  ys(m + 1) = y
  if (maxval(xs) < minval(ys)) then
     print '(a)', "No War"
  else
     print '(a)', "War"
  end if
  deallocate(xs)
  deallocate(ys)
end program onedimensional_worlds_tale


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	string s;
	char t;
	int box[26];
	int flg,x;
	int i;
	cin>>s;
	for(i=0;i<26;i++)	box[i]=0;
	for(i=0;i<(int)s.size();i++)	box[s[i]-'a']++;
	flg=0;
	for(i=0;i<26;i++){
		if(box[i]==0){
			flg=1;
			x=i;
			break;
		}
	}
	t='a';
	t+=x;
	if(flg==1)	cout<<t<<endl;
	else		cout<<"None"<<endl;
	return 0;
}
	

Measured memory_bytes: 512
#include <iostream>
using namespace std;
long long n, res, ans;
string s;
int main(void){
    // Your code here!
    cin >> n >> s;
    for (int i = 1; i < n; i++) {
        if (s[i] == 'E') ans++;
    }
    res = ans;
    for (int i = 1; i < n; i++) {
        if (s[i - 1] == 'W') ans++;
        if (s[i] == 'E') ans--;
        res = min(ans, res);
    }
    cout << res << endl;
}


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

int n, t[100009], x[100009], y[100009];

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> t[i] >> x[i] >> y[i];
	}
	for (int i = 1; i <= n; i++) {
		int P1 = t[i] - t[i - 1];
		int P2 = abs(x[i] - x[i - 1]);
		int P3 = abs(y[i] - y[i - 1]);
		if (P1 < P2 + P3 || (P2 + P3) % 2 != P1 % 2) { cout << "No" << endl; return 0; }
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1408
void main()
{
    long l, r;
    rdVals(l, r);

    long m = 2019;

    if (l / m != r / m)
    {
        0.writeln;
    }
    else
    {
        long x = l % m, y = r % m;
        long result = m;
        foreach (i; x .. y)
        {
            foreach (j; i+1 .. y+1)
            {
                result = min(result, i*j%m);
            }
        }
        result.writeln;
    }
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
# n = gets.to_i
# array = []
# n.times do
#   array << gets.chomp.to_s
# end

# n
# puts "---"
# puts array.group_by(&:itself).map{|_, v| v.size}

n = gets.chomp.to_i
array = gets.split(" ").map(&:to_i)
array = array.select{|e| e % 2 == 0}

if array.size == 0
    puts "APPROVED"
end

array.size.times do |i|
    if array[i]%3 != 0 && array[i]%5 != 0
        puts "DENIED"
        break
    end

    if i == array.size-1
        puts "APPROVED"
    end
end


Measured memory_bytes: 1788
/*input
BBB
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
    ll ans=1;
    while(m){
        if(m%2){
            ans*=a;
            ans%=(mod);
        }
        a=(a*a)%(mod);
        m>>=1;
    }
    return ans;
}


void init(long long* a,long long n,long long val){
    for(long long i=0;i<n;i++)
        a[i]=val;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    ll t=1,i,j;
   string s;
   cin>>s;
   if(s[0]==s[1]&&s[1]==s[2]){
   	cout<<"No\n";
   }else cout<<"Yes\n";
    return 0;
}




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


void print_array(int array[],int array_num) {
  for(int i=0;i<array_num-1;i++) {
    cout << array[i] << " ";
  }
  cout << array[array_num-1] << endl;
}

void insertion_sort(int array[],int N) {
  int target;
  for (int i=1;i<N;i++) {
    target = array[i];
    int j = i-1;
    while(j >= 0 && array[j] > target) {
      array[j+1] = array[j];
      j--;
    }
    array[j+1] = target;
    print_array(array,N);
  }
}

int main() {
  int N_MAX = 100;
  int N;
  int array[100];

  /* input */
  cin >> N;
  for(int i=0;i<N;i++) {
    cin >> array[i];
  }
  // ??????
  array[N] = -1;

  /* code here */
  print_array(array,N);
  insertion_sort(array,N);

  return 0;
}

Measured memory_bytes: 1160
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>

using namespace std;

static map<char, int> Dictionary;

int ParseRomanNumber(const char *roman) {
  int len = strlen(roman);
  if (len == 0) { return 0; }

  int acc = 0;
  int curr, next = Dictionary[roman[0]];
  for (int i = 1; i < len; ++i) {
    curr = next;
    next = Dictionary[roman[i]];
    acc += curr < next ? -curr : curr;
  }
  acc += Dictionary[roman[len - 1]];
  return acc;
}

int main() {
  Dictionary['I'] = 1;
  Dictionary['V'] = 5;
  Dictionary['X'] = 10;
  Dictionary['L'] = 50;
  Dictionary['C'] = 100;
  Dictionary['D'] = 500;
  Dictionary['M'] = 1000;

  char *line = nullptr;
  size_t buffer_size = 0;
  ssize_t len;
  while ((len = getline(&line, &buffer_size, stdin)) > 0) {
    for (ssize_t i = len - 1; i >= 0 and isspace(line[i]); --i) {
      line[i] = '\0';
    }
    printf("%d\n", ParseRomanNumber(line));
  }
  free(line);

  return 0;
}

Measured memory_bytes: 980
fun main(args: Array<String>) {
    val firstArgs = readLine()!!.split(" ").map { it.toInt() }
    val n = firstArgs[0]
    val x = firstArgs[1]

    val m = IntArray(n)
    for (i in 0 until n) {
        m[i] = readLine()!!.toInt()
    }

    val total = m.sum()
    val min = m.min()!!

    val add = if ((x - total) > 0 ) {
        (x - total) / min
    } else {
        0
    }

    print(n + add)
}

Measured memory_bytes: 38004
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)
k = int(input())
d = list()
d.append(a)
d.append(b)
d.append(c)
for i in range(k):
    d = sorted(d)
    e = d.pop()
    d.append(2 * e)
    
ans = 0
n = len(d)
for _ in range(n):
    ans += d.pop()
print(ans)

Measured memory_bytes: 3064
using System;
namespace inonoa{
    class Ino{
        static void Main(){
            long n = long.Parse(Console.ReadLine());
            long a = long.Parse(Console.ReadLine());
            long b = long.Parse(Console.ReadLine());
            long c = long.Parse(Console.ReadLine());
            long d = long.Parse(Console.ReadLine());
            long e = long.Parse(Console.ReadLine());

            long mn = long.MaxValue;
            foreach(long v in new long[]{a,b,c,d,e}){
                if(v<mn){mn = v;}
            }

            Console.WriteLine(5 + (n-1)/mn);
        }
    }
}

Measured memory_bytes: 11092
from collections import deque
S = list(input())
Q = int(input())
reverse = 1

d = deque()
for i in S:
  d.append(i)


for i in range(Q):
  temp = input().split()
  if temp[0] == "1":
    reverse = -reverse
  else:
    if temp[1] == "1" :
      if reverse == 1:
        d.appendleft(temp[2])
      else:
        d.append(temp[2])
    else:
      if reverse == 1:
        d.append(temp[2])
      else:
        d.appendleft(temp[2])
      
      
length = len(d)
for _ in range(length):
  temp = 0
  if reverse == 1:
    temp = d.popleft()
  else:
    temp = d.pop()
  print(temp, end="")

Measured memory_bytes: 104500
#include<bits/stdc++.h>
#define cy cout << "YES" << endl;
#define cn cout << "NO" << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{

    string s;
    cin >> s;
    map<char,int>mp;
    int m=0;
    for(int i=0;i<s.length();i++)
    {
        mp[s[i]]++;
    }
    for(auto it=mp.begin();it!=mp.end();it++)
    {
        if((it->second)%2!=0)
        {
            m++;
        }
    }
    if(m>0)
    {
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }


}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define MN 200000
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
pair<pair<int,int>,int> s[MN+5];
int n,top,ans=1,a[MN+5];
bool Solve(int ans)
{
    s[top=1]=make_pair(make_pair(1,a[1]),1);int len=a[1];
    for(int i=2;i<=n;++i)
    {
        int x=a[i];
        if(x>len) s[++top]=make_pair(make_pair(len+1,x),1);
        else
        {
            while(s[top].first.first>x) --top;
            if(s[top].first.second>x) s[top].first.second=x;
            while(top)
            {
                if(s[top].second<ans) 
                {
                    int t=s[top].second,l=s[top].first.second;
                    if(s[top].first.first<s[top].first.second) --s[top].first.second;
                    else --top;
                    s[++top]=make_pair(make_pair(l,l),t+1);
                    if(l<x) s[++top]=make_pair(make_pair(l+1,x),1);
                    break;
                }
                else --top;
            }
            if(!top) return false;
            else if(s[top].first.second<x) ++top,s[top]=make_pair(make_pair(s[top-1].first.second+1,x),1);
        }
        len=x;
       // cout<<i<<" finish "<<endl;
       // for(int j=1;j<=top;++j) printf("%d %d %d\n",s[j].first.first,s[j].first.second,s[j].second);
    }
    return true;
}
int main()
{
    n=read();
    for(int i=1;i<=n;++i) a[i]=read();
    int l=1,r=n,mid,res;
    while(l<=r)
    {
        int mid=l+r>>1;
        if(Solve(mid)) res=mid,r=mid-1;
        else l=mid+1;
    }
    cout<<res;
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cassert>

int A[10000]={0};

int min(int n);
int max(int n);
long long sum(int n);

int main(){
  int n;
  std::cin>>n;
  for(int i=0;i<n;++i){
    std::cin>>A[i];
  }

  std::cout << min(n) << " " << max(n) << " " << sum(n) << std::endl;
  return 0;
}

int min(int n){
  assert(n>=1);
  if(n==1) return A[0];
  return std::min(A[n-1],min(n-1));
}

int max(int n){
  assert(n>=1);
  if(n<=1) return A[0];
  return std::max(A[n-1],max(n-1));
}

long long sum(int n){
  assert(n>=1);
  if(n<=1) return A[0];
  return A[n-1]+sum(n-1);
}

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

const int N = 110000;

char str[N];

int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	cin >> str + 1;
	int n = strlen(str + 1);
	if (str[n] == '1' || str[1] == '0') {
		cout << "-1\n";
		return 0;
	}
	for (int i = 1; i < n; i++) if (str[i] != str[n - i]) {
		cout << "-1\n";
		return 0;
	}
	
	int rt = 1, v = 1, bf = 1;
	for (int i = 2; i <= n; i++) if (str[i] == '1') {
		cout << v + 1 << " " << rt << "\n";
		bf++;
		rt = ++v;
		for (int j = 0; j < i - bf; j++) cout << rt << " " << (++v) << "\n"; bf = i;
	}
	cout << v + 1 << " " << rt << "\n";
	
	return 0;
}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>X(N);
  for(int i=0;i<N;i++)
    cin>>X.at(i);
  vector<int>Y=X;
  sort(Y.begin(),Y.end());
  int a=Y.at((N/2)-1);
  int b=Y.at(N/2);
  for(int i=0;i<N;i++){
  if(X.at(i)<=a)
    cout<<b<<endl;
    else
      cout<<a<<endl;
  
  }

   return 0;
}

Measured memory_bytes: 3712
from collections import defaultdict
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    base = 37; MOD = 10**9 + 9
    S = readline().strip()
    L = len(S)
    H = [0]*(L+1)
    v = 0
    ca = ord('a')
    for i in range(L):
        H[i+1] = v = (v * base + (ord(S[i]) - ca)) % MOD
    M = int(readline())
    Q = []
    s = defaultdict(set)
    for i in range(M):
        x, y = readline().split()
        v0 = 0
        for c in x:
            v0 = (v0 * base + (ord(c) - ca)) % MOD
        s[len(x)].add(v0)
        v1 = 0
        for c in y:
            v1 = (v1 * base + (ord(c) - ca)) % MOD
        s[len(y)].add(v1)
        Q.append((len(x), v0, len(y), v1))
    fvs = {}; lvs = {}
    for l, vs in s.items():
        p = pow(base, l, MOD)
        fs = {}; ls = {}
        for i in range(L-l+1):
            v = (H[i+l] - H[i] * p) % MOD
            if v not in fs:
                fs[v] = i
            ls[v] = i
        fv = {}; lv = {}
        for v in vs:
            fv[v] = fs.get(v, L+1)
            lv[v] = ls.get(v, -1)
        fvs[l] = fv
        lvs[l] = lv
    for lx, x, ly, y in Q:
        p0 = fvs[lx][x]
        p1 = lvs[ly][y]
        if p0 <= p1 and p0+lx <= p1+ly:
            write("%d\n" % (p1+ly-p0))
        else:
            write("0\n")
solve()


Measured memory_bytes: 63004
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int a, cnt5 = 0, cnt7 = 0;

  REP(i, 3) {
    cin >> a;
    if(a == 5)
      cnt5++;
    else if(a == 7)
      cnt7++;
  }

  if(cnt5 == 2 && cnt7 == 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	long[] MARCH = new long[5];
    	long ans = 0;
    	for(int i = 0; i < N; i++){
    		char ch = sc.next().charAt(0);
    		switch(ch){
    		case 'M' : MARCH[0]++; break;
    		case 'A' : MARCH[1]++; break;
    		case 'R' : MARCH[2]++; break;
    		case 'C' : MARCH[3]++; break;
    		case 'H' : MARCH[4]++; break;
    		default : break;
    		}
    	}
    	sc.close();
    	for(int i = 0; i < 3; i++){
    		for(int j = i+1; j < 4; j++){
    			for(int k = j+1; k < 5; k++){
    				ans += MARCH[i] * MARCH[j] * MARCH[k];
    			}
    		}
    	}
    	System.out.println(ans);
    }

}


Measured memory_bytes: 46584
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BC
import           Data.Int              (Int64)
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  [x, y] <- readInts
  print $ solve x y

readInts :: IO [Int64]
readInts = map read . words <$> getLine

solve :: Int64 -> Int64 -> Int64
solve x y = go 1 x
  where
    go i x
      | x * 2 <= y = go (i + 1) (x * 2)
      | otherwise = i


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

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.setf(ios::fixed);
	cout.precision(4);
	
	int X, A;

	cin >> X >> A;

	if (X < A) {
		cout << "0\n";
	} else {
		cout << "10\n";
	}

	return 0;
}

Measured memory_bytes: 256
a = input()
b = -1
for i in range(2, len(a)):
    if b == -1:
        b = abs(int(a[i-2] + a[i-1] + a[i]) - 753)
    else:
        if abs(int(a[i-2] + a[i-1] + a[i]) - 753) < b:
            b = abs(int(a[i-2] + a[i-1] + a[i]) - 753)
print(b)


Measured memory_bytes: 2940