akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;


//StronglyConnectedCompoinent
struct scc_graph{
    int n;
    vector<vector<int>> graph;
    vector<vector<int>> revgraph;
    vector<int> postorder;
    vector<int> seen;

    scc_graph(int n):n(n),graph(n),revgraph(n),seen(n,-1){}

    void add_edge(int from,int to){
        graph[from].push_back(to);
        revgraph[to].push_back(from);
    }

    vector<vector<int>> scc(){
        fill(seen.begin(),seen.end(),-1);
        for(int i=0;i<n;i++){
            if(seen[i]<0) dfs(i);
        }
        fill(seen.begin(),seen.end(),-1);

        int k = 0;
        for(int i=(int)postorder.size()-1;i>=0;i--){
            if(seen[postorder[i]]<0) revdfs(postorder[i],k++);
        }

        vector<vector<int>> scc_groups(k);
        for(int i=0;i<n;i++){
            scc_groups[seen[i]].push_back(i);
        }

        return scc_groups;
    }

    void dfs(int i){
        seen[i] = 1;
        for(int j:graph[i]){
            if(seen[j]>=0) continue;
            dfs(j);
        }
        postorder.push_back(i);
    }

    void revdfs(int i,int k){
        seen[i] = k;
        for(int j:revgraph[i]){
            if(seen[j]>=0) continue;
            revdfs(j,k);
        }
    }
};

struct twosat{
    int n;
    scc_graph G;
    vector<bool> answers;
    twosat(int n):n(n),G(2*n),answers(n,false){}

    void add_clause(int i,bool f,int j,bool g){
        if(f&&g)  { G.add_edge(i+n,j); G.add_edge(j+n,i);  }
        else if(g){ G.add_edge(i,j);   G.add_edge(j+n,i+n);}
        else if(f){ G.add_edge(j,i);   G.add_edge(i+n,j+n);}
        else      { G.add_edge(i,j+n); G.add_edge(j,i+n);  }
    }

    bool satisfable(){
        G.scc();
        rep(i,n){
            if(G.seen[i] == G.seen[i+n]) return false;
        }
        rep(i,n){
            if(G.seen[i] > G.seen[i+n]) answers[i] = true;
        }
        return true;
    }

    vector<bool> answer(){ return answers;}
};


int main(){
    int n,d;
    scanf("%d%d",&n,&d);
    vector<int> x(n),y(n);
    rep(i,n){
        scanf("%d%d",&x[i],&y[i]);
    }
    twosat ts(n);
    rep(i,n)rep(j,i){
        if(abs(x[i]-x[j])<d){
            ts.add_clause(i,false,j,false);
        }
        if(abs(x[i]-y[j])<d){
            ts.add_clause(i,false,j,true);
        }
        if(abs(y[i]-x[j])<d){
            ts.add_clause(i,true,j,false);
        }
        if(abs(y[i]-y[j])<d){
            ts.add_clause(i,true,j,true);
        }
    }

    if(!ts.satisfable()){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    vector<bool> ans = ts.answer();

    for(int i=0;i<n;i++){
        if(ans[i]) cout << x[i] << endl;
        else cout << y[i] << endl;
    }
    return 0;
}

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

typedef pair<int, int> P;


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

	vector<P> p;
	int D, x, y, a;
	cin >> D;
	cin >> x;
	string s;
	for(int i = 0; i < x; i++) {
		cin >> s >> a;
		if(s == "D") p.push_back({ 1, a });
	}
	cin >> y;
	for(int i = 0; i < y; i++) {
		cin >> s >> a;
		if(s == "DD") p.push_back({ 2, a });
	}

	int N = p.size();
	int ans = 0;
	for(int i = 1; i < 1 << N; i++) {
		int Dsum = 0, score = 0;
		for(int j = 0; j < N; j++) {
			if(i >> j & 1) {
				Dsum += p[j].first;
				score += p[j].second;
			}
		}
		if(Dsum <= D) ans = max(ans, score);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3232
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	m = 55555
	a = zeros(Int,m)
	a[1] = 1
	k = 2
	while k <= sqrt(m)
		for i in 2*k:k:m
			a[i] = 1
		end
		k += 1
	end
	t = 0
	i = 1
	while t < n
		if a[i] == 0 && i%5 == 1
			if t == n-1
				println(i)
			else
				print(i, " ")
			end
			t += 1
		end
		i += 1
	end
end

main()


Measured memory_bytes: 108608
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define ob pop_back
#define xx first
#define yy second
#define dob double
#define int long long int
#define ss size()
using namespace std;
const int M=1e9+7,maxn=411;
std::vector<int> adj[30];
std::vector<int> v1;
std::vector<int> v;
int ans,n,k,m,x,y,q,par[maxn],h[maxn],mach[maxn],sk[maxn],dp[maxn][maxn];
bool mark[maxn];

int power(int g,int h){
    int t=1;
    for(int i=0;i<h;i++)
        t*=g;
    return t;
}
int32_t main(){
    cin>>k;
    int a[k+1],pa[k+1];
    for(int i=1;i<=k;i++)
        cin>>a[i];
    pa[0]=0;
    for(int i=1;i<=k;i++)
        pa[i]=pa[i-1]+a[i];
    for(int i=0;i<maxn;i++)
        for(int j=0;j<maxn;j++)
            dp[i][j]=100000000000000;
    for(int i=1;i<=k;i++)
        dp[i][i]=0;
    for(int len=1;len<k;len++){
        for(int i=1;i<=k-len;i++){
            for(int j=i+1;j<=i+len;j++)
                dp[i][i+len]=min((dp[i][j-1]+dp[j][i+len])+(pa[i+len]-pa[i-1]),dp[i][i+len]);
        }
    }
    cout<<dp[1][k];
    return 0;
}


Measured memory_bytes: 1536
program tax_increase
    integer a, b, i, ansa, ansb
    read *, a, b
    do i = 1, 1009
        ansa = int(i * 0.08)
        ansb = int(i * 0.1)
        if(ansa .eq. a .and. ansb .eq. b)exit
    end do
    if(i .le. 1009)then
        print *, i
    else
        print *, '-1'
    end if
end program

Measured memory_bytes: 2880
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int[] X = cin.arrayInt();

        Array.Sort(X);

        if (Math.Abs(X[2] - X[1]) % 2 == Math.Abs(X[2] - X[0]) % 2)
        {
            Console.WriteLine((X[2] - X[1] + X[2] - X[0]) / 2);
        }
        else
        {
            X[2]++;
            X[1]++;
            Console.WriteLine((X[2] - X[1] + X[2] - X[0]) / 2 + 1);
        }
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<list>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
//#define __int64 long long

int n;

int main(){	
	cin>>n;
	int ans=0;

	for(int i=1;;i++){

		if(i*i<=n){
				ans=max(ans,i*i);
		}	
		if(i*i>n)break;
	}
	cout<<ans<<endl;	
	return 0;
}


Measured memory_bytes: 256
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

fn main() {
    input! {
        N:isize,
    }
    for n in 1..=3500 {
        for w in 1..=3500 {
            let p = n * w * N;
            let q = 4 * n * w - n * N - w * N;
            if q > 0 && p % q == 0 {
                //dbg!(p, q);
                println!("{} {} {}", n, w, p / q);
                return;
            }
        }
    }
}


Measured memory_bytes: 2144
package main

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

func main() {
	fmt.Println(abc174b(os.Stdin))
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func abc174b(r io.Reader) int {
	sc := bufio.NewScanner(r)
	sc.Split(bufio.ScanWords)

	n, d := nextInt(sc), float64(nextInt(sc))

	var q int
	for i := 0; i < n; i++ {
		x, y := float64(nextInt(sc)), float64(nextInt(sc))
		if math.Sqrt(x*x+y*y) <= d {
			q++
		}
	}
	return q
}


Measured memory_bytes: 4904
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

ll dp[2010][2010];
ll s[100010];
int L;

ll sum(int a,int b){
	if(a>b) swap(a,b);
	ll ret = s[b];
	if(a) ret-=s[a-1];
	// cout<<"sum "<<a<<" "<<b<<" "<<ret<<" "<<ret/L<<endl;
	return ret/L;
}

void mainmain(){
	int n,m;
	cin>>n>>m>>L;
	vint v(n);
	rep(i,n) cin>>v[i],v[i]--;
	sort(ALL(v));
	vint w(m);
	rep(i,m) cin>>w[i];
	rep(i,m){
		if(!i){
			s[i]=w[i];
		}
		else{
			s[i]=s[i-1]+w[i];
		}
	}
	rep(i,2010) rep(j,2010) dp[i][j]=INFL;
	dp[0][0] = 0;
	dp[1][0] = sum(v[0],v[1]);
	rep(i,n-1){
		rep(j,i){
			mins(dp[i+1][j],dp[i][j]+sum(v[i],v[i+1]));
			mins(dp[i+1][i],dp[i][j]+sum(v[j],v[i+1]));
		}
	}
	// rep(i,n){
	// 	rep(j,n){
	// 		cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
	// 	}
	// }
	ll ans = INFL;
	rep(i,n){
		mins(ans,dp[n-1][i]+sum(v[i],v[n-1]));
	}
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 35604
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long int
#define s(x)	cin>>x
#define p(x)	cout<<x<<"\n"
#define goog(x, y)  cout<<"Case #"<<x<<": "<<y<<"\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define INF 100000000000
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpi;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
typedef long double ld;

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);
int gcd(int a, int b) ;

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve() {
    int s;cin>>s;
    ll arr[2002];
    arr[1]=0;
    arr[2]=0;
    arr[3]=1;
    arr[4]=1;
    arr[5]=1;
    Fo(i,6,2002)
    {   arr[i]=1;
        for(int p=3;p<i;++p)
        {   arr[i]=(arr[i-p]+arr[i])%mod;}
    }
    p(arr[s]);
    
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    //cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    //u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

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

Measured memory_bytes: 10696
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	
	//文字列から10進数に変換するときはparseIntを使います
	var n = parseInt(input[0], 10);
    var s = input[1];
    var count = 0;
	//出力
	for(i=0;i<n;i++){
        if(s.substr(i,3)=="ABC"){
            count=count+1;
        }

    }
    console.log('%d',count);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <stdio.h>
void swap(int *a,int *b){
    int temp;
    if(*a>*b){
        temp=*a;
        *a=*b;
        *b=temp;
    }
    
}




int main(){
    int x,y;
    while(1){
        scanf("%d%d",&x,&y);
        if(x==0&&y==0)
            break;
        swap(&x,&y);
        printf("%d %d\n",x,y);
    }
     
    
    
}


Measured memory_bytes: 2104
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50 or r >= 50:
        print("C")
    elif m + f >= 30:
        print("D")
    else:
        print("F")


Measured memory_bytes: 5592
<?php

function input() {
    return trim(fgets(STDIN));
}
function input_array() {
    return explode(' ', input());
}

$N = (int)input();

$dp = [null, array_fill(0, 100001, false)];

$dp[1][0] = true;
foreach (range(0, 6) as $power) {
    $dp[1][pow(6, $power)] = true;
}
foreach (range(0, 5) as $power) {
    $dp[1][pow(9, $power)] = true;
}
if ($dp[1][$N] === true) {
    echo "1\n";
    exit;
}

$count = 2;
while (true) {
    $dp[$count] = array_fill(0, 100001, false);
    $dp[$count][0] = true;
    for ($i = 0; $i <= 100000; $i++) {
        if ($dp[$count - 1][$i] === true) {
            foreach (range(0, 6) as $power) {
                $dp[$count][$i + pow(6, $power)] = true;
            }
            foreach (range(0, 5) as $power) {
                $dp[$count][$i + pow(9, $power)] = true;
            }
        }
    }
    if ($dp[$count][$N] === true) {
        echo "{$count}\n";
        exit;
    }
    $count++;
}

Measured memory_bytes: 89464
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 998244353;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = (int)1e6 + 1;
	
	
	void doIt() {
		int X = sc.nextInt();
		List<Integer> f = new ArrayList<>();
		for(int i = 1; i * i <= X; i++) {
			if(X % i == 0) {
				f.add(i);
			}
		}
		f.add(X);
		for(int d : f) {
			for(int a = 0; a <= 1000; a++) {
				int b = a - d;
				if(Math.pow(a, 5) - Math.pow(b, 5) == X) {
					System.out.println(a + " " + b);
					return;
				}
			}
		}
		System.out.println(Arrays.toString(f.toArray()));
	}
	
	
	public static void main(String[] args) {
		new Main().doIt();
	}

}


Measured memory_bytes: 38696
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

const LL INF = 1e18;

LL y[3]{2, 3, 5}, z[4];
map<LL, LL> dp;

LL f(LL n) {
    if(n == 0) return 0;
    if(n == 1) return z[3];
    auto it = dp.find(n);
    if(it != dp.end()) return it->second;
    LL x = INF;
    rep(i, 3) {
        LL d = n % y[i];
        x = min(x, f(n/y[i]) + d * z[3] + z[i]);
        x = min(x, f((n+y[i]-1)/y[i]) + (y[i] - d) * z[3] + z[i]);
    }
    if(x / z[3] >= n) x = min(x, n * z[3]);
    return dp[n] = x;
}

int main()
{
    int T;
    cin >> T;
    while(T--) {
        LL n;
        cin >> n;
        rep(i, 4) cin >> z[i];
        dp.clear();
        cout << f(n) << endl;
    }
	return 0;
}


Measured memory_bytes: 4288
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int[] nums=new int[n];
        int sum=0;
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
            sum+=nums[i];
        }
        int m=sc.nextInt();
        for(int i=0;i<m;i++){
            System.out.println(sum-nums[sc.nextInt()-1]+sc.nextInt());
        }
    }
    
 
}

Measured memory_bytes: 23508
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

  int A=in(),B=in();
  
  cout << (!(B%A)? (A+B) : (B-A)) << endl;
  return 0;
}


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

#define FOR(a,b,c) for(int a=(b),a##_end__=(c);a<a##_end__;a++)
const int M=2005;
bitset<M*M>b;
int n,sum;
int main(){
    b[0]=1;
    scanf("%d",&n);
    FOR(i,0,n){
        int a;
        scanf("%d",&a);
        sum+=a;
        b|=b<<a;
    }
    FOR(i,sum+1>>1,M*M) if(b[i]){
        printf("%d\n",i);
        return 0;
    }
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

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

    string res = "Draw";

    if(A > B) {
        res = "Alice";
    } else if(A < B) {
        res = "Bob";
    }

    if(A == 1) {
        res = "Alice";
    } else if(B == 1) {
        res = "Bob";
    }

    if(A == B) res = "Draw";

    cout << res << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const long MOD = 1000000007;
        static void Solve()
        {
            var o = ReadAndParseIntArr();
            int n = o[0];
            int k = o[1];
            var d = ReadAndParseIntArr();
            var usableD = new HashSet<char>();
            for(int i = 0; i < 10; ++i)
            {
                if( !d.Contains(i))
                {
                    usableD.Add((char)(i + '0'));
                }
            }

            int price = n;
            while(true)
            {
                if(IsValid(price, usableD))
                {
                    break;
                }
                price++;
            }

            Console.WriteLine(price);
        }
        private static bool IsValid(int price, HashSet<char> usableD)
        {
            string s = price.ToString();
            for(int i=0;i<s.Length;++i)
            {
                if(! usableD.Contains(s[i]))
                {
                    return false;
                }
            }
            return true;
        }
        
        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

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

string s[2005];
char ans[10005];
int len[2005];
bitset<10005> can[2005];
pair<int,int> rec[2][10005];

#define mp make_pair
#define fi first
#define se second

int main () {
        int n, k; cin >> n >> k;
        for (int i = 1; i <= n; ++i) cin >> s[i], len[i] = s[i].size();
        can[n+1][0] = 1;
        for (int i = n; i >= 1; --i) can[i] = can[i+1] | (can[i+1]<<len[i]);
        int cur = 0, nxt = cur ^ 1, cnt = 0;
        for (int i = 1; i <= n; ++i) if (can[i+1][k-len[i]]) rec[0][++cnt] = mp (i, 0);
        for (int i = 0; i < k; ++i) {
                char Min = 'z';
                for (int j = 1; j <= cnt; ++j) Min = min (Min, s[rec[cur][j].fi][rec[cur][j].se]);
                ans[i] = Min;
                int minID = 1e9, ccnt = 0;
                for (int j = 1; j <= cnt; ++j) {
                        int id = rec[cur][j].fi, pos = rec[cur][j].se;
                        if (s[id][pos] != Min) continue;
                        if (pos+1 == len[id]) minID = min(minID,id);
                        else rec[nxt][++ccnt] = mp (id,pos+1);
                }
                for (int j = minID+1; j <= n; ++j)
                        if (k-len[j]-i-1>=0 && can[j+1][k-len[j]-i-1])
                                rec[nxt][++ccnt] = mp (j,0);    
                cur ^= 1, nxt ^= 1;
                cnt = ccnt;
        }
        for (int i = 0; i < k; ++i) putchar (ans[i]); cout << endl;
        return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

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

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int H, W;
	cin >> H >> W;

	vector<string> field(H);
	for (int i = 0; i < H; ++i) cin >> field[i];
	vector<vector<int> > dist(H, vector<int>(W, -1));
	queue<pair<int, int> > que;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (field[i][j] == '#') {
				dist[i][j] = 0;
				que.push(make_pair(i, j));
			}
		}
	}

	while (!que.empty()) {
		pair<int, int> current_pos = que.front();
		int x = current_pos.first;
		int y = current_pos.second;
		que.pop();

		for (int direction = 0; direction < 4; ++direction) {
			int next_x = x + dx[direction];
			int next_y = y + dy[direction];
			if (next_x < 0 || next_x >= H || next_y < 0 || next_y >= W) continue;
			if (field[next_x][next_y] == '#') continue;

			if (dist[next_x][next_y] == -1) {
				que.push(make_pair(next_x, next_y));
				dist[next_x][next_y] = dist[x][y] + 1;
			}
		}
	}
	int max_dist = 0;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			max_dist = max(max_dist, dist[i][j]);
		}
	}
	cout << max_dist << endl;
	return 0;
}

Measured memory_bytes: 13456
#include <stdio.h>

int main(){
  double w;
  while(scanf("%lf", &w) != EOF){
    if(w > 91) puts("heavy");
    else if(w > 81) puts("light heavy");
    else if(w > 75) puts("middle");
    else if(w > 69) puts("light middle");
    else if(w > 64) puts("welter");
    else if(w > 60) puts("light welter");
    else if(w > 57) puts("light");
    else if(w > 54) puts("feather");
    else if(w > 51) puts("bantam");
    else if(w > 48) puts("fly");
    else puts("light fly");
  }
  return 0;
}

Measured memory_bytes: 608
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
	
	int a, b, c, d, e, k;
	
	scanf("%d%d%d%d%d%d",&a, &b, &c, &d ,&e , &k );

	if (e - a <= k)
	{
		printf("Yay!");
		return 0;
	}
	printf(":(");
}

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

ll N, M;
string S;

int main(){
	cin >> N >> M;
	cin >> S;
	
	int pos = N;
	vector<int> steps;
	while ( pos != 0 ){
		int step = M;
		if ( pos-step < 0 )
			step = pos;
		while ( S[pos-step] == '1' )
			step--;
		if ( step == 0 ){
			cout << "-1" << endl;
			return 0;
		}
		steps.push_back(step);
		pos -= step;
	}
	
	for ( int i = steps.size()-1; i >= 0; i-- )
		cout << steps[i] << " ";
	cout << endl;
	
	return 0;
}



Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
struct Combin{
	#define N 1000005
	int fac[N],rv[N],facrv[N];
	Combin(){
		fac[0]=rv[1]=facrv[0]=1;
		for(int i=2;i<N;i++) rv[i]=((-(mod/i)*1LL*rv[mod%i]%mod)+mod)%mod;
		for(int i=1;i<N;i++) fac[i]=1LL*fac[i-1]*i%mod;
		for(int i=1;i<N;i++) facrv[i]=1LL*facrv[i-1]*rv[i]%mod;
	}
	int C(int r1,int n1){
		if(r1>n1) return 0;
		return fac[n1]*1LL*facrv[r1]%mod*facrv[n1-r1]%mod;
	}
	#undef N
}C;
int fastpow(int x,int a){
    int ret=1;
    while(a){
        if(a&1) ret=ret*1LL*x%mod;
        x=x*1LL*x%mod;a>>=1;
    }
    return ret;
}
#define rev(x) (fastpow(x,mod-2))
int n,m;
int main(){
    scanf("%d%d",&n,&m);
    long long ans=max(n,m);
    for(int i=1;i<=min(n,m);i++)
        ans+=C.C(i,2*i)*1LL*C.C(n-i,n+m-i-i)%mod*rev(2*C.C(n,n+m)%mod)%mod;
    cout<<ans%mod<<endl;
    return 0;
}

Measured memory_bytes: 11904
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define sp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 
}



void solve()
{
	vector<int> v;
	int n;
	cin >> n;
	int x = 0, y = 0, z = 0;
	rep(i, n){
		ll a, cnt = 0;
		cin >> a;
		while(a % 2 == 0) a /= 2, ++cnt;
		if(cnt >= 2) ++x;
		else if(cnt == 0) ++y;
		else ++z;
	}
	if(x + !z >= y) cout << "Yes";
	else cout << "No";

}

 
int main()
{
	// freopen("crosses.in", "r", stdin);
	// freopen("crosses.out", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

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

int main()
{
    int n; cin >> n;
    int tmp;
    vector<int> ans(n+1);
    rep(i, n-1) {
        cin >> tmp;
        ans.at(tmp)++;
    }

    for(int i = 1; i < n+1; i++) {
        cout << ans.at(i) << endl;
    }
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	string S;
	cin >> S;

	int C[300] = {};
	rep(i, S.size()) C[S[i]]++;

	int OK = 1;
	if (C['N'] || C['S']) {
		if (!C['N'] || !C['S']) OK = 0;
	}
	if (C['E'] || C['W']) {
		if (!C['E'] || !C['W']) OK = 0;
	}
	if (OK) co("Yes");
	else co("No");

	Would you please return 0;
}

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

def solve(N: int, X: int, Y: int):
    def len_shortest_path(i, j, X, Y):
        return min(abs(j-i), abs(X-i) + abs(Y-j) + 1)
    result = collections.defaultdict(int)
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            shortest_path = len_shortest_path(i, j, X, Y)
            result[shortest_path] += 1

    for i in range(1, N):
        print(result[i])


def solve_slow(N: int, X: int, Y: int):
    d = [[100000000 for i in range(N)] for j in range(N)]
    X -= 1
    Y -= 1

    for i in range(N):
        d[i][i] = 0
        if i < N-1:
            d[i][i+1] = 1
            d[i+1][i] = 1
    d[X][Y] = 1
    d[Y][X] = 1

    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

    count_dict = collections.defaultdict(int)
    for row in d:
        for i in row:
            count_dict[i] += 1
    for i in range(1, N):
        print(count_dict[i])
    return


def solve_slow(N: int, X: int, Y: int):
    d = [[100000000 for i in range(N)] for j in range(N)]
    X -= 1
    Y -= 1

    for i in range(N):
        d[i][i] = 0
        if i < N-1:
            d[i][i+1] = 1
            d[i+1][i] = 1
    d[X][Y] = 1
    d[Y][X] = 1

    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

    count_dict = collections.defaultdict(int)
    for row in d:
        for i in row:
            count_dict[i] += 1
    for i in range(1, N):
        print(count_dict[i])
    return


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

if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
def f(x,y):
  global B
  B[y][x]^=1
  if y>0: B[y-1][x]^=1
  if y<9: B[y+1][x]^=1
  if x>0: B[y][x-1]^=1
  if x<9: B[y][x+1]^=1
  return (x,y)
R=range(10)
n=input()
for _ in [0]*n:
  A=[map(int,raw_input().split()) for _ in R]
  for p in range(1024):
    B=[e[:] for e in A]
    x=[]
    for j in R:
      if j==0: a=map(int,list(format(p,'010b')))
      else: a=B[j-1]
      for i in R:
        if a[i]==1: x.append(f(i,j))
    if sum(B[9])==0: break
  for i,j in x: B[j][i]=1
  for e in B: print " ".join(map(str,e))

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

const int N = 500005, P = 998244353;
int n, m, fac[N], ifac[N], pwn[N], pwm[N];

int power(int a, int x) {
	int ans = 1;
	for (; x; x >>= 1, a = 1ll * a * a % P)
		if (x & 1) ans = 1ll * ans * a % P;
	return ans;
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = pwm[0] = 1; i <= n; ++i)
		pwm[i] = (m + 1ll) * pwm[i - 1] % P;
	for (int i = pwn[0] = 1; i <= m; ++i)
		pwn[i] = (n + 1ll) * pwn[i - 1] % P;
	for (int i = fac[0] = 1; i <= max(n, m); ++i)
		fac[i] = 1ll * fac[i - 1] * i % P;
	ifac[max(n, m)] = power(fac[max(n, m)], P - 2);
	for (int i = max(n, m); i; --i)
		ifac[i - 1] = 1ll * ifac[i] * i % P;
	int ans = 0;
	for (int i = 0; i <= n && i <= m; ++i)
		ans = (ans + (i & 1 ? -1ll : 1ll) * ifac[n - i] * ifac[i] % P * ifac[m - i] % P * pwm[n - i] % P * pwn[m - i]) % P;
	ans = 1ll * ans * fac[n] % P * fac[m] % P;
	printf("%d\n", (ans + P) % P);
	return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
//#define int long long
int abs(int a,int b){
  int c=max(a,b)-min(a,b);
  return c;
}
int d[1000];
int c[1000];
signed main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin>>a>>b>>c;
  if(min(b,c)+a>=max(b,c)) cout<<"0\n";
  else cout<<abs((min(b,c)+a)-max(b,c))<<"\n";
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    long N =sc.nextLong();
    long A =sc.nextLong();
    long B =sc.nextLong();
    long S =N%(A+B);
    long M =(N-S)/(A+B);
    if(S<=A){System.out.println(M*A+S);}
    else{System.out.println((M+1)*A);}
  }
}

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

#define ll long long
#define endl '\n'
#ifndef _WINDOWS
// no getchar_unlocked on Windows so just call getchar
#define getchar getchar_unlocked
#endif

template <typename Func>
inline void loop(int e, Func&& f) {
    for (int i = 0; i < e; i++) {
        std::forward<Func>(f)(i);
    }
}
template <typename Func>
inline void loop(int s, int e, Func&& f) {
    for (int i = s; i < e; i++) {
        std::forward<Func>(f)(i);
    }
}
template <typename T>
inline void scanpn(T& num) {
    int c;
    num = 0;
    c = getchar();
    // bool negative = false;
    // if (c == '-') {
    // 	negative = true;
    // 	c = getchar();
    // }
    for (; (c > 47 && c < 58); c = getchar()) num = num * 10 + c - 48;
    // if (negative)
    //     number = -number;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, t;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> t;
        n -= t;
    }
    cout << (n < 0 ? -1 : n) << endl;
    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,m,x=0;
	scanf("%lld%lld",&n,&m);
	if(n>0)
	n--;
	if(m>0)
	m--;
	while(n)
	{
		x+=n;
		n--;
	}
	while(m)
	{
		x+=m;
		m--;
	}
	printf("%lld",x);
}

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

using MatrixTy = vector<vector<int>>;

int main(int argc, char **argv) {
  int N;
  cin >> N;

  int X[] = {1,2,3,4,5,6,7,8,9};

  string ans = "No";
  for (int i : X) {
    if (N % i == 0 && N / i <= 9) {
      ans = "Yes";
      break;
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main(){
    int n;
    cin>>n;
    int k;
    cin>>k;
    vector<int> in(n);
    for(int i=0; i<n; i++){
        cin>>in[i];
    }
    int r=n-1;
    int l=r-k;
    vector<bool> ans;
    while(l>=0){
        if(in[r]>in[l]){
            ans.emplace_back(true);
        }
        else{
            ans.emplace_back(false);
        }
        r--;
        l--;
    }
    for(int i=ans.size()-1; i>=0; i--){
        if(ans[i]){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
}


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

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


Measured memory_bytes: 256
#include<map>
#include<queue>
#include<time.h>
#include<limits.h>
#include<cmath>
#include<ostream>
#include<iterator>
#include<set>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep_1(i,m,n) for(int i=m;i<=n;i++)
#define mem(st) memset(st,0,sizeof st)
inline int read()
{
	int num=0, w=0;
	char ch=0;
	while (!isdigit(ch))
	{
		w|=ch=='-';
		ch = getchar();
	}
	while (isdigit(ch))
	{
		num = (num<<3) + (num<<1) + (ch^48);
		ch = getchar();
	}
	return w? -num: num;
}
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef pair<double,double> pdd;
const int inf = 0x3f3f3f3f;
const int N=2e6+10;
int a[N];
void solve()
{
	ll n;
	cin>>n;
	ll ans=7;
	for(ll i=1;i<=1000000;i++)
	{
		if(ans%n==0)
		{
			cout<<i<<endl;
			return ;
		}
		ans=ans%n*10+7;
	}
	cout<<"-1"<<endl;
}
signed main()
{
	ll t=1; 
	while(t--)
		solve();
	return 0;
}



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

int main(){
  string s;
  cin >> s;
  sort(s.begin(),s.end());
  vector<int> abc(26);
  int kireme=0;
  for(int i=97;i<123;i++){
    char x = i;
    for(int j=kireme;j<s.size();j++){
      if(s[j]==x){
        abc.at(i-97)++;
        if(abc.at(i-97) == 2){
          cout << "no" << endl;
          return 0;
        }
      }
      else{
        kireme = j;
        break;
      }
    }
  }
  cout << "yes" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int sum4 = 0, sum2 = 0;
    for (int i = 0; i < n; ++i) {
        int tmp; cin >> tmp;
        if (tmp % 4 == 0) sum4++;
        else if (tmp % 2 == 0) sum2++;
    }
    if (sum4 >= (n - (sum2 >= 1 ? (sum2 - 1) : 0)) / 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<cstdio>
#include<algorithm>
#define count Count
#define int long long
#define P pair<int,int>
using namespace std;

P c[200000];
int count[2];
int n[2];
signed main() {
	int a, b; scanf("%lld%lld", &a, &b);
	n[0] = a; n[1] = b;
	for (int d = 0; d < a; d++) {
		int e; scanf("%lld", &e);
		c[d] = { e,0 };
	}
	for (int d = 0; d < b; d++) {
		int e; scanf("%lld", &e);
		c[a+d] = { e,1 };
	}
	sort(c, c + a + b);
	int ans = 0;
	for (int i = 0; i < a+b; i++) {
		ans += (int)(c[i].first)*(n[(c[i].second + 1) & 1]- count[(c[i].second + 1) & 1]+1);
		count[c[i].second]++;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3328
using System;
using System.IO;

namespace AizuOnline
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());
            var type = new char[x];
            var num = new int[x];
            var index = 0;
            while (true)
            {
                var a = Console.ReadLine().Split(' ');
                type[index] = a[0][0];
                num[index] = int.Parse(a[1]);
                index++;
                if (index == x)
                {
                    break;
                }
            }
            Output(x, type, num, 'S');
            Output(x, type, num, 'H');
            Output(x, type, num, 'C');
            Output(x, type, num, 'D');

            Console.ReadLine();
        }

        private static void Output(int x, char[] type, int[] num, char v)
        {
            var existNum = new int[14];
            for (int i = 0; i < x; i++)
            {
                if (type[i] == v)
                {
                    existNum[num[i]] = num[i];
                }
            }
            for (int i = 1; i < 14; i++)
            {
                if (existNum[i] == 0)
                {
                    Console.WriteLine(v + " " + i);
                }
            }
        }
    }
}

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

using namespace std;

typedef long long ll;

int main(){
    ll N,M,K;
    while(cin >> N >> M, N){
        vector<ll> sum(N+1,0);
        for(int i = 0 ; i < N ; i++){
            cin >> K;
            sum[i+1] = (sum[i] + K) % M;
        }
        ll res = 0;
        set<ll> st = {0};
        for(int i = 1 ; i <= N ; i++){
            st.insert(sum[i]);
            res = max(res, sum[i]%M);
            auto x = st.upper_bound(sum[i]);
            if(x == st.end()) continue;
            res = max(res, (sum[i]-*x+M)%M);
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 2400
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>

using namespace std;

int main() {
	int n, math, english, japanese, ave;

	while (cin >> n, n) {
		for (int i = 0; i < n; ++i) {
			cin >> math >> english >> japanese;
			if (math == 100 || english == 100 | japanese == 100) {
				cout << "A" << endl;
				continue;
			}
			if (((math + english) / 2) >= 90) {
				cout << "A" << endl;
				continue;
			}

			ave = (math + english + japanese) / 3;
			if (ave >= 80) {
				cout << "A" << endl;
			}
			else if (ave >= 70) {
				cout << "B" << endl;
			}
			else if (ave >= 50 && (math >= 80 || english >= 80)) {
				cout << "B" << endl;
			}
			else {
				cout << "C" << endl;
			}
		}
	}

	return 0;
}


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

using namespace std;

int main(){
    int A,B,C,K;
    cin >> A >> B >> C;
    cin >> K;
    for(int i=0;i<K;i++){
        if(B<=A){
            B *= 2;
        }else if(C<=B){
            C *= 2;
        }
    }

    if(A<B && B<C){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pi acos(-1.0)
#define LL long long
#define mp make_pair
#define pb push_back
#define ls rt<<1, l, m
#define rs rt<<1|1, m+1, r
#define ULL unsigned LL
#define pll pair<LL, LL>
#define pii pair<int, int>
#define piii pair<int,pii>
#define mem(a, b) memset(a, b, sizeof(a))
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stout);
//head
 
const int N = 2e5 + 5;
const LL INF = 0x3f3f3f3f3f3f3f3f;
int a[N], n;
LL check(LL m) {
    LL ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += abs(a[i] - (m+i));
    }
    return ans;
}
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    LL l = -2*n, r = 1e9 + 2*n, m1 = (l+l+r)/3, m2 = (l+r+r)/3;
    while(l < r - 2) {
        if(check(m2) > check(m1)) r = m2;
        else l = m1;
        m1 = (l+l+r)/3;
        m2 = (l+r+r)/3;
 
    }
    LL ans = INF;
    for (LL i = l; i <= r; i++) ans = min(ans, check(i));
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1024
def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = int(input())
	e = int(input())
	k = int(input())
	if e-a > k:
		print(":(")
	else:
		print("Yay!")

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
n,a,b=map(int, input().split()) #a1 a2 a3

while True:
  if b-a>1:
    a+=1
  else:
    a-=1
  if a==0:
    print('Borys')
    break
  if b-a>1:
    b-=1
  else:
    b+=1
  if b==n+1:
    print('Alice')
    break

Measured memory_bytes: 3060
import java.util.*;

public class Main {

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

		while(true){
			int n = sc.nextInt();
			if(n==0) break;
			
			int[] a = new int[n];
			for(int i=0;i<n;i++){
				a[i] = sc.nextInt();
				i++;
				if(i==n) break;
				a[i] = sc.nextInt();
				if(a[i-1]!=a[i]){
					for(int j=i-1;j>=0;j--){
						if(a[j]==a[i]) break;
						a[j] = a[i];
					}
				}
			}
			int count = 0;
			for(int i=0;i<n;i++){
				if(a[i]==0) count++;
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 63172
#coding:UTF=-8

N, Y = map(int, input().split())

for x in range(N + 1):
    for y in range(N - x + 1):
        if (x * 10000) + (y * 5000) + (1000 * (N - x - y)) == Y:
            print(x, y, N - x - y)
            exit(0)
print(-1,-1,-1)


Measured memory_bytes: 3060
def main():
    N = int(input())
    S = input()
    tree = SegmentTree(initial_values=S, f=lambda x,y:x|y, converter=lambda c: 1 << (ord(c)-ord('a')))
    Q = int(input())
    update = tree.update
    query = tree.query
    for _ in range(Q):
        t, a, b = input().split()
        if t == '1': update(int(a)-1, b)
        else: print(bin(query(int(a)-1, int(b))).count('1'))    

class SegmentTree:
    def __init__(self, n=None, f=max, zero_factory=int, converter=lambda x:x, initial_values=None):
        assert(n or initial_values)
        self.__f, self.__z, self.__c = f, zero_factory, converter
        size = n if n else len(initial_values)
        self.__n = 1 << ((size - 1).bit_length())
        d = [zero_factory() for _ in range(2 * self.__n + 1)]
        self.__dat = d
        if initial_values:
            for i, v in enumerate(initial_values): d[self.__n + i] = converter(v)
            for i in range(self.__n - 1, 0, -1): d[i] = f(d[i<<1], d[i<<1|1])

    def update(self, index, value):
        i, v, d = index + self.__n, self.__c(value), self.__dat
        if d[i] == v: return
        d[i] = v
        while i:
            i = i >> 1
            d[i] = self.__f(d[i<<1], d[i<<1|1])

    def query(self, from_inclusive, to_exclusive):
        ans = self.__z()
        if to_exclusive <= from_inclusive: return ans
        l, r = from_inclusive + self.__n, to_exclusive + self.__n
        while l < r:
            if l & 1: ans, l = self.__f(ans, self.__dat[l]), l+1
            if r & 1: ans, r = self.__f(ans, self.__dat[r-1]), r-1
            l, r = l >> 1, r >> 1
        return ans

if __name__ == '__main__':
    main()


Measured memory_bytes: 116300
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[111][111];
ll R[111],C[111];
int main(){
  int n;

  fill(dp[0],dp[110],1000000000000000000LL);

  cin >> n;
  for(int i=0;i<n;i++)
    cin >> R[i] >> C[i];

  for(int i=0;i<n;i++) dp[i][i] = 0;

  for(int k=1;k<n;k++){
    //cout << k << endl;
    for(int i=0;i<n-k;i++){
      for(int j=i;j<i+k;j++){
	///	printf("dp[%d][%d] = %lld + dp[%d][%d] = %lld + %lld * %lld * %lld\n",
	//     i,j,dp[i][j],j+1,i+k,dp[j+1][i+k],R[i],C[i+k],min(C[j],R[j+1]));
	dp[i][i+k] = min( dp[i][i+k],
			  dp[i][j]+dp[j+1][i+k] + 
			  R[i] * C[i+k] * min(C[j],R[j+1]) );
      }
      //  printf("dp[%d][%d] = %lld\n",i,i+k,dp[i][i+k]);
    }
  }

  cout << dp[0][n-1] << endl;
}

Measured memory_bytes: 1260