akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int a_len = a.length();
        int b_len = b.length();
        if(a_len > b_len){
            System.out.println("GREATER");
        }
        if(a_len < b_len){
            System.out.println("LESS");
        }
        if(a_len == b_len){
            if(a.equals(b)){
                System.out.println("EQUAL");
            }
            else{
                for(int i = 0;i < a_len;i++){
                    if(a.charAt(i) > b.charAt(i)){
                        System.out.println("GREATER");
                        return;
                    }
                    if(a.charAt(i) < b.charAt(i)){
                        System.out.println("LESS");
                        return;
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

ll dp[100002][2][100];
int main() {
    init();

    string s; int d; cin >> s >> d;
    int n = s.length();
    VI k(n);
    FOR(i, 0, n)k[i] = s[i] - '0';

    dp[0][0][0] = 1;
    FOR(i, 0, n)FOR(small, 0, 2)eFOR(x, 0, (small ? 9 : k[i]))FOR(m, 0, d) {
        (dp[i + 1][small | (x < k[i])][(m + x) % d] += dp[i][small][m]) %= mod;
    }
    
    cout << (dp[n][0][0] + dp[n][1][0] - 1 + mod) % mod << "\n";
}

Measured memory_bytes: 16640
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MOD=1e9+7;
static const ll MAX=101010;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k, l;
  
  ll N;
  cin >> N;
  ll a[MAX];
  
  for(i=0; i<N; i++) cin >> a[i];
  
  
  ll ans=a[0]-1;
  ll h=2;
  for(i=1; i<N; i++) {
    if(a[i]==h) {
      h++;
    }else if(a[i]%h==0) {
      ans+=(a[i]-1)/h;
    }else {
      ans+=a[i]/h;
    }
  }
  
  pt(ans);
  
  
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define SORT(n) sort((n).begin(),(n).end(),greater<int>())
#define SORTP sort((n).begin(),(n).end(),greater<pair<int,int>>());
#define pb push_back
#define eb emplace_back
using namespace std;
struct CWW{CWW(){ios::sync_with_stdio(false);cin.tie(0);}}cww;
int main()
{
	int N, L;
	cin >> N >> L;
	vector<string> S(N);
	REP( i, N ){
		cin >> S[i];
	}
	sort( S.begin(), S.end() );
	cout << accumulate( S.begin(), S.end(), string() ) << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

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

  int n, m; cin >> n >> m;
  string s; cin >> s;

  vector<int> graph[n];

  rep(i, m) {
    int a, b; cin >> a >> b;
    a--; b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  vector<bool> removed(n);

  rep(i, n) {
    queue<int> que;
    que.push(i);
    while(!que.empty()) {
      int a = que.front(); que.pop();
      if (removed.at(a)) continue;
      bool A = false;
      bool B = false;
      for(auto b : graph[a]) {
        if (removed.at(b)) continue;
        if (s.at(b) == 'A') {
          A = true;
        } else {
          B = true;
        }
      }
      if (!A || !B) {
        removed.at(a) = true;
        for(auto b : graph[a]) {
          if (removed.at(b)) continue;
          que.push(b);
        }
      }
    }
  }

  rep(i, n) {
    if (!removed.at(i)) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 10192
#include<stdio.h>   //ABC083B - Some Sums

int sub(int num){

    int sum = 0;
    while(num>0){
        sum+=num%10;
        num/=10;
    }

    return sum;
}

int main(){

    int n,a,b;
    int total=0;
    int x;
    scanf("%d %d %d", &n,&a,&b);

    for(int i=1;i<=n;i++){
        
        x=sub(i);
        if(x>=a && x<=b){
            total+=i;
        }
    }
    printf("%d\n",total);

    return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    if (n >= m) {
        cout << 0 << endl;
    } else {
        vector<int> x(m, 0);
        for (int i = 0; i < m; i++) {
            cin >> x[i];
        }
        sort(x.begin(), x.end());
        for (int i = 0; i < m - 1; i++) {
            x[i] = x[i + 1] - x[i];
        }
        x.erase(x.end() - 1);
        sort(x.begin(), x.end());
        for (int i = 1; i < m - n; i++) {
            x[0] += x[i];
        }

        cout << x[0] << endl;
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


//k!
ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum = sum%MOD*i%MOD;
    }
    return sum%MOD;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    int n;cin>>n;
    int dp[100010][3];
    rep(i,n+1)rep(j,3)dp[i][j]=0;
    for(int i = 1;i <= n;i++){
        vector<int> v(3);
        rep(i,3)cin>>v[i];
        rep(j,3){
            rep(k,3){
                if(j==k)continue;
                dp[i][j] = max(dp[i][j],dp[i-1][k] + v[k]);
            }
        }
    }
    cout << max(dp[n][0],max(dp[n][1],dp[n][2])) << endl;
}



Measured memory_bytes: 1408
t = input()
u = list(t)
if u[0] == '?':
    u[0] = 'D'
if u[-1] == '?':
    u[-1] = 'D'
for i in range(1, len(u)-1):
    if u[i] == '?':
        if u[i-1] == 'P':
            u[i] = 'D'
        elif u[i+1] == 'D':
            u[i] = 'P'
        else:
            u[i] = 'D'
print(''.join(u))

Measured memory_bytes: 10872
import java.util.*;
     
    public class Main {
        public static void main(String[] args)  {
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int k = in.nextInt();
            int[] h = new int[n];
            int[] dp = new int[n];
            for(int i=0;i<n;i++)    h[i] = in.nextInt();
            for(int i=1;i<=k && i<n;i++)   {
                dp[i] = Math.abs(h[i] - h[0]);
            }
            solve(n, k, h, dp);
            System.out.println(dp[n-1]);
            in.close();
        }
     
        static void solve(int n, int k, int[] h, int[] dp) {
            for(int i=k+1;i<n;i++)    {
                int min = Integer.MAX_VALUE;
                int temp;
                for(int j=1;j<=k;j++)    {
                    temp = Math.abs(h[i]-h[i-j]) + dp[i-j];
                    if(temp<min)    min = temp;
                }
                dp[i] = min;
            }
        }
    }

Measured memory_bytes: 50680
n = int(input())
inlis = list(map(int,input().split()))
donelis =[]
numlis=[]

for i in inlis:
    donelis.append(i+1)
    donelis.append(i)
    donelis.append(i-1)

estc =0
donelis.sort()
a = -2
count=0
for i in donelis:
    if a != i:
        if count > estc:
            estc = count
        count = 1
        a = i
    else:
        count +=1
if count >estc:
    estc =count
print(estc)


Measured memory_bytes: 74948
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;
#include <cstring>

int main() {
  ll n, x, m, ans = 0LL, a, cnt = 0LL, sum = 0;
  set<ll> s;
  cin >> n >> x >> m;
  a = x;
  do {
    sum += a;
    a = a * a;
    a %= m;
    cnt++;
    if (s.find(a) != s.end()) {
      break;
    }
    s.insert(a);
  } while (cnt < n && a != x);
  if (cnt == n) {
    cout << sum << endl;
  } else {
    ans += sum;
    n -= cnt;
    x = a;
    sum = 0;
    s.clear();
    cnt = 0;
    do {
      sum += a;
      a = a * a;
      a %= m;
      cnt++;
      if (s.find(a) != s.end()) {
        break;
      }
      s.insert(a);
    } while (cnt < n && a != x);
    if (n == cnt) {
      cout << sum + ans << endl;
    } else {
      ans += sum * (n / cnt);
      n -= n / cnt * cnt;
      for (ll i = 0; i < n; i++) {
        ans += a;
        a = a * a;
        a %= m;
      }
      cout << ans << endl;
    }
  }
}

Measured memory_bytes: 5960
import java.util.*;

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

        long ans = 0;
        ans += (x / 500) * 1000;
        x -= (x / 500) * 500;
        ans += (x / 5) * 5;

        System.out.println(ans);
    }
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; ++i) {
    cin >> a[i];
  }
  ll sum = accumulate(a.begin(), a.end(), 0);
  ll ans = n - sum;
  if (ans < 0) ans = -1;
  cout << ans << endl;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <cctype>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CLOOP        while (true)
#define FLOOP(i, n)  for (int i = 0; i < (n); i++)
#define FOR(i, f, l) for (int i = (f); i < (l); i++)
#ifdef DEBUG
#define DUMP(var)   cerr << "[DEBUG] " << #var << ": " << var << endl
#else
#define DUMP(var)
#endif

#define LL long long

using namespace std;

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

    string s;
    string t;
    cin >> s >> t;

    int count;
    int min = INT_MAX;
    for (int i = 0; i < ((int)(s.size() - t.size()) + 1); i++) {
        count = 0;
        for (int j = 0; j < (int)t.size(); j++) {
            if (s[i+j] == t[j]) {
                count++;
            }
        }
        if ((int)t.size() - count < min)
            min = t.size() - count;
    }

    cout << min << endl;

    return 0;
}


Measured memory_bytes: 3576
N=int(input())
d={}
for i in range(N):
    l=[0]*26
    for s in input():
        l[ord(s)-97]+=1
    l=tuple(l)
    if l in d:d[l]+=1
    else:d[l]=1

ans=0
for c in d:
    if d[c]==2:ans+=1
    elif d[c]!=1:ans+=d[c]*(d[c]-1)//2
print(ans)



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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {std::cout << x;}
void __print(unsigned x) {std::cout << x;}
void __print(unsigned long x) {std::cout << x;}
void __print(unsigned long long x) {std::cout << x;}
void __print(float x) {std::cout << x;}
void __print(double x) {std::cout << x;}
void __print(long double x) {std::cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template <typename T> inline void inp(T &any) {cin >> any;} template <typename T, typename... U>inline void inp(T &a, U &...b) {cin >> a; inp(b...);}
#define rin(args...) ll args; inp(args);
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#define matdeb(mat,row,col) cout << #mat << "::" << endl; printmat(mat,row,col); printpartition;
#define debugv(v,n) cout << #v << ":" << endl; printv(v,0,n-1); printpartition;
#else
#define debug(x...)
#define matdeb(mat,row,col)
#define debugv(v,n)
#endif

const int maxm = 1000000000 + 7;

const ll MOD = 1e9 + 7;
const int INF = 55;
ll dp [INF] [INF * INF];

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->


int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    IOS;

    int n; cin>>n;

    vector<int>a(n);

    ll sum=0, ans=0;

    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
        sum += a[i];
        ans = sum;
    }



    int p,x;

    tc(m)
    {
        cin>>p>>x;

        sum -= a[p];
        sum += x;
        
        cout<<sum<<endl;

        sum=ans;


    }



}


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

using namespace std;

int main(void) {
    int n;
    long sum = 0;
    string s;
    int r = 0;
    int g = 0;
    int b = 0;
    //nt sum = 0;

    cin >> n >> s;

    for(int i = 0; i < n; i++){
        if(s[i] == 'R'){
            r += 1;
        }
        else if(s[i] == 'G'){
            g += 1;
        }
        else{
            b += 1;
        }
    }

    sum = (long) r * g * b; //条件が1つ目だけの時

    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            int k = j - i + j;
            if(k >= n){
                continue;
            }
            if(s[i] != s[j] && s[i] != s[k] && s[k] != s[j]){ //一つ目の条件を満たしてるとき、2つ目の条件を満たしてないのはこのとき。
                sum -= 1;
            }
        }
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main()
{   
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    ll n = s.length();
    ll l =-1;
    for(ll i=0;i<n;i++)
    {
      if(s[i] == 'W')
      	l = i;
    }
    ll a[l+1] = {};
    ll t =0;
    for(ll i=l;i>=0;i--)
    {
      if(s[i]=='B')
      {
      	a[i] += t;
      	t++;
      }
    }
    ll ans = 0;
    for(ll i=0;i<=l;i++)
    {
    	if(s[i] == 'B')
    	{
    		ans += l-i-a[i];
    	}
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 2196
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N, A, B, C;
int L[8];
int ans = 1000000000;

void dfs(int i, int a, int b, int c, int x){
    if(i == N){
        if(a == 0 or b == 0 or c == 0)return;
        chmin(ans, x + abs(A - a) + abs(B - b) + abs(C - c));
    } else {
        dfs(i + 1, a + L[i], b, c, x + 10);
        dfs(i + 1, a, b + L[i], c, x + 10);
        dfs(i + 1, a, b, c + L[i], x + 10);
        dfs(i + 1, a, b, c, x);
    }
}

int main(){

    cin >> N >> A >> B >> C;
    rep(i, N)cin >> L[i];

    dfs(0, 0, 0, 0, -30);
    cout << ans << endl;

}

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

#define F first
#define S second
#define PB push_back
#define int ll

using namespace std;

typedef long long ll;

signed main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n, w;
	cin >> n >> w;

	vector<pair<int, int> > items;
	for(int i = 0; i < n; i++){
		int a, b;
		cin >> a >> b;
		if(a > w)	continue;
		items.PB({a,b});
	}

	int dp[w+1];
	dp[0] = 0;
	for(int i = 1; i <= w; i++){
		dp[i] = INT_MIN;
	}

	for(int i = 0; i < n; i++){
		for(int j = w; j >= items[i].F; j--){
			if(dp[j-items[i].F] == INT_MIN)	continue;
			dp[j] = max(dp[j], items[i].S + dp[j-items[i].F]);
		}
	}

	int mmax = -1;
	for(int i = 0; i <= w; i++){
		mmax = max(mmax, dp[i]);
	}

	cout << mmax << "\n";

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  
  vector<int> h(N);
  for (int i = 0; i < N; i++){
    cin >> h.at(i);
  }  
  sort(h.begin(), h.end());
  
  //累積和
  vector<int> g(N);
  g.at(0) = 0;

  for (int i = 1; i < N; i++){
    g.at(i) = h.at(i) - h.at(i-1) + g.at(i-1); 

  }
  
 
  
  int sum = 1E9;
  for (int i = 0; i+K-1 < N; i++){
   int su = g.at(i+K-1) - g.at(i);
   sum = min(sum,su);
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>

int main(){

char A[11], B[11], C[11];

scanf("%s %s %s", A, B, C);

if (A[strlen(A) - 1] == B[0] && B[strlen(B) - 1] == C[0]){

printf ("YES\n");
}
else{
printf ("NO\n");
}
return 0;
}

Measured memory_bytes: 1644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  string s;
  cin >> s;
  for(int i=s.size()-1;i>=0; i--){
    s.erase(s.begin()+i);
    if(s.size()%2==1)continue;
    string t = s.substr(0,s.size()/2);
    string u = s.substr(s.size()/2);
    if(t==u){
      cout << s.size() << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Scanner;

public class Main {

  Scanner sc;

  Main() {
    sc = new Scanner(System.in);
  }

  int ni() {
    return sc.nextInt();
  }

  public static void main(String[] args) {
    new Main().run();
  }

  void run() {
    for (; ; ) {
      int n = ni();
      if (n == 0) {
        break;
      }
      int r = ni();
      ArrayList<Integer> list = new ArrayList<>();
      for (int i = 0; i < n; ++i) {
        list.add(n - i);
      }
      for (int i = 0; i < r; ++i) {
        int p = ni();
        int c = ni();
        ArrayList<Integer> sub = new ArrayList<>();
        for (Iterator<Integer> ite = list.listIterator(p - 1); 0 < c; --c) {
          int v = ite.next();
          sub.add(v);
          ite.remove();
        }
//        debug(list);
        list.addAll(0, sub);
//        debug(list);
      }

      System.out.println(list.get(0));
    }
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }
}

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

int main(){
    int n, m, i, j, k, d, c = 0;
    int a[3] = {3,5,7};
    cin >> n;
    for(i=1; i<=9; i++){
        for(j=0; j<pow(3,i); j++){
            int f[3] = {};
            d = j;
            m = 0;
            for(k=0; k<i; k++){
                m *= 10;
                m += a[d%3];
                f[d%3] = 1;
                d /= 3;
            }
            if(m <= n && f[0] == 1 && f[1] == 1 && f[2] == 1){
                c++;
            }
        }
    }
    cout << c;
    return 0;
}

Measured memory_bytes: 384
n=int(input())
s=[]
for i in range(n):
    s.append(int(input()))
ans=sum(s)
cnt=11110
if ans%10!=0:
    ans=ans
else:
    for i in range(n):
        if cnt>s[i] and s[i]%10!=0:
            cnt=s[i]
    if cnt==11110:
        ans=0
    else:
        ans-=cnt
print(ans)            


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set> 
#include <bitset>
#include <cmath>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)

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

    int res = 0;
    if(a > b) {
        res += a;
        a -= 1;
    } else {
        res += b;
        b -= 1;
    } 
    if(a > b) {
        res += a;
        a -= 1;
    } else {
        res += b;
        b -= 1;
    }
    cout << res << endl;

    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.nextLine());

		int[][] map = new int[n][n];
		int[][] tmpj = new int[n][n + 1];
		
		for (int i = 0; i < n; i++) {
			String[] nico = sc.nextLine().split(" ");
			
			tmpj[i][0] = 0;
			for (int j = 0; j < n; j++) {
				map[i][j] = Integer.parseInt(nico[j]);

				tmpj[i][j + 1] = tmpj[i][j] + map[i][j];
			}
		}
		
		int max = Integer.MIN_VALUE;
		for (int si = 0; si < n; si++) {
			for (int ei = (si + 1); ei <= n; ei++) {

				for (int sj = 0; sj < n; sj++) {
					for (int ej = (sj + 1); ej <= n; ej++) {
						
						int sum = 0;
						for (int i = si; i < ei; i++) {
							sum = sum + tmpj[i][ej] - tmpj[i][sj];
						}
						if (max < sum) max = sum;
					}
				}
			}
		}
		
		System.out.println(max);
	}
}

Measured memory_bytes: 31904
#include <stdio.h>

int main(void)
{
	int i, num, rest, N, K, D[10] = {0};

	scanf("%d%d", &N, &K);
	for (i = 0; i < K; i++) {
		scanf("%d", &num);
		D[num] = 1;
	}

	for (i = N;; i++)	{
		num = i;
		while (num > 0) {
			rest = num % 10;
			if (D[rest] == 1) break;
			num /= 10;
		}
		if (num == 0) {
			printf("%d\n", i);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#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 << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=1e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }


int n,m,vis[N],dp[N];
vi adj[N];





void solve() {
     cin>>n>>m;
     
     rep(i,0,m) {
		   int x,y;
		   cin>>x>>y;
		   adj[x].pb(y);
		   adj[y].pb(x);
		 }
		 

	
	vis[1]=1;
	queue<int> q;
	q.push(1);
	vis[1]=1;
	
	while(!q.empty()) {
		  int ver=q.front();
		  q.pop();		  
		  
		  for(auto to:adj[ver]) {
			     if(!vis[to]) {
					    dp[to]=ver;
					    vis[to]=1;
					    q.push(to);
					 }
			  }		  
		}
	
	
	rep1(i,2,n) {
		  if(!vis[i]) {
			    cout<<"No\n";
			    return;
			  }
		}
		
	cout<<"Yes\n";
	rep1(i,2,n) {
		   cout<<dp[i]<<endl;
		}  				   
 }

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


Measured memory_bytes: 13888
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  vector<string> S(3);
  cin >> S[0] >> S[1] >> S[2];
  int turn = 'a' - 'a';
  while (true)
  {
    if (S[turn].size() == 0)
      break;

    int next_turn = S[turn][0] - 'a';
    S[turn].erase(S[turn].begin());
    turn = next_turn;
  }

  char ans = turn + 'A';
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N=int(input())
correct = True
words = set({})

W = input()
words.add(W)
last_letter = W[len(W)-1]

for i in range(1,N):
    W = input()
    if  not W in words and W[0] == last_letter:
        words.add(W)
        last_letter = W[len(W)-1]
    else:
        correct = False
        break

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


Measured memory_bytes: 62004
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb             push_back
#define conv(a)        bitset<30>(a).to_string() ;
#define mxpq           priority_queue <int>
#define mnpq           priority_queue<int,vector<int>,greater<int>>
#define S(v)           sort(v.begin(),v.end())
#define RS(v)          sort(v.rbegin(),v.rend())
#define R(v)           reverse(v.begin(),v.end())
#define print          printf("%.16f\n", ans)
#define inf            LLONG_MAX
#define mini           LLONG_MIN
#define T              int tc;cin>>tc;while(tc--)
#define MSET(tabl,i)   memset(tabl, i, sizeof(tabl))
#define int            long long 
#define MAXN           10000001
#define M              1000000007
#define fio            cin.sync_with_stdio(false) ; cin.tie(0);cout.tie(0) ;
#define endl           "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> Set;

void Xarr(){
     
      int n ; cin>>n ;
      vector<int> a(n) ;
      vector<int> b(n) ;
      for(int i=0;i<n;i++) cin>>a[i]>>b[i] ;
      if(n%2==0){
            S(a) ; S(b) ;
            int start=a[n/2]+a[n/2-1] ;
            int end=b[n/2]+b[n/2-1] ;
            cout<<end-start+1<<endl ; 
      }  
      else{
            S(a) ; S(b) ;
            int start=a[n/2] ;
            int end=b[n/2] ;
            cout<<end-start+1<<endl ;
      }
} 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
int32_t main(){
 
    cout<<fixed<<setprecision(16);
    cin.sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
 
    #ifndef ONLINE_JUDGE
     freopen("input.txt",  "r",  stdin);
     freopen("output.txt", "w", stdout);
    #endif
    
    cout << setprecision(9) << fixed;
     clock_t z = clock();
     
     Xarr();
     cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
 
     return 0;

}

Measured memory_bytes: 6384
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m; cin>>n>>m;
	vector<int>a(n);
	double lim=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		lim+=a[i];
	}
	lim = lim/(double)m/4.0;
	sort(a.rbegin(),a.rend());
	for(int i=0;i<m;i++){
		if((double)a[i]<lim){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(itr,data) for(__typeof((data).begin()) itr=(data).begin();itr!=(data).end();++itr)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long UInt64;
typedef long long Int64;

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

using namespace std;

typedef pair<int ,int > P;


int main()
{
	int a;
	int sum=0;
	rep(i,10)
	{
		cin>>a;
		sum+=a;
	}
	cout<<sum<<endl;
		return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<vector>
#include<map>
#include<string>

int main(){
	long long int n,k,q;
	std::cin>>n>>k>>q;

	std::vector<int> v(n,k);
	
	for (int i = 0; i < q; i++) {
		long long int e;
		std::cin >> e;

		v[e-1]=v[e-1]+1;
	}


	for (int i=0;i<n;i++){
		//std::cout << v[i] - q << std::endl;
		if (0 < v[i]-q) {
			std::cout << "Yes" << std::endl;
		}
		else {
			std::cout << "No" << std::endl;
		}
	}

	
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main {
	
	static int dh[] = {-1, 0,1, 0};
	static int dw[] = {0, 1,0, -1};
	static char field[][];
	static int memo[][];
	static int H;
	static int W;
	static int max = Integer.MAX_VALUE;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		H = sc.nextInt();
		W = sc.nextInt();
		field= new char[H][W];
		for(int i=0;i<H;i++) {
			String tmp = sc.next();
			for(int j=0;j<W;j++) {
				field[i][j]=tmp.charAt(j);
			}	
		}
		sc.close();
		
		memo = new int[H][W];
		for(int t[]:memo) {
			Arrays.fill(t, max);
		}
		
		int ans = dfs(0,0,1, -1, -1);
		if(ans == max) {
			System.out.println(-1);
			return;
		}
		
		int wcnt = 0; 
		for(int i=0;i<H;i++) {
			for(int j=0;j<W;j++) {
				if(field[i][j]=='.') {
					wcnt ++;
				}
			}	
		}
		
		System.out.println(wcnt - ans);
		
	}
	
	static int dfs(int h, int w, int cnt, int bh, int bw) {
		if(field[h][w]=='#') return max;
		if(memo[h][w]<=cnt) return max; //すでに探索済みで、自分より短ければもう探索しない。
		memo[h][w]=cnt;
		if(h==H-1&&w==W-1) return cnt;
		int minD = max;
		for(int i=0;i<4;i++) {
			int nh = h + dh[i];
			int nw = w + dw[i];
			if(0<=nh&&nh<H&&0<=nw&&nw<W) {
				if(nh == bh && nw == bw)continue;
				minD = Math.min(minD, dfs(nh, nw, cnt+1, h, w));
			}
		}
		return minD;
	}
	
}



Measured memory_bytes: 21968
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        n: usize,
        s: chars
    }
    let mut cnt = 0;
    for i in 0..n-2 {
        if s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C' {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}
/* vim:set foldmethod=marker: */


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

int main(){
  int N,j=0;
  string A,B,C;
  cin>>N>>A>>B>>C;
  for(int i=0;i<N;i++)
    if(A[i]!=B[i] || B[i]!=C[i])
      if(A[i]==B[i] || B[i]==C[i] || C[i]==A[i])
        j++;
      else
        j+=2;
  cout<<j<<endl;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n;
  cin >> n;
  vector<int64> xs(n), ys(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i] >> ys[i];
  }
  sort(xs.begin(), xs.end());
  sort(ys.begin(), ys.end());

  auto median_fn = [](const vector<int64>& xs) -> int64 {
    if (xs.size() % 2 == 1) {
      return xs[xs.size() / 2];
    } else {
      return xs[xs.size() / 2 - 1] + xs[xs.size() / 2];
    }
  };
  int64 xm = median_fn(xs);
  int64 ym = median_fn(ys);
  cout << ym - xm + 1 << endl;
}


Measured memory_bytes: 6364
import sys
sys.setrecursionlimit(500*500)

def search(tree, now, pre, t, ans):
  nex_li = tree[now]
  for nex, w in nex_li:
    if pre == nex:
      continue
    t1 = t+w
    if t1%2 == 0:
      ans[nex] = 0
    else:
      ans[nex] = 1
    ans = search(tree, nex, now, t1, ans)
  return ans

def run():
  N = int(input())
  tree = {}
  for n in range(N-1):
    u, v, w = map(int, input().split())
    tree.setdefault(u, []).append((v, w%2))
    tree.setdefault(v, []).append((u, w%2))
  ans = [0]*(N+1)
  ans = search(tree, 1, -1, 0, ans)
  for a in ans[1:]:
    print(a)
  
  
if __name__ == '__main__':
    run()

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

int main (){
	int H,W;
	while(true){
		cin >> H >>W;
		if(H==0 &&W==0) break;
		for(int i = 0;i<H;++i){
			if(i==0 || i==H-1){
				for(int j=0;j<W;++j){
					cout <<"#";
				};
			}
			else {
				cout<<"#";
				for(int k=1;k<W-1;++k){
					cout <<".";
				};
				cout<<"#";
			}
			cout << "\n";
		}
		cout << "\n";
	}
	return 0;
}

Measured memory_bytes: 1120
#include <iostream>
#include <map>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
constexpr ll mod = 1000000007;
map<pll,ll> mp;
ll pw(ll a,ll x){
    ll ret = 1;
    while(x){
        if(x&1) (ret *= a) %= mod;
        (a *= a) %= mod; x /= 2;
    }
    return ret;
}

ll gcd(ll a, ll b){
    if(a<0) a *= -1;
    if(b<0) b *= -1;
    if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(a%b,b);
}

int main(){
    int i,n,cnt = 0;
    cin >> n;
    for(i=0;i<n;i++){
        ll a,b; cin >> a >> b;
        if(a==0 && b==0){
            cnt++;
        }else{
            ll x = gcd(a,b);
            a /= x; b /= x;
            if(a<0){
                a *= -1; b *= -1;
            }
            if(a==0){
                b = 1;
            }
            mp[{a,b}]++;
        }
    }
    ll ans = 1;
    for(auto p:mp){
        auto pp = p.first;
        ll a = pp.first,b = pp.second;
        ll aa = -b,bb = a;
        if(aa<0){
            aa *= -1; bb *= -1;
        }
        if(aa==0){
            bb = 1;
        }
        if(mp.find({aa,bb})!=mp.end()){
            ll s = mp[{aa,bb}],t = p.second;
            (ans *= ((pw(2,s) + pw(2,t) - 1)%mod)) %= mod;
            mp.erase({aa,bb});
        }else{
            (ans *= pw(2,p.second)) %= mod;
        }
    }
    (ans += cnt+mod) %= mod;
    cout << ((ans - 1) + mod ) % mod << endl;
}


Measured memory_bytes: 16100
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

using namespace std;

typedef long long ll;

typedef pair<int,int> P1;
typedef pair<int,P1> P2;
const ll inf=100000000000000;
struct edge{
	int to,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

#define MAX_N 100001
int dp[MAX_N]={};
bool d[MAX_N]={};
vector<edge> G[MAX_N];

int main() {
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	int r=2*n;
	rep(i,n){
		if(s.substr(n-i-1,i+1)==t.substr(0,i+1)){
			r=min(r,2*n-i-1);
		}
	}
	cout<<r<<endl;
	return 0;
}


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = 0; i < (a); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define fst first
#define snd second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  unordered_map<string, int> mp;
  ll ans = 0;
  rep(i, n) {
    string s;
    cin >> s;
    sort(all(s));
    if(mp.find(s) != mp.end()) {
      ans += mp[s];
      mp[s] += 1;
    }
    else mp[s] = 1;
  }
  out(ans);
  return 0;
}


Measured memory_bytes: 10660
#include <stdio.h>
#include<math.h>
int main(void){
    int x,a,b;
    scanf("%d%d%d",&x,&a,&b);
    if(a-b>=0) printf("delicious\n");
    else if(a-b>=-x) printf("safe\n");
    else printf("dangerous\n");
    return 0;
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

const ll MX = 1e18;

int main(void){
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  if(a[0]==0){
    cout << "0" << endl;
    return 0;
  }
  
  ll ans=1;
  bool ng = false;
  rep(i,n){
    if(ng || MX/ans < a[i]){
      ng = true;
    }
    ans *= a[i];
  }
  
  if(ng) cout << "-1" << endl;
  else cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3996
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
int main() 
{
    ll n, han = 0;
    cin >> n;
    vector<ll> a(n), b(n), anum(n, 0), bnum(n, 0);
    for(ll i = 0; i < n; i++) {
        cin >> a.at(i);
        anum.at(a.at(i) - 1)++;
    }
    for(ll i = 0; i < n; i++) {
        cin >> b.at(i);
        bnum.at(b.at(i) - 1)++;
    }
    for(ll i = 0; i < n; i++) {
        if(anum.at(i) + bnum.at(i) > n) {
            han = 1;
        }
    }

    if(han) {
        cout << "No";
    } else { 
        cout << "Yes" << endl;
        sort(b.rbegin(), b.rend());
        ll irekae = 0;
        for(ll i = 0; i < n; i++) {
            if(a.at(i) == b.at(i)) {
                while(1) {
                if(a.at(i) != b.at(irekae) && b.at(i) != a.at(irekae)) {
                ll k = b.at(i);
                b.at(i) = b.at(irekae);
                b.at(irekae) = k;
                irekae++; break;
                }
                else
                    irekae++;
                }
            }
        }
        for(ll i = 0; i < n; i++) {
            cout << b.at(i) << " ";
        }
    }

    return 0;
}

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

class Program
{
    public static void Main()
    {
        int[] data = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int w = data[0];
        int h = data[1];
        int x = data[2];
        int y = data[3];
        int r = data[4];
        
        if((x + r > w || x - r < 0) || (y + r > h || y - r < 0))
        {
            Console.WriteLine("No");
        }else
        {
            Console.WriteLine("Yes");
        }
        
    }
}


Measured memory_bytes: 18448
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var ac = 0;
        var wa = 0;
        var tle = 0;
        var re = 0;

        for(var i = 0; i < n; i++)
        {
            var line = Console.ReadLine();
            if (line == "AC")
            {
                ac += 1;
            }
            else if (line == "WA")
            {
                wa += 1;
            }
            else if(line == "TLE")
            {
                tle += 1;
            }
            else if(line == "RE")
            {
                re += 1;
            }
        }


        Console.WriteLine("AC x " + ac);
        Console.WriteLine("WA x " + wa);
        Console.WriteLine("TLE x " + tle);
        Console.WriteLine("RE x " + re);


        Console.ReadLine();

    }

}


Measured memory_bytes: 20712
function Main(input) {
    var data = input.split("\n")
	var num = data[0].split(' ');
	if(num[0] >9 || num[1] > 9) {
		console.log('-1');
	}else {
		console.log(num[0] * num[1]);
	}
}
 
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
from operator import add, sub
from itertools import product
a, b, c, d = map(int, input().strip())
e = {add:'+', sub:'-'}
for X in product([add, sub], repeat=3):
  if X[2](X[1](X[0](a, b), c), d) == 7:
    print('{}{}{}{}{}{}{}=7'.format(a, e[X[0]], b, e[X[1]], c, e[X[2]], d))
    exit()

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

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    vector<pair<int,int>> v(n);
    for(int i=0;i<n;i++)
    {
        int t;
        scanf("%d",&t);
        v[i]={t,i+1};
    }
    sort(v.begin(),v.end());
    for(pair<int,int> p:v) printf("%d ",p.second);
    printf("\n");
    return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	cout << min({ a + b,a + c,b + c }) << endl;;
}

Measured memory_bytes: 256
class Dice:
    def __init__(self, face_val=None):
        self.top = 1
        self.front = 2
        self.left = 4
        self.FaceValue = {}
        if face_val is None or len(face_val) != 6:
            face_val = [1, 2, 3, 4, 5, 6]

        for i, val in enumerate(face_val):
            self.FaceValue[i+1] = val

    def dice_move(self, direction):
        if direction == 'S':
            tmp = self.top
            self.top = 7 - self.front
            self.front = tmp
        elif direction == 'W':
            tmp = self.top
            self.top = 7 - self.left
            self.left = tmp
        elif direction == 'E':
            tmp = self.top
            self.top = self.left
            self.left = 7 - tmp
        elif direction == 'N':
            tmp = self.top
            self.top = self.front
            self.front = 7 - tmp

    def top_value(self):
        return self.FaceValue[self.top]

    def __repr__(self):
        return f'({self.top},{self.front},{self.left})'


faces = input().split()
directions = input()

dice = Dice(faces)
for direction in directions:
    #print(direction, dice, end=',to,')
    dice.dice_move(direction)
    #print(dice)

print(dice.top_value())


Measured memory_bytes: 5584
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
using namespace std;
int main(void){
    map<string,int> m;
    string s1,s2,s3;
    int n1,n2;
    cin>>s1>>s2;
    cin>>n1>>n2;
    cin>>s3;
    m[s1]=n1;
    m[s2]=n2;
    m[s3]--;
    cout<<m[s1]<<" "<<m[s2];
}


Measured memory_bytes: 256
k, s  = map(int, input().split())

ans1 = 0
ans2 = 0
ans3 = 0

for i in range(k+1):
    for j in range(i, k+1):    
        if 0 <= s-i-j <= k and j <= s-i-j:
            if i == j == s-i-j:
                ans1 +=1
            elif i == s-i-j or i == j or j == s-i-j:
                ans2 += 1
            else:
                ans3 += 1
                    

print(ans1+ans2*3+ans3*6)
#print(ans1, ans2, ans3)


Measured memory_bytes: 9116
#!/usr/bin/env python

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def main():
    ans = 0
    for i in range(N):
        if B[i] <= A[i]:
            ans += B[i]
        else:
            ans += A[i]
            B[i] = B[i] - A[i]
            if B[i] <= A[i+1]:
                ans += B[i]
                A[i+1] = A[i+1] - B[i]
            else:
                ans += A[i+1]
                A[i+1] = 0
    return ans

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

Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> pii;
int main() {
    string s; cin >> s;
    if(s == "Sunny") cout << "Cloudy" << endl;
    else if(s == "Cloudy") cout << "Rainy" << endl;
    else if(s == "Rainy") cout << "Sunny" << endl;
    else;
    return 0;
}


Measured memory_bytes: 3564