akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#else
template<class...T>void dprint(T&&...t){_print(cerr,t...);}
#endif
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<<(ostream&o,const multiset<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>>n;
    map<int,int> m;
    REP(i,n){
        int a;
        cin>>a;
        m[a]++;
    }
    vp mm(all(m));
    dprint(mm);
    if(mm.size()==3)dprint((mm[0].F^mm[1].F^mm[2].F)==0);
    if(mm.size()==1 && mm[0].F==0)Yes(1);
    else if(mm.size()==2 && mm[0].F==0 && mm[0].S*3==n)Yes(1);
    else if(mm.size()==3 &&
        (mm[0].F^mm[1].F^mm[2].F)==0 &&
        mm[0].S*3==n &&
        mm[1].S*3==n &&
        mm[2].S*3==n)Yes(1);
    else Yes(0);
    return 0;
}


Measured memory_bytes: 4480
n=int(input())
a=[int(i) for i in input().split()]
ans=[]

a.sort()
a.reverse()

flag=False
for i in range(n-1):
	if flag:
		flag=False
		continue
	if a[i]==a[i+1]:
		ans.append(a[i])
		flag=True
		if len(ans)==2:
			break
if len(ans)<2:
	print(0)
else:
	print(ans[0]*ans[1])


Measured memory_bytes: 14224
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int n,d;
vi a;
int re[114514];
int main(){
	ll S;
	cin>>S;
	ll a,b,c,d;
	ll hoge=(S)%(1000000000);
	if(hoge==0){
		a=(S/1000000000);
		d=1000000000;
		b=0;
		c=0;
	}else{
		a=(S/1000000000)+1;
		d=1000000000;
		b=1;
		c=1000000000-hoge;
	}
	cout<<0<<" "<<0<<" "<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
}

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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e5 + 5;

typedef pair<int,int>   ii;

int f[N];
int g[N];

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    string S;   cin >> S;

    S = "###" + S;

    f[0] = f[1] = -N;
    g[0] = g[1] = -N;

    for(int i = 3 ; i < sz(S) ; ++i)    {
        f[i] = g[i - 1] + 1;
        g[i] = f[i - 2] + 1;

        if (S[i] != S[i - 1])
            f[i] = max(f[i],f[i - 1] + 1);
        if (S[i] != S[i - 2] || S[i - 1] != S[i - 3])
            g[i] = max(g[i],g[i - 2] + 1);
    }

    cout << max(f[sz(S) - 1],g[sz(S) - 1]) << endl;
}

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

typedef struct Node {
  int key;
  struct Node *prev;
  struct Node *next;
} Node;

Node *head, *tail;

void dump() {
  int l = 0;
  Node *p = head;
  while (p != NULL) {
    if (l == 0)  printf("%d",  p->key);
    else printf(" %d", p->key);
    ++l;
    p = p->next;
  }
  printf("\n");
}

void insert(int key) {
  Node *nod = malloc(sizeof(Node));;
  nod->key = key;
  nod->prev = NULL;
  nod->next = NULL;

  if (head == NULL) {
    head = nod;
    tail = nod;
  } else {
    nod->next = head;
    head->prev = nod;
    head = nod;
  }
}

void delete(int key) {
  Node *p = head;
  int flg = 0;

  while (flg == 0 && p != NULL) {
    if (p->key == key) {
      Node *c = p;
      if (c->prev != NULL) {
        p->prev->next = c->next;
      } else {
        head = c->next;
      }

      if (c->next != NULL) {
        p->next->prev = c->prev;
      } else {
        tail = c->prev;
      }
      flg = 1;
    } else {
      p = p->next;
    }
  }
}

void deleteFirst() {
  if (head == tail) {
    head = NULL;
    tail = NULL;
  } else if (head != NULL) {
    if (head->next != NULL) head->next->prev = NULL;
    head = head->next;
  }
}

void deleteLast() {
  if (head == tail) {
    head = NULL;
    tail = NULL;
  } else if (tail != NULL) {
    if (tail->prev != NULL) tail->prev->next = NULL;
    tail = tail->prev;
  }
}

int main(int argc, char **argv) {
  int n;
  scanf("%d\n", &n);

  int i;
  int x;
  char buf[256];
  char tmp[256];
  for (i = 0; i < n; ++i) {
    fgets(buf, 256, stdin);
    if (buf[0] == 'i' || buf[6] == ' ') {
      sscanf(buf, "%s %d", tmp, &x);

      if (buf[0] == 'i') insert(x);
      else               delete(x);
    } else if (buf[6] == 'F') {
      deleteFirst();
    } else if (buf[6] == 'L') {
      deleteLast();
    }
  }
  dump();
  return 0;
}


Measured memory_bytes: 36040
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    int n;
    int v[100];
    int c[100];

    cin >> n;
    rep(i, n) cin >> v[i];
    rep(i, n) cin >> c[i];

    int ans = 0;
    rep(i, n){
        if(v[i] > c[i]){
            ans += (v[i]-c[i]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#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++)

int main() {
  int n;
  cin >> n;
  vector<tuple<int,int,int>>d[n];
  rep(i,n-1){
    int a,b,c;
    cin>>a>>b>>c;
    a--;
    b--;
    d[a].push_back(tuple<int,int,int>(a,b,c));
    d[b].push_back(tuple<int,int,int>(b,a,c));
  }
  vector<bool>v(n);
  v[0]=true;
  vector<int>ans(n);
  ans[0]=0;
  queue<tuple<int,int,int>>q;
  rep(i,d[0].size()){
    q.push(tuple<int,int,int>(get<0>(d[0][i]),get<1>(d[0][i]),get<2>(d[0][i])));
  }
 
  while(!q.empty()){
    tuple<int,int,int>p=q.front();
    q.pop();
    if(!v.at(get<1>(p))){
      ans.at(get<1>(p))=abs(ans.at(get<0>(p))-get<2>(p)%2);
      v.at(get<1>(p))=true;
      rep(i,d[get<1>(p)].size()){
        if(!v.at(get<1>(d[get<1>(p)][i]))){
          q.push(tuple<int,int,int>(get<0>(d[get<1>(p)][i]),get<1>(d[get<1>(p)][i]),get<2>(d[get<1>(p)][i])));
        }
      }
    }
  }
          
  
  rep(i,n){
    cout<<ans.at(i)<<endl;
  }
}




Measured memory_bytes: 10132
fn solve(s: &str) -> bool {
    let n = s.len();

    if n % 2 == 1 {
        return false;
    }

    s[0..n / 2] == s[n / 2..]
}

#[test]
fn solve_test() {
    assert_eq!(solve("abcabc"), true);
    assert_eq!(solve("z"), false);
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let _n = parse_line!(usize);
    let s = read_line!();

    println!("{}", if solve(&s) { "Yes" } else { "No" });
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

void solve(int test_case) {
	int n;
	cin>>n;
	int any=0;
	set<int> s;
	REP(i,0,n-1) {
		int val;
		cin>>val;
		if(val>0&&val<400)s.insert(1);
		else if(val>399&&val<800)s.insert(2);
		else if(val>799&&val<1200)s.insert(3);
		else if(val>1199&&val<1600)s.insert(4);
		else if(val>1599&&val<2000)s.insert(5);
		else if(val>1999&&val<2400)s.insert(6);
		else if(val>2399&&val<2800)s.insert(7);
		else if(val>2799&&val<3200)s.insert(8);
		else any++;
	}
	cout<<max(1,(int)s.size())<<" "<<any+(int)s.size();
}

int main() {
	
	////// FILE BASED IO////
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
}	


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b)
{
  return a * b / gcd(a, b);
}

//実行部
void Main()
{
  ll n, a, b; cin >> n >> a >> b;
  ll p = 0,q = 0,r = 0;
  rep(i, n)
  {
    ll k; cin >> k;
    if(k <= a) p++;
    else if(k <= b) q++;
    else r++;
  }
  fin(min(p, min(q, r)))
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int N,H,sum=0,ans=0;
int a[100001],b[100001];
int main(){
  cin >> N >> H;
  for(int i=0;i<N;i++)cin >> a[i] >> b[i];
  sort(a,a+N);
  sort(b,b+N);
  for(int i=N-1;i>=0;i--){
    if(b[i]<=a[N-1])break;
    sum+=b[i];
    ans++;
    if(sum>=H){
      cout << ans << endl;
      return 0;
    }
    
  }
  int x=H-sum;
  int y=x%a[N-1];
  if(y==0)ans+=(x/a[N-1]);
  else ans+=(x/a[N-1]+1);
  cout << ans << endl;
  return 0;
}


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

int main(void){
    ll K, N;
    cin >> K >> N;
    
    vector<ll> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    
    ll ma = 0;
    for (int i = 1; i < N; i++)
        ma = max(ma, A[i]-A[i-1]);
    
    ma = max(ma, A[0]+K-A[N-1]);
    
    cout << K-ma;
}

Measured memory_bytes: 1792
n = int(input())
a1 = list("abcdefghij")

b1 = [[0]]
c1 = 1
ans = []
while c1 < n:
    c1 += 1
    b2 = b1 + []
    b1 = []
    for i in b2:
        imax = max(i)
        for j in range(imax+2):
            b1.append(i+[j])

for i in b1:
    ans = [a1[j] for j in i]
    print("".join(ans))

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

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <functional>
#include <string>
#include <queue>
#include <iomanip>
using namespace std;

#define rep(i,a,b) for(long long int i=a; i<b; i++ )
#define REP(i,n) rep(i,0,n)


int main()
{
  double L; cin >> L;
  cout << setprecision(10) << pow(L/3.0,3) << endl;

  return 0;
}

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

int main(){
    int n; cin >> n;
    vector<ll> a(n); rep(i,n) cin >> a[i];
    vector<ll> num(9);
    rep(i,n){
        a[i] /= 400;
        if(a[i] >= 8) a[i] = 8;
        num[a[i]]++;
    }

    ll ansmin = 0;
    ll ansmax = 0;

    rep(i,8){
        if(num[i]){
            ansmin++;
            ansmax++;
        }
    }

    if(ansmin == 0) ansmin++;
    ansmax += num[8];

    cout << ansmin << " " << ansmax << endl;
}

Measured memory_bytes: 256
CARD_NUM = 13
cards = [[0 for x in range(CARD_NUM)] for y in range(4)] 

n = int(input())
for i in range(n):
	pair = list(map(str, input().split()))
	suit = pair[0]
	rank = int(pair[1])
	if suit == 'S': cards[0][rank - 1] = 1
	if suit == 'H': cards[1][rank - 1] = 1
	if suit == 'C': cards[2][rank - 1] = 1
	if suit == 'D': cards[3][rank - 1] = 1

for i in range(CARD_NUM):
	if cards[0][i] == 0: print('S ' + str(i + 1))
for i in range(CARD_NUM):
	if cards[1][i] == 0: print('H ' + str(i + 1))
for i in range(CARD_NUM):
	if cards[2][i] == 0: print('C ' + str(i + 1))
for i in range(CARD_NUM):
	if cards[3][i] == 0: print('D ' + str(i + 1))


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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    L = lmi()
    print(max(L) - min(L))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int A[210];
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    bool B=false;
    int ans =0;
    while (!B)
    {
        for (int i = 0; i < N; i++)
        {
            if (A[i]%2==1)
            {
                B=true;
            }
        }
        if (!B)
        {
            for (int i = 0; i < N; i++)
            {
                A[i]=A[i]/2;
            }
            ans++;
        }
    }
    cout << ans<<endl;
    
}

Measured memory_bytes: 256
Set = [("lu", "ru"), ("ru","lu"), ("ld","rd"), ("rd","ld")]

while True :
	n = int(input())
	if(n == 0) :
		break
	else :
		F = list(map(str, input().split()))
		cnt = 0
		while(len(F) > 1) :
			if((F[0], F[1]) in Set) :
				cnt += 1
				del F[0 : 2]
			else :
				del F[0]
		print(cnt)


Measured memory_bytes: 5624
#include <stdio.h>

int main (void)
{
    long X,Y;
    scanf("%ld",&X);
    scanf("%ld",&Y);
    long k=X,cnt=0;
    while(k<=Y)
    {
        k*=2;
        cnt++;
    }
    printf("%ld\n",cnt);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

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

    if ((B - A) % 2 == 0) {
        cout << (B - A) / 2 << endl;
        return 0;
    }

    cout << min(A - 1, N - B) + (B - A + 1) / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define forinc(i,a,b) for(int i=a;i<=b;i++)
#define fordec(i,a,b) for(int i=a;i>=b;i--)
#define int long long
const int maxn=101,maxm=1e5+1;
int n,W;
int w[maxn],f[maxn][maxm],v[maxn];
main()
{
    cin>>n>>W;
    forinc(i,1,n)
    {
        cin>>w[i]>>v[i];
    }
    f[1][w[1]]=v[1];
    forinc(i,1,n)
    {
        forinc(j,0,W)
        {
            f[i][j]=f[i-1][j];
            if(j>=w[i]) f[i][j]=max(f[i][j],f[i-1][j-w[i]]+v[i]);
        }
    }
    int res=0;
    forinc(i,0,W) res=max(res,f[n][i]);
    cout<<res;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	vector<int>v(5); rep(i, 0, 5) { cin >> v[i]; }
	cout << distance(v.begin(), find(all(v), 0)) + 1 << endl;

	return 0;
}


Measured memory_bytes: 3656
# frozen_string_literal: true

s = gets.chomp.chars
k = gets.to_i
n = s.size
a = []
count = 1
(0..(n - 2)).each do |i|
  if s[i] == s[i + 1]
    count += 1
  else
    a.push count
    count = 1
  end
end
a.push count
sum = 0
if a.size == 1
  sum = a[0] * k / 2
elsif s[0] != s[-1]
  sum = a.map { |e| e / 2 }.reduce(&:+) * k
else
  t = a.pop
  h = a.shift
  sum = a.map { |e| e / 2 }.reduce(&:+) * k
  sum += t / 2 + h / 2 + (t + h) / 2 * (k - 1)
end
puts sum


Measured memory_bytes: 2044
def main():
    k=int(input())
    Ans=[0]*(k+1)
    for i in range(1,k+1):
        for j in range(i,k+1,i):
            Ans[j]+=1
    ans=0
    for i in range(1,k+1):
        ans+=i*(Ans[i])
    print(ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 145952
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define pa pair<int,int>
#define mod 998244353
#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define cl(x) memset(x,0,sizeof x)
#ifdef Devil_Gary
#define bug(x) cout<<(#x)<<" "<<(x)<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define bug(x)
#define debug(...)
#endif

const int INF = 0x7fffffff;
const int N=1e5+5;
/*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=(TT=but)+fread(but,1,1<<15,stdin),TT==mo))?-1:*TT++)//*/
inline int read(){
    int x=0,rev=0,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')rev=1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
    return rev?-x:x;
}/*
struct Edge{
	int nxt,v;
//	int w;
//	int id;
}e[N<<1];
void add(int u,int v){
	e[++tot].v=v,e[tot].nxt=head[u],head[u]=tot;
	e[++tot].v=u,e[tot].nxt=head[v],head[v]=tot;
}*/

int main(){
#ifdef Devil_Gary
    freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);
#endif
	int x=read();
	puts((x>=30)?"Yes":"No"); 
	return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>

void check(int w, int h, int x, int y, int r) {
	if (x - r >= 0 && x + r <= w && y - r >= 0 && y + r <= h) printf("Yes\n");
	else printf("No\n");
	return;
}

int main(void)
{
	int w, h, x, y, r;
	scanf("%d%d%d%d%d", &w, &h, &x, &y, &r);
	check(w, h, x, y, r);
	return 0;
}


Measured memory_bytes: 2108
#include <iostream>
using namespace std;
int n,i,j,l,ans,a;
int arr[11233]={};
int main() {
	
	cin>>n;
	for(i=1;i<=100;i++)
	{
		for(j=i;j<=100;j++)
		{
			for(l=j;l<=100;l++)
			{
				ans=i*(i+j+l)+j*(j+l)+l*l;
				if(ans<=10000)
				{
					if(i==j&&j==l)
					{
						arr[ans]++;
					}
					if(i==j&&i!=l||j==l&&i!=l)
					{
						arr[ans]+=3;
					}
					if(i!=j&&j!=l&&i!=l)
					{
						arr[ans]+=6;
					}
				}
			}
		}
	}
	for(i=1;i<=n;i++)
	{
		cout <<arr[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(v) for(int k=head[v];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=5e5+5,M=1e7+5,INF=1e9,mod=1e9+7;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
il void gen(){freopen("data.in","w",stdout);}
int col[N],d[N];ll bi,unbi,sep,typ,m,n;
struct edge{int t,ne;}e[N];
int head[N],cnt;
void adde(int a,int b){
	e[++cnt]=(edge){b,head[a]};head[a]=cnt;
}
void dfs(int x){
	run(x)if(!col[v]){
		col[v]=3-col[x];
		dfs(v);
	}else if(col[v]!=3-col[x])typ=1;
}
int main(){
	read(n);read(m);
	rep(i,1,m){
		int x,y;read(x,y);
		adde(x,y);adde(y,x);
		d[x]++;d[y]++;
	}
	rep(i,1,n)if(!col[i]){
		col[i]=1;
		if(d[i]){
			typ=0;
			dfs(i);
			if(typ==0)bi++;else unbi++;
		}else sep++;
	}
	ll res=sep*sep+sep*(n-sep)+sep*(n-sep)+bi*bi*2+unbi*unbi+unbi*bi*2;
	cout<<res<<endl;
}

Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
int main(){
    int x,y,z,k;
    cin>>x>>y>>z>>k;
    vector<int64_t> A(x),B(y),C(z);
    map<tuple<int,int,int>,int> p;
    rep(i,x) cin>>A[i];
    rep(i,y) cin>>B[i];
    rep(i,z) cin>>C[i];
    all(A),all(B),all(C);
    Re(A),Re(B),Re(C);
    priority_queue <tuple<int64_t,int,int,int>> ppq;
    queue <int64_t> pq;
    ppq.push(make_tuple(A[0]+B[0]+C[0],0,0,0));
    p[make_tuple(0,0,0)]++;
    int a=0,b=0,c=0;
    rep(i,k){
        int64_t t,q,w,e;
        tie(t,q,w,e) = ppq.top();
        ppq.pop();
        //cout<<t<<" "<<q<<" "<<w<<" "<<e<<endl;
        if(q+1<x && p[make_tuple(q+1,w,e)]==0){
           // cout<<"P1"<<endl;
            p[make_tuple(q+1,w,e)]++;
            ppq.push(make_tuple(A[q+1]+B[w]+C[e],q+1,w,e));
        }
        if(w+1<y && p[make_tuple(q,w+1,e)]==0){
            //cout<<"P2"<<endl;
            p[make_tuple(q,w+1,e)]++;
            ppq.push(make_tuple(A[q]+B[w+1]+C[e],q,w+1,e));
        }
        if(e+1<z && p[make_tuple(q,w,e+1)]==0){
            //cout<<"P3"<<endl;
            p[make_tuple(q,w,e+1)]++;
            ppq.push(make_tuple(A[q]+B[w]+C[e+1],q,w,e+1));
        }
        cout<<t<<endl;
        pq.push(t);

    }
    /*
    rep(i,k){
        cout<<pq.front()<<endl;
        pq.pop();
    }
    */
}


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

int main(){
	int r, c;
	int a[1000][1000];
	cin >> r >> c;
	for(int i=0; i<r; i++){
		for(int j=0; j<c; j++){
			cin >> a[i][j];
		}
	}
	for(int i=0; i<r; i++){
		a[i][c] = 0;
		for(int j=0; j<c; j++){
			a[i][c] += a[i][j];
		}
	}
	for(int j=0; j<=c; j++){
		a[r][j] = 0;
		for(int i=0; i<r; i++){
			a[r][j] += a[i][j];
		}
	}
	for(int i=0; i<r+1; i++){
		for(int j=0; j<c; j++){
			cout << a[i][j] << " ";
		}
		cout << a[i][c] << endl;
	}
	return 0;
}

Measured memory_bytes: 1556
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	int N, A[222];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
		int min_res = A[0];
		int max_res = A[0];
		for (int i = 0; i < N; i++) {
		if (min_res > A[i]) {
			min_res = A[i];
		}
		if (max_res < A[i]) {
			max_res = A[i];
		}
	}

	cout << max_res - min_res << endl;

	return 0;
}

Measured memory_bytes: 384
import sys
inputs = sys.stdin.readlines()
N, D = map(int, inputs[0].split())
x_list = []
for x in inputs[1:]:
    x_list.append(list(map(int, x.split())))
    
from itertools import combinations
from math import sqrt, floor
count = 0
for i, j in combinations(range(N), 2):
    s = 0
    for k in range(D):
        s += (x_list[i][k] - x_list[j][k]) ** 2
    if floor(sqrt(s)) ** 2 == s:
        count += 1
        
print(count)

Measured memory_bytes: 3064
K,N=map(int,input().split())
A= list(map(int,input().split()))
maxA =K-(A[N-1]-A[0])
sumA =K-(A[N-1] -A[0])
for i in range(N-1):
    sumA += A[i+1]-A[i]
    if A[i+1]-A[i] >maxA:
        maxA=A[i+1]-A[i]
print(sumA-maxA)

Measured memory_bytes: 26444
#include <iostream>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
long long arr[(int) 1e5+5][3];
long long dp[(int) 1e5 +5][3];
int n;
int main(){
    cin>>n;
    for(int i = 0;i<n;i++) {
        cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
    }
    dp[0][1] = arr[0][1];
    dp[0][0] = arr[0][0];
    dp[0][2] = arr[0][2];
    for(int i = 1;i<n;i++){
        for(int j = 0;j<3;j++){
            long long ans = -1;
            for(int k = 0;k<3;k++){
                if(j!=k){
                    ans = max(ans, dp[i-1][k]);
                }
            }
            dp[i][j] = ans + arr[i][j];
        }
    }
    cout<<max(dp[n-1][0], max(dp[n-1][2], dp[n-1][1]))<<endl;
    return 0;
}

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


void solve(long long N, std::vector<long long> L){
    sort(L.begin(), L.end());
    int counter = 0;
    for (int i=0; i<N; i++) {
        for (int j=0; j<i; j++) {
            for (int k=0; k<j; k++) {
                if (abs(L[i] - L[j]) < L[k] && L[k] < L[i] + L[j]) {
                    counter++;
                }
            }
        }
    }
    cout << counter << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&L[i]);
    }
    solve(N, std::move(L));
    return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
int num[200010];
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,k; cin >> n >> k;
    priority_queue<int,vector<int>,greater<int>> a;
    int tmp;
    rep(i,0,n){
        cin >> tmp;
        num[tmp]++;
    }
    rep(i,0,200010){
        if(num[i]!=0) a.push(num[i]);
    }
    int ans=0;
    while(a.size()>k){
        ans += a.top();a.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
int32_t main()
{
   IOS;
	ll x1,y,x,y2,t1=0,n,m,i,j,cnt=0,sum1=0,sum2=0,l;
	string s;
	cin>>s;
	ll a[26]={0};
	for(i=0;i<4;i++)
    {
        if(s[i]>64&&s[i]<91)
        {
            a[s[i]-65]++;
        }
    }
    for(i=0;i<26;i++)
    {
        if(a[i]==2)
        {
            cnt+=1;
        }
    }
    if(cnt==2)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }



        return 0;
}



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

using ll=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout<<fixed<<setprecision(10);
  double ans=0;
  rep(i,n){
    double mass ;
    string coin ;
    cin >> mass >> coin;
    if(coin =="JPY") ans += mass;
    if(coin == "BTC") ans += mass*380000.0;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);

int n,m;
cin >> n >> m;
int res = (n * (n - 1))/2 + (m * (m - 1) )/ 2;
cout << res << endl;
}

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

int main(void) {
  int N, K;
  cin >> N >> K;

  if (N % K == 0) {
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3600
s = list(input())

f1 = False
f2 = False

for i in range(len(s)):
        if s[i] == 'A':
                f1 = True
        if f1 and s[i] == 'C':
                f2 = True
                f1 = False
                break
        if s[i] != 'A':
                f1 = False

if f2:
        print('Yes')
else:
        print('No')

Measured memory_bytes: 3060
function main (s) {
    s=s.split(" ");
	for(var i=0;i<3;i++)s[i]=parseInt(s[i]);
	if(s[2]-s[1]<=0)console.log("delicious\n");
	else if(s[2]-s[1]<=s[0])console.log("safe\n");
	else console.log("dangerous\n");
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int q(int x, int y) {
	if (x < y) return y;
	else return x;
}

int main() {
	int o = 0;
	vector<char> a(2);
	vector<char> b(2);
	vector<char> c(2);
	rep(i, 2) {
		cin >> a[i] >> b[i] >> c[i];
	}
	if (a[1] == a[0]) o++;
	if (b[1] == b[0]) o++;
	if (c[1] == c[0]) o++;
	cout << o << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <vector>

using namespace std;
int N;
vector<int> v;

bool isprime(int n) {
    if (n == 1) {
        return false;
    }
    if (n == 2) {
        return true;
    }
    if (n % 2 == 0) {
        return false;
    }
    for (int i = 3; (i * i) <= n; i += 2) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    cin >> N;
    v = vector<int>(N);
    for (int i = 0; i < N; i++) {
        cin >> v[i];
    }
    int cnt = 0;
    for (int i : v) {
        if (isprime(i)) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3076
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <math.h>

#define rep(i,n) for(int i = 0; i <(n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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


int main(void) {
	string a, b;
	int i, j, k, ans = 0;
	cin >> a;
	cin >> b;

	rep(i, 3){
		if (a[i] == b[i]) {
			ans++;
		}
	}
	cout << ans;

	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int A[n], B[n];
    for(int i = 0; i < n; i++){
        cin >> A[i];
        B[i] = A[i];
    }
    sort(A, A+n);
    int j = 0, s = 0, cnt, t, s1, s2;
    while(j < n){
        if(A[j] != B[j]){
            s1 = s2 = cnt = 0;
            int l = j;
            while(B[l] != A[j]){
               l++;
            }
            int k = j;
            while(B[k] != A[l]){
                k++;
            }
            t = B[l]; B[l] = B[k]; B[k] = t; cnt++;
            s1 += B[k] + B[l];
            while(A[k] != B[k]){
                l = j;
                while(B[l] != A[k]){
                    l++;
                }
                t = B[l]; B[l] = B[k]; B[k] = t; cnt++;
                s1 += B[l] + B[k];
                k = l;
            }
            s2 = (A[0] + A[j])*2 + s1 - cnt*(A[j] - A[0]);
            if(s1 >= s2) s = s + s2;
            else s = s + s1;
        }
        j++;
    }

    cout << s << endl;

    return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <cmath>
#include <map>
#include <utility>
#include <list>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

#define LL long long

int h[100];

int water(int l, int r){
    //cout << l << ", " << r << endl;

    if (l == r) {
        return h[l];
    }

    int total = 0;
    int start = -1;
    for (int i = l; i <= r; i++){
        h[i]--;

        if (start == -1 && h[i] != 0) {
            start = i;
        }

        if (start != -1 && h[i] == 0) {
            total += water(start, i - 1);
            start = -1;
        }
    }

    if (start != -1){
        total += water(start, r);
    }
    return total + 1;
}

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

    int total = 0;
    
    int start = -1;
    for (int i=0; i < n; i++){
        if (start == -1 && h[i] != 0) {
            start = i;
        }
        if (start != -1 && h[i] == 0) {
            total += water(start, i-1);
            start = -1;
        }
    }
    if (start != -1) {
        total += water(start, n - 1);
    }
    cout << total << endl;

    return 0;
}


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

int main() {
	int K, S;
	cin >> K >> S;
	int ans = 0;
	for (int x = 0; x <= K; x++) {
		for (int y = 0; y <= K; y++) {
			int z = S - x - y;
			if (z <= K && z >= 0) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}


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

// import java.text.DecimalFormat; 
// import java.text.DecimalFormatSymbols; 
 
 
// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
 
public class Main {
    
    
    public static void main(String args[] ) throws Exception {
        StringBuffer str = new StringBuffer();
        PrintWriter pw=new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        
        
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = sc.nextInt();
        }
        long[] dp = new long[n+1];
        dp[1] = Math.abs(a[1]-a[0]);
        for(int i=2;i<n;i++){
            dp[i] = (dp[i-2]+Math.abs(a[i]-a[i-2])<dp[i-1]+Math.abs(a[i]-a[i-1]))?dp[i-2]+Math.abs(a[i]-a[i-2]):dp[i-1]+Math.abs(a[i]-a[i-1]);
        }
        
        str.append(dp[n-1]);
        
        pw.println(str.toString());
        
        pw.close();
    }
     
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		public String next(int k) {
			try {
				return br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "Not able to read";
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() {
			return Double.parseDouble(next());
		}
		
	    
	}
   
}

Measured memory_bytes: 43160
n= int(input())
ans,i = 0,1
while i*i<=n:
    if n % i == 0:
        if 1<i and n//(i-1) == n%(i-1):
            ans += i-1
        j = n//i
        if 1<j and n//(j-1) == n%(j-1):
            ans += j-1
    i+=1
print(ans)


Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(500000)

h, w, k = map(int, input().split())
s = []
ans = [[0] * w for _ in range(h)]
cnt = 0
#prev = 1

for i in range(h):
    s.append(input())

#print(s)

for i in range(h):
    if '#' not in s[i]:
        continue
    shouldCover = False

    for j in range(w):
        if j == 0 and s[i][j] == '.':
            cnt += 1
            ans[i][j] = cnt
            shouldCover = True
        elif s[i][j] == '#' and shouldCover:
            ans[i][j] = cnt
            shouldCover = False
        elif s[i][j] == '#':
            cnt += 1
            ans[i][j] = cnt
            shouldCover = False
        else:
            ans[i][j] = cnt

def solve(cur, nxt, down):
    if nxt < 0 or nxt > h-1:
        return
    if down:
        if '#' in s[nxt]:
            for k in range(cur, nxt):
                for j in range(w):
                    ans[k][j] = ans[nxt][j]
        else:
            solve(cur, nxt+1, down)
    else:
        if '#' in s[nxt]:
            for k in range(cur, nxt, -1):
                for j in range(w):
                    ans[k][j] = ans[nxt][j]
        else:
            solve(cur, nxt-1, down)


for i in range(h):
    if all(ans[i][j] == 0 for j in range(w)):
        if i == h - 1:
            solve(i, i-1, False)
        else:
            #print('down!')
            solve(i, i+1, True)

for i in range(h):
    print(*ans[i])
#print(ans)





Measured memory_bytes: 7568
import numpy as np

mod = 998244353

n, s = map(int, input().split())
A = list(map(int, input().split()))
DP = np.zeros(3005, dtype=np.int64)
DP[0] = 1

for a in A:
    double = DP * 2
    shift = np.hstack([np.zeros(a), DP[:-a]]).astype(np.int64)
    DP = double + shift
    DP %= mod

print(DP[s])


Measured memory_bytes: 27760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)

int main() {
    ll a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
using namespace std;

ll a,b;

int main()
{

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

    cin >> a >> b;
    cout << a*b/__gcd( a , b );

    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
A = []
for i in range(n):
    A.append([int(x) for x in list(input().split())])

b = []
for i in range(m):
    result = 0
    b.append(int(input()))

for i in range(n):
    res = 0
    for bb, aa in zip(b, A[i]):
        res += bb * aa
    print(res)



Measured memory_bytes: 6012