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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  i64 x, k, d;

  cin >> x >> k >> d;

  i64 n1, n2;

  if (abs(x) / d >= k) {
    if (x > 0) {
      i64 ans = x;
      rep(i, k) ans -= d;
      cout << abs(ans);
      // cout << x - k * d;
      return 0;
    } else {
      i64 ans = x;
      rep(i, k) ans += d;
      cout << abs(ans);
      // cout << x + k * d;
      return 0;
    }
  }

  if (x > 0) {
    n1 = x - x / d * d;
    n2 = n1 - d;

  } else {
    n1 = abs(x) / d * d + x;
    n2 = n1 + d;
  }

  if ((abs(n1) <= abs(n2) && ((k - abs(x) / d) & 1) == 0) ||
      (abs(n1) >= abs(n2) && ((k - abs(x) / d) & 1) == 0)) {
    cout << abs(n1);
  } else {
    cout << abs(n2);
  }
  return 0;
}


Measured memory_bytes: 3672
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner  scan = new Scanner(System.in);
		int cats = scan.nextInt();
		int mix = scan.nextInt();
		int rslt = scan.nextInt();

		if(rslt >= cats && cats+mix >= rslt) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 22996
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;


int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> x(n);
    for(ll i=0;i<n;i++){
        cin>>x[i];
    }
    ll ans=INF;
    for(ll i=0;i<n;i++){
        ll l=i;
        ll r=i+k-1;
        if(r>=n)  break;
        if(x[l]<0 && x[r]<0){
            ans=min(ans,-x[l]);
        }else if(x[l]<0 && x[r]>=0){
            ans=min(ans,min(-2*x[l]+x[r],-x[l]+2*x[r]));
        }else{
            ans=min(ans,x[r]);
        }
    }
    cout<<ans<<endl;

}

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

int main(){
  int n,k,x,way=0;
  cin >> n >> k;
  
  for(int i=0;i<n;i++){
    cin >> x;
    if(x*2<k)
      way +=2*x;
    else
      way +=(k-x)*2;
  }
  cout << way << endl;
}

Measured memory_bytes: 256
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
#define WAIT system ("pause")
#define rt0 return 0
using namespace std;
int main()
{
    int n,sum=0;
    cin>>n;
    vector <int> a(n+2,0),b(n,0);
    for(int i=0;i<n;i++) 
    {
        cin>>b[i];
        a[i+1]=b[i];
    }
    a[0]=0;
    a[n+1]=0;
    for(int i=0;i<n+1;i++) sum+=abs(a[i+1]-a[i]);
    for(int i=1;i<n+1;i++) cout<<sum-((abs(a[i]-a[i-1])+abs(a[i+1]-a[i]))-abs(a[i+1]-a[i-1]))<<" ";
    WAIT;
    rt0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

typedef __int128 i128;
const int N=201000;
int n;
ll x,a[N],s[N];
int main() {
	scanf("%d%lld",&n,&x);
	rep(i,1,n+1) scanf("%lld",a+i),s[i]=s[i-1]+a[i];
	ll ans=1ll<<60;
	rep(c,1,n+1) {
		i128 ss=(n+c)*x;
		ss+=s[n]-s[n-c];
		ll cnt=2;
		for (int k=n;k>0;k-=c) {
			int pre=k-c,pree=k-2*c;
			pre=max(pre,0); pree=max(pree,0);
			ss+=(i128)(s[k]-s[pre]-s[pre]+s[pree])*cnt*cnt;
			cnt++;
		}
		ans=min((i128)ans,ss);
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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 n;
void dfs(string s,char mx){
    if(s.size()==n){
        cout << s << endl;
        return ;
    }
    else{
        for(char i='a';i<=mx+1;i++){
            string t=s;
            t+=i;
            dfs(t,max(i,mx));
        }
    }
}
int main(){
    cin >> n;
    dfs("",'a'-1);
    return 0;
}

Measured memory_bytes: 1536
/*Made by Shivam Solanki*/
#include<bits/stdc++.h> 
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
typedef queue<int> qii;
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define repllr(i,k,n) for (ll i = n; i >= k; --i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
 
void solve(){
	int n;
	cin>>n;
	vi a(n);
	rep(i,0,n) cin>>a[i];
	bool flag=0;
	rep(i,0,n){
		if(a[i]%2==0 and a[i]%3!=0 and a[i]%5!=0){
			flag=1;
			break;
		}
	}
	cout<<(flag?"DENIED":"APPROVED");
}
    
int main(){
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    // fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 384
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize, a: usize, b: usize,
        x: [usize; n],
    }
    let mut tired = 0;
    for i in 1..n {
        if (x[i] - x[i - 1]) * a <= b {
            tired += (x[i] - x[i - 1]) * a
        } else {
            tired += b;
        }
    }
    println!("{}", tired);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef pair<string,ll> si;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
#define sort(a) sort(a.begin(),a.end());
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define mp make_pair
#define F first
#define S second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define nl "\n"
const int MOD = 1e9+7;
const ld PI = 3.1415926535898;
const ll LLMAX = LLONG_MAX;
#define N (int)1e6+1

int main()
{
	ios
	string a,b;
	cin>>a>>b;
	int dp[a.length()+1][b.length()+1];
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=a.length();i++)
	{
		for(int j=1;j<=b.length();j++)
		{
			if(a[i-1]==b[j-1])
			{
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else
			{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	string ans="";
	int i=a.length(),j=b.length();
	while(i>0 && j>0)
	{
		if(a[i-1]==b[j-1])
		{
			ans+=a[i-1];
			i--;j--;
		}
		else
		{
			if(dp[i-1][j]>dp[i][j-1])
			{
				i--;
			}
			else
			{
				j--;
			}
		}
	}
	for(int i=ans.length()-1;i>=0;i--)
		cout<<ans[i];
}

Measured memory_bytes: 35456
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

const int inf = 1 << 29;

typedef long long ll;

double abs(double a, double b){
  if( a > b){ return a- b;}
else{return b - a;}}

int main(){
  ll N; cin >> N;
  vector<ll> A(N); for(ll i = 0; i  <N; i++){ cin >> A[i];}
  sort(A.begin(),A.end());
  ll a = A[N-1] / 2 ; ll b = A[0]; ll c = (A[N-1] + 1) / 2; ll d = A[0];
  if( A[N-1] % 2 == 0){
  for(ll i = 0; i < N; i++){
    if( abs( A[i] - a) < abs( b - a ) ){ b = A[i];}}
  cout <<A[N-1] << " " << b << endl;}
  else{
   for(ll i = 0; i < N; i++){
     if( abs( A[i] - a) < abs ( b - a)){ b = A[i];}}
    for(ll j = 0; j < N; j++){
     if( abs( A[j] - c ) < abs( d - c)){ d = A[j];}}
    if( b == d){ cout << A[N-1] << " " << b << endl;}
    else{
      if( abs( (double) b, (double) A[N-1] / 2) < abs( (double) d , (double) A[N-1] / 2)){
        cout << A[N-1] << " " << b << endl;}
      else{ cout << A[N-1] << " " << d << endl;}}}
  
  return 0;}
  
 
    

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

int a[200010];

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

	if(n%2==0){
		for(int i=n-1; i>0; i-=2) cout << a[i] << " ";
		for(int i=0; i<n-1; i+=2) cout << a[i] << " ";
	} else {
		for(int i=n-1; i>=0; i-=2) cout << a[i] << " ";
		for(int i=1; i<n-1; i+=2) cout << a[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 2944
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while(true) {
			int n = scan.nextInt();
			if(n == 0) {
				break;
			}
			long[] d = new long[n];
			long sum = 0;
			for(int i = 0; i < n; i++) {
				long k = scan.nextInt();
				d[i] = k;
				sum += k;
			}
			long g = 0;
			for(int i = 0; i < n; i++) {
				g += (n * d[i] - sum) * (n * d[i] - sum);
			}
			double ans = (double) g / (n * n * n);
			ans = Math.sqrt(ans);
			System.out.println(ans);
		}
		scan.close();
	}
}


Measured memory_bytes: 30796
S = input()

a = len(S)
cnt = 0
for i in range(a):
#奇数の場合
  if i % 2==0:
#L以外が含まれる（Lではない）
    if S[i] != "L":
      cnt +=1
    elif S[i] == "L":
      cnt -= 101
#偶数の場合
  elif i %2 ==1:
#R以外が含まれる（Rではない）
    if S[i] != "R":
      cnt +=1
    elif S[i]=="R":
      cnt -= 101

if cnt>0:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll n,m,i;
    cin>>n>>m;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll s=0;
    for(i=0;i<n;i++)
    {
        s+=a[i];
    }
    ll c=0;
    for(i=0;i<n;i++)
    {
        if((a[i]*(4*m))>=s)
        {
            c++;
        }
    }
    if(c>=m)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<set>
#include<functional>
#include<list>
#include<bitset>
#include<numeric>
#include<utility>
#define INF (int)1e9
#define DINF (double)1e9
#define MOD 1000000007
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> p;

//cout<<fixed<<setprecision(15)<<ans;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	int a,b,c;
	cin >> a >> b >> c;
	int m = max(a, max(b, c));
	cout << 9 * m + a + b + c;

	return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define size(a) int(a.size())

const ll mod = 1e9 + 7;
const ll inf = ll(1e18);
const double PI = acos(-1);

ll modexp(ll x, ll n, int md) {
    if (n == 0)return 1;
    if (n % 2 == 0)return modexp((x * x) % md, n / 2, md);
    return (x * modexp((x * x) % md, n / 2, md)) % md;
}


int main() {
    fastio;
    // clock_t tm = clock();
    int h,w,k;string s;
    cin>>h>>w>>k;
    vvi a(h,vi(w));
    f(i,0,h){
        cin>>s;
        f(j,0,w){
            a[i][j]=(s[j]=='#');
        }
    }
    int ans=0;
    f(i,0,(1<<h)){
        f(j,0,(1<<w)){
             int temp=0;
             f(z1,0,h){
                 f(z2,0,w){
                     if((i&(1<<z1))==0 and (j&(1<<z2))==0 and a[z1][z2]==1){
                         ++temp;
                     }
                 }
             }
             ans+=(temp==k);
        }
    }
    cout<<ans<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}


Measured memory_bytes: 3656
#include<stdio.h>

int main(){
    int n,k,x,y;
    scanf("%d%d%d%d",&n,&k,&x,&y);

    int sum=0;
    if(n>k){
        for(int i=0;i<k;i++){
            sum+=x;
        }
        for(int i=k;i<n;i++){
            sum+=y;
        }
    }else{
        for(int i=0;i<n;i++){
            sum+=x;
        }
    }
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 1724
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

// -----------------------------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------------------------

let main() =
    let [| n; k |] = reada int
    let mutable n, ans = n, 1
    while n / k > 0 do
        ans <- ans + 1
        n <- n / k
    puts ans
    ()

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()


Measured memory_bytes: 11220
#include <iostream>
#include <algorithm>
using namespace std;
using Int = int64_t;
int main() {
    Int A[3], K;
    cin >> A[0] >> A[1] >> A[2] >> K;
    sort(A, A + 3);
    cout << A[0] + A[1] + A[2] * (1 << K) << endl; 
}


Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var s = "abcdefghijklmnopqrstuvwxyz";
  var output = [];
  dfs([], 0);
  output.sort();
  myout(myconv(output, 9));

  function dfs(list, max){
    if(list.length == N){
      output.push(list.join(""));
      return;
    }
    for(var i = 0; i <= max; i++){
      var tmp = makeClone(list);
      tmp.push(s[i]);
      dfs(tmp, Math.max(max, s.indexOf(s[i]) + 1));
    }
  }
}



Measured memory_bytes: 62476
import math

N = int(input())
A = list(map(int, input().split()))

flag = 1
count = 0

while flag:
    flag = 0
    for j in range(N-1, 0, -1):
        if A[j] < A[j-1]:
            temp = A[j]
            A[j] = A[j-1]
            A[j-1] = temp
            count += 1
            flag = 1
print(' '.join(map(str, A)))
print(count)
            

Measured memory_bytes: 7756
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);


//入力変数
int A=sc.nextInt();
int B=sc.nextInt();
int C=sc.nextInt();
int X=sc.nextInt();

//入力値変換

//出力変数
int ans;

//計算
int tempofans=0;

for(int a=0;a<=A;a++){
    for(int b=0;b<=B;b++){
        for(int c=0;c<=C;c++){
            if(X==500*a+100*b+50*c){
                tempofans++;
            }
        }
    }
}
ans = tempofans;

//出力
System.out.println(ans);

}}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll k,x;
    cin>>k>>x;
    k*=500;
    if (k>=x){
        cout<<"Yes\n";
    }
    else cout<<"No\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <climits>
#include <cmath>
#include <unordered_map>

using namespace std;

typedef long long ll;

ll N, A, B, C;
vector<ll> l;

ll dfs(int current, int a, int b, int c) {
  if (current == N) {
    if (min(a, min(b, c)) > 0) {
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    } else {
      return INT_MAX;
    }
  }
  ll c1 = dfs(current + 1, a, b, c);
  ll c2 = dfs(current + 1, a + l[current], b, c) + 10;
  ll c3 = dfs(current + 1, a, b + l[current], c) + 10;
  ll c4 = dfs(current + 1, a, b, c + l[current]) + 10;
  return min(c1, min(c2, min(c3, c4)));
}


int main(void) {
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) { int tmp; cin >> tmp; l.push_back(tmp); }
  ll cost = dfs(0, 0, 0, 0);
  cout << cost << endl;
}


Measured memory_bytes: 256
n,y = map(int,input().split())
for i in range(n+1):
    for j in range(n+1):
        if 10000*i+5000*j+1000*(n-i-j)==y and n-i-j>=0:
            print(i,j,n-i-j)
            exit()
print(-1,-1,-1)

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

using namespace std;
typedef long long ll;

int main() {
    int n, k, m;
    ll i, j;
    string s;
    cin >> n;
    cin >> s;
    int ret = 0;
    for(i = 1; i < n; i++) {
        int tmp = 0;
        for(j = 0; j < n - i; j++) {
            if(s[j] == s[j + i]) {
                tmp++;
                ret = max(tmp, ret);
                if(tmp == i) break;
            } else {
                tmp = 0;
            }
        }
    }
    cout << ret << endl;
    return 0;
}

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




int main()
{
	int i,j;
	int x,y,s;
	int ans;

	while(1)
	{
		scanf("%d %d %d",&x,&y,&s);
		if((x==0)&&(y==0)&&(s==0)){break;}
		else
		{
			ans=0;
			for(i=1;i<s;i++)
			{
				for(j=i;j<=(s-i);j++)
				{
					if((i*(100+x)/100+j*(100+x)/100)==s)
					{
						if(ans<(i*(100+y)/100+j*(100+y)/100))
						{
							ans=(i*(100+y)/100+j*(100+y)/100);
						}
					}
				}
			}
		}
		printf("%d\n",ans);
	}

	return 0;
}
	

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

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

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

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

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);
int fr[1005];

int main(){
  int n;
  string str;
  while(cin >> n){
    string res[1005];
    memset(fr, -1, sizeof(fr));
    REP(i, n){
      cin >> str;
      res[i] = str;
      int depth=0;
      while(str[depth]=='.') {
        res[i][depth]=' ';
        depth++;
      }
      if(depth>0) res[i][depth-1]='+';
      int tmp = depth;
      if(fr[depth]!=-1){
        for(int j=fr[depth]+1; j<i; j++) res[j][depth-1]='|';
        tmp++;
        while(fr[tmp]!=-1){
          fr[tmp]=-1;
          tmp++;
        }
      }
      fr[depth]=i;
    }
    REP(i, n){
      cout << res[i] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4036
#include<stdio.h>
#include<stdlib.h>
#define N 102
#define white 0
#define gray 1
#define black 2

int n,color[N],d[N],f[N],S[N],top=0,t=0,nt[N],a[N][N];

void push(int x){
  if(top==N){
    printf("Stack overflow!\n");
    exit(2);
  }
  S[++top]=x;
}

int pop(void){
  if(top==0){
    printf("Stack is empty!\n");
    exit(3);
  }
  top--;
  return S[top+1];
}

int next(int u){
  int v;
  for(v=nt[u];v<=n;v++){
    nt[u]=v+1;
    if(a[u][v]) return v;
  }
  return -1;
}

void dfs(int r){
  int i;
  for(i=1;i<=n;i++) nt[i]=0;

  push(r);
  color[r]=gray;
  d[r]=++t;

  while(S[top]!=0){
    int u=S[top],v=next(u);

    if(v!=-1){
    if(color[v]==white){
      color[v]=gray;
      d[v]=++t;
      push(v);
    }
    }
    else {
      pop();
      color[u]=black;
      f[u]=++t;
    }
  }
}

void dfs_init(){
  int i,u;
  for(i=1;i<=n;i++){
    color[i]=white;
  }
  t=0;

  for(u=1;u<=n;u++){
    if(color[u]==white) dfs(u);
  }
  
}

void print(){
  int i;
  for(i=1;i<=n;i++) printf("%d %d %d\n",i,d[i],f[i]);
}

int main(){
  int i,j,u,k,v;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      a[i][j]=0;
    }
  }

  for(i=1;i<=n;i++){
    scanf("%d%d",&u,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      a[u][v]=1;
    }
  }

  dfs_init();
  print();


  return 0;
}



Measured memory_bytes: 2052
n = int(input())
l = list(map(int, input().split()))

f = lambda x, y: (x-y)*(x-y)
temp = []
for i in range(min(l), max(l)+1):
    aaa = sum([f(m, i) for m in l])
    temp.append(aaa)
print(min(temp))

Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
    
    int x = 0;
    int i = 0;
    
    do {
        if(x != 0) printf("Case %d: %d\n", i, x);
        scanf("%d", &x);
        i ++;
    } while (x != 0);
    
    return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;

namespace CA {
	class Prg {
		static void Main() {
			List<string> l = new List<string>();
			for(byte j = 0; j < 4; j++) {
				string m = string.Empty;
				switch (j) {
					case 0:
					m = "S ";
					break;
					case 1:
					m = "H ";
					break;
					case 2:
					m = "C ";
					break;
					case 3:
					m = "D ";
					break;
				}
				for(byte k = 1; k < 14; k++) {
					l.Add(m + k);
				}
			}
			byte i = byte.Parse(Console.ReadLine());
			while(i-- != 0) {
				l.Remove(Console.ReadLine());
			}
			l.ForEach(x => {
				Console.WriteLine(x);
			});
        }
	}
}

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

int n;
vector<int> t[100005];
vector<int> dist;

void walker(int c, int p, int d) {
  for(int n:t[c]) if(n!=p) walker(n, c, d+1);
  dist.at(c) = d;
}

vector<int> getDist(int pos) {
  dist = vector<int>(n);
  walker(pos, -1, 0);
  return dist;
}

int main() {
  int u, v, a, b, mx=0;
  cin >> n >> u >> v;
  for(int i=1;i<n;++i) {
    cin >> a >> b;
    --a; --b;
    t[a].push_back(b);
    t[b].push_back(a);
  }
  auto distU = getDist(--u);
  auto distV = getDist(--v);
  for(int i=0;i<n;++i) if(distU[i] < distV[i]) mx=max(distV[i], mx);
  cout << mx-1 << endl;
}

Measured memory_bytes: 13304
#include <stdio.h>
#define MAX 100
#define INFTY (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];

void dijkstra(){
  int minv,i,v,u;
  int d[MAX],color[MAX];

  for(i=0 ; i<n ; i++){
    d[i]=INFTY;
    color[i]=WHITE;
  }

  d[0]=0;
  color[0]=GRAY;
  while(1){
    minv=INFTY;
    u=-1;
    for(i=0 ; i<n ; i++){
      if(minv > d[i] && color[i] != BLACK){
        u=i;
        minv=d[i];
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(v=0 ; v<n ; v++){
      if(color[v] != BLACK && M[u][v] != INFTY){
        if(d[v]>d[u]+M[u][v]){
          d[v]=d[u]+M[u][v];
          color[v]=GRAY;
        }
      }
    }
  }  
  for(i=0 ; i<n ; i++){
    printf("%d %d\n",i,(d[i]==INFTY ? -1 : d[i]));
  }
}

int main(){
  int i,k,c,u,v,j;
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    for(j=0 ; j<n ; j++){
      M[i][j]=INFTY;
    }
  }

  for(i=0 ; i<n ; i++){
    scanf("%d %d",&u,&k);
    for(j=0 ; j<k ; j++){
      scanf("%d %d",&v,&c);
      M[u][v]=c;
    }
  }
  
  dijkstra();

  return 0;

}


Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using static System.Console;

namespace ABC123A
{
    static class Program
    {
        static void Main(string[] args)
        {
            var l = ReadLineOne<int>(5);
            var k = ReadLine().TryParse<int>();

            string a = l.All(x => l.All(y => Math.Abs(y - x) <= k)) ? "Yay!" : ":(";
            WriteLine(a);
        }

        private static string Check(List<int> l, int k)
        {
            for (int i = 1; i < l.Count; i++)
            {
                for (int j = i + 1; j < l.Count; j++)
                {
                    if (l[j] - l[i] > k) return ":(";

                }

            }

            return "Yay!";
        }

        public static T TryParse<T>(this String input)
        {
            try
            {
                var converter = TypeDescriptor.GetConverter(typeof(T));
                if (converter != null)
                {
                    return (T)converter.ConvertFromString(input);
                }
                else
                {
                    throw new InvalidCastException("");
                }
            }
            catch
            {
                throw new InvalidCastException(typeof(T) + " is not supported.");
            }
        }

        public static List<T> SplitTryParseToList<T>(this String input)
        {
            return input.Split().Select(n => n.TryParse<T>()).ToList();
        }

        public static List<T> ListSwap<T>(this List<T> list, Int32 index1, Int32 index2)
        {
            var t = list[index1];
            list[index1] = list[index2];
            list[index2] = t;
            return list;
        }

        public static List<Tuple<T, int>> DuplicateCount<T>(this IEnumerable<T> list)
        {
            return list
                .GroupBy(i => i)
                .Where(g => g.Any())
                .Select(g => Tuple.Create(g.Key, g.Count()))
                .ToList();
        }
        public static List<Tuple<T, int>> DuplicateSort<T>(this IEnumerable<Tuple<T, int>> list)
        {
            return list.OrderByDescending((x) => x.Item2).ToList();
        }
        public static List<T> ReadLineOne<T>(int n)
        {
            var list = new List<T>();
            foreach (var i in Enumerable.Range(1, n))
            {
                list.Add(Console.ReadLine().TryParse<T>());
            }
            return list;
        }
        public static void PrintAll<T>(this IEnumerable<T> list)
        {
            foreach (var i in list)
            {
                Console.Write($"{i} ");
            }

            Console.WriteLine();
        }
    }
}


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

typedef unsigned long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N, K, Q;
    cin >> N >> K >> Q;
    vector<ll> points(N, 0);
    REP(i,Q){
        ll A;
        cin >> A;
        points[A-1]++;
    }

    REP(i,N){
       ll p = Q - (points[i]);
       if( p >= K ){
            cout << "No" << endl;
       }else{
            cout << "Yes" << endl;
       }
    }

}


Measured memory_bytes: 1408
#include <iostream>

int main()
{
    int h = 0;
    int n = 0;
    std::cin >> h >> n;
    
    for(int i = 0; i < n; ++i)
    {
        int a = 0;
        std::cin >> a;
        h -= a;
        
        if(h <= 0)
        {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }
    
    std::cout << "No" << std::endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
using namespace std;
int main(){
    int X,A;
    cin >> X>>A;
    if(X>=A){
        cout << 10 <<endl;
    }
    else
        cout << 0 <<endl;
    
    return 0;
}

Measured memory_bytes: 1016
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define debug(x) { cerr << #x << " = " << x << "\n"; }
#define pii pair<int, int>
#define vi vector <int>
#define vpii vector <pii>
#define vll vector <ll>
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0);

typedef long long ll;

using namespace std;

int main() {
	fast_io;
	int a;
	cin >> a;
	string s;
	cin >> s;
	if (a >= 3200) {
		cout << s;
	} else {
		cout << "red";
	}
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <fstream>

#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef long long ll;

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

    (a < 10 && b < 10) ? cout << a * b : cout << "-1";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main (){

  int n,cou = 0;
  cin >> n;
  for (int i = 1; i <= n /2; i++){
  if (i == n - i){
  continue;
  }
  cou++;    
  }
    
   cout << cou << endl; 
    
return 0;
}

Measured memory_bytes: 256
word = $stdin.gets.chomp
(0...word.length).each do |start|
   s1 = word[start]
   s2 = word[start+1]
   if s1 == s2
     puts (start+1).to_s + " " + (start+2).to_s
     exit
   end
   next if start == (word.length - 1)

   s3 = word[start+2]
   if s1 == s3
     puts (start+1).to_s + " " + (start+3).to_s
     exit
   end
end
puts "-1 -1"

Measured memory_bytes: 1916
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define MAXA 100000
#define MAXB 100000
#define MAXW 100000
int main(int argc,char const* argv[])
{
  int a,b,w,ans;
  cin >> w >> a >> b;
  if(a+w<=b) ans=abs(b-(a+w));
  else if(b+w<=a) ans=abs(a-(b+w));
  else if(a<=b && b<=a+w) ans=0;
  else if(b<=a && a<=b+w) ans=0;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s;
  cin >> s;
  int counter = 0;
  if (s[0]=='1')
    counter++;
  if (s[1]=='1')
    counter++;
  if (s[2]=='1')
    counter++;
  cout << counter;
  return 0;
}

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

int main(void){
  double A;
  char* s;
  double p;
  int n;
  char str[5000];

  scanf("%d\n",&n);

  fgets(str,sizeof(str),stdin);

  A=0.0;
  s=strtok(str," ");
  while(s!=NULL){

    p=atof(s);
    A+=1.0/p;
    s=strtok(NULL," ");
    
  }



  A=1.0/A;

  printf("%f",A);
  return 0;
}


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

int main() {
  int m1,d1,m2,d2;
  cin>>m1>>d1>>m2>>d2;
  if(d2==1){
    cout<<"1"<<endl;
  }
  else{
    cout<<"0"<<endl;
  }
  
}

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    string s;
    cin >> s;
    int count = 0;
    for(int i=1;i<s.size();i++){
        if(s[i]!=s[i-1])count++;
    }
    COUT(count);
    return 0;
}


Measured memory_bytes: 512
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
    s+=b[a[i]-1]
    if i< n-1:
            if a[i+1]-a[i]==1:
                s=s+c[a[i]-1]
print(s)

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

using namespace std;

#define MAX 45
#define INF 1e9

int N,p[MAX],t[MAX];
int dp[MAX][4];
bool used[MAX];

void init(){
  p[0] = t[0] = 0;
  fill(dp[0],dp[0]+MAX*4,INF);
  memset(used,false,sizeof(used));
}

int d(int idx,bool v){
  if(v){
    return p[idx]+p[idx+1];
  }else{
    return abs(p[idx]-p[idx+1]);
  }
}

int solve(int idx,int cap){
  used[idx] = true;
  if(idx == N){
    return dp[idx][cap] = p[idx];
  }
  int &res = dp[idx][cap],dt = t[idx+1]-t[idx];
  if(res != INF){ return res; }
  if(p[idx]*(cap+1)+p[idx+1] <= dt){
    res = min(res,solve(idx+1,1) + d(idx,1));
  }
  if(cap < 3 && d(idx,0)*(cap+1) <= dt){
    res = min(res,solve(idx+1,cap+1) + d(idx,0));
  }
  return res;
}

int main(){
  while(cin >> N, N){
    init();
    for(int i = 1 ; i <= N ; i++){
      cin >> p[i] >> t[i];
    }
    int ans = solve(0,0);
    if(ans != INF){
      cout << "OK " << ans << endl;
    }else{
      cout << "NG " << find(used+1,used+N,false)-used << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
def allocation():
    n, cars = map(int, input().split())
    weight = [int(input()) for i in range(n)]

    left = max(weight)
    right = sum(weight)

    while left < right:
        mid = (left + right) // 2

        if check(weight, cars, mid):
            right = mid
        else:
            left = mid + 1

    print(left)

def check(weight, cars, capacity):
    t = 0
    c = 1
    for w in weight:
        t += w
        if t > capacity:
            t = w
            c += 1

    if c <= cars:
        return True
    else:
        return False

if __name__ == '__main__':
    allocation()

Measured memory_bytes: 11504
fn main() {
    proconio::input! {
        n: usize,
        mut ls: [usize; n],
    }
    ls.sort();
    let mut count = 0usize;
    for (i, l) in ls.iter().enumerate().skip(2) {
        for j in 1..i {
            for k in 0..j {
                if ls[j] + ls[k] > *l && ls[j] != ls[k] && ls[j] != *l && ls[k] != *l {
                    count += 1;
                }
            }
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 2152
#include<bits/stdc++.h>
#define find Find
using namespace std;
int n,doe,root,ans,maxn;
int col[101010],du[101010];
bool br[101010];
int pre[202020],son[202020],now[101010];
char ch[101010];
void add(int x,int y)
{
	++doe;
	pre[doe]=now[x];
	now[x]=doe;
	son[doe]=y;
}
void dfs(int x,int fa)
{
	if (col[x]==1) br[x]=1;
	int p=now[x];
	while (p)
	{
		int y=son[p];
		if (y!=fa)
		{
			dfs(y,x);
			br[x]|=br[y];
		}
		p=pre[p];
	}
}
int f[101010];
void find(int x,int fa)
{

	br[x]=0;

	int v1=-n-1,v2=-n-1;
	
	int p=now[x];
	int d;
	if ((col[x]^(du[x]%2))==1) d=2;
	else d=0;
	f[x]=max(f[x],d);
	while (p)
	{
		int y=son[p];
		if (y!=fa && br[y])
		{
			find(y,x);
			f[x]=max(f[x],f[y]+d);
			if (f[y]>v1) v2=v1,v1=f[y];
			else if (f[y]>v2) v2=f[y];
		}
		p=pre[p];
	}
	maxn=max(maxn,f[x]);
	maxn=max(maxn,v1+v2+d);
}
int main()
{
	scanf("%d",&n);
//	for (int i=1;i<=n;++i) f[i]=-n-1;

	int x,y;
	for (int i=1;i<n;++i)
		scanf("%d%d",&x,&y),add(x,y),add(y,x);
	scanf("%s",ch+1);
	for (int i=1;i<=n;++i) if (ch[i]=='W') col[i]=1,root=i;
	dfs(root,0);
//	for (int i=1;i<=n;++i) printf("%d ",br[i]);
//	printf("\n");

	for (x=1;x<=n;++x) if (br[x])
	{
		++ans;
		int p=now[x];
		while (p)
		{
			int y=son[p];
			if (br[y]) ++du[x];
			p=pre[p];
		}
	}
	if (ans==0)
	{
		printf("0\n");
		return 0;
	}
	--ans;
	if (ans==0)
	{
		printf("1\n");
		return 0;
	}
	ans*=2;
	for (int i=1;i<=n;++i) if (br[i])
	{
		if (col[i]^(du[i]%2)==1) ++ans;
	}
//	for (int i=1;i<=n;++i) printf("%d ",col[i]^(du[i]%2));
//	printf("\n");

	for (int i=1;i<=n;++i) if (br[i])
		find(i,0);
//	printf("%d %d\n",ans,maxn);
	printf("%d\n",ans-maxn);
	return 0;
}

Measured memory_bytes: 10496
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;

int main(){
    
    int n;
    cin >> n;
    set<string> S;
    
    rep(i,n){
        string s;
        cin >> s;
        S.emplace(s);
    }
    
    cout << S.size() << "\n";
    
    return 0;
}


Measured memory_bytes: 15676
#include <stdio.h>



 int main()
 {
   int H;
   int W;
   int i=0;
   int j=0;
   int x;

  x = i+j;

while (1){
  scanf("%d %d",&H,&W);

  if(H==0 && W ==0) break;


  for(i=0;i < H ;i++){
      for(j = 0; j < W; j++){
        x = i+j;
        if(x%2==0){
          printf("#");
        }
        else{
          printf(".");
        }
      }
     printf("\n");
    }
     printf("\n");
    }

return(0);
}

Measured memory_bytes: 572
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int a = sc.nextInt();
        int b  = sc.nextInt();
        if ( b > a + w) {
            System.out.println(b - a - w);
        } else if (a > b + w) {
            System.out.println(a - b - w);
        } else {
            System.out.println(0);
        }
    }

}


Measured memory_bytes: 22484
using System;

public class Security
{
    public static void Main(string[] args)
    {
        string S = Console.ReadLine();
        bool isGood = true;
        if (S[0] == S[1]) isGood = false;
        else if (S[1] == S[2]) isGood = false;
        else if (S[2] == S[3]) isGood = false;
        S = (isGood) ? "Good" : "Bad";
        Console.WriteLine(S);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    bool F[N][5][2];
    int P[N][11];

    for(int i=0; i<N; i++){
        for(int j=0; j<5; j++){
            for(int k=0; k<2; k++){
                cin >> F[i][j][k];
            }
        }
    }

    for(int i=0; i<N; i++){
        for(int j=0; j<=10; j++){
            cin >> P[i][j];
        }
    }

    int ans = -1000000006;
    for(int bit=1; bit<(1<<10); bit++){
        int prof = 0;
        for(int sh=0; sh<N; sh++){
            int cnt = 0;
            for(int i=0; i<5; i++){
                for(int j=0; j<2; j++){
                    if(F[sh][i][j] && bit&(1<<(2*i+j))) cnt++;
                }
            }
            prof += P[sh][cnt];
        }
        ans = max(ans, prof);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.awt.desktop.SystemSleepEvent;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 文字列の入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] c = new int[n];
		int[][] a = new int[n][m];
		int[] suma = new int[m];

		int fillCount = 0;
		for (int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
			for (int j = 0; j < m; j++) {
				a[i][j] = sc.nextInt();
				if (suma[j] < x && suma[j] + a[i][j] >= x) {
					fillCount++;
				}
				suma[j] += a[i][j];
			}
		}

		if (fillCount == m) {
			// 出力
			System.out.println(sumPrice(0, new int[m], c, a, x));
		} else {
			// 出力
			System.out.println(-1);
		}

		sc.close();
	}

	public static int sumPrice(int price, int[] suma, int[] cList, int[][] aList, int border) {
		int minPrice = 1200000;
		for (int i = 0; i < cList.length; i++) {
			int tempPrice = price + cList[i];
			if (tempPrice < minPrice) {
				boolean judge = true;
				int[] tempSuma = new int[suma.length];
				for (int j = 0; j < suma.length; j++) {
					tempSuma[j] = suma[j] + aList[i][j];
					if (tempSuma[j] < border) {
						judge = false;
					}
				}

				if (!judge) {
					int[] tempCList = new int[cList.length - (i + 1)];;
					System.arraycopy(cList, i + 1, tempCList, 0, tempCList.length);
					int[][] tempAList = new int[tempCList.length][aList[0].length];
					System.arraycopy(aList, i + 1, tempAList, 0, tempCList.length);
					tempPrice = sumPrice(tempPrice, tempSuma, tempCList, tempAList, border);
				}

				if (tempPrice < minPrice) {
					minPrice = tempPrice;
				}
			} else {

			}
		}
		return minPrice;
	}
}


Measured memory_bytes: 37848
#include<stdio.h>

int main(void){
    char s[5],a;
    int i,num1=0,num2=-1,flag=0;
    scanf("%s",s);
    for(i=1;i<4;i++){
        if(s[i]!=s[0]&&flag==0){
            a=s[i];
            flag=1;
        }
        if(s[0]==s[i]){
            num1++;
        }else if(s[i]==a){
            num2++;
        }
    }
    if(num1==1&&num2==1){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    //printf("%c\n",a);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define for0(n) for(i=0; i<(n); i++)
#define for1(n) for(i=1; i<=(n); i++)


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll _,i,j,n,a,b,e,k,u,t,x=1,m,y,q,f=1,c=0,d=0,l,p,z,o,r,g;
    string ss,s;
    double xx,yy,aa,dd;
    cin>>n>>dd;
    while(n--)
    {
        cin>>xx>>yy;
        aa=sqrt(xx*xx+yy*yy);
        if(aa<=dd)c++;
    }
    cout<<c<<endl;
}



Measured memory_bytes: 3780
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        long result = 1;
        long max = 1000000000000000000L;
        for (int i = 0 ; i < N ; i++) {
            long a = scanner.nextLong();
            if (a == 0) {
                result = 0;
                break;
            }
            if (result != -1 && max / result >= a) {
                result *= a;
            } else {
                result = -1;
            }
        }
        
        System.out.println(result);
    }
}


Measured memory_bytes: 59796
//#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>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=1e6+5,M=2e6+5,MOD=1e9+7,OO=1e9;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();
	
	int n,G;

	scanf("%d %d",&n,&G);
	std::vector<pair<int,int>> a(n);
	for(int i=0;i<n;i++){
		scanf("%d %d",&a[i].first,&a[i].second);
	}
	int ans = 1e9;
	for(int i=0;i<(1<<n);i++){
		int curr = 0;
		int cnt = 0;
		set<int,greater<int>>s;
		for(int j=0;j<n;j++){
			if(i&(1<<j)){
				curr+=a[j].second + (j+1)*100*a[j].first;
				cnt+=a[j].first;
			}
			else	s.insert(j);
		}
		if(curr>=G){
			ans = min(ans,cnt);
		}
		else{	
			for(auto x : s){
				curr+=(a[x].first-1)*100*(x+1);
				cnt+=(a[x].first-1);
				if(curr>=G){
					while(curr>=G)cnt--,curr-=100*(x+1);
					cnt++;
					curr+=(100*(x+1));
					break;
				}
			}
			if(curr>=G)ans = min(ans,cnt);
		}
	}

	printf("%d\n",ans );
}	



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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct Combination {
    Combination(ll n) {
        mNumTbl.resize(n + 1);
        mInverseNumTbl.resize(n + 1);
        mNumTbl[0] = 1;
        mInverseNumTbl[0] = 1;
        FOR(i, n + 1, 1) {
            mNumTbl[i] = (mNumTbl[i - 1] * i) % MOD;
        }
        FOR(i, n + 1, 1) {
            mInverseNumTbl[i] = modpow(mNumTbl[i]);
        }
    }

    ll get(ll n, ll r) {
        if (n < r || n < 0)
            return 0;
        return (((mNumTbl[n] * mInverseNumTbl[r]) % MOD) * mInverseNumTbl[n - r]) % MOD;
    }

    ll modpow(ll n) {
        ll s = 1, p = n;
        for (ll i = 0; (1LL << i) <= MOD - 2; ++i, p = (p * p) % MOD) {
            if (((MOD - 2) & (1 << i)) == 0)
                continue;
            s *= p;
            s %= MOD;
        }
        return s;
    }

    vector<ll> mInverseNumTbl;
    vector<ll> mNumTbl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    ll R = N - K;
    Combination cmb(N + 5);
    REP(i, K) {
        ll r = cmb.get(R + 1, i + 1);
        r = r * cmb.get(K - 1, i) % MOD;
        cout << r << endl;
    }
    return 0;
}

Measured memory_bytes: 256