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

int main () {

  int a, b;
  cin >> a >> b;
  
  int a_b = b-a;
  int h = 0;
  for (int i = 1; i<a_b; i++) h += i;
  
  cout << h-a << endl;
}

Measured memory_bytes: 256
var
 s:string;
 k:char;
 i:longint;
begin
 readln(s);
 k:='C';
 for i:=1 to length(s) do
  begin
   if(s[i]=k)then
         begin
          if(k='F')then
                begin
                 writeln('Yes');
                 halt;
                end;
          k:='F';
         end;
  end;
 writeln('No');
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
     double a;cin>>a;
     ll b;b=0;
     rep(i,10){
              if(a/i==1||a/i==2||a/i==3||a/i==4||a/i==5||a/i==6||a/i==7||a/i==8||a/i==9){
                                                                                          cout<<"Yes"<<endl;
                                                                                          b++;
                                                                                          break;
                                                                                         }
               
              }
      if(b==0){
               cout<<"No"<<endl;
               }
              
                                
}



Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>

using namespace std;

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

  cin >> n;
  cin >> a >> b;
  
  int cnt[3] = { };

  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;

    if (p <= a) {
      cnt[0]++;
    } else if (p <= b) {
      cnt[1]++;
    } else {
      cnt[2]++;
    }
  }

  int ans = min({cnt[0], cnt[1], cnt[2]});
  cout << ans << endl;

 
  return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n,p=parseMap(split(readline()))
    if n==1
        println(p)
    else
        lim=trunc(Int,ceil(p^(1/n)))
        ans=1
        for i in 2:lim
            res=i^n
            if p<res || res<(i-1)^n
                break
            end
            if p%(i^n)==0
                ans=i
            end
        end
        println(ans)
    end
end
main()

Measured memory_bytes: 111712
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int d[1000][1000];
int c[1000][1000];

int main(){
  int n,m,Q;
  cin >> n >> m >> Q;
  int l[m],r[m];
  rep(i,m)cin >> l[i] >> r[i];
  int p[Q],q[Q];
  rep(i,Q)cin >> p[i] >> q[i];
  for(int i=0;i<m;i++){
    for(int j=1;j<=l[i];j++){
      d[j][r[i]]++;
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      c[i][j]=c[i][j-1]+d[i][j];
    }
  }
  rep(i,Q){
    cout << c[p[i]][q[i]] << endl;
  }
return 0;}

Measured memory_bytes: 9344
#include "stdio.h"
int main(int argc, char const *argv[])
{
	int a,b,i,j,k,l,num[10000],count,number;
	for(i=0;;i++){
		scanf("%d",&a); scanf("%d",&b);
		if(a == 0 && b == 0){
			number = i;
			break;
		}
		count = 0;
		for(j=1;j<=a-2;j++){
			for(k=j+1;k<=a-1;k++){
				for(l=k+1;l<=a;l++){
					if(j+k+l == b){
						count++;
					}
				}
			}
		}
		num[i]= count;
	}

	for (i = 0; i < number; ++i)
	{
		printf("%d\n",num[i]);
	}
	return 0;
}


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

using namespace std;

long long n, k;
int a[200005];
bool visited[200005];
long long d[200005];

int start(int current, int step) {
	if (step == k) {
		return current;	
	}
	visited[current] = true;
	int to = a[current];
	if (!visited[to]) {
		d[to] = d[current] + 1;
		return start(to, step + 1);
	}

	for (int i = 0; i < n; i++)
		visited[i] = false;
	k = (k - d[to]) % (d[current] - d[to] + 1);
	return start(to, 0);
}

int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i]--;
	}
	
	cout << start(0, 0) + 1;
	return 0;
}


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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> L(M),R(M);
  for(int i=0;i<M;++i){
    cin>>L.at(i)>>R.at(i);
  }
  sort(L.begin(),L.end(),greater<int>());
  sort(R.begin(),R.end());

  cout<<max(0,min(N,R.at(0))-L.at(0)+1)<<endl;
}


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

#define mp make_pair
#define pb push_back
#define ppb pop_back
#define fi first
#define se second

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> pl;
typedef vector<ll> vl;
typedef vector<pl> vpl;
typedef vector<vl> vvl;
typedef vector<bool> vb;
typedef vector<vb> vvb;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define foR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define fors(i, n, s) for (int i = 0; i < (int)(n); i += s)
#define foRs(i, a, b, s) for (int i = (int)(a); i < (int)(b); i += s)
#define forr(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define foRr(i, a, b) for (int i = (int)(a) - 1; i >= (int)(b); --i)

#define prnt(a) cout << (a)
#define prntl(a) cout << (a) << endl
#define in insert
#define rem remove
#define er erase

#define linf ((ll) 1e9)
#define inf ((int) 1e5)
#define otherinf 555555

#define mod 1000000007


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

	ll n, a, b;
	string s;
	cin >> n >> a >> b >> s;

	ll passed = 0;
	ll overSeasRank = 1;
	forn(i, s.size())
	{
		if(s[i] == 'a')
		{
			if(passed < a+b)
			{
				cout << "Yes" << endl;
				passed++;
			}
			else
				cout << "No" << endl;
		}
		else if(s[i] == 'b')
		{
			if(overSeasRank <= b && passed < a+b)
			{
				cout << "Yes" << endl;
				passed++;
			}
			else
			{
				cout << "No" << endl;
			}

			overSeasRank++;
		}
		else
			cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 848
#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>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin>>n;
    int w[n];
    rep(i,n){
        cin>>w[i];
    }
    int ans=1e9;
    rep(i,n){
        int sum=0;
        rep(j,n){
            if(j<i){
                sum+=w[j];
            }
            else{
                sum-=w[j];
            }
        }
        ans=min(ans,abs(sum));
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 3588
using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		
		string s = Console.ReadLine();
		int[] a = new int[4]{int.Parse(s.Substring(0,1)),int.Parse(s.Substring(1,1)),int.Parse(s.Substring(2,1)),int.Parse(s.Substring(3,1))};
		int counter = 0;
		
		for(int i=0; i!=3; i++){
			if(a[i]==a[i+1]){counter++;}
		}
		
		if(counter==0){
			Console.WriteLine("Good");
		}else{
			Console.WriteLine("Bad");
		}
	}
}

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

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

    string S;
    cin >> S;

    vector<int> ans(N+1, 0);
    for(int i = 1; i <= N; ++i){
        ans[i] = ans[i-1];
        if(S[i-1] == 'A' && S[i] == 'C') ++ans[i];
    }

    int l, r;
    for(int i = 0; i < Q; ++i){
        cin >> l >> r;
        cout << ans[r-1]-ans[l-1] << endl;
    }
}

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

const int MAX = 100001;
ll d[MAX];

int main () {
  REP(i,MAX) d[i] = 0;

  int n, a, b;
  ll k;
  cin >> n >> k;
  REP(i,n) {
    cin >> a >> b;
    d[a] += b;
  }
  REP(i,MAX) {
    k -= d[i];
    if(k <= 0) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 1024
inputList = list(input().split())

stack = []
operand = ['+', '-', '*']

for i in range(len(inputList)):
  if (inputList[i] in operand):
    arg1 = int(stack.pop())
    arg2 = int(stack.pop())
    if (inputList[i] == '+') :
      temp = arg2 + arg1
    elif (inputList[i] == '-') :
      temp = arg2 - arg1
    elif (inputList[i] == '*') :
      temp = arg2 * arg1
    stack.append(temp)
  else :
    stack.append(inputList[i])
print (stack.pop())



Measured memory_bytes: 5600
#!/usr/bin/env fsharpi

open System;

let ParseIntN ( str : string ) =
    str.Split(' ')
    |> Array.map System.Int32.Parse

let ParseInt1 ( str : string ) =
    ParseIntN str |> fun arr -> arr.[0]

let ParseInt2 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1])

let ParseInt3 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1],arr.[2])

let ReadLinesN ( n : int ) =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.take n

let ReadLines =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.takeWhile ((<>) null)

module String =
    /// Converts a string into a list of characters.
    let explode (s:string) =
        [for c in s -> c]

    /// Converts a list of characters into a string.
    let implode (xs:char list) =
        let sb = System.Text.StringBuilder(xs.Length)
        xs |> List.iter (sb.Append >> ignore)
        sb.ToString()

let s = Console.ReadLine()
s
|> String.explode
|> List.toArray
|> fun s -> (s.[0] = s.[s.Length - 1], s.Length % 2 = 0)
|> function
   | true,true -> "First"
   | true,false -> "Second"
   | false,true -> "Second"
   | false,false -> "First"
|> Console.WriteLine


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


void solve(long long N, long long M, std::vector<long long> H, std::vector<long long> A, std::vector<long long> B){
  long long count = 0;

  map<long long, vector<long long>> hs;
  for(long long i = 0; i < M; i++) {
    hs[A[i]].push_back(H[B[i]-1]);
    hs[B[i]].push_back(H[A[i]-1]);
  }

  for(long long i = 0; i < N; i++) {
    if(hs[i+1].size() == 0 || H[i] > *max_element(hs[i+1].begin(), hs[i+1].end())) count++;
  }

  cout << count << endl;
}

// 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)
int main(){
    long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  std::vector<long long> H(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&H[i]);
  }
  std::vector<long long> A(M);
  std::vector<long long> B(M);
  for(int i = 0 ; i < M ; i++){
    scanf("%lld",&A[i]);
    scanf("%lld",&B[i]);
  }
    solve(N, M, std::move(H), std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 17000
fun main(args: Array<String>) {
    agc011b()
}

fun agc011b() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map { it.toLong() }
        .sorted()

    val cumulativeSum = LongArray(n) { 0 }
    cumulativeSum[0] = aList.first()
    for (i in 1..aList.lastIndex) cumulativeSum[i] = cumulativeSum[i - 1] + aList[i]

    val cumulativeSumReversed = cumulativeSum.reversed()
    val aListReversed = aList.reversed()
    var answer = 1
    while (answer < n && cumulativeSumReversed[answer] * 2 >= aListReversed[answer - 1]) answer++

    println(answer)
}


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

int main()
{
    long long int n,k,i,j;
    cin>>n>>k;

    vector<long long int> stones(n);
    vector<bool> dp(k+1,false);

    for(i=0;i<n;i++)
        cin>>stones[i];
    for(i=0;i<=k;i++)
    {
        for(j=0;j<n;j++)
        {
            if(stones[j]<=i&&!dp[i-stones[j]])
                dp[i]=true;
        }
    }

    if(dp[k])
        cout<<"First";
    else
        cout<<"Second";
}


Measured memory_bytes: 256
private fun readStrings() = readLine()!!.split(" ")
private fun readInts() = readStrings().map { it.toInt() }

fun main(args: Array<String>) {
    val (n, m, d) = readInts()
    val diff = if (d == 0) n else (n - d) * 2
    val answer = (diff.toDouble() / n) * ((m - 1).toDouble() / n)
    println("%.9f".format(answer))
}

Measured memory_bytes: 36068
package main

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

func main() {
	n := readi()
	m := readi()
	a := make([]int, m)
	for i := 0; i < m; i++ {
		a[i] = readi()
	}

	sum := 0
	for i := 0; i < m; i++ {
		sum = sum + a[i]
	}

	ans := n - sum
	if ans >= 0 {
		fmt.Println(ans)
		return
	}
	fmt.Println("-1")
}

/*-------------------utilities-------------------*/

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

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


Measured memory_bytes: 1876
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MOD = 1000000007;

void dfs(int d, ll var, vector<ll> &ans){
    ans.push_back(var);
    if (d == 11)
        return;
    for (ll i = -1; i < 2; i++){
        int a = var % 10 + i;
        if (a >= 0 && a <= 9)
            dfs(d + 1, 10 * var +  a, ans);
    }
}

int main(){
    ll k;
    cin >> k;
    vector<ll> ans;
    for (int i = 1; i < 10; i++){
        int d = 1;
        dfs(d, i, ans);
    }
    sort(ans.begin(), ans.end());
    cout << ans[k - 1] << endl;
}

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

#define                                 pai                                         acos(-1)
#define                                 ll                                          long long
#define                                 pb                                          push_back
#define                                 mp                                          make_pair
#define                                 pll                                         pair<ll,ll>
#define                                 sz(a)                                       (ll)a.size()
#define                                 endl                                        "\n"
#define                                 gcd(a, b)                                   __gcd(a, b)
#define                                 lcm(a, b)                                   (((a)*(b))/gcd(a,b))
#define                                 all(vec)                                    vec.begin(),vec.end()
#define                                 ms(a, b)                                    memset(a,b,sizeof(a))
#define                                 TEST_CASE(t)                                for(int www=1;www<=t;www++)
#define                                 PRINT_CASE                                  printf("Case %d: ",z)
#define                                 fii                                         freopen("input.txt","r",stdin);
#define                                 foo                                         freopen("output.txt","w",stdout);
#define                                 fast                                        ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

const ll mod  = 1e9 +07;
const ll mxn  = 1e6 +10;

int  main()
{
    ll i,j,k,a,b,c,d=0,n,m,t,h,u,v,x,y,z;
    cin>>n;
    vector<ll>vec(n);
    ll sum=0;
    ll tem=0;
    for(i=0;i<n;i++)
    {
        cin>>vec[i];
        if(i==0)
        {
            tem=vec[i];
        }
        else
        {
            ll res=((tem%mod)*(vec[i]%mod))%mod;
            sum=((sum%mod)+(res%mod))%mod;
            //cout<<tem<<"===="<<res<<endl;
            tem=(tem%mod+vec[i]%mod)%mod;

        }
    }
    cout<<sum<<endl;
    return 0;
}




Measured memory_bytes: 4744
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, x[1003] = {}, y[1003] = {}, b = 0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    for (int i = 1; i < n; i++) if (abs(x[i] + y[i]) % 2 != abs(x[0] + y[0]) % 2) {
        cout << -1;
        return 0;
    }
    if ((x[0] + y[0]) % 2 == 0) {
        cout << 32 << '\n';
        for (int i = 30; i >= 0; i--) cout << (1 << i) << ' '; cout << 1 << '\n';
        for (int i = 0; i < n; i++) x[i]--;
        b = 1;
    } else {
        cout << 31 << '\n';
        for (int i = 30; i >= 0; i--) cout << (1 << i) << ' '; cout << '\n';
    }
    for (int i = 0; i < n; i++) {
        int u = 0, v = 0;
        for (int j = 30; j >= 0; j--) {
            if (x[i] - u > y[i] - v && x[i] - u > v - y[i]) u += (1 << j), cout << 'R';
            else if (x[i] - u > y[i] - v && x[i] - u < v - y[i]) v -= (1 << j), cout << 'D';
            else if (x[i] - u < y[i] - v && x[i] - u > v - y[i]) v += (1 << j), cout << 'U';
            else if (x[i] - u < y[i] - v && x[i] - u < v - y[i]) u -= (1 << j), cout << 'L';
            else return 1;
        }
        if (b) cout << 'R';
        cout << '\n';
    }
}


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

using namespace std;

int main(){
	for(int w,h;scanf("%d%d",&w,&h),w;){
		char mat[71][72];
		w++,h++;
		for(int i=0;i<h;i++)	mat[i][0]='X';
		for(int j=0;j<w;j++)	mat[0][j]='X';
		for(int i=1;i<h;i++)	cin>>&mat[i][1];

		string memo[71][71];
		for(int i=1;i<h;i++)for(int j=1;j<w;j++){
			if(!isdigit(mat[i][j]))	continue;

			int len1=memo[i-1][j].length(),len2=memo[i][j-1].length();
			if(len1>0 && len2>0){
				if     (len1>len2)	memo[i][j]=memo[i-1][j];
				else if(len2>len1)	memo[i][j]=memo[i][j-1];
				else	memo[i][j]=max(memo[i-1][j],memo[i][j-1]);
			}
			else if(len1>0)	memo[i][j]=memo[i-1][j];
			else if(len2>0)	memo[i][j]=memo[i][j-1];
			else{
				if(mat[i][j]=='0')	continue;
			}
			memo[i][j]+=mat[i][j];
		}

		string ans;
		int lmax=0;
		for(int i=1;i<h;i++)for(int j=1;j<w;j++){
			int len=memo[i][j].length();
			if(lmax<len || (len==lmax && ans<memo[i][j])){
				ans=memo[i][j];
				lmax=len;
			}
		}
		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

long long r;
long long d;
long long x;
long long dp[555];

int main(){
    cin >> r >> d >> x;
    dp[0] = x;
    for(int i = 0; i < 10; i++){
        dp[i+1] = r*dp[i] - d;
        cout << dp[i + 1] << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAX 100010
vector<int> g[MAX];
int main(){
    int n,m;cin >> n >> m;
    int in[MAX] = {0};
    for(int i = 0;i<m;i++){
        int u,v;cin >> u >> v;
        u--;
        v--;
        in[v]++;
        g[u].push_back(v);
    }
    queue<int> q;
    int d[MAX] = {0};
    for(int i = 0;i<n;i++) if(in[i] == 0) q.push(i);
    
    while(!q.empty()){
        int u = q.front();
        q.pop();
        for(auto v : g[u]){
            in[v]--;
            if(!in[v]){
                d[v] = d[u]+1;
                q.push(v);
            }
        }
    }
    int r = -1;
    for(int i = 0;i<n;i++) r = max(r,d[i]);
    cout << r << '\n';
}

Measured memory_bytes: 6528
#include<iostream>
using namespace std;
int main()
{
  int count, yen;
  cin >> count >> yen;
  
  if(500 * count >= yen)
  {
    cout << "Yes" << endl;
  }
  else
  { 
    cout << "No" << endl;
  }
  
  return 0;
}

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

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

  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }

  vector<int> c(n);
  for (int i = 0; i < n; i++) {
    cin >> c.at(i);
  }

  vector<int> diff(n);
  for (int i = 0; i < n; i++) {
    diff.at(i) = v.at(i) - c.at(i);
  }

  sort(diff.begin(), diff.end(), greater<int>());

  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (diff.at(i) > 0) {
      sum = sum + diff.at(i);
    } else {
      break;
    }
  }

  cout << sum << endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re
import math


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    si = S()
    ans = 0
    for i, s in enumerate(si):
        if s == "R":
            if ans > 0 and si[i-1] == "R":
                ans += 1
            elif ans==0:
                ans += 1
                
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

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

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(7);
    int n;
    cin >> n;
    vector<int> x(n), y(n), num;
    rep (i, n) {
        cin >> x[i] >> y[i];
        num.push_back(i);
    }
    double cnt = 0;
    double res = 0;
    do {
        double tmp = 0;
        rep (i, n - 1) {
            int dx = x[num[i]] - x[num[i + 1]];
            int dy = y[num[i]] - y[num[i + 1]];
            tmp += sqrt(dx * dx + dy * dy);
        }
        res += tmp;
        cnt++;
    } while (next_permutation(num.begin(), num.end()));
    cout << res / cnt << endl;
    
    return 0;
}



Measured memory_bytes: 256
numbers = []
n = int(raw_input())

S = raw_input()

b = S.split(" ")
s = S.split(" ")

for i in range(n):
    for j in  range(n - 1, i, -1):
        if int(b[j][-1]) < int(b[j - 1][-1]):
        	b[j], b[j - 1] = b[j - 1], b[j]
print ' '.join(b)
print "Stable"

for i in range(n):
	minj = i
	for j in range(i, n):
		if int(s[j][-1]) < int(s[minj][-1]):
			minj = j
	s[i], s[minj] = s[minj], s[i]

print ' '.join(s)
flag = 0
for i in range(n):
	if b[i] != s[i]:
		flag = 1
if flag:
	print "Not stable"
else:
	print "Stable"

Measured memory_bytes: 6372
from itertools import combinations
n = int(input())
l = [0]*5
ans = 0

for i in range(n):
  s = input()
  if s[0] == "M":
    l[0] += 1
  elif s[0] == "A":
    l[1] += 1
  elif s[0] == "R":
    l[2] += 1 
  elif s[0] == "C":
    l[3] += 1
  elif s[0] == "H":
    l[4] += 1
    
for a,b,c in combinations(l, 3):
  ans += a* b* c
  
print(ans)

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

int main() {
    int n; cin >> n;
    vector<int> p(n+1); for (int i=1; i<=n; ++i) cin >> p[i];
    int cnt = 0;
    for (int i=1; i<n+1; ++i) {
        if (p[i] != i) cnt += 1;
    }
    if (cnt<=2) {
        cout << "YES" << endl;
    } else {
        cout << "NO"<< endl;
    }
    return 0;
}

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

int main(){
    int N, L;

    cin >> N >> L;

    int sum = (2*L + N - 1)*N / 2;
    if(L <= 0 && L + N - 1 >= 0){
        cout << sum << endl;
    }else if(L > 0){
        cout << sum - L << endl;
    }else{
        cout << sum - (L+N-1) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
// AtCoder :: Beginner Contest 179 :: B - Go to Jail
// https://atcoder.jp/contests/abc179/tasks/abc179_b

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    int doublets{0};
    bool soln{false};
    for (int i{0}; i < N; ++i) {
        int a, b;
        cin >> a >> b;
        if (a == b) {
            doublets++;
            if (doublets == 3) {
                soln = true;
                break;
            }
        } else {
            doublets = 0;
        }
    }
    if (soln) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return EXIT_SUCCESS;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 100100100100100100;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

int main(){
    /*ll N;
    cin >> N;
    map<ll,ll> mp;
    bool flag = 1;
    rep(i,N){
        ll a;cin >> a;
        if(mp[a] != 0){
            cout << "NO" << endl;
            flag = 0;
        }
        mp[a] = 1;
    }
    if(flag){
        cout << "YES" << endl;
    }*/
    ll N,K;
    cin >> N >> K;
    vector<double> A(N);
    rep(i,N){
        cin >> A[i];
        A[i] = (A[i] * (A[i] + 1)) / (2 * A[i]);
    }
    vector<double> sum(N+1);
    rep(i,N){
        sum[i+1] = A[i] + sum[i];
    }
    double ans = 0;
    rep(i,N-K+1){
        ans = max(ans,sum[i+K] - sum[i]);
    }
    cout << setprecision(20) << fixed;
    cout << ans << endl;
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n, a, b, c, d; std::cin >> n >> a >> b >> c >> d;
  a--, b--, c--, d--;
  string s; std::cin >> s;
  if (s[a] == '#' || s[b] == '#' || s[c] == '#' || s[d] == '#') {
    std::cout << "No" << "\n";
    return 0;
  }
  int r = max(c, d);
  int rockCnt = 0, blankCnt = 0;
  bool isCon2Rock = false, canOverB = false;
  srep(i, a, r) {
    if (s[i] == '#') rockCnt++;
    else rockCnt = 0;
    if (rockCnt > 1) isCon2Rock = true;
  }
  if (c > d) {
    srep(i, b-1, d+2) {
      if (s[i] == '.') blankCnt++;
      else blankCnt = 0;
      if (blankCnt > 2) canOverB = true;
    }
  }
  if (isCon2Rock || (c > d && !canOverB)) {
    std::cout << "No" << "\n";
  } else {
    std::cout << "Yes" << "\n";
  }
}


Measured memory_bytes: 592
package main

import (
	"bufio"
	"fmt"
	"os"
	// "reflect"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	n := nextInt()
	MOD := 1000000007
	var ans int64
	ans = 1
	for i:=1;i<=n; i++{
	    ans *= int64(i)
	    ans %= int64(MOD)
	}
	fmt.Fprint(out, ans)
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

int main() {
  int n;
  cin >> n;
  V<int> a(n);
  rep(i, n) cin >> a[i];

  V<int> c(1e5 + 10);
  rep(i, n) c[a[i]]++;
  V<int> m;
  rep(i, 1e5 + 1) {
    if (c[i] > 0) m.push_back(c[i]);
  }

  int ans = 0;
  int s = m.size();
  int l = 0;
  int r = s - 1;
  while (l <= r) {
    while (m[l] <= 1 && l <= s - 1) l++;
    while (m[r] <= 1 && r >= 0) r--;
    if (r == l) {
      if (m[r] % 2 == 0) ans = -1;
      break;
    } else if (m[l] > 1 || m[r] > 1) {
      m[l]--;
      m[r]--;
    }
  }

  rep(i, s) if (m[i] > 0) ans++;
  cout << ans << endl;
}


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

template<typename T>
void chmin(T &a,T b){
  if(a>b)a=b;
}

using ll=long long;
const long long LINF=1e18;
ll v[3]={2,3,5},w[3],d,n,t;
map<ll,ll> m;
ll f(ll x){
  if(!x)return LINF;
  if(x==1)return d;
  if(m[x])return m[x];
  ll res=LINF;
  if(res/d>x-10)chmin(res,x*d);
  for(int i=0;i<3;i++){
    chmin(res,f((x+v[i]-1)/v[i])+w[i]+(v[i]-x%v[i])*d);
    chmin(res,f(x/v[i])+w[i]+(x%v[i])*d);
  }
  return m[x]=res;
}

int main(){
  cin>>t;
  while(t--){
    cin>>n>>w[0]>>w[1]>>w[2]>>d;
    m.clear();
    cout<<f(n)<<endl;
  }
}


Measured memory_bytes: 4380
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = sc.nextInt()
    val A = Array.fill(N)(sc.nextInt())

    // 偶数の時, 同じ向き
    // 奇数の時, 逆向き
    // 0から始まる時, 偶数の時, 後ろにつける, 奇数の時, 前に付ける
    def solve(N: Int, A: Array[Int]): Vector[Int] = {
      @scala.annotation.tailrec
      def loop(i: Int, sink: Vector[Int]): Vector[Int] =
        if (i < N) {
          if (i % 2 == 0) loop(i + 1, sink :+ A(i))
          else loop(i + 1, A(i) +: sink)
        } else {
          if (N % 2 == 0) sink
          else sink.reverse
        }
      loop(0, Vector.empty)
    }

    println(solve(N, A).mkString(" "))
  }

}


Measured memory_bytes: 109920
import math as m
import fractions

A, B = list(map(int, input().split()))
#A , B = 12, 18

def sieve_of_eratosthenes(n):
    candidate = [1 for i in range(n+1)]
    candidate[0] = 0
    candidate[1] = 0
    for i in range(len(candidate)):
        if (candidate[i] == 0):
            continue
        j = 2
        while j * i < len(candidate):
            candidate[i * j] = 0
            j = j + 1
    primes = [i for i in range(n) if candidate[i] == 1]
    return primes

def prime_factorize(A):
    p = sieve_of_eratosthenes(m.floor(A**0.5))
    a = [0 for i in p]
    for i in range(len(p)):
        if A % p[i] != 0:
            a[i] = 0
        else:
            temp = A
            while temp % p[i] == 0:
                temp = temp / p[i]
                a[i] = a[i] + 1
    return a

#pf = prime_factorize(fractions.gcd(A, B))
# num = 1

# for x in pf:
#     if x >= 1:
#         num = num + 1



# print(num)

g = fractions.gcd(A,B)
primes = []
num = 1

if True:
    i = 2
    while i * i <= g:
        if (g % i == 0):
            cnt = 0
            while g % i == 0:
                cnt = cnt + 1
                g = g // i
            primes.append([i, cnt])
        i = i + 1
    if (g != 1):
        primes.append([g, 1])
print(len(primes)+1)

Measured memory_bytes: 5076
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int N,Ac=0,Wc=0,Tc=0,Rc=0;
  cin >> N;
  string str[N];
  
  for (int i = 0;i<N; i++) {
    
    cin >> str[i];
   
     if (str[i]=="AC") 
      Ac++;
     if (str[i]=="WA") 
      Wc++;
     if (str[i]=="TLE") 
      Tc++;
     if (str[i]=="RE") 
      Rc++;
 }
  cout << "AC x " << Ac << endl;
  cout << "WA x " << Wc << endl;
  cout << "TLE x " << Tc << endl;
  cout << "RE x " << Rc << endl;
}

Measured memory_bytes: 6712
use std::io;
fn main() -> io::Result<()>{
    let mut stdin = io::stdin();
    let mut buf = String::new();

    stdin.read_line(&mut buf)?;
    buf.trim();
    let line = buf.split_whitespace().map(|c| c.parse::<u64>().unwrap()).collect::<Vec<u64>>();
    println!("{}",line[0] * line[1]);
    Ok(())
}


Measured memory_bytes: 2140
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-07-29 17:00:49 +0900
# LastModified: 2020-07-29 17:12:06 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd
from collections import Counter


def main():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    a_cnt = sorted(list(map(list, Counter(A).items())), reverse = True, key = lambda x: x[1])
    init_kind = len(set(A))
    ans = 0
    while len(a_cnt) > k:
        _, num = a_cnt.pop()
        ans += num
    print(ans)




if __name__ == "__main__":
    main()


Measured memory_bytes: 51372
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    int n;
    cin>>n;
    ll hi;
    ll ph=0;
    bool ans=true;
    ll h[100001];
    rep(i,n){
        cin>>hi;
        h[i]=hi;
    }

    ll check[100001]={1};
    
    for(int i=n-2;i>=0;i--){
        if(h[i]<=h[i+1]){
            check[i]=0;
        }else if(h[i]==h[i+1]+1){
            h[i]=h[i]-1;
        }else{
            ans=false;
        }
    }
    string a=(ans)?"Yes":"No";
    cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <tuple>

using namespace std;
using int64 = long long;
using TP = tuple<int64,int,int>;
int main() {
  int n;
  cin >> n;
  vector<TP> ab;
  for (int i=0; i<n; i++) {
    int a, b;
    cin >> a >> b;
    ab.emplace_back(a+b, a, b);
  }
  sort(ab.rbegin(), ab.rend());
  
  int64 a = 0;
  int64 b = 0;
  for (int i=0; i<n; i++) {
    if (i%2) b += get<2>(ab[i]);
    else a += get<1>(ab[i]);
  }
  
  cout << (a-b) << endl;
}

Measured memory_bytes: 4912
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(),v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin>>n;
    ll sum = 0;
    vector<ll> d(n);
    for (ll i = 0; i < n; i++)
    {
        cin>>d[i];
    }

    for (ll i = 0; i < n-1; i++)
    {
        for (ll k = i + 1; k < n; k++)
        {
            sum += d[i] * d[k];
        }
        
    }
    cout<<sum<<endl;

    
}

Measured memory_bytes: 256
import Data.List

solve n c
    | (n `rem` 2) == (tar `rem` 2) = (tar - n) `div` 2
    | otherwise = solve n (c + 1)
    where
        tar = c * 3

main = do
    [a,b,c] <- sort . map read . words <$> getLine
    print $ solve (a+b+c) c 

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

int main(void) {
  while (true) {
    int m, nmin, nmax, p[210];
    cin >> m >> nmin >> nmax;
    if(!m && !nmin && !nmax) break;
    REP(i, m) cin >> p[i];

    int diff, maxdiff = -INF, ans = 0;
    ;
    FOR(i, nmin, nmax + 1) {
      diff = p[i - 1] - p[i];
      if (diff >= maxdiff) {
        maxdiff = diff;
        ans = i;
      }
    }

    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

using ll = long long;

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

    vector<int> bricks(n);
    for (int i = 0; i < n; i++) cin >> bricks[i];

    int destroy = 0;
    int x = 1;
    for (int i = 0; i < n; i++) {
        if (bricks[i] == x) {
            x++;
        }
        else {
            destroy++;
        }
    }

    if (x == 1) cout << -1 << endl;
    else cout << destroy << endl;

    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int64_t> A(N);
  map<int64_t, int64_t> mp;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    mp[A[i]]++;
  }
  int64_t cnt = 0;
  for (auto it : mp) {
    if (it.second >= 2) cnt += (it.second - 1) * it.second / 2;
  }
  for (int i = 0; i < N; i++) {
    int64_t res = 0;
    int64_t n = mp[A[i]];
    if (n >= 2) {
      res -= (n - 1) * n / 2;
      n--;
      res += (n - 1) * n / 2;
    }
    cout << res + cnt << '\n';
  }
  return 0;
}


Measured memory_bytes: 11136
while True:
    H,W=map(int,input().split(" "))
    if W==0 and H==0:
        break

    else:
        for i in range(H):
            if i%2==0:
                for j in range(W):
                    if j%2==0:
                        print("#",end="")
                    else:
                        print(".",end="")
                print("")
            else:
                for j in range(W):
                    if j%2==0:
                        print(".",end="")
                    else:
                        print("#",end="")
                print("")
        print("")
        


Measured memory_bytes: 7008
#include <iostream>

using namespace std;

int main(){

    int bingo[9];

    cin >> bingo[0] >> bingo[1] >> bingo[2];
    cin >> bingo[3] >> bingo[4] >> bingo[5];
    cin >> bingo[6] >> bingo[7] >> bingo[8];

    int N, A;
    int ans[9] = {0};

    cin >> N;

    for(int i =0; i < N; ++i ){
        cin >> A;
        for(int j = 0; j < 9; ++j){
            if( bingo[j] == A ){
                ans[j] = 1;
            }
        }
        A = 0;
    }
    // check
    // yoko
    if(ans[0]+ans[1]+ans[2] == 3){
        cout << "Yes" << endl;
        return 0;
    }
    if(ans[3]+ans[4]+ans[5] == 3){
        cout << "Yes" << endl;
        return 0;
    }
    if(ans[6]+ans[7]+ans[8] == 3){
        cout << "Yes" << endl;
        return 0;
    }
    // tate
    if(ans[0]+ans[3]+ans[6] == 3){
        cout << "Yes" << endl;
        return 0;
    }
    if(ans[1]+ans[4]+ans[7] == 3){
        cout << "Yes" << endl;
        return 0;
    }
    if(ans[2]+ans[5]+ans[8] == 3){
        cout << "Yes" << endl;
        return 0;
    }
    // naname
    if(ans[0]+ans[4]+ans[8] == 3){
        cout << "Yes" << endl;
        return 0;
    }
    if(ans[2]+ans[4]+ans[6] == 3){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;

int main()
{
    int X,A,B;
    cin>>X>>A>>B;

    if(B<=A){
        cout<<"delicious"<<endl;
    }else if(B<=(A+X)){
        cout<<"safe"<<endl;
    }else{
        cout<<"dangerous"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
S = int(input())

x1, y1 = [0, 0]
x2 = 10 ** 9
y2 = 1

if S % 10 ** 9 == 0:
    y3 = S // 10 ** 9
    x3 = 0
else:
    y3 = (S // 10 ** 9) + 1
    x3 = 10 ** 9 - (S % 10 ** 9)

print("{} {} {} {} {} {}".format(x1, y1, x2, y2, x3, y3))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
int main()
{
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
    ll n;
    cin>>n;
    ll a[n+1];
    for(ll i=1;i<=n;i++)   cin>>a[i];
    ll ans[n+1];
    memset(ans,0,sizeof(ans));
    ll cnt = 0;
    for(ll i=n;i>=1;i--)
    {
    	ll sum = 0;
         for(ll j=i+i;j<=n;j+=i)  sum += ans[j];
         if(sum%2==a[i]%2)
         {}
         else  ans[i] = 1,cnt++;
         
    }
    cout<<cnt<<"\n";
    for(ll i=1;i<n+1;i++)   if(ans[i]==1)   cout<<i<<" ";
}


Measured memory_bytes: 3968
// https://atcoder.jp/contests/abc124/tasks/abc124_c

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int ans1 = 0, ans2 = 0;

    for (int i = 0; i < (int)s.length(); i++) {
        if (i % 2 == 0 ^ s[i] == '0') {
            ans1++;
        } else {
            ans2++;
        }
    }
    cout << min(ans1, ans2) << endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main() {
    int n; cin >> n;
    string a,b; cin >> a; cin.ignore();
    cin >> b; cin.ignore();
    
    int res=0;
    for(int i=0; i<n; i++){
        int temp=0;
        for(int j=0; j<i+1; j++){
            if(a[n-1+j-i] == b[j]){
                temp++;
            }else{
                break;
            }

        }
        res = max(res,temp);
      
    }
    cout << 2*n-res << endl;
    
    return 0;
}


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

using namespace std;

#define MIN(a,b) ((a)<(b)?(a):(b))

int main()
{
    int N,M;
    string instr;
    vector<int> W,B,R;
    int cost=100000000;
    int temp;

    cin >> N >> M;

    for(int i=0; i<N; ++i) {
        cin >> instr;
        W.push_back(0);
        B.push_back(0);
        R.push_back(0);
        for(int j=0; j<M; ++j) {
            if(instr[j]=='W') ++W[i];
            if(instr[j]=='B') ++B[i];
            if(instr[j]=='R') ++R[i];
        }
    }


    for(int i=1; i<N-1; ++i) {
        for(int j=i; j<N-1; ++j) {
            temp=M-W[0];
            temp+=M-R[N-1];
            for(int k=1; k<N-1; ++k) {
                if(k<i) {
                    temp+=M-W[k];
                } else if(k<=j) {
                    temp+=M-B[k];
                } else {
                    temp+=M-R[k];
                }
            }
            cost=MIN(cost,temp);
        }
    }

    cout << cost << endl;

    return 0;
}

Measured memory_bytes: 3184
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 20;
ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int DB[6][3] = {
	{0,1,2},
	{0,2,1},
	{1,0,2},
	{1,2,0},
	{2,0,1},
	{2,1,0}
};
int ch(int a, int b, int c) {
	if (a == 0) {
		if (b == 1) return 0;
		else return 1;
	}
	if (a == 1) {
		if (b == 0) return 2;
		return 3;
	}
	if (b == 0) return 4;
	return 5;
}

int dp[305][305][6];
ll tdp[305][305][6];

vector <pii> Vl[305];
int main() {
	int N, M, i, j, k, l, m;
	scanf("%d %d", &N, &M);
	for (i = 1; i <= M; i++) {
		int t1, t2, t3;
		scanf("%d %d %d", &t1, &t2, &t3);
		Vl[t2].emplace_back(t3, t1);
	}

	for (auto it : Vl[1]) if (it.first >= 2) return !printf("0\n");
	dp[0][0][0] = dp[0][0][2] = dp[0][0][4] = 1;
	for (i = 2; i <= N; i++) {
		memset(tdp, 0, sizeof(tdp));
		for (j = 0; j < i; j++) {
			for (k = 0; k <= j; k++) {
				for (l = 0; l < 6; l++) {
					for (m = 0; m < 3; m++) {
						if (m == DB[l][0]) tdp[j][k][l] += dp[j][k][l];
						else if (m == DB[l][1]) tdp[i - 1][k][ch(m, DB[l][0], DB[l][2])] += dp[j][k][l];
						else tdp[i - 1][j][ch(m, DB[l][0], DB[l][1])] += dp[j][k][l];
					}
				}
			}
		}
		for (j = 0; j < i; j++) {
			for (k = 0; k <= j; k++) {
				for (l = 0; l < 6; l++) dp[j][k][l] = 0;

				bool chk = true;
				for (auto it : Vl[i]) {
					int t1 = it.first, t2 = it.second;
					if (t1 == 1) {
						if (j + 1 <= t2);
						else chk = false;
					}
					if (t1 == 2) {
						if (k + 1 <= t2 && t2 <= j);
						else chk = false;
					}
					if (t1 == 3) {
						if (t2 <= k);
						else chk = false;
					}
				}
				if (!chk) continue;
				for (l = 0; l < 6; l++) dp[j][k][l] = tdp[j][k][l] % MOD;
			}
		}
	}

	ll ans = 0;
	for (i = 0; i <= N; i++) for (j = 0; j <= N; j++) for (k = 0; k < 6; k++) ans = (ans + dp[i][j][k]) % MOD;
	return !printf("%lld\n", ans);
}
//*/

Measured memory_bytes: 6784