akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;

int main() {
  int N, K, A[1000000];
  int i = 1;
  cin >> N >> K;

  for (int j = 0; j < N; j++) cin >> A[j];

  for (i = 1; i <= 1000000; i++) {
    if ((N - 1) - i * (K - 1) <= 0)
      break;
  }
  cout << i << endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;}
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<ll> a(n);
	cin >> a;
	ll res1 = 0;
	ll sum = 0;
	for (int i = 0; i < n; ++i) {
		if (i % 2) {
			if (sum + a[i] >= 0) {
				res1 += sum + a[i] + 1;
				sum = -1;
			}
			else sum += a[i];
		}
		else {
			if (sum + a[i] <= 0) {
				res1 += 0 - (sum + a[i]) + 1;
				sum = 1;
			}
			else sum += a[i];
		}
	}
	ll res2 = 0;
	sum = 0;
	for (int i = 0; i < n; ++i) {
		if (!(i % 2)) {
			if (sum + a[i] >= 0) {
				res2 += sum + a[i] + 1;
				sum = -1;
			}
			else sum += a[i];
		}
		else {
			if (sum + a[i] <= 0) {
				res2 += 0 - (sum + a[i]) + 1;
				sum = 1;
			}
			else sum += a[i];
		}
	}
	cout << min(res1, res2) << endl;
	return 0;
}

Measured memory_bytes: 3976
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    string s;
    cin >> s;
    if(s.size() == 2){
        cout << s << endl;
    }else{
        cout << s.at(2) << s.at(1) << s.at(0) << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n;
  while(cin >>n,n){
    long long int d[10][10];
    int m=0;
    for(int i=0; i<10; i++){
      for(int j=0; j<10; j++){
	if(i == j) d[i][j] = 0;
	else d[i][j] = 1000000000;
      }
    }
    for(int i=0,a,b,c; i<n; i++){
      cin >>a>>b>>c;
      d[a][b] = c;
      d[b][a] = c;
      m = max(m,max(a,b));
    }
    for(int k=0; k<=m; k++) for(int i=0; i<=m; i++) for(int j=0; j<=m; j++) d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
    long long int ans,cost=-1;
    for(int i=0,t; i<=m; i++){
      t = 0;
      for(int j=0; j<=m; j++) t+=d[i][j];
      if(cost>t || cost == -1){cost = t;ans = i;}
    }
    cout <<ans<<" "<<cost<<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

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

using namespace std;

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

    string s;
    cin >> s;

    vector<ll> cnt;
    string check = "";
    ll xcnt = 0;
    for (auto e : s) {
        if (e == 'x') {
            xcnt++;
        } else {
            check += e;
            cnt.push_back(xcnt);
            xcnt = 0;
        }
    }
    cnt.push_back(xcnt);

    string checkr = check;
    reverse(check.begin(), check.end());
    if (check != checkr) {
        cout << -1 << "\n";
        return 0;
    }

    // for (auto e : cnt) cout << e << " ";

    ll n = cnt.size()-1;
    ll ans = 0;
    Rep (i, n+1) {
        ans += abs(cnt[i] - cnt[n-i]);
    }
    cout << ans/2 << "\n";
}

Measured memory_bytes: 1608
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#define fol(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int A,B,C;
    cin >>A>>B>>C;
    if (C>=A&&C<=B) cout <<"Yes"<<endl;
    else cout << "No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  vector<string> S(3);
  rep(i, 3) cin >> S[i];

  vector<int> itr(3);
  int turn = 0;
  int temp;
  while (true) {
    if (itr[turn] == S[turn].size()) {
      cout << (char)(turn + 'A') << endl;
      return 0;
    }
    temp = turn;
    turn = S[turn][itr[turn]] - 'a';
    itr[temp]++;
  }
}

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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for(auto& x : a) cin >> x;

    vector<int> dp(n);
    dp[0] = 0, dp[1] = abs(a[1]-a[0]);

    for(int i = 2; i < n; i++) {
        dp[i] = min(dp[i-1] + abs(a[i]-a[i-1]),
    				dp[i-2] + abs(a[i]-a[i-2]));
    }
    cout << dp[n-1] << endl;

    return 0;
}


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

int main() {
  int N; cin >> N;
  int num = 0;
  int a;
  rep2(i, 1, N+1) {
    int ans = i;
    int cnt = 0;
    while (ans % 2 == 0) {
      ans /= 2;
      cnt++;
    }
    num = max(num, cnt);
  }
  cout << pow(2, num) << endl;
}

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

using namespace std;

long long sm1 = 0, sm2 = 0;
multiset<int> s1, s2;

int add(int x) {
    if (x > (*s1.rbegin())) {
        s2.insert(x);
        sm2 += x;
    } else {
        s1.insert(x);
        sm1 += x;
    }
    while (s2.size() > s1.size()) {
        x = *s2.begin();
        s1.insert(x);
        s2.erase(s2.begin());
        sm1 += x;
        sm2 -= x;
    }
    while (int(s1.size() - s2.size()) > 1) {
        x = *s1.rbegin();
        s2.insert(x);
        s1.erase(--s1.end());
        sm1 -= x;
        sm2 += x;
    }
    return *s1.rbegin();
}


int main() {
    // freopen("in.txt", "rt", stdin);
    int q;
    long long as = 0, bs = 0;
    long long c = 0;
    long long mn;
    scanf("%d", &q);
    long long a, b;
    int t;
    scanf("%d %lld %lld", &t, &a, &b);
    s1.insert(a);
    bs += b;
    sm1 += a;
    mn = a;
    while (--q) {
        scanf("%d", &t);
        if (t == 1) {
            scanf("%lld %lld", &a, &b);
            mn = add(a);
            bs += b;
            ++c;
        } else {
            long long ans = bs + sm2 - sm1;
            long long d = s1.size() - s2.size();
            ans += d * mn;
            printf("%lld %lld\n", mn, ans);
        }

    }
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 
	long long  i,j,k,n,c=0;
	cin>>n;
	long long  a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	for(i=1;i<n;i++){
		if(a[i]<a[i-1]){
			c += a[i-1]-a[i];
			a[i] = a[i-1]; 
		}
	}
	cout<<c;
}

Measured memory_bytes: 5144
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
x, y, a, b, c = map(int, input().split()) # 入力が複数

reds = sorted([int(i) for i in input().split()], reverse=True)
greens = sorted([int(i) for i in input().split()], reverse=True)
whites = sorted([int(i) for i in input().split()], reverse=True)

reds = reds[:x]
greens = greens[:y]

apples = sorted(reds + greens + whites, reverse=True)
ans = sum(apples[:x + y])
print(ans)

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

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

// cout<<fixed<<setprecision(10);

template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int MAX_N = 100000;

int main(){
    int n; cin>>n;
    P machine[MAX_N]; // end, start
    rep(i, n){
        int x, l;
        cin >> x >> l;
        machine[i] = make_pair(x+l, x-l);
    }
    sort(machine, machine+n);
    int ans=0, t=-1e9;
    rep(i, n){
        if(t <= machine[i].second){
            ans++;
            t = machine[i].first;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main() {

	
	/*int N, D[100000], M, T[100000];

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> D[i];
	}
	cin >> M;
	for (int j = 0; j < M; j++) {
		cin >> T[j];
	}
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if (D[i] == T[j]) {
				cnt++;
			}
		}
	}
	if (cnt == M) {
		cout << "YES" << endl;

	}
	else {
		cout << "NO" << endl;*/

	int k;
	 string s;
	
		 cin >> k;
	 cin >> s;
	
		 if (s.size() > k) {
	 s = s.substr(0, k) + "...";
		
	}
	
		cout << s << endl;
	
		 return 0;
}

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

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

int main() {
  int N; cin >> N;
  vector<vector<int>> A(2, vector<int>(N));
  REP(i, 2) {
    REP(k, N) {
      cin >> A[i][k];
    }
  }

  int cnt = 0;
  int flag = 0;

  REP(i, N) {
    int tmp = 0;
    REP(k, N) {
      tmp += A[flag][k];
      if(k == i) {
        flag = 1;
        tmp += A[flag][k];
      }

      if(tmp > cnt) cnt = tmp;
    }
    flag = 0;
  }
  cout << cnt << endl;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    vector<ll> a(N);
    rep (i, N) {
        cin >> a[i];
    }

    ll ans = 0;
    ll right = 0;
    ll sum = 0;
    for (ll left = 0; left < N; left++) {
        // while(right < N && check()) {
        while(right < N && (sum + a[right]) == (sum ^ a[right])) {
            sum += a[right];
            right++;
        }

        ans += right-left;
        if (left == right) {
            right++;
        } else {
            sum -= a[left];
        }
    }

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

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

using namespace std;

int main()
{
    string s,t;
    cin>>s>>t;
    int lens=s.length(),lent=t.length();
    s=' '+s;
    t=' '+t;
    int ans=1e9;
    for(int i=1;i+lent-1<=lens;i++)
    {
        int cnt=0;
        for(int j=i;j<=i+lent-1;j++)
        {
            if(s[j]!=t[j-i+1]) cnt++;
        }
        ans=min(ans,cnt);
    }
    printf("%d",ans);
    return 0;
}

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

#define ARC(i, a, b) for(int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)

template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T rng(const T &a, const T &b){ return a > b ? a - b : b - a; }
template<class T> T &anth(T &a, const T &b){ return a = ant(a, b); }
template<class T> T &onth(T &a, const T &b){ return a = ont(a, b); }

int main(){
	int d, g;
	int numo = 100000000;
	int p[10], c[10];
	std::cin >> d >> g;
	RC(i, d) std::cin >> p[i] >> c[i];
	for(unsigned n = 0; n < 1 << d; ++n){
		int num = 0, sum = 0;
		RC(i, d) if(n >> i & 1){
			num += p[i];
			sum += p[i] * (i + 1) * 100 + c[i];
			//printf(" %d点を%d問(ボーナス%d点)", (i + 1) * 100, p[i], c[i]);
		}
		for(int i = d - 1;; --i){
			if(g <= sum){
				//printf(" 計%d問解いて%d点\n", num, sum);
				onth(numo, num);
				break;
			}
			if(i < 0){
				//printf(" 足りない\n");
				break;
			}
			if(!(n >> i & 1)){
				int tmp = (g - sum - 1) / ((i + 1) * 100) + 1;
				if(tmp >= p[i]) tmp = p[i] - 1;
				num += tmp;
				sum += tmp * (i + 1) * 100;
				//printf(" %d点を%d問", (i + 1) * 100, tmp);
			}
		}
	}
	printf("%d\n", numo);
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int, S: "List[str]"):
    c = {}
    for s in S:
        if not s in c:
            c[s] = 0
        c[s] += 1
    tmp =list( c.items())
    tmp.sort(key = lambda x: (-x[1], x[0]))
    ret = [tmp[0][0]]
    for i in range(1, len(tmp)):
        if tmp[i][1] == tmp[0][1]:
            ret.append(tmp[i][0])
        else:
            break
    for r in ret:
        print(r)
    return

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
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 60780
import sys

input = sys.stdin.readline
P = 10 ** 9 + 7


def main():
    N, K = map(int, input().split())

    ans = 0
    n_gcd = dict.fromkeys(range(K + 1), 0)
    for k in reversed(range(1, K + 1)):
        n_gcd[k] = pow(K // k, N, mod=P)
        for m in range(2, K // k + 1):
            n_gcd[k] = (n_gcd[k] - n_gcd[k * m]) % P
        ans = (ans + k * n_gcd[k]) % P

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 19412
/*
 * main.c
 *
 *  Created on: 2019/06/22
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	int N = 0, L = 0;
	int org = 0, nsum = 0, min = 0x7fffffff, ans = 0, i = 0, val = 0;
	scanf("%d %d", &N, &L);
	for(i = 1; i <= N; i++) {
		org += L + i - 1;
		//printf("org=%d\n", org);
	}
	for(i = 1; i <= N; i++) {
		nsum = org - (L + i - 1);
		val = abs(abs(org) - abs(nsum));
        if(val < min) {
        	min = val;
    		//printf("org=%d sum=%d i=%d min=%d val=%d\n", org, nsum, i, min, val);
			ans = nsum;
		}
	}
	printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define pi (acos(-1))
#define ull  unsigned long long
#define ld long double
///freopen("input.txt","r",stdin);
///freopen("output.txt","w",stdout);
#define M 100000
ll LCM(ll a, ll b)
{
    ll g = __gcd(a,b);
    return (a*b)/g ;
}
string numtostr(ll n)
{
    ostringstream str1 ;
    str1 << n ;
    return str1.str();
}
ll strtonum(string s)
{
    ll x ;
    stringstream str1(s);
    str1 >> x ;
    return x ;
}
ll a,c;
ld b;
int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   cin>>a>>b;
    c=a*b;
    cout<<(ll)c<<"\n";
    return 0;
}


Measured memory_bytes: 3788
#include<stdio.h>
#include<stdlib.h>

#define NIL NULL

struct node{
  struct node *right, *left, *parent;
  int key;
};

typedef struct node * Node;
Node root, head, tail;

void inorder(Node node){
  if(node != tail){
    inorder(node->left);
    printf(" %d", node->key);
    inorder(node->right);
  }
}
void preorder(Node node){
  if(node != tail){
    printf(" %d", node->key);
    preorder(node->left);
    preorder(node->right);
  }
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else                x = x->right ;
    z->parent = y;
  }

    if(y == NIL)                root = z;
    else if(z->key < y->key)    y->left = z;
    else                        y->right = z;
}

Node find (Node A, int x){
  while(A!=NIL && x!=A->key){
    if(x < A->key)  A = A->left;
    else            A = A->right;
  }
  return A;
}

int main(void){
  int n, x;
  char com[20];
  Node a;
  scanf("%d", &n);

  for(int i = 0; i < n; i++ ){
    scanf("%s", com);
    if (com[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }

   else if(com[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(com[0] == 'f'){
	    scanf("%d", &x);
	    a = find(root, x);
	    if(a == NIL)   printf("no\n");
	    else           printf("yes\n");
    }
  }

  return 0;
}




Measured memory_bytes: 20484
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
const ll MOD = 1e9 + 7;

const ll MAX_V = 100000;
vector<ll> g[MAX_V];
bool visit[MAX_V];

struct edge {
  ll to, idx;
};

ll N, K;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> K;
  for (int i = 0; i < N - 1; i++) {
    ll ai, bi;
    cin >> ai >> bi;
    ai--;
    bi--;
    g[ai].push_back(bi);
    g[bi].push_back(ai);
  }

  ll ans = K;
  queue<edge> q;
  q.push(edge{0, 1});
  visit[0] = true;

  while (!q.empty()) {
    edge e = q.front();
    q.pop();

    ll num = 0;
    if (e.idx <= 2) {
      num = K - e.idx;
    } else {
      num = K - 2;
    }

    for (int i = 0; i < g[e.to].size(); i++) {
      ll to = g[e.to][i];
      if (visit[to]) {
        continue;
      }
      visit[to] = true;
      ans *= num;
      ans %= MOD;
      q.push(edge{to, e.idx + 1});
      num--;
    }
  }

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

Measured memory_bytes: 8308
n = int(input())
ans = [0]*(10**4+1)
for x in range(1,10**2+1):
    for y in range(1,10**2+1):
        for z in range(1,10**2+1):
            i = x*x + y*y + z*z + x*y + x*z + y*z
            if i <= 10**4:
                ans[i] += 1
            else:
                break
#print(ans)
for i in range(1,n+1):
    print(ans[i])

Measured memory_bytes: 74736
import bisect
import math
N, H = map(int, input().split())
swing = []
throw = []
for _ in range(N):
    sw, th = map(int, input().split())
    swing.append(sw)
    throw.append(th)
swing.sort(reverse=True)
throw.sort()
idx = bisect.bisect_right(throw, swing[0])
if idx == len(throw):
    print(math.ceil(H / swing[0]))
else:
    throw = throw[idx:]
    cnt = 0
    damage_sum = 0
    for i in reversed(throw):
        cnt += 1
        damage_sum += i
        if damage_sum >= H:
            print(cnt)
            exit()
    print(math.ceil(cnt + (H - damage_sum) / swing[0]))


Measured memory_bytes: 17704
#include<iostream>
using namespace std;
int main()
{
  int a,b;
  char op;
  cin>>a>>op>>b;
  int result;
  switch (op) {
    case '+' : result = a + b;break;
    case '-' : result = a - b;break;
  }
  cout << result;

  return 0;
}


Measured memory_bytes: 256
from sys import stdin

N=int(stdin.readline().rstrip())
if N % 2 == 1:
    output=0
else:
    num_list=[int(x) for x in stdin.readline().rstrip().split()]
    num_list.sort()
    output=0
    half=int(N/2)
    output=num_list[half]-num_list[half-1]

print(output)


Measured memory_bytes: 14396
N,M = map(int,input().split())

A = [[0]]*N
B = [[0]]*M

for i in range(N):
    A[i] = input()
for j in range(M):
    B[j] = input()

judge = False 

#行同士で比較していく
for k in range(N-M+1):
    for i in range(N-M+1):
        count = 0
        for j in range(M):
            if B[j]==A[j+i][k:k+M]:
                count += 1
                
                if count == M:
                    judge = True
                    break
            
if judge == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();
		int r = scan.nextInt();

		if(x < 0 && x + r <= 0 || x + r > X){
			System.out.println("No");
		}
		else if(y < 0 && y + r <= 0 || y + r > Y){
				System.out.println("No");
		}
		else if(x + r < 0 || x + r > X || y + r < 0 || y + r > Y){
			System.out.println("No");
		}
		else{
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 26308
n=int(input())
a=list(map(int,input().split()))
hu=0
min_=10**9+1
total=0
for i in range(n):
    if a[i]<0:
        hu+=1
    if abs(a[i])<min_:
        min_=abs(a[i])
    total+=abs(a[i])
print(total if hu%2==0 else total-min_*2)

Measured memory_bytes: 64752
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
    long long int N;
    cin >> N;

    long long int n = (long long int)sqrt(N) + 1;
    int ans = 100;
    for (long long int i=1; i <= n; i++) {
        if (N % i == 0) {
            long long int A = i;
            long long int B = N / A;
            int fa = 0;
            int fb = 0;
            while (A>0) {
                ++fa;
                A /= 10;
            }
            while (B>0) {
                ++fb;
                B /= 10;
            }
            int f = max(fa, fb);
            ans = min(ans, f);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
from operator import itemgetter
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
l=[]
for i in range(n):
  l.append([i,a[i],b[i]])
l.sort(key=itemgetter(1))
cost = 0
for i in range(n):
  val = l[i][1]
  ix = l[i][0]; previx = -2
  if(i!=0):
    previx = l[i-1][0]
  cost+=(l[i][2])
  if(previx+1==ix):
    cost+=(c[i-1])
print(cost)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){

    
	int t=1;
	while(t--){
		string a,b;
		cin>>a>>b;
		int dp[a.size()+1][b.size()+1];
		string pos[a.size()+1][b.size()+1];
		memset(dp,0,sizeof(dp));
		for(int i=0;i<=a.size();i++)
			dp[i][0]=0;
		for(int i=0;i<=b.size();i++)
			dp[0][i]=0;
		for(int i=1;i<=a.size();i++){
			for(int j=1;j<=b.size();j++){
				if(a[i-1]==b[j-1]){
					dp[i][j]=1+dp[i-1][j-1];
					pos[i][j]="cross";
				}
				else{
					if(dp[i-1][j]>dp[i][j-1])
						pos[i][j]="up";
					else
						pos[i][j]="left";	
					dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
				}

			}
		}
		string ans="";
		for(int i=0;i<dp[a.size()][b.size()];i++)
			ans+='a';
		int count=ans.size()-1;
		int i=a.size();
		int j=b.size();
		while(i>0&&j>0){
				
				if(pos[i][j]=="cross"){
					ans[count--]=a[i-1];
					j--;
					i--;
				}
				else if(pos[i][j]=="up"){
					i--;
				}
				else{
					j--;
				}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 527744
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2")
#pragma GCC optimize ("trapv")

#include <bits/stdc++.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()
#define what_is(x) cerr << #x << " is " << x << endl;
#define wis cout<<endl<<"I already speak english, bitch"<<endl<<endl;
 
typedef long long int lli;
typedef vector<lli> vi;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef pair<ii,lli> iii;
typedef long double C; 

#define trace(args...) { string  _s =#args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
void err(istream_iterator<string> it){}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args){
    cerr <<  *it  << " : " << a << endl;
    err(++it, args...);
}

const int N=40;
vector<int> v[N];

int main(){
	fastio;
	
	string s; cin>>s;
	set<int> pos;
	rep(i,0,sz(s)){
		pos.insert(int(s[i]-'a'));
		v[int(s[i]-'a')].pb(i+1);
	}
	bool chi=false;
	for(auto x : pos){
		if(sz(v[x])==1) continue;
		else{
			//bool chi=false;
			rep(i,0,sz(v[x])-1){
				int tot=v[x][i+1]-v[x][i]+1;
				if(tot<=3){
					cout<<v[x][i]<<" "<<v[x][i+1];
					return 0;
				}
			} 
			if(sz(v[x])>=3){
				rep(i,0,sz(v[x])-2){
					int tot=v[x][i+2]-v[x][i];
					if(tot<=5){
						cout<<v[x][i+2]<<" "<<v[x][i];
						return 0; 
					}
				}
			}
		}
	}
	cout<<-1<<" "<<-1;

	return 0;
}


/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/

/*
tip:
 crtl+B to find errors in the code  
*/


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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 59;
const int mod = 1e9 + 7;


int N;
double P[3000];
double dp[6002][3000];
bool memo[6002][3000];

double rec(int up, int idx) {
  if(idx == N) return up > 3000 ? 1.0 : 0.0;
  if(exchange(memo[up][idx], true)) return dp[up][idx];
  double ret = 0.0;
  ret += rec(up + 1, idx + 1) * P[idx];
  ret += rec(up - 1, idx + 1) * (1 - P[idx]);
  return dp[up][idx] = ret;
}

int main() {
  cin >> N;
  for(int i = 0; i < N; i++) cin >> P[i];
  cout << fixed << setprecision(10) << rec(3000, 0) << endl;
}




Measured memory_bytes: 158208
#include <iostream>
#include <queue>
using namespace std;
struct masatoint{
    char syori[10];
    int time;
};
int main(void){
    int n,q,i,keikatime=0;
    masatoint sharing;
    queue<masatoint> kyu;
    cin>>n>>q;
    for(i=0;i<n;i++){
        cin>>sharing.syori>>sharing.time;
        kyu.push(sharing);
    }
    while(!kyu.empty()){
        sharing=kyu.front();
        kyu.pop();
        if(sharing.time<=q){
            keikatime+=sharing.time;
            cout<<sharing.syori<<' '<<keikatime<<endl;
        }
        else{
            keikatime+=q;
            sharing.time-=q;
            kyu.push(sharing);
        }
    }
}

Measured memory_bytes: 3680
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
	vector<bool> numbers(1300000, true);
	vector<int> primes;

	numbers[0] = false;
	numbers[1] = false;

	for (int i = 2; i <= sqrt(1300000); i++) {
		for (int j = i + i; j < 1300000; j += i) {
			numbers[j] = false;
		}
	}

	for (int i = 2; i < 1300000; i++) {
		if (numbers[i] == true) {
			primes.push_back(i);
		}
	}

	while (true) {
		int n;
		cin >> n;

		if (n == 0) {
			break;
		}

		for (int i = 0; i < primes.size(); i++) {
			if (n == primes[i]) {
				cout << 0 << endl;
				break;
			}
			else if (n > primes[i] && n < primes[i + 1]) {
				cout << primes[i + 1] - primes[i] << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3424
import sys,math,copy,queue,itertools,bisect
from fractions import gcd
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(0,1),(-1,0),(0,-1))
N,K = LI()
if K == 1:
    print (0)
    exit (0)
if N == 0:
    print (0)
    exit(0)

if N == 1:
    print (1)
    exit(0)
N = N % K
while True:
    NN = abs(N - K)
    if NN >= N:
        print (N)
        exit (0)
    N = NN

Measured memory_bytes: 63084
#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>
#include <numeric>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

  ll N, M;

  cin >> N >> M;

  vector<ll> A(N);

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

  // for (int i = 0; i < N; i++){
  //   for (int j = i; j < N; j++){
  //     if (accumulate(A.begin()+i, A.begin()+j+1, 0LL) % M == 0){
  //       cout << i << "," << j << endl;
  //     }
  //   }
  // }

  vector<ll> left_v(N+1);
  map<ll, ll> m{};
  left_v[0] = 0;
  for (int i = 0; i < N; i++){
    left_v[i+1] = (left_v[i] + A[i]) % M;
  }

  for (int x : left_v){
    m[x]++;
  }

  ll count = 0;
  for (auto iter = m.begin(); iter != m.end(); iter++){
    //cout << iter->first << ":" << iter->second << endl;
    if (iter->second != 1) {
      count += iter->second * (iter->second - 1) / 2;
    }
  }


  cout << count << endl;



  return 0;
}


Measured memory_bytes: 5760
import Control.Applicative

main = do
    n <- read <$> getLine
    putStrLn $
        concat $ zipWith (++) (repeat " ") (show <$> filterCheckNumber n)

filterCheckNumber :: Int -> [Int]
filterCheckNumber n = [ x | x <- [1..n], (x `mod` 3 == 0) || includeThree x ]

includeThree :: Int -> Bool
includeThree x
    | x == 0          = False
    | x `mod` 10 == 3 = True
    | otherwise       = includeThree $ x `div` 10

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll A, B, C;
    cin >> A >> B;

    vector<bool > ans(3, false);
    ans[A-1] = true;
    ans[B-1] = true;

    for(ll i = 0; i < 3; i++){
        if(ans[i] == false){
            cout << i + 1 << endl;
            return 0;
         }
    }


}

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

using namespace std;

#define MP make_pair
#define PB push_back
#define f first
#define s second

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

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll fastExp(ll base, ll exp)
{
    if(exp == 0LL)
    {
        return 1LL;
    }

    if(exp%2==0)
    {
        return fastExp(times(base, base), exp/2);
    }
    else
    {
        return times(base, fastExp(times(base, base), exp/2));
    }
}


const int MAXN = (int)1e5+1;
int N;


int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0; i<s.length()/2; i++)
    {
        if(s[i] != s[s.length()-i-1])
        {
            ans++;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
A,B,C,K=gets.split()
a=A.to_i()
k=K.to_i()
if(a>k)
  puts(k)
else
  b=B.to_i()
  if(b>k-a)
    puts(a)
  else
    puts(a-(k-a-b))
  end
end


Measured memory_bytes: 14440
fun main(args: Array<String>) {
    val s = readLine()!!
    val n = s.length
    var a = "No"
    if (n == 3 && s == s.reversed()) {
        a = "Yes"
    } else {
        val prefix = s.substring(0, (n - 1) / 2)
        val suffix = s.substring((n + 3) / 2 - 1)
        if (s == s.reversed() && prefix == prefix.reversed() && suffix == suffix.reversed()) {
            a = "Yes"
        }
    }
    println(a)
}

Measured memory_bytes: 33720
// In the name of GOD
 
#include <bits/stdc++.h>
#define ll long long
#define pp pair <int, int>
using namespace std;
const ll N = 2e5 + 10, MOD =  998244353;

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = 0; i < k; i++) {
        ans += a[i];
    }
    cout << ans;
}


int main()  {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    } 
}                                   

Measured memory_bytes: 3616
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int Howmany(int j, int k){
  int cnt = 0;
  int check = j;
  while(check < k){
    cnt++;
    check *= 2;
  }
  return cnt;
}

ll beki(int n){
  if(n==0) return 1;
  else return 2*beki(n-1);
}


int main(){

  int N, K;
  cin >> N >> K;

  double ans = 0;

  int M = Howmany(1,K);

  /*for(int i=1;i<=N;i++){
    int a = Howmany(i,K);
    float tmp = 1.0;
    for(int l=0;l<a;l++){
      tmp /= 2.0;
    }
    ans += tmp;
  }*/

  for(int i=1;i<=N;i++){
    int count = M - Howmany(i,K);
    int tmp = 1;
    for(int l=0;l<count;l++){
      tmp *= 2;
    }
    ans += tmp;
  }

  ans /= beki(M);
  ans /= N;
  cout << setprecision(15) << ans <<endl;

  return 0;
}













Measured memory_bytes: 256
#include <stdio.h>
#define N 101

int main() {
  int i,n,t,k,v,j=0,u[N][N];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++)u[i][j]=0;
  }
  for(i=1;i<=n;i++){
    scanf("%d%d",&t,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      u[t][v]=1;
    }
  }
  for(int i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(j>1)printf(" ");
      printf("%d",u[i][j]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2056
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool up_min(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool up_max(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_mdvector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_mdvector(int n, Ts ... ts){
        return vector<decltype(make_mdvector(ts...))>(n, make_mdvector(ts...));
    }

    inline ll bit(int x){
        return 1ll << x;
    }

    template<class T>
    istream& operator>>(istream& is, vector<T>& v){
        for (auto &&x : v) { is >> x; } return is;
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    ll N;
    void run();
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef XELMH
    string test_cases = "test_D.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


void solver::run(){
    ll M;
    is >> N >> M;
    if(!is) return;
    max_queue<ll> pq;
    for (int i = 0; i < N; ++i) {
        ll A;
        is >> A;
        pq.push(A);
    } // end i
    while(M){
        ll a = pq.top();pq.pop();
        pq.push(a/2); M--;
    }
    ll sum = 0;
    while(!pq.empty()){
        sum += pq.top(); pq.pop();
    }
    os << sum << endl;
}


Measured memory_bytes: 1400
/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

string s;

int main(){
  cin >> s;
  if(sz(s) < 26){
    set < char > st;
    for(char i = 'a'; i <= 'z'; ++i) st.insert(i);
    for(char i : s){
      st.erase(i);
    }
    s += *st.begin();
    cout << s;
    return 0;
  }
  for(int i = sz(s) - 1; i >= 0; --i){
    for(char e = s[i] + 1; e <= 'z'; ++e){
      int ok = 1;
      for(int t = 0; t < i; ++t){
        ok &= s[t] != e;
      }
      if(ok){
        s[i] = e;
        s.erase(s.begin() + i + 1, s.end());
        cout << s << "\n";
        return 0;
      }
    }
  }
  cout << -1 << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
using ll = long long;

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

  for( int i=1; i<=9; i++ ){
    for( int j=1; j<=9; j++ ){
      if( N == i*j ){
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";        
  return 0;
}


Measured memory_bytes: 256
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')


N = int(input())
dp = [[] for _ in range(N)]

for i in range(N):
    dp[i] = inpl()

for i in range(1,N):
        for k in range(3):
            dp[i][k] = max(dp[i-1][k-2] + dp[i][k],dp[i-1][k-1]+dp[i][k])


print(max(dp[N-1]))

Measured memory_bytes: 31556
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int x, a, b;
	cin >> x >> a >> b;
	if (a >= b)
		print("delicious");
	else if (b - a <= x)
		print("safe");
	else
		print("dangerous");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    set<string> se;
    int n; cin >> n;
    while (n--) {
        string s; cin >> s;
        se.insert(s);
    }
    cout << se.size() << '\n';

}


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

int main() {
  int N;
  cin>>N;
  vector<int> a(N);
  for(int j=0;j<N;j++){
    cin>>a[j];
  }
  long c1=0, c2=0;
  long sum=0;
  // a[0]>0
  for(int i=0;i<N;i++){
    sum += a[i];
    if(i%2==1 && sum>=0){
      c1 += sum+1;
      sum =-1;
    }
    if(i%2==0 && sum<=0){
      c1 += -sum+1;
      sum = 1;
    }
  }

  // a[0]<0
  sum=0;
  for(int i=0;i<N;i++){
    sum += a[i];
    if(i%2==1 && sum<=0){
      c2 += -sum+1;
      sum =1;
    }
    if(i%2==0 && sum>=0){
      c2 += sum+1;
      sum = -1;
    }
  //  cout<<sum<<endl;
  }


   // cout<<c1<<" "<<c2<<endl;
  cout<<min(c1,c2)<<endl;

}


Measured memory_bytes: 640
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

vector<int> enum_divisor(int n) {
	vector<int> result;
	for(int i=1; i*i <= n; i++){
		if(n % i == 0){
			result.push_back(i);
			if(i*i != n) result.push_back(n / i);
		}
	}

	return result;
}

int A[200000];
unordered_set<int> st;
map<int, int> mp;

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

	for (int i=0; i<N; i++) {
		cin >> A[i];
		st.insert(A[i]);
		mp[A[i]]++;
	}

	int ans = 0;

	for (int i=0; i<N; i++) {
		if (mp[A[i]] >= 2) {
			continue;
		}
		vector<int> divisors = enum_divisor(A[i]);
		bool cannot_div = true;
		for (int d : divisors) {
			//cout << d << " "; // **** debug ****
			if (d != A[i] && st.count(d) == 1) {
				cannot_div = false;
				break;
			}
		}
		if (cannot_div) ans++;
		//cout << endl; // **** debug ****
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 21412
local n = io.read("*n")
local r = 1
for i = 1, n do
  r = r * 3
end
local odd = 1
for i = 1, n do
  local a = io.read("*n")
  if a % 2 == 0 then
    odd = odd * 2
  end
end
print(r - odd)


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

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

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

void solve() {
	int ans = 0;
	string S;
	cin >> S;
	for (auto c : S) {
		if (c == '+') {
			++ans;
		}
		else {
			--ans;
		}
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

int main()
{
	int n, a, b;
	std::string s;
	std::cin >> n >> a >> b >> s;
	
	int cnt = 0;
	int bcnt = 0;
	const int max = a + b;
	for (char c : s) {
		if (c == 'b') bcnt++;
		if (cnt >= max || c == 'c' || (c == 'b' && bcnt > b)) {
			std::cout << "No\n";
		}
		else {
			std::cout << "Yes\n";
			cnt++;
		}
	}
	
	return 0;
}


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

#ifdef __WIN32
#define LLFORMAT "I64"
#else
#define LLFORMAT "ll"
#endif

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	long long x = 0, y = 0;
	for (char c: s) {
		if(c == 'B') ++y;
		else x += y;
	}
	cout << x << endl;
	return 0;
}


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

int main(){
  int x;
  cin >> x;
  for(int i=x; ;i++){
    bool ok = true;
    for(int j=2; j*j<=i; j++){
      if(i%j == 0){
        ok = false;
        break;
      }
    }
    if(ok){
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <complex>
#include <stack> 
#include <random>

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

/////////////////////////////////////////////////////////////////////

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

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

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

template <typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p) {
	in >> p.first >> p.second;
	return in;
}

template <typename T1, typename T2>
ostream& operator << (ostream& out, pair<T1, T2>& p) {
	out << p.first << ' ' << p.second;
	return out;
}

mt19937_64 rnd(0);

const int LOG = 64;
const int N = (int)2e5 + 7;
const int MAXN = (int)1e6 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)2e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e18;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

/////////////////////////////////////////////////////////////////////

void solve() {
	char c; cin >> c;
	if ('A' <= c && c <= 'Z')
		cout << "A";
	else
		cout << "a";
}

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	rnd.seed(time(0));
#endif
		
	int t = 1;
	for (int i = 0; i < t; i++) {
		solve();
	}

#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

Measured memory_bytes: 3640