akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 0
for i in range(N-1):
  dup1 = A[i] // 2
  A[i] -= dup1 * 2
  dup2 = min(A[i], A[i+1])
  A[i+1] -= dup2
  ans += dup1 + dup2
dup1 = A[-1] // 2
ans += dup1
print(ans)

Measured memory_bytes: 7072
#include <stdio.h>

int main(void){
    int x,n=0;
    int temp=0;
    int flagP=0;
    int flagM=0;
    int array[100]={0};

    scanf("%d %d",&x,&n);
    if(n==0){
        printf("%d",x);
        return 0;
    }

    for(int i=0;i<n;i++){
        scanf("%d",&array[i]);
    }
    if(n==1 && array[0]==x){
        printf("%d",x-1);
    }

    for(int i=0;i<n;i++){
        flagP=0;
        flagM=0;
        for(int j=0;j<n;j++){
            if(array[j]==x+i){
                flagP=1;
            }
            if(array[j]==x-i){
                flagM=1;
            }
            if(flagP==1 && flagM==1){
                break;
            }
        }
        if(flagP==0 || flagM==0){
            temp=i;
            break;
        }
    }
    if(flagM==0){
        printf("%d",x-temp);
    }
    else if(flagP==0){
        printf("%d",x+temp);
    }


    return 0;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;


int main() 
{

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    string s;
    getline(cin, s);
  	cout << "A"<<s[8]<<"C"<<'\n';
    

}

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

int main(){
  string a,b;
  cin >> a;
  if(a == "A"){
    b = "T";
  }
  else if(a == "T"){
    b = "A";
  }
  else if(a == "C"){
    b = "G";
  }
  else if(a == "G"){
    b = "C";
  }
  cout << b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 32);
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;

#define Endl endl

/*--------------------template--------------------*/


map<ll, ll> mp;

int main() {
    cin >> n;
    vi v(n), va;
    REP(i, n) {
        cin >> v[i];
    }
    va.push_back(v[0]);
    REP(i, n - 1) {
        va.push_back(va[i] + v[i + 1]);
    }
    REP(i, va.size()) {
        mp[va[i]]++;
    }
    mp[sum]++;
    for (auto x : mp) {
        if (x.second >= 2) {
            cnt += (x.second * (x.second - 1)) / 2;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 15856
function main(){
	var n = scan();
	var m = scan();
	var p = Array(m);
	rep(m, function(i){
		p[i] = scan() - 1;
	});
	var a = Array(n - 1);
	var b = Array(n - 1);
	var c = Array(n - 1);
	rep(n - 1, function(i){
		a[i] = scan();
		b[i] = scan();
		c[i] = scan();
	});
	var x = Array(n);
	rep(n, function(i){
		x[i] = 0;
	});
	rep(m - 1, function(i){
		var s = Math.min(p[i], p[i + 1]);
		var t = Math.max(p[i], p[i + 1]);
		x[s] += 1;
		x[t] -= 1;
	});
	rep(n - 1, function(i){
		x[i + 1] += x[i];
	});
	var ans = [0, 0];
	rep(n - 1, function(i){
		v = Math.min(a[i] * x[i], b[i] * x[i] + c[i]);
		ans[1] += Math.floor((v + ans[0]) / 1e12);
		ans[0] = (v + ans[0]) % 1e12;
	});
	if(ans[1] == 0){
		print(ans[0]);
	}
	else{
		print('' + ans[1] + (Array(12).join('0') + ans[0]).slice(-12));
	}
}

function rep(n, func){
	for(var i = 0; i < n; ++i){
		func(i);
	}
}

process.stdin.resume();
process.stdin.setEncoding('utf8');

var input = '';
var input_index = 0;

function scan(type){
	if(type === 'string'){
		return input[input_index++];
	}
	else{
		return +input[input_index++];
	}
}

function print(val){
	console.log(val);
}

process.stdin.on('data', function(chunk){
	input += chunk;
});
process.stdin.on('end', function(){
	input = input.split(/\s+/);
	main();
});

Measured memory_bytes: 55136
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int i=0, j;
    string s,c;

    cin >> c;
    transform(c.begin(), c.end(), c.begin(), ::toupper);

    while (1) {
        cin >> s;
        if (s == "END_OF_TEXT") break;
        transform(s.begin(), s.end(), s.begin(), ::toupper);
        if (s == c) i++;
    }
    cout << i << endl;
}

    


Measured memory_bytes: 3200
n = int(input())
cand = list("357")
stk = ["0"]
ans = 0
while stk:
    tmp = stk.pop()
    if len(tmp)==10:
        if 0<int(tmp)<=n and tmp.count("3") and tmp.count("5") and tmp.count("7"):
            ans += 1
    else:
        if int(tmp)==0: stk.append(tmp+"0")
        for i in cand: stk.append(tmp+i)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

string s;
int a, b;

int main() {
	cin >> s;
	
	inc(i, SI(s)) { (s[i] == '0' ? a : b)++; }
	
	cout << min(a, b) * 2 << endl;
	
	return 0;
}


Measured memory_bytes: 512
function Main(input) {
    var flag = false;
    if(input.substr(0,7)=="keyence"||input.substr(-7)=="keyence"){
        flag = true;
    }else{
        	input = input.split("");
        	var p=0
    if(input[0]=="k"){
        p=1;
        if(input[1]=="e"){
            p=2;
            if(input[2]=="y"){
                p=3;
                if(input[3]=="e"){
                    p=4;
                    if(input[4]=="n"){
                        p=5;
                        if(input[5]=="c"){
                            p=6;
                        }
                    }
                }
            }
        }
    }
    var n = 0
        if(input[input.length-1]=="e"){
        n=1;
        if(input[input.length-1-1]=="c"){
            n=2;
            if(input[input.length-1-2]=="n"){
                n=3;
                if(input[input.length-1-3]=="e"){
                    n=4;
                    if(input[input.length-1-4]=="y"){
                        n=5;
                        if(input[input.length-1-5]=="e"){
                            n=6;
                        }
                    }
                }
            }
        }
    }
    }
        console.log((flag||p+n>=7)?"YES":"NO")
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 7372
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int ans = 0;
        ArrayList<Integer> list = new ArrayList<Integer>();
        
        for(int i=0; i<3; i++){
            list.add(sc.nextInt());
        }

        Collections.sort(list);

        for(int i=0; i<2; i++){
            ans += list.get(i);
        }
        System.out.println(ans);
    }
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N; 
ll A[int(2e5+5)];

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

  ll ans = 0, now = 0, R = 0;
  for (ll i = 0; i < N; i++){
    if (R < i) R = i;
    if (i > 0) now = now ^ A[i-1];
    while (R < N){
      ll X = now ^ A[R]; 
      ll sum = now + A[R];
      if (X != sum) break;
      now = now ^ A[R]; R++;
    }
    ans += R - i;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5188
# AtCoder Beginner Contest 176
# C - Step 
# https://atcoder.jp/contests/abc176/tasks/abc176_c
N = gets.chomp.to_i
A = gets.chomp.split.map(&:to_i)

st = Array.new(N) { 0 }
maxh = A[0]

(0...N).each do |i|
  if maxh > A[i]
    st[i] = maxh - A[i]
  else
    maxh = A[i]
    st[i] = 0
  end
end

puts st.reduce(&:+)


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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

template<int M = 1000000007>
struct ModInt {
    int data;

    ModInt(int data) : data(data) {}

    ModInt() : data(0) {}

    inline ModInt<M> operator+(ModInt<M> const &right) const {
        int temp = data + right.data;
        return ModInt(temp > M ? temp - M : temp);
    }

    inline ModInt<M> &operator+=(ModInt<M> const &right) {
        data += right.data;
        data = data > M ? data - M : data;
        return *this;
    }

    inline ModInt<M> operator-(ModInt<M> const &right) const {
        int temp = data - right.data;
        return ModInt(temp < 0 ? temp + M : temp);
    }

    inline ModInt<M> &operator-=(ModInt<M> const &right) {
        data -= right.data;
        data = data < 0 ? data + M : data;
        return *this;
    }

    inline ModInt<M> operator*(ModInt<M> const &right) const {
        int temp = data * right.data % M;
        return ModInt(temp < 0 ? temp + M : temp);
    }

    inline ModInt<M> &operator*=(ModInt<M> const &right) {
        data = data * right.data % M;
        data = data < 0 ? data + M : data;
        return *this;
    }

    inline bool operator==(ModInt<M> const &right) const {
        return data == right.data;
    }

    inline bool operator!=(ModInt<M> const &right) const {
        return data != right.data;
    }


};

template<int M = 1000000007>
inline ostream &operator<<(ostream &os, const ModInt<M> mi) {
    os << mi.data;
    return os;
}

ModInt<> dp[65][2][2][2];

signed main() {
    int L, R;
    cin >> L >> R;
    dp[64][0][0][0] = 1;
    for (int i = 63; i >= 0; --i) {
        bool LL = L >> i & 1;
        bool RR = R >> i & 1;
        rep(xflag, 2) {
            rep(yflag, 2) {
                rep(msbflag, 2) {
                    rep(x, 2) {
                        rep(y, 2) {
                            if (!xflag && LL && !x)continue;
                            if (!yflag && !RR && y)continue;
                            if (!msbflag && (x ^ y))continue;
                            if (x && !y)continue;
                            bool n_xflg = xflag || (!LL && x);
                            bool n_yflg = yflag || (RR && !y);
                            bool n_msbflg = msbflag || (x && y);
                            dp[i][n_xflg][n_yflg][n_msbflg] += dp[i + 1][xflag][yflag][msbflag];
                        }
                    }
                }
            }
        }
    }
    ModInt<> ans;
    rep(xflg, 2) {
        rep(yflg, 2) {
            ans += dp[0][xflg][yflg][1];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read() {
	int x=0,f=0;
	char ch=getchar();
	while(!isdigit(ch))f|=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return f?-x:x;
}
int vis[200007];
int main(){
    int l=200000,r=0;
    int n=read(),k=read();
    for(int i=1;i<=n;i++){
        int o=read();
        vis[o]++;//cout<<vis[o]<<" ";
        l=min(l,o);
        r=max(r,o);
    }
//    cout<<l<<r;
    if(r-l+1<=k) {
        cout<<0;
        return 0;
    }
//    for(int i=l;i<=r;++i)cout<<vis[l]<<" ";
    
    sort(vis+l,vis+r+1);
    int ans=0;
//    cout<<r-l+1;
//    for(int i=l;i<=r;++i)cout<<vis[l]<<" ";
    while(r-l+1>k){
        ans+=vis[l];
        l++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1024
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort()
    for i in range(1, n):
        if a[i] == a[i-1]:
            print("NO")
            exit()
    print("YES")


if __name__ == '__main__':
    solve()


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

#define ll long long

using namespace std;
ll gcd(ll x,ll y);
ll lcm(ll x,ll y);

int main()
{
  int a,b;
  
  cin>>a>>b;
  cout<<lcm(a,b)<<endl;

  return 0;
}

ll gcd(ll x,ll y)
{
  ll r;

  while(y>0){ r=x%y; x=y; y=r; }
  return x;
}

ll lcm(ll x,ll y){ return x/gcd(x,y)*y; }


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

int main()
{
	int s1,s2,ms,mn;
	
	while(cin >> s1 >> s2, (s1||s2))
	{
		ms = 0; mn = s1+s2;
		for(int i=1; i<5; i++)
		{
			cin >> s1 >> s2;
			if(s1+s2>mn)
			{
				ms = i;
				mn = s1+s2;
			}
		}
		cout << (char)('A'+ms) << " " << mn << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;

bool is_lunlun(long long a) {
	bool ret = true;
	if (a < 10) { return ret; }

	while (a >= 10) {
		int b = a % 10;
		a = a / 10;
		if (a % 10 - b > 1 || a % 10 - b < -1) { return false; }
	}
	return true;
}

int not_lunlun(long long a) {
	int ret = 0;

	while (a >= 10) {
		int b = a % 10;
		a = a / 10;
		if ((a % 10 - b) > 1) { return ret; }
		if ((a % 10 - b) < -1) { return ret + 1; }
		ret++;
	}
	return true;
}

int main() {
	int K;
	cin >> K;
	int ans = 0;
	long long P = 1;
	while (true) {
		if (is_lunlun(P)) {
			ans += 1;
//			cout << P << " ";
			if (ans == K) { cout << P; return 0; }
			P++;
		}
		else {
			int cnt = not_lunlun(P);
			//			cout << "\n" << P << " not lunlun " << cnt << "\n";
			for (int i = 0; i < cnt; i++) {
				P = P / 10;
			}
			P++;
			for (int i = 0; i < cnt; i++) {
				P = P * 10;
			}
		}
		
	}
}

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

using namespace std;

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


int main()
{
  int x;
  cin >> x;
  vector<ll> v;
  for (int i = 100; i >= 1 ; i--){
    for (int j = 10; j > 1; j--){
      v.push_back(pow(i, j));
    }
  }
  sort(v.begin(), v.end());
for (int i = 99 * 9 - 1; i > 0; i--){
    if (v[i] <= x) {
      cout << v[i] << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
s = input()

res = []

if 0<int(s[2:])<13: # YYMM
    res.append("YYMM")
if 0<int(s[:2])<13: # MMYY
    res.append("MMYY")

if len(res)==1:
    print(res[0])
elif len(res)==2:
    print("AMBIGUOUS")
else:
    print("NA")


Measured memory_bytes: 3060
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    S = input_raw[0]
    W_num = S.count("W")
    E_num = S.count("E")
    if (W_num == 0 and E_num != 0) or (E_num == 0 and W_num != 0):
        print "No"
        return

    N_num = S.count("N")
    S_num = S.count("S")
    if (N_num == 0 and S_num != 0) or (S_num == 0 and N_num != 0):
        print "No"
        return

    print "Yes"


if __name__ == '__main__':
    main()

Measured memory_bytes: 2928
from collections import defaultdict
import heapq
INF = 10**100

def dijkstra(N, s, i):
  visited = [False]*(N+1)
  costs = [INF]*(N)
  costs[s-1] = 0

  pq = [(0,s)]
  while pq:
    c, n = heapq.heappop(pq)
    visited[n] = True
    for nei,*fee in adj_list[n]:
      if visited[nei]: continue
      if c+fee[i] < costs[nei-1]:
        costs[nei-1] = c+fee[i]
        heapq.heappush(pq, (costs[nei-1],nei))

  return costs

n,m,s,t = map(int, input().split())
adj_list = defaultdict(list)
for _ in range(m):
  u,v,a,b = map(int, input().split())
  adj_list[u].append((v,a,b))
  adj_list[v].append((u,a,b))

yen_costs = dijkstra(n, s, 0)
snk_costs = dijkstra(n, t, 1)
total_costs = list(map(sum, zip(yen_costs, snk_costs)))
comp = INF
res = []
for c in reversed(total_costs):
  if c < comp:
    res.append(int(1e15 - c))
    comp = c
  else:
    res.append(int(1e15 - comp))

print("\n".join(map(str, reversed(res))))


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

// abc049_c

int main()
{
    std::string S;
    std::cin >> S;

    int len = S.length();

    unsigned long long sum=0;

    for (int bit=0; bit < (1<<len-1); bit++){
        std::string tempS;
        std::vector<unsigned long long> nums;
        tempS.push_back(S[0]);
        for (int i=0; i<len; i++){
            if(bit & (1<<i)) {
                // std::cout << tempS << std::endl;
                nums.push_back(stoull(tempS));
                tempS.clear();
            }
            tempS.push_back(S[i+1]);
        }
        nums.push_back(stoull(tempS));

        // for(auto num : nums) std::cout << num << std::endl;

        sum+=std::accumulate(nums.begin(), nums.end(), (long long)0);
    }

    std::cout << sum << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		
    		char[] s=scan.next().toCharArray();
    		
    		for (int i=0;i<10;++i) {
    			if (i==3) {
    				System.out.print(8);
    			}else {
    				System.out.print(s[i]);
    			}
    		}
     
    }
    }
// end 

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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll n;
    cin>>n;
    ll x=(ll)pow(n,3);
    cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
AB = []
for i in range(n):
  AB.append(list(map(int, input().split())))
time = 0
flag = True
AB.sort(key = lambda x:x[1])
for i in range(n):
  time += AB[i][0]
  if AB[i][1] >= time:
    continue
  else:
    flag = False
    print('No')
    break
if flag:
  print('Yes')

Measured memory_bytes: 53720
#include<iostream>
#include<algorithm>
using namespace std;
 
int R[1000000], N;
 
main(){
  cin>>N;
  	
  for(int i=0;i<N;i++){
		cin>>R[i];
	}
  int minv=R[0];
  int ans=-2000000000;
  for(int i=1;i<N;i++){
    ans=max(ans,R[i]-minv);
    minv=min(minv,R[i]);
  }
 
  cout<<ans<<endl;
 
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int w;
  while (cin >> w, w) {
    int ans = 1 << 30;
    for (int i = 0; i * 200 <= w; i++) {
      for (int j = 0; j * 300 <= w; j++) {
        for (int k = 0; k * 500 <= w; k++) {
          if (i * 200 + j * 300 + k * 500 != w) continue;
          int sub = i * 380 + j * 550 + k * 850;
          sub -= (i / 5) * 5 * 380 * 20 / 100;
          sub -= (j / 4) * 4 * 550 * 15 / 100;
          sub -= (k / 3) * 3 * 850 * 12 / 100;
          ans = min(ans, sub);
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}


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

int main() {
    string s;
    cin >> s;
    if(s[0] == s[1] || s[2] == s[3] || s[1] == s[2]) {
        cout << "Bad";
    } else {
        cout << "Good";
    }
    return 0;
}


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

ll f(ll b, ll n){
  if(n < b) return n;
  return f(b, n/b) + n%b;
}

int main(){
  ll n, s; cin >> n >> s;

  if(s == n){
    cout << n+1 << endl;
    return 0;
  }
  if(s > n){
    cout << -1 << endl;
    return 0;
  }

  for(ll i=2; i*i <= n; i++){
    if(f(i, n) == s){
      cout << i << endl;
      return 0;
    }
  }

  ll ans = LLONG_MAX;
  for(ll p=1; p*p <= n; p++){
    if((n-s) % p == 0 && f((n-s)/p + 1, n) == s){
      ans = min((n-s)/p + 1, ans);
    }
  }

  if(ans == LLONG_MAX) cout << -1 << endl;
  else cout << ans << endl;

  return 0;
}


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

using namespace std;

int main(){
	int A;
	int B;
	int C;
	int ans;

	cin >> A >> B >> C;
	vector<int> X(3);

	if (A >= B){
		if (B >= C){
			X[0] = A;
			X[1] = B;
			X[2] = C;
		}
		else if (C >= A){
			X[0] = C;
			X[1] = B;
			X[2] = A;
		}
		else{
			X[0] = A;
			X[1] = B;
			X[2] = C;
		}
	}
	else{
		if (A >= C){
			X[0] = B;
			X[1] = A;
			X[2] = C;
		}
		else if (C >= B){
			X[0] = C;
			X[1] = B;
			X[2] = A;
		}
		else{
			X[0] = B;
			X[1] = C;
			X[2] = A;
		}
	}

	ans = X[0]*10 + X[1] + X[2];

	cout << ans << endl;
}

Measured memory_bytes: 256
// ABC162 C

#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int k_num, buf;
    long long int sum = 0;
    cin >> k_num;
    for(int i = 1; i <= k_num; i++){
        for(int j = 1; j <= k_num; j++){
            for(int k = 1; k <= k_num; k++){
                buf = __gcd(j, k);
                // cout << __gcd(buf, i) << endl;
                sum += __gcd(buf, i);
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
ifstream f("A.in");
typedef long long ll;

int main()
{
   int X,n,a,b,x;
   bool fr[110]={0};
   cin>>X>>n;
   for(int i=1;i<=n;i++)
   {
       cin>>x;
       fr[x]=1;
   }
   int ans=0;
   if(fr[X]==0) cout<<X;
   else
   {
       int op=X-1;
       while(fr[op]) op--;
       ans=op;

       op=X+1;
       while(fr[op]) op++;
       if( ( op -X ) < ( X-ans ) ) ans=op;
       cout<<ans;
   }

}


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

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n,x;cin>>n>>x;
  vector<int> a(n);
  int ans=0;
  ll sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(all(a));
  for(int i=0;i<n;i++){
    sum+=a[ans];
    if(sum>x){
      break;
    }
    ans++;
  }
  if(sum!=x&&ans==n){
    ans--;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, p[100005], ans = 0;
int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) {
        scanf("%d", &p[i]);
    }
    for(int i = 1; i < n; i++) {
        if(p[i] == i && p[i + 1] == i + 1) {
            swap(p[i], p[i + 1]);
            ans++;
        }
    }
    for(int i = 1; i <= n; i++) {
        if(p[i] == i) {
            ans++;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void){
  ll a, b, x;
cin >> a >> b >> x;
cout << b / x - (a >= 1 ? (a - 1) / x : -1) << endl;

}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;

int main(void){
 int N,K;

 cin>>N>>K;
 if(K==1)cout<<0<<endl;
 else cout<<N-K<<endl;
 return 0;
}

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

using namespace std;

int main()
{
    string st;
    int n;
    set<char>s;
    cin>>st;
    cin>>n;

    for(int i=0; i<st.size(); i++)
        s.insert(st[i]);

    int t = n;
    set<char>::iterator it = s.begin();
    set<string>s22;

    for(int cnt = 1; cnt<=6; cnt++)
    {
        for(int i=0; i<st.size(); i++)
        {
            if(*it != st[i])
                continue;
            for(int j=1; j<=5&&j+i<=st.size(); j++)
            {
                string st2 = st.substr(i,j);
                s22.insert(st2);
            }
        }
        if(it != s.end())
            it++;
    }

    set<string>::iterator it2 = s22.begin();

    n--;
    while(n-- && it2 != s22.end())
        it2++;
    cout<<*it2<<endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    string s;
    cin >> s;
    unordered_map<char, int> um;
    for (auto ss : s) {
        um[ss]++;
    }
    for (auto p : um) {
        if (p.second > 1) {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
}




Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll N, A, B;
    cin >> N >> A >> B ;
    ll ans = N / (A + B) * A;
    ans += min(N % (A + B), A);
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lowbit(x) x&-x
using namespace std;
const int N=2e5+10,mod=1e9+7;
int n,ans,f[N],b[N],size,t[N];
struct node
{
	int xi,vi;
	friend bool operator < (node ly1,node ly2)
	{
		return ly1.xi<ly2.xi;
	}
}a[N];
struct interval
{
	int l,r;
	friend bool operator < (interval ly1,interval ly2)
	{
		return ly1.r==ly2.r?ly1.l<ly2.l:ly1.r<ly2.r;
	}
}c[N];

void add(int x,int k)
{
	while(x<=n)
	{
		t[x]=(t[x]+k)%mod;
		x+=lowbit(x);
	}
}

int ask(int x)
{
	int tmp=0;
	while(x>0)
	{
		tmp=(tmp+t[x])%mod;
		x-=lowbit(x);
	}
	return tmp;
}

int main()
{
//	freopen("in.txt","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i].xi,&a[i].vi),b[i]=a[i].vi;
	sort(b+1,b+n+1),size=unique(b+1,b+n+1)-(b+1);
	for(int i=1;i<=n;i++) a[i].vi=lower_bound(b+1,b+size+1,a[i].vi)-b + 1;
	sort(a+1,a+n+1);
	for(int i=1,mx=0;i<=n;i++) mx=max(mx,a[i].vi),c[i].r=mx;
	for(int i=n,mn=a[n].vi;i>=1;i--) mn=min(mn,a[i].vi),c[i].l=mn;
	c[++n]={1,1};sort(c+1,c+n+1);add(1,1);
	for(int i=2;i<=n;i++)
	{
		f[i]=(ask(c[i].r)-ask(c[i].l-2)+mod)%mod,add(c[i].r,f[i]);	
		if(c[i].r==n) ans=(ans+f[i])%mod;	
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	string ans;
	if(a + b > c + d) {
		ans = "Left";
	}
	else if(a + b == c + d) {
		ans = "Balanced";
	}
	else {
		ans = "Right";
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
#define SZ 1234567
int n,h_[SZ+SZ],*h=h_,dt=0; char s[SZ],t[SZ];
int main()
{
	scanf("%d%s%s",&n,s+1,t+1);
	if(strcmp(s+1,t+1)==0)
	{
		puts("0");
		return 0;
	}
	int cr=n,cl=n+1,ans=0;
	for(int i=n;i>=1;--i)
	{
		if(t[i-1]==t[i]) continue;
		int x=min(cl-1,i);
		while(x&&s[x]!=t[i]) --x;
		if(!x)
		{
			puts("-1");
			return 0;
		}
		int ir=i;
		while(t[ir+1]==t[i]) ++ir;
		while(cl>x)
			h[--cl]=-dt;
		while(cr>=ir)
			ans=max(ans,h[cr--]+dt);
		++h; ++dt;
	}
	while(cl>1)
		h[--cl]=-dt;
	while(cr>=1)
		ans=max(ans,h[cr--]+dt);
	printf("%d\n",ans);
}

Measured memory_bytes: 8192
N, W = map(int, input().split())
V = [[] for i in range(4)]
w0, v0 = map(int, input().split())
V[0].append(v0)
for i in range(N - 1):
  w, v = map(int, input().split())
  V[w - w0].append(v)
V = [[0] + sorted(V[i], reverse=True) for i in range(4)]
value = 0
val = [0] * 4
for i in range(min(W // w0 + 1, len(V[0]))):
  val[0] += V[0][i]
  for j in range(min((W - w0 * i) // (w0 + 1) + 1, len(V[1]))):
    val[0] += V[1][j]
    val[1] += V[1][j]
    for k in range(min((W - w0 * (i + j) - j) // (w0 + 2) + 1, len(V[2]))):
      val[0] += V[2][k]
      val[2] += V[2][k]
      for l in range(min((W - w0 * (i + j + k) - j - k * 2) // (w0 + 3) + 1, len(V[3]))):
        val[0] += V[3][l]
        val[3] += V[3][l]
      value = max(value, val[0])
      val[0] -= val[3]
      val[3] = 0
    val[0] -= val[2]
    val[2] = 0
  val[0] -= val[1]
  val[1] = 0
print(value)

Measured memory_bytes: 3316
import java.util.*;
class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int a=Integer.parseInt(s.next()),
		    b=Integer.parseInt(s.next());
		System.out.printf("%d %d %f",a/b,a%b,1.0*a/b);
	}
}

Measured memory_bytes: 26384
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;

int main(){
    int n, m;
    cin >> n >> m;
    
    using P = pair<int, int>;
    vector<P> v(m);
    rep(i, m){
        cin >> v[i].second >> v[i].first;
    }
    sort(all(v));

    int ans = 1;
    int x = v[0].first - 1;
    rep(i, m){
        if(x < v[i].second){
            x = v[i].first - 1;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
typedef long long LL;
int main() {
	LL h;
	scanf("%lld",&h);
	LL ans=0,blood=h,k=1;
	while(1) {
		blood>>=1ll;
		ans+=k;
		k<<=1ll;
		if(blood<=0ll)
			break;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int query(string s1,string s2){
  cout << s1 << "\n" << s2 << endl;
  string a;cin>>a;
  if(a=="T") return 0;
  if(a=="F") return 1;
  return -1;
}
int main(){
  int n,i,j,k;cin>>n;
  string s1,s2;
  string a1[]={".",".","#","#"},a2[]={".","#",".","#"};
  bool f;
  while(1){
    f=false;
    for(i=0;i<4;i++){
      k=query(s1+a1[i],s2+a2[i]);
      if(k==-1) return 0;
      if(k==0){
	s1+=a1[i];
	s2+=a2[i];
	f=true;
	break;
      }
    }
    if(f) continue;
    break;
  }
  while(1){
    f=false;
    for(i=0;i<4;i++){
      k=query(a1[i]+s1,a2[i]+s2);
      if(k==-1) return 0;
      if(k==0){
	s1=a1[i]+s1;
	s2=a2[i]+s2;
	f=true;
	break;
      }
    }
    if(f) continue;
    break;
  }
  return 0;
}


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

using namespace std;

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

    for(int i = a; i <= min(a+k-1, b); i++){
        cout << i << "\n";
    }
    for(int i = max(b-k+1, a+k); i <= b; i++){
        cout << i << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
def main():
    n=int(input())
    a=map(int,input().split())
    b=list(map(int,input().split()))
    c=list(map(int,input().split()))
    m = 0
    prev = -100
    for i in (x-1 for x in a):
        m += b[i]
        if prev + 1 == i:
            m += c[prev]
        prev = i
    return m

if __name__ == "__main__":
    print(main())


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

char getGrade(int m, int f, int r){
  int sum = m + f;
  char grade;
  if(m == -1 || f == -1){
    grade ='F';
  }else if(80 <= sum){
    grade = 'A';
  }else if(65 <= sum && sum < 80){
    grade = 'B';
  }else if(50 <= sum && sum < 65){
    grade = 'C';
  }else if(30 <= sum && sum < 50){
    if(50 <= r){
    grade='C';
    }else{
      grade = 'D';
    }
  }else if(sum < 30){
    grade = 'F';
  }
  
  return grade;
}

int main(){
  int m, f, r;
  while(1){
    cin >> m >> f >> r;
    if(m == -1 && f == -1 && r == -1)break;
    cout << getGrade(m, f, r) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>
#include <utility>

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

int main(void) {
  int k, x;
  std::cin >> k >> x;
  std::cout << (k * 500 >= x ? "Yes" : "No") << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n,i,j,ans,sum,num[100005];
string s[100005],now;
int main()
{   scanf("%lld\n",&n);
	for (i=0;i<n;i++)
	{	cin>>s[i];
		sort(s[i].begin(),s[i].end());
	}
	sort(s,s+n);
	for (i=0;i<n;i++)
	{	if (now!=s[i])
		{  now=s[i];
		   num[sum]=1;
		   sum++;
		}
		else num[sum-1]++;
	}
	for (i=0;i<sum;i++)
		ans+=(num[i]*(num[i]-1))/2;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class Task{
public:
    int f(int x){
        if(x&1) return 3 * x + 1;
        return x / 2;
    }

    void solve(istream& in, ostream& out){
        vc<int> A(1000001);
        unordered_set<int> S;
        in>>A[0];
        S.insert(A[0]);
        int cur = 1;
        while(true){
            A[cur] = f(A[cur-1]);
            if(S.count(A[cur])){
                out<<cur+1<<'\n';
                return;
            }
            S.insert(A[cur]);
            ++cur;
        }
    }
};

int main(){
    istream& in(cin);
    ostream& out(cout);
    ios_base::sync_with_stdio(false);
    in.tie(nullptr), out.tie(nullptr);
    Task solver;
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 4224
s = input()
K = int(input())

n = len(s)

sub = []
alp = [chr(i) for i in range(ord('a'), ord('z')+1)]

for a in alp:
    if a in s:
        start = -1
        while True:
            start = s.find(a, start+1)
            if start==-1:
                break
            for j in range(start+1, min(start+K+1,n+1)):
                if s[start:j] not in sub:
                    sub.append(s[start:j])
    if len(sub) > K:
        break

sub.sort()
print(sub[K-1])

Measured memory_bytes: 3188
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define Mx 200001
#define inf 1e15
const int MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


typedef long long  L;
//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,q,q1,q2,q3,q4,r,s,t,
u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,id4,lim;

//double rat;
L A[Mx+5],B[Mx+5];

char str[Mx];

//struct node{L nid,nv;node(L nid_,L nv_){nid=nid_;nv=nv_;}};
//vector<node>V;
void solve(){
	if(str[0]!=str[1] || str[0]!=str[2] || str[1]!=str[2]){
    	printf("Yes");
    }else{
      printf("No");
    }
}
int main()
{
    scanf("%s",str);
  	solve();
    return 0;
}
/// lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();

		for (int i=1; i<=9; i++) {
			if (a%i != 0)
				continue;
			int b = a/i;
			if (b >= 1 && b <=9) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");
	}
}



Measured memory_bytes: 24020
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    int N; cin>>N;
    string s; cin>>s;
    stack<char> st;
    REP(i, N){
        if(st.empty()){
            st.push(s[i]);
        }
        else{
            if(st.top()==s[i]) continue;
            else st.push(s[i]);            
        }
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>

using namespace std;
typedef long long int ll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)

bool can_pass(string s, ll l, ll r){
  bool flg = true;
  char prev = '.';
  repi(i, l, r+1){
    if(prev == '#' && s[i] == '#'){
      flg = false;
      break;
    }
    prev = s[i];
  }
  return flg;
}

bool three_nothing(string s, ll l, ll r){
  bool flg = false;
  ll cnt = 0;
  repi(i, l, r+1){
    if(s[i] == '.') cnt++;
    else cnt = 0;
    if(cnt >= 3){
      flg = true;
      break;
    }
  }
  return flg;
}

int main(){
  ll N, A, B, C, D;
  string S;
  cin >> N >> A >> B >> C >> D;
  cin >> S;

  string ans = "No";
  if(C < D){
     if(can_pass(S, A-1, C-1) && can_pass(S, B-1, D-1)) ans = "Yes";
  }
  else{
     if(can_pass(S, A-1, C-1) && three_nothing(S, B-2, D)) ans = "Yes";
  }
  cout << ans <<endl;
  return 0;
}


Measured memory_bytes: 900
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import qualified Data.Map.Strict             as Map
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  n <- getInt
  as <- getIntVec n

  let xs = V.map (\i -> as V.! i + i) $ V.fromList [0..(n-1)]

      makeYs i m | i == n = m
                 | otherwise = let y = i - as V.! i
                                   m' = case Map.lookup y m of
                                          Just c  -> Map.insert y (c+1) m
                                          Nothing -> Map.insert y 1 m
                               in makeYs (i+1) m'

      mapY = makeYs 0 (Map.empty :: Map.Map Int Int)


  let solve i res
        | i == n = res
        | otherwise = let xi = xs V.! i
                          ct = fromMaybe 0 (Map.lookup xi mapY)
                      in solve (i+1) (res + ct)

      ans = solve 0 0

  print ans


Measured memory_bytes: 39972
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

typedef pair<int, int> P;

const int N = 100000;
const int INF = (1<<28);

int n, d[N], vis[N], vis2[N];
bool loop[N];

void find_loop(int p){
  vis[p] = true;
  for(int i=1;i<=6&&p+i<n;i++){
    int np = p + i;
    if(vis[np]) continue;
    if(d[np] != 0){
      fill(vis2, vis2+n, false);
      while(1){
        vis[np] = vis2[np] = true;
        if(d[np] == 0) break;
        np += d[np];
        if(vis2[np]){
          np = p + i;
          while(!loop[np]){
            loop[np] = true;
            np += d[np];
          }
          break;
        }
      }
    }
    if(!loop[np] && d[np] == 0) find_loop(np);
  }
}

int solve(){
  fill(vis, vis+n, INF);
  queue<P> q;
  vis[0] = 0;
  q.push(make_pair(0, 0));
  while(!q.empty()){
    P p = q.front(); q.pop();
    if(p.second == n-1) return p.first;
    for(int i=1;i<=6&&p.second+i<n;i++){
      int np = p.second + i;
      if(loop[np]) continue;
      if(vis[np] > p.first + 1){
        while(1){
          vis[np] = p.first + 1;
          if(d[np] == 0) break;
          np += d[np];
        }
        q.push(make_pair(p.first + 1, np));
      }
    }
  }
  return -1;
}

main(){
  cin >> n;
  for(int i=0;i<n;i++) cin >> d[i];
  for(int i=0;i<n;i++) vis[i] = loop[i] = false;
  find_loop(0);
  cout << solve() << endl;
}

Measured memory_bytes: 3052
#include<stdio.h>

int main()
{
	int a,b,i,j,x;
	while(scanf("%d %d",&a,&b)!=EOF){
		j=0;
		i = a + b;
        if(i>=10){
            while(1){
            	i/=10;
            	j++;
            	if(i<10)
            	    break;
            }
        }
        printf("%d\n",j+1);
    }
    return 0;
}

Measured memory_bytes: 600
import math

n, *caps = [int(input()), int(input()), int(input()), int(input()), int(input()), int(input())]

print(math.ceil(n / min(caps)) + 4)

# counts = [n, 0, 0, 0, 0, 0]
# ans = 0
# while counts[-1] != n:
#     for i in range(5):
#         mv = min(counts[4 - i], caps[4 - i])
#         counts[4 - i] -= mv
#         counts[5 - i] += mv
#     ans += 1
# print(ans)



Measured memory_bytes: 2940
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;

#define dbg(x1) cout<<#x1<<" = "<<(x1)<<endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<" "<<#x3<<" = "<<(x3)<<endl

int main() {
    //freopen(".in", "r", stdin);
    ll n;
    scanf("%lld",&n);
    ll sum = n/11;
    ll ans = 2LL*sum ;
    n = n%11;
    if(n>=1&&n<=6) ans++;
    else if(n>6) ans+=2;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256