akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
using namespace std;

typedef long long ll;
#define rep(i, a, b) for (ll i=(a); i<(b); i++)
#define all(obj) (obj).begin(), (obj).end()
#define fi first
#define sc second
#define pb push_back
#define str to_string
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
void chmax(ll &a, ll b) { a = max(a, b); }
void chmin(ll &a, ll b) { a = min(a, b); }

ll dp[1010][1010];

ll LCS(string a, string b) {
    int N = a.size();
    int M = b.size();
    memset(dp, 0, sizeof(dp));

    rep(i, 0, N+1) rep(j, 0, M+1) {
        if (i < N) {
            chmax(dp[i+1][j], dp[i][j]);
        }
        if (j < M) {
            chmax(dp[i][j+1], dp[i][j]);
        }
        if (i < N && j < M && a[i] == b[j]) {
            chmax(dp[i+1][j+1], dp[i][j]+1);
        }
    }
    return dp[N][M];
}

int main() {
    int Q;
    string a, b;
    cin >> Q;
    rep(i, 0, Q) {
        cin >> a;
        cin >> b;
        cout << LCS(a, b) << endl;
    }
    return 0;
}



Measured memory_bytes: 11156
using System;
class Program
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] args = Console.ReadLine().Split(' ');
    int[] Iargs = new int[N];
    for(int i = 0; i < N; i++)
    {
      Iargs[i] = int.Parse(args[i]);
    }
    Array.Sort(Iargs);
    Array.Reverse(Iargs);
    int Sum = 0;
    for(int j = 1; j < N; j++)
    {
      Sum += Iargs[j];
    }
    if(Iargs[0] < Sum) Console.WriteLine("Yes");
    else Console.WriteLine("No");
  }
}

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

int main(){
    int a,b;
    cin >> a >> b;
    if (a > b) {
          cout << "a > b"<< endl;
    }
    if (a < b) {
          cout << "a < b"<< endl;
    }
    if (a == b) {
          cout << "a == b"<< endl;
    }
return 0;
}
   
    

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int a, b;
    cin >> a >> b;
    int res = 0;
    for(;(a - 1)*res + 1 < b;res++) {}
    cout << res << endl;
    return 0;
}



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

int n, m, dp[100100][2], a[110];

int solve(int K, int turn) {
	if(K == 0) return turn == 1 ? 1 : 0; // player 2 turn => player 1 win
	int &ret = dp[K][turn];
	if(ret != -1) return ret;
	ret = turn == 0 ? -1e9 : 1e9;
	for(int i = 0; i < n; i++) {
		if(K >= a[i]) {
			if(turn == 0) ret = max(ret, solve(K-a[i], !turn));
			else ret = min(ret, solve(K-a[i], !turn));
		}
	}
	if(ret > 1 || ret < 0) {
		if(turn == 0) ret = 0;
		else ret = 1;
	}
	return ret;
}

int main() {
	memset(dp, -1, sizeof(dp));
	cin>>n>>m;
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	if(solve(m, 0) == 1) cout<<"First\n";
	else cout<<"Second\n";
	return 0;
}


Measured memory_bytes: 8832
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;

#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()

ll n, k, m, M = 1e9 + 7;

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

    cin >> n >> m;

    vl a(n);
    rep(i, n) cin >> a[i];

    vvl b(m, vl(2));
    rep(i, m) rep(j, 2) cin >> b[i][j];

    sort(all(a));
    sort(all(b), [](vl a, vl b) {return a[1] > b[1];});

    if(a[0] >= b[0][1]) {
        ll sum = 0;
        rep(i, n) sum += a[i];
        return cout << sum << endl, 0;
    }

    ll sum = 0, idx = 0, che = 0;
    rep(i, n) {
        if(a[i] < b[idx][1]) {
            sum += b[idx][1];
        } else {
            for(; i < n; i++) sum += a[i];
            break;
        }

        che++;
        if(che == b[idx][0]) {
            idx++;
            if(idx == m) {
                for(i++; i < n; i++) sum += a[i];
                break;
            }
            che = 0;
        }
    }

    cout << sum << endl;
}

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

using namespace std;

int main()
{
 string s;
 cin >> s;
 int num = 0;
 int ans = 0;
 for(auto i : s){
     if(i == 'A' || i == 'C' || i == 'G' || i == 'T'){
         num++;
         ans = max(ans, num);
     }
     else{
         num = 0;
     }
 }
 cout << ans << endl;    
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 500000
 
int n;

 
void MaxHeapify(int He[],int i){
  int l, r, large;
  int tmp;
   
  l = left(i);
  r = right(i);
 
  if(l<=n && He[l]>He[i]){
    large = l;
  }
  else large = i;
 
  if(r<=n && He[r]>He[large]){
    large = r;
  }
 
  if(large != i){
    tmp = He[i];
    He[i] = He[large];
    He[large] = tmp;
 
    MaxHeapify(He, large);
  }  
}

void BuildMaxHeap(int He[]){
  int i;
  for(i=n/2; i >= 1;i--){
    MaxHeapify(He,i);
  }
}
 

int left(int l){
  int x;
  x = 2*l;
  return x;
};
int right(int r){
  int x;
  x = 2*r+1;
  return x;
};

int main(){
  int i;
  int He[MAX];
 
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&He[i]);
  }
   
  BuildMaxHeap(He);
 
  for(i=1;i<=n;i++){
    printf(" %d",He[i]);
  }
  
  printf("\n");
   
  return 0;
}

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

int main()
{
    int x;
    vector<int> v;
    for(int i=0;i<5;i++){
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end(), [](int a, int b){return (a+9)%10 > (b+9)%10;});
    int res=0;
    for(int i=0;i<4;i++){
        res += ((v[i]+9)/10)*10;
    }
    res += v.back();
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void insertionsort(int *a, int n, int g, int &cnt)
{
    for (int i = g; i < n; ++i)
    {
        int tmp = a[i];
        int j = i - g;
        while (j >= 0 && tmp < a[j])
        {
            a[j + g] = a[j];
            j -= g;
            cnt++;
        }
        a[j + g] = tmp;
    }
}
void shellsort(int *a, int n)
{
    vector<int> G;
    int cnt(0);
    for (int h = 1; h <= n;)
    {
        G.push_back(h);
        h = 3 * h + 1;
    }
    cout << G.size() << endl;
    for (int i = G.size() - 1; i >= 0; --i)
    {
        insertionsort(a, n, G[i], cnt);
        cout << G[i] << flush;
        if (i > 0)
        {
            cout << ' ' << flush;
        }
    }
    cout << endl
         << cnt << endl;
}
int main()
{
    int n;
    cin >> n;
    int A[n];
    for (int i = 0; i < n; ++i)
        cin >> A[i];
    shellsort(A, n);
    for (int i = 0; i < n; ++i)
        cout << A[i] << endl;
}


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

int main()
{
  int arr[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin>>k;
  cout<<arr[k-1]<<endl;
  return 0;
}

Measured memory_bytes: 256
a=str(input())
A={"a":"b","b":"c","c":"d","d":"e","e":"f","f":"g","g":"h","h":"i","i":"j","j":"k","k":"l","l":"m","m":"n","n":"o","o":"p","p":"q","q":"r","r":"s","s":"t","t":"u","u":"v","v":"w","w":"x","x":"y","y":"z"}
print(A[a])


Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename Container>
int SZ(const Container& S) { return S.size(); }

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg_var(x) clog << #x  << ": " << x << endl;
    #define dbg_array(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg_var(x)
    #define dbg_array(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

const int MAXN = -1;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!
    int N;
    cin >> N;
    vector<int> A(N+1);
    A[N] = 0;
    for (int i = 0; i < N; i++) cin >> A[i];
    vector<int> nextval(N+1);
    nextval[N] = N;
    for (int i = N-1; i >= 0; i--) {
        if (A[i+1] != 0) nextval[i] = i+1;
        else nextval[i] = nextval[i+1];
    }
    LL res = 0;
    for (int i = 0; i < N; i++) {
        int xxx = A[i];
        int sum = A[i];
        int it = i;
        while (it < N and xxx == sum) {
            it = nextval[it];
            xxx ^= A[it];
            sum += A[it];
        }
        res += it-i;
    }
    cout << res << "\n";
}


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

int main()
{
    int64_t X;
    cin >> X;
    int year = 0;
    int64_t saveing = 100;
    double interest = 0.01;


    while(saveing < X) {
        saveing = saveing + saveing * interest;
        year++;
    }

    cout << year << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
struct node{
	int x,y;
	int z;
};
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,k;
	cin>>n>>k;
	int ave=k+k+n+n-1;
	vector<node>a(n);
	for(int i=0;i<n;i++){
		a[i].y=k+n+n-1-i;
	}
	int cha=n/2;
	for(int i=0;i<=cha;i++){
		a[i].x=k+cha-i;
	}
	int tmp=n-cha-2;
	for(int i=cha+1;i<n;i++){
		a[i].x=k+cha+1+(tmp-(i-cha-1));
	}
	sort(a.begin(),a.end(),[&](node a,node b){return a.x+a.y<b.x+b.y;});
	for(int i=0;i<n;i++)
		a[i].z=k+n+n+i;
	for(int i=0;i<n;i++){
		if(a[i].z<a[i].x+a[i].y){cout<<"-1\n";exit(0);}
	}
	for(int i=0;i<n;i++)
		cout<<a[i].x<<' '<<a[i].y<<' '<<a[i].z<<endl;
	return 0;
}

Measured memory_bytes: 3456
#include <stdio.h>

int main(void)
{
	int a,b=0,c,d=0,i;
	for(i=0;i<4;i++)
	{
		scanf("%d",&a);
		b=b+a;
	}
	for(i=0;i<4;i++)
	{
		scanf("%d",&c);
	d=d+c;
	}
	if(b>d)
	{
		printf("%d\n",b);
	}
	else if(d>b)
	{
		printf("%d\n",d);
	}
	else printf("%d\n",b);
	return 0;
}



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

using ld = long double;
#define f(i,a,b) for (int i = a; i < b; i++)

int main() {
int N; cin>>N;
vector<int> v(N);
f(i,0,N) cin>>v[i];
sort(begin(v),end(v),greater<int>());
ld ans = v.back(); v.pop_back();
while (v.size()) {
ans = (ans+v.back())/2; v.pop_back();
}
cout << setprecision(20) << ans << endl;
return 0;
}

Measured memory_bytes: 256
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;
import std.traits;

struct Input
{
	int n;
	string[] s;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		n = readln().strip().to!int;
        s.length = n;
        foreach (i; 0..n)
            s[i] = readln().strip();
	}
}

auto main2(Input* input)
{
	with (input)
	{
        int[string] occurrence;
        int max = 0;

        foreach (si; s)
        {
            if (si in occurrence)
            {
                occurrence[si] += 1;
            }
            else
            {
                occurrence[si] = 1;
            }

            if (occurrence[si] > max)
                max = occurrence[si];
        }

        auto result = occurrence.byKeyValue().filter!(a => a.value == max).map!(a => a.key).array.sort();

        foreach (word; result)
    		writefln("%s", word);
	}
}

alias retType = ReturnType!main2;
static if (!is(retType == void))
{
	unittest { writeln("begin unittest"); }
	auto _placeholder_ = ReturnType!main2.init;
	unittest { writeln("end unittest"); }

	void parseExample(out Input input, string example)
	{
		struct Adapter
		{
			string[] _lines;
			this(string input) { _lines = input.splitLines(); }
			string readln() { auto line = _lines[0]; _lines = _lines[1..$]; return line; }
		}
		parseInput(input, Adapter(example));
	}
}

void printResult(T)(T result)
{
	static if (isFloatingPoint!T) writefln("%f", result);
	else writeln(result);
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	alias retType = ReturnType!main2;
	static if (is(retType == void))
		main2(&input);
	else
	{
		auto result = main2(&input);
		printResult(result);
	}
}


Measured memory_bytes: 32508
#include<stdio.h>

#define MAX 251
#define NIL 2000000001

main(){
  int i,n,k[MAX];

  for(i=0;i<MAX;i++){
    k[i]=NIL;
  }
  scanf("%d",&n);

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

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,k[i]);
    
    if(k[i/2]!=NIL) printf("parent key = %d, ",k[i/2]);

    if(2*i<=n && k[2*i]!=NIL) printf("left key = %d, ",k[2*i]);
    
    if(2*i+1<=n && k[2*i+1]!=NIL) printf("right key = %d, ",k[2*i+1]);
    
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 600
import sys
from operator import itemgetter

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    A = [int(a) for a in input().split()]
    A.sort()
    change = [[int(i) for i in input().split()] for _ in range(M)]
    change.sort(key = itemgetter(1), reverse = True)

    ai = 0
    for i in range(M):
        cb, c = change[i]
        if ai >= N or c < A[ai]: break
        for _ in range(cb):
            if ai >= N: break
            if A[ai] <= c:
                A[ai] = c
                ai += 1
            else: break
    print(sum(A))
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 27048
def main():
	n = int(input())
	h = list(map(int,input().split()))
	
	base = h[0]
	ans = 0
	for i in range(1,n):
		if base >= h[i]:
			ans += base-h[i]
		else:
			base = h[i]
	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 105112
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b[10000]={0},B[10000]={0},c=0;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b[i];
  }
  for(int i=0;i<a;i++){
    if(b[i]==2||b[i]==3||b[i]==5||b[i]==7||b[i]==11||b[i]==13||b[i]==17||b[i]==19||b[i]==23||b[i]==29||b[i]==31||b[i]==37||b[i]==41||b[i]==43||b[i]==47||b[i]==53){
       continue;
    }else if(b[i]%2==0||b[i]%3==0||b[i]%5==0||b[i]%7==0||b[i]%11==0||b[i]%13==0||b[i]%17==0||b[i]%19==0||b[i]%23==0||b[i]%29==0||b[i]%31==0||b[i]%37==0||b[i]%41==0||b[i]%43==0||b[i]%47==0||b[i]%53==0){
        c++;
    }else{
        for(int j=13;j<b[i]/53;j++){
            if(b[i]%j==0){
                c++;
                break;
            }else {
                j++;
    }
  }
 
}
} 
c=a-c;
cout <<c<<endl;
  return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

typedef long long ll;
typedef pair<ll,ll> P;

ll ans, d;
ll ten[20];
ll mp[11];

void dfs(int l, int r, ll now, ll cou) {
	if(cou < 0)return;
	if(l >= r){
		if(now == d){
			if(l == r)ans += cou * 10;
			else ans += cou;
		}
		return;
	}
	ll tmp = mp[l] * ten[l] - mp[l] * ten[r] * (l != r);
	dfs(l+1, r-1, now + tmp, cou * (10 - mp[l] - (l == 0)));
	tmp = (mp[l] - 10) * ten[l] - (mp[l] - 10) * ten[r] * (l != r);
	mp[l+1]++;
	dfs(l+1, r-1, now + tmp, cou * (mp[l] - (l == 0)));
	mp[l+1]--;
}

void init() {
	ten[0] = 1;
	REP(i,18)ten[i+1] = ten[i] * 10;
}

int main() {
	
	init();
	
	cin >> d;
	ll dd = d;
	REP(i, 11){
		mp[i] = dd % 10;
		dd /= 10;
	}	
	
	for(int i = 1;i <= 18;i++){
		dfs(0, i, 0, 1);
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i

c500 = Array.new(a+1) { |i| i * 500 }
c100 = Array.new(b+1) { |i| i * 100 }
c50 = Array.new(c+1) { |i| i * 50 }

count = 0
c500.each do |c500n|
  c100.each do |c100n|
    c50.each do |c50n|
      count += 1 if (c500n + c100n + c50n) == x
    end
  end
end

puts count


Measured memory_bytes: 14336
#include <stdio.h>
int main() {
    int N,i,v,j,k;
    scanf("%d",&N);
    int A[N]; 
    for(i=0; i<N; i++){
        scanf("%d",&A[i]);
    }
    for(i=0; i<N; i++){
        v = A[i];
        j = i-1;
        while( j>= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        for(k=0; k<N; k++){
            printf("%d",A[k]);
            if(k<N-1) printf(" ");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2100
# B - Red or Blue
import sys
input = sys.stdin.readline
n = int(input())
huts = input()
r = 0
b = 0
for i in range(n):
	if huts[i] == "R":
		r += 1
	else:
		b += 1
if r > b:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int n;

char next_animal(string &a, string &b, int i){
  if(b[i]=='S'){
    if(b[i-1]=='S'){
      if(a[i%n]=='o') return 'S';
      else return 'W';
    }else{
      if(a[i%n]=='o') return 'W';
      else return 'S';
    }
  }else{
    if(b[i-1]=='S'){
      if(a[i%n]=='o') return 'W';
      else return 'S';
    }else{
      if(a[i%n]=='o') return 'S';
      else return 'W';
    }
  }
}

bool res(string &a, int m){
  rep(i,m){
    if(a[i]!=a[n+i]) return false;
  }
  return true;
}

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

  string a,b,c,d;
  a = "SS", b = "SW", c = "WS", d = "WW";
  reps(i,n+5){
    a.PB(next_animal(s,a,i));
    b.PB(next_animal(s,b,i));
    c.PB(next_animal(s,c,i));
    d.PB(next_animal(s,d,i));
  }
  if(res(a,5)) rep(i,n) cout<<a[i];
  else if(res(b,5)) rep(i,n) cout<<b[i];
  else if(res(c,5)) rep(i,n) cout<<c[i];
  else if(res(d,5)) rep(i,n) cout<<d[i];
  else cout << -1;

  cout << endl;

  return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< int, i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dij geo2

signed main()
{
    Int(n);
    vi p(n);
    rep(i, n) {
        cin >> p[i];
    }

    rep(i, n) {
        std::cout << 30000 * (i + 1) << " ";
    }
    cout << endl;

    vi data(n);
    rep(i, n) {
        data[i] = (n - i) * 30000;
    }
    rep(i, n) {
        data[p[i]-1] += i;
    }
    rep(i, n) {
        std::cout << data[i] << " " ;
    }
    cout << endl;


    return 0;
}


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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

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

int main(){

  ll n, k;
  cin >> n >> k;

  ll ans = k;

  rep(i, n-1) ans *= (k-1);

  cout << ans << endl;

	return 0;
}


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


int main(){
    int a, b;
    cin >> a >> b;
    int ans=0;
    rep(i,b-a+1){
        if((a+i)/10000 == (a+i)%10 && ((a+i)%10000)/1000 == ((a+i)%100)/10){
            ans ++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
import java.util.*;
import java.math.BigDecimal;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
	BigDecimal A = sc.nextBigDecimal();
    BigDecimal B = sc.nextBigDecimal();
    
    BigDecimal C = A.multiply(B);
    
    BigDecimal D = C.setScale(0, BigDecimal.ROUND_DOWN);
    System.out.println(D);
  }
}

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

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

  char b = '_';
  int cnt = 0;
  for (auto c : s)
  {
    if (b == 'B')
    {
      if (c == 'C')
      {
        cnt++;
      }
      b = '_';
    }
    if (b == 'A')
    {
      if (c == 'B')
      {
        b = 'B';
      }
      else
      {
        b = '_';
      }
    }
    if (b == '_' && c == 'A')
    {
      b = 'A';
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>


int main() {
    
    char x,y;
    scanf("%c %c", &x, &y);
    if( x > y){
        printf (">\n");
    }else if ( x < y){
        printf ("<\n");
    }else{
        printf ("=\n");
    }

    return 0;
}


Measured memory_bytes: 256
//I am so vegetable
//#define err
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = acos(-1.0);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }


int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
    #ifdef err
	double be = clock();
    #endif
    int ans;
    _for(i,0,5){
        int x;cin>>x;
        if(!x)ans=1+i;
    }
    cout<<ans;
    #ifdef err
	double en = clock();
    cout<<"time: "<<fixed<<setprecision(8)<<en-be;
    #endif
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ii pair<int,int>
#define INF 1000000000
#define M 1000000007ll
#define UQ(x) (x).resize(distance((x).begin(),unique(all((x)))))
int n,k,a,b,ans;
vector<int> adj[2005];
bool vis[2005],dead[2005];
vector<ii> l[2005];
int cnt[2005];
void dfs(int v,int d,int i) {
	vis[v]=1;
	l[i].pb(mp(d,v));
	for (int x:adj[v]) {
		if (!vis[x]) {
			dfs(x,d+1,i);
		}
	}
}
int main() {
	scanf("%d%d",&n,&k);
	for (int i=0;i<n-1;i++) {
		scanf("%d%d",&a,&b);
		--a,--b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	for (int i=0;i<n;i++) {
		memset(vis,0,sizeof(vis));
		dfs(i,0,i);
		sort(all(l[i]));
		for (ii x:l[i]) {
			if (x.first>k) cnt[i]++;
		}
	}
	while(1) {
		int val=-1,idx=0;
		for (int i=0;i<n;i++) {
			if (!dead[i] && cnt[i]>val) {
				val=cnt[i];
				idx=i;
			}
		}
		if (val<=0) break;
		dead[idx]=1;
		for (ii x:l[idx]) {
			if (!dead[x.second] && x.first>k) cnt[x.second]--;
		}
		ans++;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 32512
n, y = gets.split.map(&:to_i)
flag = false
catch(:break_loop) do
  (n+1).times do |i|
    (n+1).times do |j|
      k = n - i - j
      if 10 * i + 5 * j + 1 * k == y/1000 && k >= 0
        puts "#{i} #{j} #{k}"
        flag = true
        throw :break_loop
      end
    end
  end
end
puts "-1 -1 -1" unless flag

Measured memory_bytes: 1916
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k=sc.nextInt();
        sc.close();
        int ans;
        if(k%2==0) ans=k/2;
        else ans=k/2+1;
        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
import java.io.*;
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		int n = 0;
		
		
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			n = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			return;
		}
		
		int min = Integer.MAX_VALUE;
		for (int i = 1; i <= n / 2; i++) {
			int a = i;
			int b = n - i;
			
			int tmp = 0;
			while (a > 0) {
				tmp += (a % 10);
				a /= 10;
			}
			while (b > 0) {
				tmp += (b % 10);
				b /= 10;
			}
			
			min = Math.min(min, tmp);
		}
		
		System.out.println(min);
	}
}


Measured memory_bytes: 21204
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            if(s[0]==s[1] || s[1]==s[2] || s[2] ==s[3])
            {
                Console.WriteLine("Bad");
            }
            else
            Console.WriteLine("Good");
        }
    }
}


Measured memory_bytes: 11092
let _ =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let res = ref 0. in
  for i = 0 to n - 1 do
    let v, u = Scanf.scanf "%f %s\n" (fun v u -> v, u) in
    res := !res +. (if u = "JPY" then v else v *. 380000.0)
  done;
  !res |> Printf.printf "%f"

Measured memory_bytes: 384
// 解説AC
// https://atcoder.jp/contests/code-festival-2017-qualb/tasks/code_festival_2017_qualb_c
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

class Graph {
   private:
    struct edge {
        int to;
        edge(int i) : to(i) {}
    };
    vector<vector<edge>> edges;
    static const int COLORLESS = 0, BLACK = 1, WHITE = -1;
    const int flipColor(int color) const {
        return (color == BLACK ? WHITE : BLACK);
    }
    vector<int> colors;

   public:
    Graph(int n) { edges.resize(n); };
    int size() const { return edges.size(); };
    int countEdge() const {
        int count = 0;
        for (auto &&i : edges)
            for (auto &&j : i) count++;
        return count;
    }
    void addDirectedEdge(int from, int to) { edges[from].push_back(edge(to)); }
    void addEdge(int from, int to) {
        addDirectedEdge(from, to);
        addDirectedEdge(to, from);
    }

    // 二部グラフ判定
    bool isBipartite() {
        // 頂点を深さ優先探索
        colors.assign(size(), (int)COLORLESS);
        stack<int> stk;
        stk.push(0);
        colors[0] = BLACK;

        while (!stk.empty()) {
            const int p = stk.top();
            stk.pop();
            for (auto &&next_edge : edges[p]) {  // すべての隣接する頂点を調べる
                const int np = next_edge.to;
                // 今の頂点と隣接する頂点が同色なら偽
                if (colors[np] == colors[p]) return false;
                // 隣接する頂点が無色なら今の頂点とは別の色で塗る
                if (colors[np] == COLORLESS) {
                    stk.push(np);
                    colors[np] = flipColor(colors[p]);
                }
            }
        }
        return true;
    }
    int countColor(int color) const {
        int count = 0;
        for (auto &&i : colors) {
            if (i == color) count++;
        }
        return count;
    }
    int countBlack() const { return countColor(BLACK); }
    int countWhite() const { return countColor(WHITE); }
};

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

    int n, m;
    cin >> n >> m;

    Graph g(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;  // convert to 0-based
        g.addEdge(a, b);
    }

    int ans;

    // 二部グラフ判定
    if (g.isBipartite()) {
        // もし二部グラフならば、別色のノードにのみ辺をはることができる。
        // 多重辺、ループなしでできるだけ辺を追加したときの辺数は(黒頂点数)x(白頂点数)
        // 答え=最大辺数-初期辺数
        const int blacks = g.countBlack(), whites = g.countWhite();
        ans = blacks * whites - m;
    } else {
        // もし二部グラフではないならば、ある頂点は全頂点に辺を貼れる。
        // 多重辺、ループなしでできるだけ辺を追加したときの辺数は(頂点数)x(頂点数-1)/2
        // 答え=最大辺数-初期辺数
        ans = n * (n - 1) / 2 - m;
    }

    cout << ans << endl;
}


Measured memory_bytes: 7168
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

  private static PrintWriter out;

  public static void main(String[] args) {
    Main main = new Main();
    Runtime.getRuntime().addShutdownHook(new Thread(() -> out.close()));
    try {
      main.run(args);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void run(String[] arguments) throws Exception {
    MyScanner sc = new MyScanner();
    out = new PrintWriter(new BufferedOutputStream(System.out));

    int n = sc.nextInt();
    //ArrayList<Integer> list = new ArrayList<>();

    HashMap<Integer, Integer> map = new HashMap<>();

    for (int i = 0; i < n; i++) {
      int a = sc.nextInt();
      if (map.containsKey(a)) {
        int counter = map.get(a) + 1;
        map.put(a, counter);
      } else {
        map.put(a, 1);
      }
    }

    List<Integer> list = new ArrayList<>(map.keySet());

    int MAX_A = (int) Math.pow(10, 6);
    int[] checks = new int[MAX_A + 1];
    int ans = 0;

    for (Integer num : list) {
      for (int i = num; i <= MAX_A; i += num) {
        checks[i]++;
      }
    }

    for (Integer number : list) {
      if (checks[number] == 1 && map.get(number) == 1) {
        ans++;
      }
    }

    out.println(ans);
    out.close();

  }

  /*
   * Form: http://codeforces.com/blog/entry/7018
   */
  private class MyScanner {

    BufferedReader br;
    StringTokenizer st;

    MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}


Measured memory_bytes: 68488
//

fun main() {
    abc179b()
}

fun abc179b() {
    val n = readLine()!!.toInt()
    var count = 0
    repeat(n) {
        val (a, b) = readLine()!!.split(" ")
        if (a == b) {
            count++
        } else {
            count = 0
        }
        if (count >= 3) {
            println("Yes")
            return
        }
    }
    println("No")
}


Measured memory_bytes: 37232
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)	   for(int i = 0; i < (n); ++i)
#define all(c)		   begin(c), end(c)
#define rall(c)		   rbegin(c), rend(c)
#define SZ(a)		   ((ll) a.size())

typedef long long		   ll;
typedef unsigned long long ull;


int main(){
	ll N,z,w;
	scanf("%lld %lld %lld",&N,&z,&w);
	ll a[N];
	rep(i,N) scanf("%lld",&a[i]);
	ll score[N][2];
	score[N-1][0] = abs(a[N-1]-a[N-2]);
	score[N-1][1] = abs(a[N-1]-a[N-2]);
	score[N-2][0] = max(score[N-1][1],abs(a[N-3]-a[N-1]));
	score[N-2][1] = min(score[N-1][0],abs(a[N-3]-a[N-1]));
	ll tmp;
	RFOR(i,N-2,0){
		tmp = abs(a[i-1]-a[N-1]);
		FOR(j,i,N-1) tmp = max(score[j+1][1],tmp);
		score[i][0] = tmp;
		tmp = abs(a[i-1]-a[N-1]);
		FOR(j,i,N-1) tmp = min(score[j+1][0],tmp);
		score[i][1] = tmp;
	}
	tmp = abs(w-a[N-1]);
	FOR(j,0,N-1) tmp = max(score[j+1][1],tmp);
	score[0][0] = tmp;

	printf("%lld",score[0][0]);
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("-Ofast")
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(a) (long long)a.size()
#define all(a) a.begin(), a.end()
#define reset(a, n) a.clear(), a.resize(n)
#ifndef ONLINE_JUDGE
#define cin ___in
#endif
std::ifstream ___in("input.in");
using namespace std;
using ll = long long;
typedef pair<ll, ll> pi;
typedef vector<ll> vec;
typedef vector<vector<ll> > vvec;
typedef vector<pair<ll, ll> > vecpi;
typedef vector<vector<pair<ll, ll> > > vvecpi;
typedef set<ll> seti;
typedef set<pair<ll, ll> > setpi;
typedef multiset<ll> mseti;
typedef multiset<pair<ll, ll> > msetpi;
typedef map<ll, ll> mpi;

static const bool tc = 0;
static const ll mod = LLONG_MAX - 24;

void solve() {
        ll k, md = 0;
        cin >> k;
        for(ll i = 1; i <= 100000000; ++i) {
                if(((md % k) * (10 % k) + 7 % k) % k == 0) {
                        cout << i;
                        return;
                }
                md = (md % k) * (10 % k) + 7 % k;
        }
        cout << -1;
}

int main() {
        srand(time(0));
        int T = 1;
        if(tc) cin >> T;
        for(int i = 1; i <= T; ++i) {
                #ifndef ONLINE_JUDGE
                cout << "----- " << i << " -----\n";
                #endif
                solve();
        }
        return 0;
}


Measured memory_bytes: 3584
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

void prime_factorize(long long N, vector<ll> &div) {
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0)
            continue;

        // 割れる限り割り続ける
        while (N % a == 0) {
            div[a] += 1;
            N /= a;
        }
    }

    // 最後に残った数について
    if (N != 1)
        div[N] += 1;

    return;
}

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

    int N;
    cin >> N;
    vector<ll> div(N + 1, 0);

    for (int i = 1; i <= N; i++) {
        prime_factorize(i, div);
    }

    ll mod = pow(10, 9) + 7;
    ll ans = 1;
    rep(i, N + 1) {
        if (div[i] == 0)
            continue;
        ans *= (div[i] + 1);
        ans %= mod;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using P=pair<int, int>;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    fast_io

    int a;
    cin>>a;

    cout<<a+a*a+a*a*a<<endl;

    
    return 0;
}

Measured memory_bytes: 3644
fn func(input_str: &str) {
    let mut iter = input_str.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();
    if n == 1 {
        println!("{}", m);
        return;
    }
    let mut divisors = Vec::new();
    for c in 2..((m as f64).sqrt() as usize + 1) {
        if m % c == 0 {
            if n <= m / c {
                divisors.push(c);
            }
            if n <= c {
                divisors.push(m / c);
            }
        }
    }
    divisors.sort();
    if let Some(c) = divisors.last() {
        println!("{}", c);
    } else {
        println!("{}", 1);
    }
}

use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    func(&buf[..]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>


//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;

typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)



ll fast_pow(ll x,ll n,ll mod){
    if (n==0) return 1;
    ll res=fast_pow(x*x %mod,n/2,mod);
    if (n&1) res=res*x%mod;
    return res;
}

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}



int main(){
    
    int n;
    cin>>n;
    int h[n];
    rep(i,n){
        cin>>h[i];
    }
    ll a[n];
    a[0]=0;
    a[1]=abs(h[1]-h[0]);
    for (int i=2;i<n;i++){
        a[i]=min(a[i-2]+abs(h[i]-h[i-2]),a[i-1]+abs(h[i]-h[i-1]));
    }
    cout<<a[n-1]<<endl;
}


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

int main() {
	int X,A,B;
	cin >> X >> A >> B;
	string k = "safe";//safe dangerous
	if(B - A <= 0)
	{
		k = "delicious";
	}
	else if(B - A > X)
	 {
	 	k = "dangerous";
	 }
    cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,k,h) for(int i = k; i < h; ++i)
#define rep3(i,k,h) for(int i = k; i <= h; ++i)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf

typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;



int main() {
    int k,x;
    cin >> k >> x;
    if(500 * k >= x) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

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

int main() {
	int N;
	cin >> N;
	int ans;
	cin >> ans;
	for (int i = 1; i < N; i++) {
		int A;
		cin >> A;
		ans = gcd(A, ans);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int infty = (1 << 21);



int make_bamboo(vector<int> &assign,vector<int> &array,vector<int> &abc,vector<int> &use){
    ll mp = 0;
    vector<int> a,b,c;
    for(int i=0;i<assign.size();i++){
        if(assign.at(i) == 0){
            a.push_back(i);
        }else if(assign.at(i) == 1){
            b.push_back(i);
        }else{
            c.push_back(i);
        }
    }

    if(a.size() == 0 || b.size() == 0|| c.size() == 0) return infty;
    int a_bamboo = use.at(a.at(0));
    for(int i=1;i<a.size();i++){
        mp += 10;
        a_bamboo += use.at(a.at(i));
    }
    mp += abs(abc.at(0) - a_bamboo);

    int b_bamboo = use.at(b.at(0));
    for(int i=1;i<b.size();i++){
        mp += 10;
        b_bamboo += use.at(b.at(i));
    }
    mp += abs(abc.at(1) - b_bamboo);

    int c_bamboo = use.at(c.at(0));
    for(int i=1;i<c.size();i++){
        mp += 10;
        c_bamboo += use.at(c.at(i));
    }
    mp += abs(abc.at(2) - c_bamboo);
    //cout << mp << endl;
    return mp;

}

int func(vector<int> &array,vector<int> &use,vector<int> &abc){
    int minmp = infty;
    int n = use.size();
    for(int tmp = 0; tmp < pow(3,n); tmp++){
        int mark = tmp;
        vector<int> assign(n);
        for(int i=n-1;i>=0;i--){
            int a = pow(3,i);
            assign.at(i) = mark / a;
            mark = mark % a;
        }
        int mp = make_bamboo(assign,array,abc,use);
        if(minmp > mp) minmp = mp;
    }
    return minmp;
}


int main(){
    int n,a,b,c,minmp = infty;
    cin >> n ;
    vector<int> abc(3);
    for(int i=0;i<3;i++) cin >> abc.at(i);
    vector<int> array(n);
    for(int i=0;i<n;i++) cin >> array.at(i);
    for(int tmp=0; tmp < (1 << n); tmp++){
        vector<int> use(0);
        bitset<8> s(tmp);
        for(int i=0;i<n;i++){
            if(s.test(i)){
                use.push_back(array.at(i));
                int mp = func(array,use,abc);
                if(mp < minmp) minmp = mp;
            }

        }
    }
    cout << minmp << endl;
}

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

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

    int b, c;
    b =a / 100;
    c = (a - b * 100) / 10;
    a -= b * 100 + c * 10;

    int ans = 0;
    if(b == 1){
        ans += 900;
    }else{
        ans += 100;
    }

    if(c == 1){
        ans += 90;
    }else{
        ans += 10;
    }

    if(a == 1){
        ans += 9;
    }else{
        ans += 1;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

using namespace std;
typedef long long ll;
typedef __int128_t lll;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template<typename T>string join(V<T>&v){stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modpow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isprime(ll n){if(n<2)return 0;if(!(n%2))return !(n-2);lll d=n-1,t,y;while(!(d%2))d>>=1;V<ll> al={2,325,9375,28178,450775,9780504,1795265022};for(ll a:al){if(n<=a)break;t=d,y=modpow(a,t,n);while(t!=n-1&&y!=1&&y!=n-1)y=y*y%n,t<<=1;if(y!=n-1&&!(t%2))return 0;}return 1;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}
mt19937 rnd; void set_rnd(){random_device r;rnd=mt19937(r());}
V<ll> fact, rfact; void set_fact(int n, ll m){fact.pb(1);rfact.pb(1);FOR(i,1,n+1)fact.pb(fact[i-1]*i%m),rfact.pb(modpow(fact[i],m,m-2));}
const int iinf = 1e9+6;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 2e5+1;
void init(){
  set_rnd();
//  set_fact(N);
}
int n;
ll t, X;
lll x[N];

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  init();
  cin >> n >> X;
  FOR(i, 1, n+1) cin >> t, x[i]=t;
  reverse(x+1, x+n+1);
  FOR(i, 0, n) x[i+1] += x[i];
  lll ans = lll(linf)*linf;
  FOR(i, 1, n+1){
    int l=0, r=i, c=3;
    lll _ans = (x[r]-x[l])*2 + X*(i+n);
    while(true){
      mins(r, n);
      _ans += (x[r]-x[l]) * c;
      if(r==n) break;
      l += i;
      r += i;
      c += 2;
    }
    mins(ans, _ans);
  }
  cout << ll(ans) << endl;
  return 0;
}

Measured memory_bytes: 3456
// ABC 055 D
#include<bits/stdc++.h>
 
using namespace std;
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())

#define PB(a) push_back(a)

#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------

  LL x,y;
  str ans;
  cin >> x >>y;
  ans = llabs(x-y)<=1?"Brown":"Alice";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256