akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	int a[100];
	int color[9] = { 0,0,0,0,0,0,0,0,0 };
	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> a[i];
		if (a[i] <= 399)	color[0] = 1;
		else if (a[i] <= 799)	color[1] = 1;
		else if (a[i] <= 1199)	color[2] = 1;
		else if (a[i] <= 1599)	color[3] = 1;
		else if (a[i] <= 1999)	color[4] = 1;
		else if (a[i] <= 2399)	color[5] = 1;
		else if (a[i] <= 2799)	color[6] = 1;
		else if (a[i] <= 3199)	color[7] = 1;
		else
		{
			color[8] += 1;
		}
	}

	int min=0, max=0;

	for (int i = 0; i < 9-1; i++) {
		min += color[i];
	}

	max = min + color[8];
	if (min == 0) {
		min = 1;
	}
	cout << min << " " << max << "\n";
	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  string s,t;
  cin >> s >> t;
  cout << t + s << 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
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();

            // 出力
            if ("ABC".equals(S)) out.println("ARC");
            else out.println("ABC");

        }

    }
}



Measured memory_bytes: 35816
#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 105, K = 1e5 + 5, MOD = 1e9 + 7;
int n, p, dp[N][K], prefix[N][K], a[N];
 
inline int add(int a, int b){
	a += b;
	if(a >= MOD)a -= MOD;
	return a;
}
 
inline int sub(int a, int b){
	a -= b;
	if(a < 0)a += MOD;
	return a;
}
 
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
 
	cin>>n>>p;
	for(int i=1;i<=n;++i)
		cin>>a[i];
 
	for(int i=0;i<=n;++i)
		dp[i][0] = prefix[i][0] = 1;
	for(int j=0;j<=p;++j)
		prefix[0][j] = 1;
 
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=p;++j)
		{
			// coefficient of x^j is prefix[i - 1][j - a[i] : j];
 
			int first = (j - a[i] - 1 >= 0)? prefix[i - 1][j - a[i] - 1] : 0;
			int last = prefix[i - 1][j];
			
			dp[i][j] =  sub(last, first);
			prefix[i][j] = add(prefix[i][j - 1], dp[i][j]);
		}
	}
		
 
	cout<<dp[n][p]<<"\n";
	return 0;
}


Measured memory_bytes: 82176
#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i = 0;i < n;i++){
        scanf("%d",&a[i]);
    }
    int max = 0;
    int max_ind;
    int sub_max = 0;
    for(int i = 0;i<n;i++){
        if(max < a[i]){
            max = a[i];
            max_ind = i;
        }else if(sub_max < a[i]){
            sub_max = a[i];
        }
    }
    for(int i = 0;i < n;i++){
        if(i != max_ind){
            printf("%d\n",max);
        }else{
            printf("%d\n",sub_max);
        }
    }
    return 0;
}

Measured memory_bytes: 2304
n, m = map(int, input().split())
stu = [list(map(int, input().split())) for _ in range(n)]
che = [list(map(int, input().split())) for _ in range(m)]
for i in range(n):
    dmin = abs(stu[i][0] - che[0][0]) + abs(stu[i][1] - che[0][1])
    ans = 1
    for j in range(1, m):
        d = abs(stu[i][0] - che[j][0]) + abs(stu[i][1] - che[j][1])
        if d < dmin:
            ans = j + 1
            dmin = d
    print(ans)


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

typedef long long int ll;
typedef pair<ll, ll> pii;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b)  for(ll i=a;i>=b;i--)
#define vll vector<ll>
#define sz(a) ll(a.size())
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front 
#define MAXN 100010
#define N 100010
#define MOD 1000000007
#define mod 998244353
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define debug(x) cout << '>' << #x << ':' << x << " ";
#define nl '\n'
#define MS(x,y) fill_n(*x, sizeof x / sizeof **x, y);
#define mem(x,y) memset(x,y,sizeof(x));
#define INF 1000000000000000000
#define IO                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);
#define int long long int
main()
{
    IO;
	int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    int pre = 0;
    int res = 0;
    for(int i = 0; i < n; i++){
        if(v[i] < pre){
            res += pre - v[i];
        }
        pre = max(pre, v[i]);
    }
    cout << res << nl;
    return 0;
}

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

int H, W;
vector<string> S;
vector<vector<int>> reach;
long long cntBlack = 0;
long long cntWhite = 0;

void search(int h, int w){
    if(S[h][w]=='#') cntBlack++;
    if(S[h][w]=='.') cntWhite++;

    reach[h][w] = 1;
    int dh[4] = {-1, 1, 0, 0};
    int dw[4] = {0, 0, -1, 1};
    for(int i=0; i<4; i++){
        int nh = h + dh[i];
        int nw = w + dw[i];
        if(0 <= nh && nh < H && 0 <= nw && nw < W && S[nh][nw] != S[h][w] && reach[nh][nw] == 0){
            search(nh,nw);
        }    
    }
}

int main(){
    cin >> H >> W;
    S = vector<string>(H);
    reach = vector<vector<int>>(H, vector<int>(W, 0));
    for(int i=0; i<H; i++)  cin >> S[i];

    long long ans = 0;
    for(int h=0; h<H; h++){
        for(int w=0; w<W; w++){
            cntBlack = 0;
            cntWhite = 0;
            if(reach[h][w] != 1){    
                search(h,w);
                ans += cntBlack*cntWhite;
            }
        }
    }
    cout << ans << endl;
}

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

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

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

    long long ans = 0;
    for(int i = 1; i < n; i++){
        int t = a[i - 1] + a[i];
        if(t <= x) continue;
        ans += t - x;
        a[i] -= min(t - x, a[i]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init (n + 1) @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let maximum = Array.make (n + 1) 0 in
  try
    maximum.(0) <- 1 - as_.(0);
    for i = 1 to n do
      maximum.(i) <- min 1000000000000000000 @@ 2 * maximum.(i - 1) - as_.(i)
    done;
    if List.exists (( > ) 0) @@ Array.to_list maximum then raise Not_found;
    let acc = ref 0 in
    let nodes = ref 0 in
    for i = n - 1 downto 0 do
      let nodes' = min maximum.(i) @@ !nodes + as_.(i + 1) in
      if 2 * nodes' < !nodes then raise Not_found;
      acc := !acc + nodes';
      nodes := nodes'
    done;
    Printf.printf "%d\n" @@ !acc + Array.fold_left ( + ) 0 as_
  with Not_found -> print_endline "-1"


Measured memory_bytes: 9012
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int h,w;
  cin >> h >> w;

  vector<string> c(h);

  rep(i,h)
  {
    cin >> c[i];
  }

  rep(i,h)
  {
    cout << c[i] << endl;
    cout << c[i] << endl;
  }


  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
using System;

class MaximumSum{
    static void Main(string[] args){
        var abc = Console.ReadLine().Split(' ');
        var a = int.Parse(abc[0]);
        var b = int.Parse(abc[1]);
        var c = int.Parse(abc[2]);
        var k = int.Parse(Console.ReadLine());

        var n1 = 0;
        var n2 = 0;
        var maxNumber = max(a, b, c);
        if(maxNumber == a){
            n1 = b;
            n2 = c;
        }else if(maxNumber == b){
            n1 = a;
            n2 = c;
        }else if(maxNumber == c){
            n1 = a;
            n2 = b;
        }

        for(int i=0; i<k; i++){
            maxNumber = maxNumber * 2;
        }

        Console.WriteLine(n1 + n2 + maxNumber);
    }

    static int max(int a, int b, int c){
        if(a > b){
            return (a>c) ? a : c;
        }
        return (b>c) ? b : c;
    }
}

Measured memory_bytes: 11092
var
	M,L,R,ans,ll,rr:int64;
    k,i,x,y,xl,yl,limx,limy,xx,yy,id,ie:Longint;
    dp:array[1..60,1..2,1..2]of int64;
begin
	read(L,R);
    M:=1000000007;
    ll:=1;
    rr:=2;
    for k:=1 to 60 do begin
    	if(rr<=L)or(R<ll)then begin
        	ll:=ll*2;
            rr:=rr*2;
        	continue;
        end;
        for i:=1 to 60 do begin
        	dp[i,1,1]:=0;
        	dp[i,1,2]:=0;
        	dp[i,2,1]:=0;
        	dp[i,2,2]:=0;
        end;
        if L<=ll then if rr-1<=R then dp[1,2,2]:=1 else dp[1,2,1]:=1 else if rr-1<=R then dp[1,1,2]:=1 else dp[1,1,1]:=1;
        for i:=1 to k-1 do begin
        	x:=(L>>(k-1-i))mod 2;
            y:=(R>>(k-1-i))mod 2;
            for xl:=1 to 2 do begin
            	if xl=1 then limx:=x else limx:=0;
                for yl:=1 to 2 do begin
                	if dp[i,xl,yl]=0 then continue;
                	if yl=1 then limy:=y else limy:=1;
                    for yy:=0 to limy do begin
                    	for xx:=limx to yy do begin
                        	if(xl=2)or(xx>limx)then id:=2 else id:=1;
                            if(yl=2)or(yy<limy)then ie:=2 else ie:=1;
                            dp[i+1,id,ie]:=(dp[i+1,id,ie]+dp[i,xl,yl])mod M;
                        end;
                    end;
                end;
            end;
        end;
        ll:=ll*2;
        rr:=rr*2;
        ans:=(ans+dp[k,1,1]+dp[k,1,2]+dp[k,2,1]+dp[k,2,2])mod M;
    end;
    writeln(ans);
end.

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

int main(){
    int x,a,b;cin>>x>>a>>b;
    if(abs(x-a)>abs(x-b))cout<<'B'<<endl;
    else cout<<'A'<<endl;
}

Measured memory_bytes: 3628
package main

import (
	"fmt"
)

func main() {
	var a int
	fmt.Scan(&a)
	min := a
	max := a
	for i := 1; i < 5; i++ {
		var o int
		fmt.Scan(&o)
		if min > o {
			min = o
		}
		if max < o {
			max = o
		}
	}
	var k int
	fmt.Scan(&k)
	if max-min > k {
		fmt.Println(":(")
	} else {
		fmt.Println("Yay!")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 1e6 + 11;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int a, b, n, X;

int get (int x) {
	return (a*x) / b - a*(x / b);
}


main () {
	cin >> a >> b >> n;
	if (b < N) {
		for (int x = 0; x <= min(n, b - 1); ++x)
			if (get(X) < get(x))
				X = x;
	} else {
		for (int y = 0; y <= (n + b - 1) / b; ++y) {
			int x = min(n, (y + 1)*b - 1);
			if (get(x) > get(X))
				X = x;
		}
			
	}

	cout << get(X) << endl;

	
}




Measured memory_bytes: 3596
#include <iostream>

using namespace std;

int main()
{
 int a, b , c ;
 cin >> a >> b >> c ;

    if(a == b && a == c)
        cout << 1;

    else if(a == b && a != c)
        cout << 2;

    else if(a == c && a != b)
        cout << 2;

    else if(b == c && b != a)
        cout << 2;
    else
        cout << 3;


  return 0;
}



Measured memory_bytes: 256
var N = 0
var A = 0

fun main(args: Array<String>) {
    readLine()?.split(" ")?.map {
        it.toInt()
    }?.let {
        N = it[0]
        A = it[1]
    }


    val x = Array(N + 1) { 0 }
    readLine()?.split(" ")?.map {
        it.toInt()
    }?.forEachIndexed { i, n ->
        x[i + 1] = n
    }

    val dp = Array(N + 1) {
        Array(N + 1) {
            Array(N * A + 1) { 0L }
        }
    }
    for (i in 0..N) {
        dp[i][0][0] = 1
    }

    for (i in 1..N) {
        for (j in 1..i) {
            for (k in 1..(N * A)) {
                dp[i][j][k] = if (k < x[i]) {
                    dp[i - 1][j][k]
                } else {
                    dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i]]
                }
            }
        }
    }

    var ans = 0L
    for (j in 1..N) {
        ans += dp[N][j][j * A]
    }

    println(ans)
}



Measured memory_bytes: 63652
while True:
    n, x = [int(i) for i in input().split()]

    if n == x == 0:
        break

    count = 0
    for s in range(1, n+1):
        for m in range(s+1, n):
            for e in range(m+1, n+1):
                if x == sum([s, m, e]):
                    count += 1

    print(count)

Measured memory_bytes: 7716
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	double n, a;
	cin >> n;
	double ans=0.0;
	rep(i, 0, n) {
		cin >> a;
		ans += 1 / a;
	}
	printf("%.5f\n",1/ans);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 2000000

int H[N];
int top=0;

void swap(int a,int b){
	int temp=H[a];
	H[a]=H[b];
	H[b]=temp;
	return;
}

void up_to_heap(){
	
	int i=top-1;
	while(i>0){
		if(i%2==0){
			if(H[i] > H[i/2-1]){
				swap(i,i/2-1);
				i=i/2-1;
			}
			else break;
		}
		else {
			if(H[i] > H[i/2]){
				swap(i,i/2);
				i=i/2;
			}
			else break;
		}
	}
	return;

}

int is_leaf(int i){
	if(top/2 <= i && i < top)return 1;
	return 0;
}

void down_to_heap(){
	int i=0;
	
	while(!is_leaf(i)){
		if(i*2+1==top-1){
			if(H[i] < H[i*2+1]){
				swap(i,i*2+1);
			}
			break;
		}
		else {
			if(H[i*2+1] < H[i*2+2]){
				if(H[i] <H[i*2+2]){
					swap(i,i*2+2);
					i=i*2+2;
				}
				else break;
			}
			else {
				if(H[i] < H[i*2+1]){
					swap(i,i*2+1);
					i=i*2+1;
				}
				else break;
			}
		}
	}
	
	return;
	
}

void extractMax(){
	printf("%d\n",H[0]);
	swap(0,top-1);
	top--;
	down_to_heap();
	return;
}


void insert(int x){
	H[top++]=x;
	up_to_heap();
	
	return;
}

int main(){
	char com[10];
	int x;
	
	while(scanf("%s",com)!=EOF){
		if(com[2]=='d')break;
		
		if(com[0]=='i'){
			scanf("%d",&x);
			insert(x);
		}
		
		if(com[1]=='x')
			extractMax();
	}
	
	return 0;
	
}


Measured memory_bytes: 5600
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	double xs[20],ys[20];
	int cnt=0;
	while(scanf("%lf,%lf",&xs[cnt],&ys[cnt])!=EOF) 
	{
		++cnt;
	}

	int mid=1;
	double ans=0;
	while(mid+1<cnt) 
	{
		double a=sqrt( (xs[mid]-xs[0])*(xs[mid]-xs[0])+(ys[mid]-ys[0])*(ys[mid]-ys[0]) );
		double b=sqrt( (xs[mid]-xs[mid+1])*(xs[mid]-xs[mid+1])+(ys[mid]-ys[mid+1])*(ys[mid]-ys[mid+1]) );
		double c=sqrt( (xs[mid+1]-xs[0])*(xs[mid+1]-xs[0])+(ys[mid+1]-ys[0])*(ys[mid+1]-ys[0]) );
		double z=(a+b+c)/2;
		ans+=sqrt(z*(z-a)*(z-b)*(z-c));
		mid++;
	}
	printf("%.9lf\n",ans);
  return 0;
}

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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

double pow(int p)
{
    double tmp = 1;
    for(int i = 0; i < p ;i++){
        tmp *= 2;
    }
    return tmp;
}

int main()
{
    int n,k; cin >> n >> k;
    double ans = 0;
    for(int i = 1; i <= n; i++){
        int tmp = i;
        int cnt = 0;
        while(tmp < k){
            tmp *= 2;
            cnt++;
        }
        ans += (1.0/pow(cnt)) / n;
    }   
    printf("%.12lf",ans);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
  public static void main(String[] args) throws Exception {
    int n;
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      n = Integer.parseInt(br.readLine());
    }
    System.out.println(n*n*n);
  }
}


Measured memory_bytes: 21332
import collections
import itertools
import numpy as np
import sys
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A,B,C = IL()

if B//A < C:
    print(B//A)
else:
    print(C)

Measured memory_bytes: 21888
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> points = new ArrayList<>();
        for(int i=0; i<n; i++) {
            points.add(sc.nextInt());
        }

        int min = points.get(0);

        for(int p : points) {
            min = Math.min(p, min);
        }

        int max = points.get(0);

        for(int p : points) {
            max = Math.max(p, max);
        }

        System.out.println(max - min);
    }

}

Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int a,b,c;cin >> a >> b >> c;
    if((a == b && b != c) || (a == c && c != b) || (b == c && b != a))cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
// syakyo

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;

int main(){
    int n;
    while(cin >> n,n){
        vvb G(n+1,vb(n+1));
        rep(i,n)rep(j,n){
            char c; cin>>c;
            G[i+1][j+1] = c=='.';
        }

        vvi dp(n+1, vi(n+1));
        int ans = 0;
        loop(i,1,n+1)loop(j,1,n+1)if(G[i][j]){
            dp[i][j] = min({dp[i-1][j-1],dp[i-1][j],dp[i][j-1]})+1;
            ans = max(ans,dp[i][j]);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 5292
a = [ list(map(int,input().split(" "))) for i in range(3)]
n = int(input())
d = [[0 for i in range(3)] for j in range(3)]

for k in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                d[i][j] = 1

ans = 'No'
for i in range(3):
    if ans == 'Yes':
        break;
    count = 0
    for j in range(3):
        count += d[i][j]
        if count == 3:
            ans = 'Yes'
            break;

count = 0
for i in range(3):
    if ans == 'Yes':
        break;
    count = 0
    for j in range(3):
        count += d[j][i]
    if count == 3:
        ans = 'Yes'
        break;

count = 0
for i in range(3):
    if ans == 'Yes':
        break;
    count += d[i][i]
    if count == 3:
        ans = 'Yes'

count = 0
for i in range(3):
    if ans == 'Yes':
        break;
    count += d[i][2 - i]
    if count == 3:
        ans = 'Yes'
            

print(ans)


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

int main(){
    char ch;
    vector<pair <char, int>> p(26, pair< char, int>('a', 0));
    rep(i,25){
        p[i+1].first=p[i].first+1;
    }
    
    while(cin>>ch){
        rep(i,26){
            if(p[i].first==ch||ch+32==p[i].first)
                p[i].second++;
        }
    }
    rep(i, 26){
        cout<<p[i].first<<" : "<<p[i].second<<endl;
    }
            
}


Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
int N, Q;
string S;


//1-indexed
template <typename T>
struct bit{
    int n;
    vector<T> data;

    bit(int n_){
        n = 1;
        while(n < n_) n *= 2;
        data = vector<T>(n+1);
        for(int i = 0; i <= n; i++) data[i] = 0;
    }
    
    T sum(int i){
        T ret = 0;
        while(i > 0){
            ret += data[i];
            i -= i&-i;
        }
        return ret;
    }

    void add(int i, T x){
        while(i <= n){
            data[i] += x;
            i += i&-i;
        }
    }
};

bit<int> *bt[26];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    cin >> S;
    cin >> Q;
    bit<int> p0(N);bt[0] = &p0;
    bit<int> p1(N);bt[1] = &p1;
    bit<int> p2(N);bt[2] = &p2;
    bit<int> p3(N);bt[3] = &p3;
    bit<int> p4(N);bt[4] = &p4;
    bit<int> p5(N);bt[5] = &p5;
    bit<int> p6(N);bt[6] = &p6;
    bit<int> p7(N);bt[7] = &p7;
    bit<int> p8(N);bt[8] = &p8;
    bit<int> p9(N);bt[9] = &p9;
    bit<int> p10(N);bt[10] = &p10;
    bit<int> p11(N);bt[11] = &p11;
    bit<int> p12(N);bt[12] = &p12;
    bit<int> p13(N);bt[13] = &p13;
    bit<int> p14(N);bt[14] = &p14;
    bit<int> p15(N);bt[15] = &p15;
    bit<int> p16(N);bt[16] = &p16;
    bit<int> p17(N);bt[17] = &p17;
    bit<int> p18(N);bt[18] = &p18;
    bit<int> p19(N);bt[19] = &p19;
    bit<int> p20(N);bt[20] = &p20;
    bit<int> p21(N);bt[21] = &p21;
    bit<int> p22(N);bt[22] = &p22;
    bit<int> p23(N);bt[23] = &p23;
    bit<int> p24(N);bt[24] = &p24;
    bit<int> p25(N);bt[25] = &p25;
    
    for(int i = 0; i < N; i++){
        bt[S[i]-'a']->add(i+1, 1);
    }
    
    for(int i = 0; i < Q; i++){
        int c, l, r;
        char s;
        cin >> c >> l;
        if(c  == 1){
            cin >> s;
            bt[s-'a']->add(l, 1);
            bt[S[l-1]-'a']->add(l, -1);
            S[l-1] = s;
        }else{
            cin >> r;
            int ans = 0;
            for(int j = 0; j  < 26; j++){
                int cnt = bt[j]->sum(r)-bt[j]->sum(l-1);
                if(cnt > 0) ans++;
            }
            cout << ans << endl;
        }
    }

}

Measured memory_bytes: 54300
import sys
A=range(14)
m=[[0 for i in A]for j in A]
def f(y,x):
    if m[y][x]==1:
        m[y][x]=0
        f(y,x+1)
        f(y,x-1)
        f(y+1,x)
        f(y-1,x)
    return 1
def solve():
    c=0
    for i in A:
        while m[i].count(1)>0:c+=f(i,m[i].index(1))
    print c
    return 0
y=0
for s in sys.stdin:
    if y<12:
        y+=1
        m[y]=[0]+map(int,list(s[:-1]))+[0]
    else:y=solve()
solve()

Measured memory_bytes: 4300
N = gets.to_i
S = gets.chomp
stack = 0
lp = 0
ans = ""
S.chars{ |s|
  case s
  when "("
    stack += 1
  when ")"
    if stack > 0
      stack -= 1
    else
      lp += 1
    end
  end
  ans += s
}
puts ("("*lp) + ans + (")"*stack)

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

#ifdef DEBUG
#include "../.inc/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    int A, B;
    cin >> A >> B;

    cout << max({A*B, A-B, A+B}) << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int curX = 0, curY = 0, curT = 0;
	rep(i,n){
		int t, x, y;
		cin >> t >> x >> y;
		int dx = abs(curX - x), dy = abs(curY - y);
		if((dx + dy > t - curT) || ((t-curT)-(dx+dy))%2 == 1){
			cout << "No" << endl;
			return 0;
		}
		curX = x; curY = y; curT = t;
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
//http://acm-icpc.aitea.net/index.php?plugin=attach&refer=2009%2FPractice%2F%E6%A8%A1%E6%93%AC%E5%9C%B0%E5%8C%BA%E4%BA%88%E9%81%B8%2F%E8%AC%9B%E8%A9%95&openfile=b.pdf

#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)

int main(void){
	while(1){
		int n, d;//n country  d limit
		cin >> n >> d;
		if(n == 0 && d == 0) return 0;

		vector<pair<int, int> > inf(n);//fi ???????????????????????????????¨????se????¬?????????????????????¨?????§???????????????????????????
		rep(i, n) inf[i].fi = 0;//?????????
		rep(i, n) inf[i].se = 0;//?????????
		vector<vector<int> > misairu(n);//misairu[i][]??????i???????????????????????\???

		rep(i, n){
			int m; scanf("%d", &m);
			misairu[i].resize(m);
			for (int j = m - 1; j >= 0 ; --j){//?????????????????????????????????????????????????????§??????????????\??????
				int c; scanf("%d", &c);
				misairu[i][j] = c;
				inf[i].fi += c;//??????????????????????????\????????????
			}
		}

		//??§?¬????
		while(1){
			bool endflag = false;
			int cntflag = 0;
			rep(j, n){
				int size = misairu[j].size() - inf[j].se;//j???????????¨?????????????????????????????£????????????

				if(size <= 0) continue;
				int now = inf[j].se;//???????¶?????????¨?????§???????????????????????????
				int tikara = misairu[j][now];//????????¨??????????????¨????????????????????????????¨????
				int tmp = inf[j].fi;//????¨?????????????????????????
				inf[j].fi -= tikara;//??????????????????????????????????¨???????????¨????
				//?????§?????¨????°?????????¢???
				int dai = -1, syou = 10000000;
				//??????????????????????????????????¨???????????¨????????¨????
				rep(k, n){
					dai = max(dai, inf[k].fi);
					syou = min(syou, inf[k].fi);
				}

				if(dai - syou > d){//??????????¨?????????§???????????¨?°????????????????????????????d????¶???????????????????????????§??????
					inf[j].fi = tmp;//?????????????????????
					cntflag++;
					if(j == n - 1 && cntflag == n){
						printf("No\n");
						endflag = true;
						break;
					}  
				}else{
					inf[j].se++;
				}
				//?????????????????????????????????????????????????¨????????¨????
				int sum = 0;
				rep(j, n) sum += inf[j].fi;
				if(sum == 0){
					printf("Yes\n");
					endflag = true;
					break;
				}
			}
			if(endflag == true) break;
		}
	}
	return 0;
}

Measured memory_bytes: 3144
#include<stdio.h>
#include<string.h>
int main()
{
    char a[15],b[15],c[15];
    char ph1,ph2;
    scanf("%s",a);
    int len,flag=0;
    len=strlen(a);
    ph1=a[len-1];
    scanf("%s",b);
    ph2=b[0];
    len=strlen(b);
    if(ph1!=ph2)
    {
        printf("NO");
      return 0;
    }
    ph1=b[len-1];
    scanf("%s",c);
    ph2=c[0];
    if(ph1!=ph2&&flag==0)
    {
        printf("NO");
        return 0;
    }
        printf("YES");
    return 0;
}


Measured memory_bytes: 128
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let x: usize = iterator.next().unwrap().parse().unwrap();

    return if x == 3 || x == 5 || x == 7 {
        "YES".to_string()
    } else {
        "NO".to_string()
    };
}


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

int main() 
{
    int n,temp;
    cin>>n;
    temp=n%10;
    if(temp== 2 || temp== 4 || temp== 5 || temp== 7 || temp== 9 )       
    cout<<"hon";
        
    else if(temp==0 || temp== 1 || temp== 6 || temp== 8)
    cout<<"pon";
    
    else if(temp== 3)
    cout<<"bon";
    return 0;
}

Measured memory_bytes: 3600
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: int, B: int, C: int, D: int):
    while True:
        C -= B
        if C <= 0:
            print("Yes")
            break
        A -= D
        if A <= 0:
            print("No")
            break
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(A, B, C, D)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61892
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x -> left != NIL){
    x = x -> left;
  }
  return x;
}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u -> key){
    return u;
  }
  if(k < u -> key){
    return treeSearch(u -> left,k);
  }
    else return treeSearch(u -> right,k);
}

Node treeSuccessor(Node x){
  Node y;
  if(x -> right != NIL){
    return treeMinimum(x -> right);
  }
    y = x -> parent;
    while(y != NIL && x == y -> right){
      x = y;
      y = y -> parent;
    }
    return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z -> left == NIL || z -> right ==  NIL){
    y = z;
  }
    else y = treeSuccessor(z);

  if(y -> left != NIL){
    x = y -> left;
  }
  else x = y -> right;

  if(x != NIL){
    x -> parent = y -> parent;
  }
  if(y -> parent == NIL){
    root = x;
  }
  else if(y == y -> parent -> left)
    y -> parent -> left = x;
  else y -> parent -> right = x;

  if(y != z){
    z -> key = y -> key;
  }
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x != NIL){
    y = x;
    if(z -> key < x -> key){
      x = x -> left;
    }
    else x = x -> right;
  }
  z -> parent = y;
  if(y == NIL){
    root = z;
  }
  else if(z -> key < y -> key){
    y -> left =z;
  }
  else y -> right = z;
}

void inorder(Node u){
  if(u -> left != NIL){
    inorder(u -> left);
  }
  printf(" %d",u -> key);

  if(u -> right != NIL){
    inorder(u -> right);
  }
}

void preorder(Node u){
  printf(" %d",u ->key);

  if(u -> left != NIL){
    preorder(u -> left);
  }
  if(u -> right != NIL){
    preorder(u -> right);
  }
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 9844
#include<stdio.h>
#include<stdlib.h>

typedef long long int int64;

void run(void){
  int n,q;
  scanf("%d%d",&n,&q);
  int *a=(int *)calloc(n,sizeof(int));
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  while(q--){
    int64 x;
    scanf("%lld",&x);
    int64 ans=0;
    int j=0;
    for(i=0;i<n;i++){
      while(j<n && x-a[j]>=0) x-=a[j++];
      ans+=j-i;
      x+=a[i];
    }
    printf("%lld\n",ans);
  }
}

int main(void){
  run();
  return 0;
}



Measured memory_bytes: 2140
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
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;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////




int main(){fastio
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll nxt[n];memset(nxt,-1,sizeof(nxt));
    ll pre=-1;
    rep(i,0,n-1){
        
        if(a[i]!=0){
            if(pre!=-1){
                nxt[pre]=i;
            }
            pre=i;
        }
    }
    //rep(i,0,n-1)cout<<nxt[i]<<" ";cout<<endl;
    pre=n;
    for(ll i=n-1;i>=0;i--){
        if(nxt[i]==-1){
            nxt[i]=pre;
        }else{
            pre=i;
        }
    }
    //rep(i,0,n-1)cout<<nxt[i]<<" ";cout<<endl;
    ll ans=0;
    rep(i,0,n-1){
        ll xo=a[i];
        ll pos=nxt[i];
        while(pos<n){
            if((xo+a[pos])==(xo^a[pos])){
                xo+=a[pos];
                pos=nxt[pos];
            }else{
                break;
            }
        }
        ans+=pos-i;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>
void swap(long long int* first, long long int* second)
{
	int temp = *first;
	*first = *second;
	*second = temp;
}
void quick_sort(long long int* arr, long long int l, long long int r)
{
	if (l >= r)
		return;
	int x = arr[l], i = l - 1, j = r + 1;    //选取左边界值为分界点x，创建i，j两个指针，使其分别指向l - 1和r + 1；
	while (i < j)
	{
		do i++; while (arr[i] < x);
		do j--; while (arr[j] > x);
		if (i < j)
			swap(&arr[i], &arr[j]);
	}
	quick_sort(arr, l, j);
	quick_sort(arr, j + 1, r);
}
int main()
{
	long long int n, k;
	scanf("%lld %lld", &n, &k);
	long long int arr[200005];
	long long int i;
	for (i = 0; i < n; i++)
	{
		scanf("%lld", &arr[i]);
	}
	long long int j;
	long long int temp;
	quick_sort(arr, 0, n - 1);
	long long int sum = 0;
	if (k >= n)
		printf("0");
	else if (k < n)
	{
		for (i = 0; i < n - k; i++)
		{
			sum += arr[i];
		}
		printf("%lld", sum);
	}
	return 0;
}

Measured memory_bytes: 1664
import java.util.Scanner
  
  import scala.collection.immutable.Range.BigInt
  
  
  object Main {
    def main(args: Array[String]): Unit = {
      val sc = new Scanner(System.in)
      val a, b = sc.nextBigInteger()
      
      val ans = if (a.compareTo(b)==1) "GREATER" else if (a.equals(b)) "EQUAL" else "LESS"
      
      println(ans)
    }
    
    def printArray[T](arr: Array[T]): Unit = {
      for (i <- arr.indices) {
        print(s"${arr(i)} ")
      }
      println()
    }
  }


Measured memory_bytes: 27320
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;while(t--)
#define pb push_back
#define nl cout<<endl
#define MOD 1000000007
#define loop(i,start,end) for(int i=start;i<end;i++)
#define N 100001
#define all(v) v.begin(),v.end()
#define oa(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";nl
#define ov(a) for(int i=0;i<a.size();i++)cout<<a[i]<<" ";nl
#define vinn(n,v) int n;cin>>n;vector<int>v(n);loop(i,0,n)cin>>v[i];
#define vinm(n,m,v) int n,m;cin>>n>>m;vector<int>v(n);loop(i,0,n)cin>>v[i];
#define debug(x) cerr<<#x<<" : "<<x<<endl;
mt19937 rd(time(0)); // i = rd%n
bool ch(int n)
{
    int d = n%10;
    while(n>0)
    {
        if(abs(d-n%10)>1)return 0;
        n/=10;
    }
    return 1;
}
struct compare 
{
  bool operator()(const int& l, const int& r) 
  {
      return l > r; //min: > ; max: <
  }
};
 
signed main() 
{
    fastio();

    int k;
    cin>>k;
    vector<int>nx[11];
    queue<int>pq;
    for(int i = 0;i<10;i++)
    {
        if(i-1>=0)nx[i].pb(i-1);
        nx[i].pb(i);
        if(i+1<=9)nx[i].pb(i+1);
        if(i!=0)pq.push(i);
    }

    while(!pq.empty())
    {
        int top = pq.front();
        pq.pop();
        k--;
        if(k==0){cout<<top;return 0;}
        for(auto i:nx[top%10])
        {
            pq.push(top*10+i);
        }
    }


    return 0;
}


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

int main() {
    int N, K, panel=1;
    cin >> N >> K;
     for (int i = 0; i < N; i++) {
        if (panel * 2 < panel + K) {
            panel *= 2;
        }
        else {
            panel += K;
        }
    }
    cout << panel << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

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

    cin>>n;

    cout<<n*n*n<<"\n";

    return 0;
}


Measured memory_bytes: 256
s = input()
listS =list(s)
length = len(listS)
listT = list(input())
listT.extend(listT)

index=0
flag =0
while index<length:
    index2=0
    word=""
    while index2<length:
        word+=listT[index+index2]
        index2+=1
    if word == s:
        flag =1
        print("Yes")
        break
    else:
        index+=1
if flag==0:
    print("No")


Measured memory_bytes: 3060
from operator import mul
from functools import reduce
def comb2(n,r):
    r = min(n - r, r)
    if r <= 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = []

N, K = LI()

for i in range(1,K+1):
    a = int(0)
    if N-K-i+1>=0 and K-i+1>=0:
        a += comb2(N-K+1,i)*comb2(K-1,i-1)
    print(a%mod)

Measured memory_bytes: 44764
import java.util.*;
public class Main{
static long[] aa;
  static long maxx(int[] arr,int ind,int k){
  	if(ind==arr.length-1){
    	return 0;
    }
    if(aa[ind]!=-1){return aa[ind];}
    long maxs=Integer.MAX_VALUE;
    for(int j=1;j<=k;j++){
      if(ind+j>=arr.length){break;}
    	maxs=(long)Math.min( maxs, maxx(arr,ind+j,k )+(long)Math.abs(arr[ind]-arr[ind+j] )  );
    }
    return aa[ind]=maxs;
  }
  
  public static void main(String[] args){
  
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int k=s.nextInt();
    int[] arr=new int[n];
    for(int j=0;j<n;j++){
    	arr[j]=s.nextInt();
    }
    aa=new long[n];
    Arrays.fill(aa,-1);
    System.out.println(maxx(arr,0,k));
  
  }
  
}

Measured memory_bytes: 64456
#include <iostream>
#include <cstring>
#include <string>
int main()
{
    int x,y,k;
    
    std::cin>>x>>y>>k;
    if(y-x+1<=2*k)
    {
        for(int i=x;i<=y;i++)std::cout<<i<<std::endl;
    }
    else
    {
        for(int i=x;i<x+k;i++)std::cout<<i<<std::endl;
        
        for(int i=y-k+1;i<=y;i++)std::cout<<i<<std::endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mem(arr,v) memset(arr,v,sizeof(arr))
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
int main()
{
     ll t,v;
     cin>>t;
     map<ll,ll>mp;
     map<ll,ll> :: iterator it;
     for(int i=1;i<=t;i++)
     {
         cin>>v;
         mp[v]=i;
     }
     for(it=mp.begin();it!=mp.end();it++)
     {
         cout<<it->second<<" ";
     }
}


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

using namespace std;

const int N=2e5+5,OO=0x3f3f3f3f,M=1e9+7;
int t,n,m,k;
vector<string>v;

int main() {
    cin>>n>>m;
    for(int i=0;i<n;++i){
        string s;
        cin>>s;
        v.push_back(s);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();++i)
        cout<<v[i];
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

  int W,H,T,P,x,y,t,s,ans = 0;
  int nae[50][50] ={{}};
  int hiryo[50][50] = {{}};

  cin >> W >> H >> T >> P;

  for(int i = 0;i < P; i++){
    cin >> x >> y >> t;
    if(t > T) continue;
    hiryo[y][x]++;
  }
    /*  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){

      cout << hiryo[i][j];
    }
    cout << endl;
  }
  cout << endl;

  }*/

  /* for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){

      cout << hiryo[i][j];
    }
    cout << endl;
    }*/

  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){
      cin >> s;
      if(s == 1){
	nae[i][j] = 1;
      }
    }
  }

  /* for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){

      cout << nae[i][j];
    }
    cout << endl;
    }*/


  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){
      if(hiryo[i][j] != 0 && nae[i][j] == 1){
	ans += hiryo[i][j];
      }
    }
  }

  cout << ans << endl;
} 

Measured memory_bytes: 1188
n = int(input())

data = {}
names = []
max_poll = 1

for i in range(n):
    s = input()
    try:
        data[s] += 1
    except:
        data[s] = 1
        names.append(s)
    if max_poll < data[s]:
        max_poll = data[s]

winner = []
for key, value in data.items():
    if max_poll == value:
        winner.append(key)

winner.sort()
for i in winner:
    print(i)

Measured memory_bytes: 33416
#include <iostream>

 

using namespace std;

 

int main()
{
    int i, x;
    
    for(i=1; i<=10000; i++)
    {
        cin >> x;
        if(x==0)
        break;
        cout << "Case " << i << ": "<< x << endl;
        
        
    } 
}


Measured memory_bytes: 3052
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int h, a;
	cin >> h >> a;
	if (h%a == 0) cout << h / a << endl;
	else cout << h / a + 1 << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A.append(0)
A.insert(0, 0)

def cost(x1, x2):
    return abs(x1 - x2)

cost_sum = 0
for i in range(1,N+2):
    cost_sum += cost(A[i-1], A[i])

def diff_cost(A, i):
    return cost(A[i-1], A[i]) + cost(A[i], A[i+1]) - cost(A[i-1], A[i+1])

for i in range(1,N+1):
    print(cost_sum - diff_cost(A,i))


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

int main(){
  vector<int> a(3);
  rep(i,3) cin>>a[i];
  sort(a.begin(),a.end());
  vector<int> b(3);
  int t=0;
  while(true){
    if(a[0]%2==1 or a[1]%1==2 or a[2]%2==1){
      break;
    }else if(a[0]==a[1] and a[1]==a[2]){
      t=-1;
      break;
    }else{
      b[0]=a[1]/2+a[2]/2,b[1]=a[2]/2+a[0]/2,b[2]=a[0]/2+a[1]/2;
      a[0]=b[0],a[1]=b[1],a[2]=b[2];
      t++;
    }
  }
  
  cout << t;
  return 0;
}

Measured memory_bytes: 3608