akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  char str[11];
  scanf("%d%s",&n,&str);
  if(n>=3200) printf("%s\n",str);
  else printf("red\n");

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define tr(c, it) \
    for (auto it = c.begin(); it != c.end(); it++)
#define cpresent(c, e) (find(all(c), e) != c.end())
#define present(c, e) (c.find(e) != c.end())
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, d, ans = 0;
    cin >> n >> d;
    fr(i, 0, n)
    {
        ll u, v;
        cin >> u >> v;
        if (u * u + v * v <= d * d)
        {
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

const int INF = 1e15;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

int getNext(const vector<int> &a, int x) {
    auto it = lower_bound(all(a), x);
    if (it == a.end()) return INF;
    return *it;
}

int getPrev(const vector<int> &a, int x) {
    auto it = upper_bound(all(a), x);
    if (it == a.begin()) return INF;
    it--;
    return *it;
}

int f(const vector<int> &a, const vector<int> &b, int x) {
    int ret = 0;
    int next = getNext(a, x);
    ret += abs(x - next);
    int nnext = getNext(b, next);
    int nprev = getPrev(b, next);
    ret += min(abs(next - nnext), abs(next - nprev));
    return ret;
}

int g(const vector<int> &a, const vector<int> &b, int x) {
    int ret = 0;
    int next = getPrev(a, x);
    ret += abs(x - next);
    int nnext = getNext(b, next);
    int nprev = getPrev(b, next);
    ret += min(abs(next - nnext), abs(next - nprev));
    return ret;
}

signed main() {
    int A, B, Q;
    cin >> A >> B >> Q;

    vector<int> s, t;
    inputVector(s, A);
    inputVector(t, B);

    rep(_, Q) {
        int x;
        cin >> x;

        int ret = LLONG_MAX;
        ret = min(ret, f(s, t, x));
        ret = min(ret, f(t, s, x));
        ret = min(ret, g(s, t, x));
        ret = min(ret, g(t, s, x));

        cout << ret << endl;
    }

    return 0;
}


Measured memory_bytes: 2944
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<cmath>
#include<set>
#include<cstdlib>
#include<functional>
#include<climits>
#include<cctype>
#include<iomanip>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
const int mod = 1e9+7 ;
#define clr(a,x) memset(a,x,sizeof(a))
#define cle(a,n) for(int i=1;i<=n;i++) a.clear();
const double eps = 1e-6;
int main()
{
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
   ll a,b;
   while(cin>>a>>b)
   {
     ll c = min(a,b/2);
     b=b-2*a;
     //cout<<c;
     if(b>=4)
     {
       c+=(b/4);
       //cout<<"  00 1 "<<endl;
     }
     cout<<c<<endl;
   }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define CLR(a,x) memset(a,x,sizeof(a))
#define MP make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pa;
const int maxn=1e5+10;

inline ll rd(){
    ll x=0;char c=getchar();int neg=1;
    while(c<'0'||c>'9'){if(c=='-') neg=-1;c=getchar();}
    while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*neg;
}

char s[maxn];

int main(){
    //freopen("","r",stdin);
	scanf("%s",s+1);
	int ans=0;
	for(int i=strlen(s+1);i>1;i--) if(s[i]!=s[i-1]) ans++;
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 384
import * as fs from 'fs';

export class Reader {
    lines: string[];
    currentLine: number;

    constructor() {
        this.lines = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        this.currentLine = 0;
    }

    readLine(): string {
        return this.lines[this.currentLine++];
    }

	readChars(): string[] {
		let S = this.readLine();
		return new Array(S.length).fill(null).map((_, i) => S.charAt(i));
	}

    readInt(): number {
        return Number(this.readLine());
    }

    readInts(): number[] {
        return this.readLine().split(" ").map(Number);
    }
}

let reader = new Reader();
let S = reader.readChars();
let K = reader.readInt();

let i = 0;
let alphabets = "abcdefghijklmnopqrstuvwxyz";

while (K > 0) {
	if (i == S.length-1) {
		S[i] = alphabets[(alphabets.indexOf(S[i])+K)%26];
		K = 0;
	} else if (S[i] == 'a') {
		i += 1;
	} else {
		if ((26-alphabets.indexOf(S[i])) <= K) {
			K = K-(26-alphabets.indexOf(S[i]));
			S[i] = 'a';
		}
		i += 1;
	}
}

console.log(S.join(""));


Measured memory_bytes: 36296
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	


int main() {
	int x;
	cin >> x;
	cout << (x < 1200 ? "ABC" : "ARC") << endl;

	return 0;
}


Measured memory_bytes: 256
def sum_digit(x):
    sumv = 0
    while x > 0:
        t = x % 10
        sumv += t
        x = x // 10
    return sumv

if __name__ == '__main__':
    n, a, b = map(int, input().split())

    ans = 0
    for num in range(a, n+1):
        sumv = sum_digit(num)
        if a <= sumv and sumv <= b:
            ans += num
    print(ans)

Measured memory_bytes: 3060
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	int tmp;
    ll a, b, c;
    cin >> a >> b >> c;
  	if(a*b*4<(c-b-a)*(c-b-a)&&c-b-a > 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main(){
  string S;
  cin>>S;
  int sum=0;
  int count=S.size();
  for(int i=0; i<count; i++){
    char a=S.at(i);
    int n=a-'0';
    sum+=n;
  }
  cout<<(sum%9==0?"Yes":"No")<<endl;
}


Measured memory_bytes: 3700
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	mpa := map[int]int{}
	mpb := map[int]int{}
	aa := make([]int, n)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
		mpa[aa[i]] = 1
	}
	m := getNextInt(scanner)
	bb := make([]int, m)
	for i := 0; i < m; i++ {
		bb[i] = getNextInt(scanner)
		mpb[bb[i]] = 1
	}
	ans := make([]int, 0)
	for i := 0; i < n; i++ {
		if mpb[aa[i]] == 0 {
			ans = append(ans, aa[i])
		}
	}
	for i := 0; i < m; i++ {
		if mpa[bb[i]] == 0 {
			ans = append(ans, bb[i])
		}
	}
	sort.Ints(ans)
	for i := 0; i < len(ans); i++ {
		fmt.Fprintln(writer, ans[i])
	}
}



Measured memory_bytes: 37728
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++ i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; -- i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++ i)
#define ri rd<int>
using namespace std;
const int mod = 1e9 + 7;
const int maxN = 1e6 + 7;

inline int pls(int x, int y) {return (x + y) % mod;}
inline int mns(int x, int y) {return pls(x, mod - y);}
inline int mul(int x, int y) {return 1LL * x * y % mod;}
inline void Add(int &x, int y) {x = pls(x, y);}
inline void Mul(int &x, int y) {x = mul(x, y);}

template<class T> inline T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - 48; return f ? x : -x;
}

int n;
int f[maxN], s[maxN];

int main() {

	n = ri();

	f[0] = 1, f[1] = n;
	s[0] = 1, s[1] = n + 1;
	rep (i, 2, n) {
		f[i] = f[i - 1];
		Add(f[i], mul(n-1, n-1));
		if (i == 2) Add(f[i], n-1);
		else {
			int l = i - 2;
			Add(f[i], s[i-3]);
			Add(f[i], n - 1 - l);
		}
		s[i] = pls(s[i-1], f[i]);
	}

	printf("%d\n", f[n]);

	return 0;
}


Measured memory_bytes: 7936
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"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 getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

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

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

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

const inf = math.MaxUint64 >> 1

var N, K int
var p []int
var c []int

func solveShort(s int) int {
	n := p[s]
	sum := 0
	ret := -inf
	for i := 0; i < K; i++ {
		sum += c[n]
		n = p[n]
		ret = max(ret, sum)
	}
	return ret
}

func solve(s int) int {
	// search loop
	n := p[s]
	used := make([]bool, N)
	r := make([]int, 0)
	for used[n] == false {
		r = append(r, n)
		used[n] = true
		n = p[n]
	}
	// pre
	if K < len(r) {
		m := -inf
		sum := 0
		for i := 0; i < K; i++ {
			sum += c[r[i]]
			m = max(m, sum)
		}
		return m
	}
	ret := -inf
	f := 0
	sum := 0
	for r[f] != n {
		sum += c[r[f]]
		ret = max(ret, sum)
		f++
	}
	// loop
	loop := 0
	mm := ret
	for i := f; i < len(r); i++ {
		loop += c[r[i]]
		mm = max(mm, sum+loop)
	}
	if loop < 0 {
		return mm
	}
	loopsize := len(r) - f
	nn := (K - f) / loopsize
	re := (K - f) % loopsize
	if nn > 0 {
		re += loopsize
		nn--
	}
	out(nn, re)
	sum += loop * nn
	ret = sum
	out(f, r)
	cur := r[f]
	out(sum)
	for i := 0; i < re; i++ {
		sum += c[cur]
		out(sum, cur)
		cur = p[cur]
		ret = max(ret, sum)
	}
	out(ret)
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N, K = getInt(), getInt()
	p = make([]int, N)
	for i := 0; i < N; i++ {
		p[i] = getInt() - 1
	}
	c = getInts(N)

	ans := -inf
	for i := 0; i < N; i++ {
		var ret int
		if K < 10000 {
			ret = solveShort(i)
		} else {
			ret = solve(i)
		}
		ans = max(ans, ret)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 6680
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<iomanip>
#include<algorithm>
using namespace std;



int main() {
  int a;cin >> a;
  if(a<1200){
    cout << "ABC" << endl;
  }else if(1200 <= a && a < 2800){
    cout << "ARC" << endl;
  }else{
    cout << "AGC" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(string S, string T) {
  cout << T << S << endl;
}

int main() {
  string S;
  cin >> S;
  string T;
  cin >> T;
  solve(S, T);
  return 0;
}


Measured memory_bytes: 256
#include <complex>
#include <vector>
#include <set>
#include <cstdio>
using namespace std;

const double EPS = 1e-12;
typedef complex<long double> P;
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

long long pow_binary_mod(long long x,long long y,long long M){
	long long z=1;
	for(;y;y>>=1){
		if((y&1)!=0)z=z*x%M;
		x=x*x%M;
	}
	return z;
}

int main(){
	int M=998244353;
	int N,x,y;
	scanf("%d",&N);
	vector<P>v(N);
	int r=pow_binary_mod(2,N,M);
	set<L>se;
	for(int i=0;i<N;i++)scanf("%d%d",&x,&y),v[i]={(double)x,(double)y};
	for(int i=0;i<N;i++)for(int j=i+1;j<N;j++){
		//if(se.find({i,j})!=se.end())continue;
		L l(v[i],v[j]);
		vector<int>x={i,j};
		for(int k=0;k<N;k++)if(k!=i&&k!=j&&intersectSP(l,v[k]))x.push_back(k);
		r=(r-pow_binary_mod(2,x.size()-2,M))%M;
		for(int a=0;a<x.size();a++)for(int b=a+1;b<x.size();b++){
			//se.emplace(x[a],x[b]);
		}
	}
	printf("%d\n",((r-N-1)%M+M)%M);
}

Measured memory_bytes: 384
#include <cstdio>
#include <cmath>
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
int main( void ){
	int a, b, x;
	if (!scanf( "%d%d%d", &a, &b, &x )){
		return 1;
	}
	if (x > a * a * b / 2){
		printf( "%lf\n", std::atan2(2*(( double )b - (double)x / ( a * a )), (double)a) * 180 / M_PI  );
		return 0;
	}
	printf( "%lf\n", std::atan2(( double )1, 2 * (double)x / (a* b * b )) * 180 / M_PI  );
	return 0;
}


Measured memory_bytes: 128
sub main {
    chomp(my $tmp1 = <STDIN>);
    chomp(my $tmp2 = <STDIN>);
    my ($N, $K) = split(/ /, $tmp1);
    my (@l) = split(/ /, $tmp2);
    print solver($N, $K, @l);
}
main() unless caller;

sub solver {
    my ($N, $K, @l) = @_;
    @l = sort{$b <=> $a}@l;
    my $aa = 0;
    my $maisu = 0;
    my $end_maisu = 0;
    my $ans = 0;
    for my $i(0..$N-1) {
        $maisu++;
        $aa += $l[$i];
        if( $aa >= $K) {
            $aa -= $l[$i];
            $ans++;
            $end_maisu = $maisu;
            $maisu--;
        }
    }
    $end_maisu--;
    if($end_maisu < 0){
        $end_maisu = 0;
    }
    return($N-$ans-$end_maisu);
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main() {
    int k, t;
    cin >> k >> t;
    vector<int> a(t);
    rep(i, t) {
        cin >> a[i];
    }
    sort(all(a), greater<int>());
    if (a[0] <= k / 2) {
        cout << 0 << endl;
    } else {
        cout << k - ((k - a[0]) * 2 + 1) << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node {
  struct node *p;
  int k;
  struct node *n;
};

typedef struct node *NodePointer;

void insert(int);
void delete(NodePointer);
void listprint(void);
NodePointer make_1node(int, NodePointer,NodePointer);

NodePointer head;
NodePointer tail;

int list_count=0;

int main() {
    NodePointer n;
    char command[12];
    int count,num,time=0,flag=0;
    char command_list[4][12]={{"insert"},{"delete"},{"deleteFirst"},{"deleteLast"}};
    head = make_1node(0,NULL,NULL);
    tail = make_1node(0,head,NULL);
    head->n = tail;
    
    scanf("%d",&count);
    while(count>0){
        count--;
        scanf("%s",command);

        if(strcmp(command,command_list[0]) == 0) { 
            scanf("%d",&num);
            insert(num);
            list_count++;
        }

        else if(strcmp(command,command_list[1]) == 0) {
            scanf("%d",&num);
            for(n =head->n; n != tail; n=n->n){
                if(n->k == num){
                    n->p->n = n->n;
                    n->n->p = n->p;
                    delete(n);
                    break;
                }
            }
        }
            
        else if(strcmp(command,command_list[2]) == 0) { 
            n = head->n;
            head->n = n->n;
            head->n->p = head;
            delete(n);
        }
            
        else if(strcmp(command,command_list[3]) == 0) {
	  n=tail->p;
	  tail->p = n->p;
            tail->p->n = tail;
            delete(n);
        }
        
    }
    for(n=head->n; n != tail->p; n=n->n)printf("%d ",n->k);
    printf("%d\n",n->k);
  
    return 0;
}

void insert(int num) {
    NodePointer newnode = make_1node(num, head, head->n);
    head->n->p = newnode;
    head->n = newnode;
}

NodePointer make_1node(int num, NodePointer pre,NodePointer nex) {
    NodePointer n;

    if ((n = (NodePointer)malloc(sizeof(struct node))) == NULL) {
    printf("Error in memory allocation\n");
    exit(8);
    }
    
    n->k = num;
    n->n = nex;
    n->p = pre;
    return n;
}

void delete(NodePointer n) {
    list_count--;
    free(n);
}



Measured memory_bytes: 33040
#include <stdio.h>
#include <iostream>

using namespace std;

#define NONE -1

int checkLength(int index,string str){
    int height = 1;
    for(int i = index;i < str.length();++i){
        switch(str.at(i)){
            case '\\':
                height++;
                break;
            case '_':
                break;
            case '/':
                height--;
                if(height == 0){
                    return i;
                }
                break;
        }
    }
    return NONE;
}

float checkArea(int index1,int index2,string s){
    int height = 1;
    float area = 0.5;
    
    for(int i = index1;i <= index2;++i){
        switch(s.at(i)){
            case '\\':
                area += 0.5 + height;
                height++;
                break;
            case '_':
                area += height;
                break;
            case '/':
                height--;
                area += 0.5 + height;
                break;
        }
    }
    return area;
}


int main(void){
    string s;
    int poolNum = 0;
    double area[20000] = {};
    double totalArea = 0;
    cin >> s;
    
    for(int i = 0;i < s.length();++i){
        if(s.at(i) == '\\'){
            int length = checkLength(i + 1, s);
            if(length != NONE){
                area[poolNum] = checkArea(i + 1,length, s);
                totalArea += area[poolNum];
                poolNum++;
                i = length;
            }
        }
    }
    printf("%.0lf\n",totalArea);
    //cout << totalArea << endl;
    cout << poolNum;
    if(poolNum > 0){
        cout << " ";
    }
    else{
        cout << endl;
    }
    
    for(int i = 0;i < poolNum;++i){
        //cout << area[i];
        printf("%.0lf",area[i]);
        if(i + 1 >= poolNum){
            cout << endl;
        }
        else{
            cout << " ";
        }
    }
}


Measured memory_bytes: 3556
#coding:utf-8

D = int(input())

C = [int(y) for y in input().split()]

S = []

for i in range(D):
    s = [int(y) for y in input().split()]
    S.append(s)

for i in S:
    k = 0
    num = 0
    for f,t in enumerate(i):
        k = max(k,t)
        if k == t:
            num = f + 1
    print("{}".format(num))

Measured memory_bytes: 9516
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[100001];
        for(int i=0;i<n;i++){
            a[sc.nextInt()]++;
        }
        int q = sc.nextInt();
        int b,c;
        long bef = sum(a);
        long ans[] = new long[q];
        for(int i=0;i<q;i++){
            b = sc.nextInt();
            c = sc.nextInt();
            ans[i] = bef+ (c-b)*a[b];
            bef = ans[i];
            a[c] += a[b];
            a[b]=0;
        }
        for (long x : ans) {
            System.out.println(x);
        }
    }

    static long sum(int[] a){
        long sum = 0;
        for (int i=0;i<a.length;i++){
            if(a[i]!=0){
                sum += a[i]*(i);
            }
        }
        return sum;
    }
}

Measured memory_bytes: 60380
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;


int main(){
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    int N, M;
    while(cin>>N>>M, N|M){
        vector<pair<int, int>> d(N);
        for(int i=0; i<N; i++)
            cin >> d[i].second >> d[i].first;
        sort(d.rbegin(), d.rend());
        
        int sum = 0;
        for(int i=0; i<N; i++){
            int x = min(M, d[i].second);
            M -= x;
            sum += d[i].first * (d[i].second-x);
        }
        cout << sum << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull; 
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define SQ(a) (a)*(a)

template <class T, class U> ostream& operator<< (ostream &out, pair<T,U> c) { out << "(" << c.first << " "; out << c.second << ")"; return out; }
template <class T> ostream& operator<< (ostream &out, vector<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
template <class T> ostream& operator<< (ostream &out, set<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
const double PI  = 3.141592653589793238463;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, maxi = 0;
    string s;
    map<string,int> w;
    cin >> n;
    FOR(i,0,n){
        cin >> s;
        w[s]++;
    }
    cin >> m;
    FOR(i,0,m){
        cin >> s;
        w[s]--;
    }
    map<string,int>::iterator it;
    for(it = w.begin(); it != w.end(); it++){
        if(it -> second > maxi){
            maxi = it -> second;
        }
    }
    cout << maxi << endl;
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
using namespace std;
const long long MOD = 1e9 + 7;
int N, K;
string s;
int A[103];
int dp[10005][100], dp2[10005][100], eq[10005];
int main() {
    cin >> s >> K;
    N = s.length();
    //reverse(s.begin(), s.end());
    for (int j = 1; j < 10; ++j)
        dp[0][j % K]++;
    for (int i = 1; i < N - 1; ++i)
        for (int j = 0; j <= 9; ++j)
            for (int k = 0; k < K; ++k)
                dp[i][ (j + k) % K] = (dp[i][ (j + k) % K] + dp[i - 1][k]) % MOD;
    int cnt = 0;
    for (int i = 0; i < N - 1; ++i)
        cnt = (cnt + dp[i][0]) % MOD;

    for (int j = 1; j < s[0] - '0'; ++ j)
        dp2[0][j % K]++;
    eq[0] = (s[0] - '0') % K;
    for (int i = 1; i < N; ++i) {
        eq[i] = (eq[i - 1] + s[i] - '0') % K;
        for (int j = 0; j <= 9; ++j) {
            for (int k = 0; k < K; ++k) {
                dp2[i][ (j + k) % K] = (dp2[i][ (j + k) % K] + dp2[i - 1][k]) % MOD;
            }
            if (j < s[i] - '0') dp2[i][(j + eq[i - 1]) % K]++;
        }
    }
    cout << (cnt + dp2[N - 1][0] + (eq[N - 1] == 0)) % MOD;
    return 0;
}


Measured memory_bytes: 8192
#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() {
  int k,n;
  cin >> k >> n;
  vector<int> a(n+1);
  rep(i,n) cin >> a[i];
  a[n]=k+a[0];
  int l=0;
  rep(i,n){
    l=max(l,a[i+1]-a[i]);
  }
  cout << k-l <<endl;
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(int *a, int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}//ちいさい順
//qsort(a,n,sizeof(int),cmp);
//char s[n][11]

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);


int main (void)
{
	int a[210000],b,c,n,i,count=0;

scanf("%d",&n);
	for(i=1;i<=n;i++){
scanf("%d",&a[i]);
if(a[i]%2==1&&i%2==1){
count++;
}
	}
  printf("%d\n",count);
return 0;
}


Measured memory_bytes: 1732
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

ll modpow(ll a, ll n, ll m){
    if(n == 0) return 1;
    ll half = modpow(a,n/2,m);
    ll res = half * half % m;
    if(n & 1) res = res * a % m;
    return res;
}

int main(){
  int N;cin >> N;
  vector<int> A(N);
  rep(i,N){
    cin >> A[i];
  }
  vector<int> num(N);
  bool ok = true;
  ll ans = 0;
  if(N % 2 == 0){
    rep(i,N){
      num[A[i]]++;
    }
    for(int i = 1; i < N; i+=2){
      if(num[i] != 2) ok = false;
    }
    if(ok){
      ans = modpow(2,N/2,MOD);
    }
  }
  else{
    rep(i,N){
      num[A[i]]++;
    }
    for(int i = 0; i < N; i+=2){
      if(i == 0){
        if(num[i] != 1) ok = false;
      }
      else{
        if(num[i] != 2) ok = false;
      }
    }
    if(ok){
      ans = modpow(2,N/2,MOD);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>

using namespace std;

struct Node {
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

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

    z = (Node *) malloc(sizeof(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 == NIL)
        return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if (u == NIL)
        return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n, i, x;
    string com;

    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        cin >> com;
        if (com == "insert") {
            scanf("%d", &x);
            insert(x);
        } else if (com == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}

Measured memory_bytes: 26668
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

int main(){
	long long k;
	vector<long long> a(3);
	rep(i,3) cin >> a[i];
	cin >> k;

	sort(all(a));
	a[2] *= pow(2, k);
	cout << accumulate(all(a),0LL) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int m,f,r,scoa;
        
        while(true){
            m = sc.nextInt();
            f = sc.nextInt();
            r = sc.nextInt();
            if(m==-1&&f==-1&&r==-1)break;
            scoa = m+f;
            if(m==-1||f==-1)System.out.println("F");
            else if (scoa>=80)System.out.println("A");
            else if (scoa>=65&&scoa<80)System.out.println("B");
            else if (scoa>=50&&scoa<65)System.out.println("C");
            else if (scoa>=30&&scoa<50&&r>=50)System.out.println("C");
            else if (scoa>=30&&scoa<50&&r<50)System.out.println("D");
            else if (scoa<=30)System.out.println("F");
            else System.out.println("E");
        }
        sc.close();
    }
}


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

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

const int64_t mod = 1000000000 + 7;
int64_t mpow(int64_t a, int64_t x) {
  int64_t res = 1;
  while (x > 0) {
    if (x & 1) { res = res * a % mod; }
    a = a * a % mod;
    x = x / 2;
  }
  return res;
}

int64_t solve(int r, int c) {
  auto n = r + c + 2;
  vector<int64_t> fac(n), inv(n);
  fac[0] = 1;
  for (int i = 1; i < n; i++) {
    fac[i] = i * fac[i - 1] % mod;
  }
  inv[n - 1] = mpow(fac[n - 1], mod - 2);
  for (int i = n - 2; i >= 0; i--) {
    inv[i] = inv[i + 1] * (i + 1) % mod;
  }
  auto binom = [&](int a, int b) -> int64_t {
    if (a < 0 or b < 0) return 0;
    if (a < b) return 0;
    return fac[a] * inv[b] % mod * inv[a - b] % mod;
  };
  auto countPath = [&](int a, int b) { return binom(a + b, b); };
  int64_t res = 0;
  for (int i = 0; i <= r; i++) {
    res = (res + countPath(i + 1, c)) % mod;
  }
  return res;
}

int main() {

  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;

  auto ans = solve(r2, c2);
  ans = (ans - solve(r1 - 1, c2) + mod) % mod;
  ans = (ans - solve(r2, c1 - 1) + mod) % mod;
  ans = (ans + solve(r1 - 1, c1 - 1)) % mod;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 31592
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>

#define PB push_back
#define MP make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define LLINF (1LL<<60)
#define MOD 1000000007
#define REP(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;

int main() {
    int count[200] = {};
    string s;
    cin >> s;
    bool ans = true;
    for (int i = 0; i < s.length(); i++) count[s[i]]++;
    for (int i = 'a'; i <= 'z'; i++) {
        if (count[i] % 2 != 0)ans = false;
    }
    if (ans)Yes;
    else No;
    return 0;
}


Measured memory_bytes: 256
def RLE(s):
    rle = []
    pre = "1"
    cnt = 0
    for c in s:
        if c == pre:
            cnt += 1
        else:
            rle.append(cnt)
            pre = c
            cnt = 1
    rle.append(cnt)
    return rle

n, k = map(int, input().split())
s = input()
a = RLE(s)
n = len(a)
a.append(0)
now = sum(a[:2 * k + 1])
ans = now
for i in range(2 * k + 1, n, 2):
    now += a[i] + a[i + 1] - a[i - 2 * k - 1] - a[i - 2 * k]
    ans = max(ans, now)
print(ans)
    

Measured memory_bytes: 77252
d,g=map(int,input().split())
p=[0 for _ in range(d)]
c=[0 for _ in range(d)]
ans = 100**10

for i in range(d):#値を取得！
	p[i],c[i]=map(int,input().split())

for i in range(2**d):
	score = 0
	count = 0
	horyu = 0
	for j in range(d):
		if ((i >> j) & 1):
			score += (j+1)*p[j]*100 + c[j]
			count += p[j]
		else:
			horyu = j
	for _ in range(p[horyu]):
		if score >= g and count < ans:
			ans = count
		score += (horyu + 1) * 100
		count += 1

print(ans)

Measured memory_bytes: 3064
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let v = read_vec::<i32>();
    let n = v[0] as usize;
    let k = v[1];
    let q = v[2];

    let mut members = vec![k-q; n+1];

    for _ in 0..q {
        let a = read::<usize>();
        members[a-1] += 1;
    }

    for i in 0..n {
        yn(members[i] > 0);
    }
}


Measured memory_bytes: 4732
from collections import Counter
from collections import defaultdict
from heapq import heapify
from heapq import heappop
from heapq import heappush
from _collections import defaultdict

h,w,m=[int(x) for x in input().split()]

hcnt=defaultdict(int)
wcnt=defaultdict(int)
bomb=set()
for _ in range(m):
    hi,wi=[int(x)-1 for x in input().split()]
    hcnt[hi]+=1
    wcnt[wi]+=1
    bomb.add((hi,wi))

hmax=max(hcnt.values())
wmax=max(wcnt.values())

hidx=[x for x,y in hcnt.items() if y==hmax]
widx=[x for x,y in wcnt.items() if y==wmax]

ofst=-1
for i in hidx:
    for j in widx:
        if not (i,j) in bomb:
            ofst=0
            break
                
print(hmax+wmax+ofst)

Measured memory_bytes: 80544
'use strict'
const Main = (arg) => {
  let input = arg.trim().split('\n');
  let S = input[0].split('').map(Number);
  let Ans = 0;
  for (let i = 0; i < 3; i++) {
    if (S[i] === S[i + 1]) {
      Ans += 1;
    }
  }
  console.log(Ans===0?'Good':'Bad');
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int b,c,t,ans=0,n,i,a[100005];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    //a[0]--;
    //1 1 0
    for(i=n-2;i>=0;i--)
    {
        if(a[i]>a[i+1])
        a[i]--;
    }
    for(i=1;i<n;i++)
    {
        if(a[i]<a[i-1])
        {
            printf("No");
            return 0;
        }
    }
    printf("Yes");
}

Measured memory_bytes: 640
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sn = new Scanner(System.in);
        
        int r = sn.nextInt();
        BigDecimal num = BigDecimal.valueOf(r * 6.28);
        
        System.out.println(num);

    }
}


Measured memory_bytes: 36148
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1000*1007;

int n, m;

vi graf[nax];

int dp[nax];

int dfs(int v)
{
	if (dp[v])
		return dp[v];
	for (int i : graf[v])
		dp[v]=max(dp[v], dfs(i));
	dp[v]++;
	return dp[v];
}

int main()
{
	scanf("%d%d", &n, &m);
	while(m--)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		graf[a].push_back(b);
	}
	int wyn=0;
	for (int i=1; i<=n; i++)
		wyn=max(wyn, dfs(i));
	printf("%d\n", wyn-1);
	return 0;
}


Measured memory_bytes: 30464
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int a, b, c;
    cin >> a >> b >> c;

    cout << min(c, b / a) << endl;

    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int n;
vector<int> u, k;
vector<int> d, f;
vector<vector<int>> v;

int a = 0;
void dfs(int _n) {
  a++;
  d[_n] = a;
  for(int i = 0; i < k[_n]; ++i) {
    if(d[v[_n][i] - 1] != 0) {
      continue;
    }
    dfs(v[_n][i] - 1);
  }
  a++;
  f[_n] = a;
}

int main() {
  cin >> n;
  u.resize(n); k.resize(n);
  d.assign(n, 0); f.assign(n, 0);
  v.resize(n);
  REP(i, n) {
    cin >> u[i] >> k[i];
    REP(m, k[i]) {
      int a; cin >> a;
      v[i].push_back(a);
    }
  }
  for(int i = 0; i < n; ++i) {
    if(d[i] == 0) dfs(i);
  }
  REP(i, n) {
    cout << u[i] << " " << d[i] << " " << f[i] << endl;
  }
}



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

typedef long long int ll;
using namespace std;
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	string s,t;
    cin>>s>>t;
    ll cnt=0;
    for(ll i=0;i<s.length();i++)
    {
    	if(s[i]!=t[i])
		{
			cnt++;
		}
	}
	cout<<cnt;
}

Measured memory_bytes: 3824
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <iomanip>


using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define dump(x)  cout << #x << " = " << (x) << endl;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
//             0123456789 - digits. check the limits, int vs long
const int MX = 100001;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(6);
    cout << std::fixed;
    // freopen("ex.in","r",stdin);
    // freopen("ex.out","w",stdout);
    int n, k;
    cin >> n >> k;
    int x;
    int cnt = 0;
    for (int i = 0 ; i < n; i++) {
        cin >> x;
        if (x >= k) cnt++;
    }
    cout << cnt ;
    return 0;
}

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

template <class T, class U>
inline bool chmax(T& t, const U& f) { return t < f ? t = f, true : false; }

inline double sqr(double x) { return x * x; }

double solve(int N, vector<double>& r) {
    vector<double> x = r;
    rep(i, N) rep(j, i) chmax(x[i], x[j] + sqrt(sqr(r[i] + r[j]) - sqr(r[i] - r[j])));
    double L = 0.0;
    rep(i, N) chmax(L, x[i] + r[i]);
    return L;
}

int main() {
    int N; cin >> N;
    vector<double> r(N);
    for (auto& e : r) cin >> e;
    cout << fixed << setprecision(8) << solve(N, r) << endl;
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;
int fact[333333],inv[333333];
int mpow(int n,int m){
    int ret=1;
    while(m){
        if(m&1)ret=ret*n%mod;
        n=n*n%mod;
        m>>=1;
    }
    return ret;
}

int C(int n,int k){
    return fact[n]*inv[k]%mod*inv[n-k]%mod;
}

int D(int h,int w){
    return C(h+w-2,h-1);
}

signed main(){
    fact[0]=1;
    for(int i=1;i<333333;i++)fact[i]=fact[i-1]*i%mod;
    inv[333333-1]=mpow(fact[333333-1],mod-2);
    for(int i=333333-2;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;

    int H,W,A,B;
    cin>>H>>W>>A>>B;

    int ans=0;
    for(int j=B;j<W;j++){
        ans=(ans+D(H-A,j+1)*D(A,W-j))%mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5504
def main():
    n,k = map(int,input().split())
    x_s = list(map(int,input().split()))
    left = []
    right = []
    for x in x_s:
        if x < 0:
            left.append(abs(x))
        else:
            right.append(abs(x))

    left = sorted(left)
    right = sorted(right)
    mn = 100000000000
    for i in range(0,k+1):
        #print(i,k-i)
        if i > len(left) or k-i > len(right):
            #print("index_error!")
            continue

        l = left[i-1] if i > 0 else 0
        r = right[k-i-1] if k-i > 0 else 0
        first_move = min(l,r)
        mn = min(mn,l+r+first_move)
        #print("l:",l,"r:",r,"mn:",mn)
    print(mn)








if __name__ == '__main__':
    main()


Measured memory_bytes: 14844
s = input()
n = int(input())
orders = [input().split() for _ in range(n)]
for order in orders:
    a, b = map(int, order[1:3])
    if order[0] == 'print':
        print(s[a:b+1])
    elif order[0] == 'replace':
        s = s[0:a] + order[3] + s[b+1:]
    elif order[0] == 'reverse':
        s = s[0:a] + s[a:b+1][::-1] + s[b + 1:]


Measured memory_bytes: 5624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();//, n = sc.nextInt();
		int sum=0,count=0,flag=0,max=-999999,min=99999;
		//String[] array = new String[n];
		String s=sc.next();//,t=sc.next();
		String buff1,buff2;

		for(int i=0;i<s.length()-1;i++) {
			buff1=s.substring(0,i+1);
			buff2=s.substring(i+1,s.length());
			//System.out.println(buff1+" "+buff2);
			for(int j=0;j<buff1.length();j++) {
				for(int l=0;l<j;l++) {
					if(buff1.charAt(j)==buff1.charAt(l)) {
						flag=1;
						//System.out.println("same");
					}
				}
				if(flag==1) {
					flag=0;
					continue;
				}
				flag=0;
				for(int k=0;k<buff2.length();k++) {
					if(buff1.charAt(j)==buff2.charAt(k)) {
						count++;
						break;
					}
				}
			}
			//System.out.println(count);
			max=Math.max(count, max);
			count=0;
		}

		System.out.println(max);

	}
	public static int sample(int n) {
		return n;
	}

}


Measured memory_bytes: 23508
#include <iostream>

using namespace std;

int main(){
  int y,m,d;
  while(cin>>y>>m>>d){
    if(y>1989||y==1989&&(m>1||(m==1&&d>=8))) cout<<"heisei "<<y-1989+1<<' '<<m<<' '<<d<<endl;
    else if(y>1926||y==1926&&(m>12||(m==12&&d>=25))) cout<<"showa "<<y-1926+1<<' '<<m<<' '<<d<<endl;
    else if(y>1912||y==1912&&(m>7||(m==7&&d>=30))) cout<<"taisho "<<y-1912+1<<' '<<m<<' '<<d<<endl;
    else if(y>1868||y==1868&&(m>9||(m==9&&d>=8))) cout<<"meiji "<<y-1868+1<<' '<<m<<' '<<d<<endl;
    else cout<<"pre-meiji"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1168