akhauriyash/Code-Regression huggingface dataset:
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
#define MOD (1e9+7)
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")



/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main() { 
  int n;cin>>n;
  string a,b;cin>>a>>b;
  for(int i = 0; n > i; i++){
    cout << a[i] << b[i];
  }
  cout << endl;
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

double dp[3000][3000];

int main() {

  i32 n;
  cin >> n;
  vector<double> p(n);
  rep(i, n) { cin >> p[i]; }

  dp[0][0] = 1 - p[0];
  dp[0][1] = p[0];

  for (i32 i = 1; i < n; i++) {
    rep(j, n + 1) {
      if (j > 0) {
        dp[i][j] = dp[i - 1][j - 1] * p[i] + dp[i - 1][j] * (1 - p[i]);
      } else {
        dp[i][j] = dp[i - 1][j] * (1 - p[i]);
      }
    }
  }

  double ans = 0;

  // rep(i, n) {
  //   rep(j, n + 1) { cout << dp[i][j] << '\t'; }
  //   cout << endl;
  // }

  for (i32 i = (n + 1) / 2; i < n + 1; i++) {
    ans += dp[n - 1][i];
  }

  printf("%.10lf",ans);

  return 0;
}


Measured memory_bytes: 74120
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <vector>

using namespace std;

int main(){
  long long int H, W, N;
  scanf("%lld%lld%lld", &H, &W, &N);
  vector<pair<long long int,long long int> > ab(N, pair<long long int,long long int>(0,0));
  set<pair<long long int,long long int> > black;
  for (int i = 0; i < N; i++){
    scanf("%lld%lld", &(ab[i].first), &(ab[i].second));
    black.insert(ab[i]);
  }
  set<pair<long long int,long long int> > check;
  for (int i = 0; i < N; i++){
    for (int y = -2; y <= 2; y++){
      for (int x = -2; x <= 2; x++){
        int yy = ab[i].first + y;
        int xx = ab[i].second + x;
        if ((1 < yy) && (yy < H) && (1 < xx) && (xx < W)){
          check.insert(pair<long long int,long long int>(yy, xx));
	}
      }
    }
  }
  vector<long long int> counter(10, 0);
  long long int totalcounter = 0;
  for (set<pair<long long int,long long int> >::iterator iter = check.begin(); iter != check.end(); iter++){
    int bcounter = 0;
    for (int y = -1; y <= 1; y++){
      for (int x = -1; x <= 1; x++){
        if (black.find(pair<long long int, long long int>(iter->first+y, iter->second+x)) != black.end()){
          bcounter++;
	}
      }
    }
    counter[bcounter]++;
    if (bcounter != 0){
      totalcounter++;
    }
  }
  counter[0] = (H-2)*(W-2)-totalcounter;
  for (int i = 0; i < 10; i++){
    cout << counter[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 164352
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

struct seed {
  string name;
  int p,a,b,c,d,e,f,s,m;
};

using ps = pair<double, string>;

int main() {
  int n;
  while (cin >> n and n != 0) {
    vector<seed> seeds(n);
    vector<ps> eff;
    rep(i, n) {
      string name;
      int a,b,c,d,e,f,s,m,p;
      cin >> name >> p >> a >> b >> c >> d >> e >> f >> s >> m;
      seeds[i] = {name, p, a, b, c, d, e, f, s, m};
    }

    for (auto&& sed : seeds) {
      ps p;
      double cnt = 0;
      double time = 0;
      p.second = sed.name;
      time += sed.a + sed.b + sed.c;
      rep(i, sed.m) {
        time += sed.d + sed.e;
        cnt += sed.f;
      }

      p.first = ((cnt * sed.s) - sed.p) / time;
      eff.emplace_back(p);
    }

    sort(eff.begin(), eff.end(), [](auto const& lhs, auto const& rhs){ 
      if (lhs.first != rhs.first) return lhs.first < rhs.first;
      else return lhs.second > rhs.second;
    });

    for (auto itr = eff.rbegin(); itr != eff.rend(); ++itr) {
      cout << itr->second << endl;
    }

    cout << "#" << endl;
  } 
}



Measured memory_bytes: 3024
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main()
{
    int R, C, K;
    cin >> R >> C >> K;
    vector<vector<ll>> rcv(R, vector<ll>(C, 0)); 
    int r, c;
    ll v;
    for (int i = 0; i < K; i++) {
        cin >> r >> c >> v;
        rcv[r-1][c-1] = v;
    }
    ll _inf = -1000000000000000000;
    vector<vector<vector<ll>>> dp(R, vector<vector<ll>>(C, vector<ll>(4, _inf)));
    dp[0][0][0] = 0;
    if (rcv[0][0] > 0) {
        dp[0][0][1] = rcv[0][0];
    }
    for (int i = 0; i < R; i++) {
        for (int j = 0; j < C; j++) {
            for (int k = 0; k <= 3; k++) {
                if (j+1 < C) {
                    if (rcv[i][j+1] > 0 && k < 3 && dp[i][j][k] != _inf) {
                        dp[i][j+1][k+1] = max(dp[i][j+1][k+1], dp[i][j][k] + rcv[i][j+1]);
                    }
                    dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]);
                }
                if (i+1 < R) {
                    if (rcv[i+1][j] > 0 && dp[i][j][k] != _inf) {
                        dp[i+1][j][1] = max(dp[i+1][j][1], dp[i][j][k] + rcv[i+1][j]);
                    }
                    dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][k]);
                }
            }
        }
    }

    ll ans = _inf;
    for (int k = 0; k <= 3; k++) {
        ans = max(ans, dp[R-1][C-1][k]);
    }
    cout << ans << endl;
}

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

int n;
LL sum[maxn];
int ar[maxn];
LL dp[maxn][maxn];

int main() {
	scanf("%d",&n);
	for( int i = 1 ; i <= n ; i++ ) {
		scanf("%d",&ar[i]);
		sum[i] = sum[i-1] + ar[i];
	}
	for( int len = 2 ; len <= n ; len++ )
		for( int i = 1 ; i <= n-len+1 ; i++ ) {
			int j = i+len-1;
			dp[i][j] = (1LL << 60);
			for( int k = i ; k < j ; k++ )
				dp[i][j] = min( dp[i][j] , dp[i][k] + dp[k+1][j] );
			dp[i][j] += sum[j] - sum[i-1];
		}
	printf("%lld\n",dp[1][n]);
	return 0;
}


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

int i, j;

int main(){
    int a, b, c, x, sol = 0;
    cin >> a >> b >> c >> x;
    for(i = min(a, x / 500); i > -1; i--){
        for(j = min(b, x / 100); j > -1; j--){
            if(500 * i + 100 * j > x){
                continue;
            }else{
                //printf("500 * %d + 100 * %d = %d\n", i, j, 500 * i + 100 * j);
                if((x - 500 * i - 100 * j) / 50 >= 0 && (x - 500 * i - 100 * j) / 50 <= c){
                    sol++;
                    //printf(" + 50 * %d: sol %d\n", (x - 500 * i - 100 * j) / 50, sol);
                }
            }
        }
    }
    cout << sol << endl;
    return 0;
}

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

int main(){
    int N;
    int ans=0;
  int max =0;

    cin >> N;
    int P[N];
    for(int i = 1;i<=N;i++){
        cin >> P[i];
        if(max < P[i])max = P[i];
        ans = ans + P[i];
    }

    cout << ans - max/2;
}

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

int main(){
  int n;cin >> n;
  vector<int> a(n);
  long long ans=1;
  int count=0;
  for(int i=0;i<n;i++)cin >> a[i];
  sort(a.rbegin(),a.rend());
  for(int i=0;i<n;i++){
    if(a[i]==a[i+1]){
      ans *= a[i];
      count++;
      i++;
    }
    if(count==2)break;
  }
  if(count==2)cout << ans << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 640
import java.io.*;
class Main{
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String line = br.readLine();
    String[] array = line.split(" ");
    if (!(array.length == 3))
      return;
    int a = Integer.parseInt(array[0]);
    int b = Integer.parseInt(array[1]);
    int c = Integer.parseInt(array[2]);
    if(a < b && b < c) {System.out.println("Yes");}
    else {System.out.println("No");}
  }
}

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


int main(void){
    int n; cin >> n;
    if(n%2) cout << (n-1)/2 << endl;
    else cout << n/2 - 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  	int x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;

    int x3 = x2 + (y1 - y2);
    int y3 = y2 + (x2 - x1);
    int x4 = x3 - (x2 - x1);
    int y4 = y3 - (y2 - y1);
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <assert.h>

unsigned int a;           //現在時刻
unsigned int b;           //コンテストが始まるまでの時間
unsigned int c;           //コンテストが始まる時間
int i;                    //カウント変数

int main()
{
  std::cin >> a >> b;
  assert(0<=a && a<24);
  assert(0<=b && b<24);
  c = a+b;
  c %= 24;
  std::cout << c << '\n';
  return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int N;
    cin >> N;
    vector<int> a(N);
    for (auto &&i : a) {
        cin >> i;
    }
    SORT(a);
    int ans = 0;
    REP(i, 8) {
        int cnt = upper_bound(ALL(a), 400 * (i + 1) - 1) -
                  lower_bound(ALL(a), 400 * i);
        if (0 < cnt)
            ans++;
    }
    int mx = a.end() - lower_bound(ALL(a), 3200);
    print(max(ans, 1), ans + mx);

    return 0;
}


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

int main() {
	int n,x;cin>>n>>x;
	int ans=0;
	vector<int> a(n);
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	for(int i=0;i<n;++i){
		if(x<=0)break;
		if(i==n-1){
			if(a[i]%x==0)++ans;
		}else{
			x-=a[i];
			if(x>=0)++ans;
		}
	}
	cout<<ans<<endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
        int al[26] = {};
        char se[1201];
        int i,len;

        while(scanf("%s",se) != EOF){
                len = strlen(se);

                for(i=0;i<len;i++){
                        if(se[i] >= 'a' && se[i] <= 'z'){
                                al[se[i]-'a']++;
                        }else if(se[i] >= 'A' && se[i] <= 'Z'){
                                al[se[i]-'A']++;
                        }
                }
        }
        for(i=0;i<26;i++){
                printf("%c : %d\n",'a'+i,al[i]);
        }
        return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int ans=s.size();
    for(int i=1;i<s.size();i++){
        if(s[i-1] == s[i])continue;
        ans = min(ans, max(i, (int)s.size() - i));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<queue>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

// dijkstra
template<typename Edge>
struct dijkstra {
  using Graph = std::vector<std::vector<Edge>>;
  using T = typename Edge::cost_type;
  using GP = std::pair<T, int>;
  using Q = std::priority_queue<GP, std::vector<GP>, std::greater<GP>>;

  Graph& G;
  int N;
  std::vector<T> d;
  T INF;
  dijkstra(Graph& Graph, T inf): G(Graph), N(Graph.size()), INF(inf) {}

  void search(int s) {
    Q q;
    d.assign(N, INF);
    d[s] = 0;
    q.push(GP(0, s));
    while(!q.empty()) {
      GP p = q.top(); q.pop();
      int v = p.second;
      if(d[v] < p.first) continue;
      for(auto e: G[v]) {
        T newd = d[v]+e.cost;
        if(newd >= d[e.to]) continue;
        if(newd >= INF) continue;
        d[e.to] = newd;
        q.push(GP(d[e.to], e.to));
      }
    }
  }
};

struct edge {
  using cost_type = int;
  cost_type cost;
  int to;
  edge(cost_type c, int t): cost(c), to(t) {}
};


int main() {
  int N, M; std::cin >> N >> M;
  std::vector<std::vector<edge>> G(N*3);
  for(int i = 0; i < M; ++i) {
    int u, v; std::cin >> u >> v; --u; --v;
    G[u].emplace_back(1, N+v);
    G[N+u].emplace_back(0, N+N+v);
    G[N+N+u].emplace_back(0, v);
  }
  dijkstra<edge> dij(G, N+N);
  int S, T; std::cin >> S >> T; --S; --T;
  dij.search(S);
  int ans = dij.d[T];
  if(ans > N) ans = -1;
  fin(ans);
  return 0;
}


Measured memory_bytes: 17792
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define sec second
#define fir first
#define min3(a,b,c) min(min(a,b),c)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define entire(a) (a).begin(),(a).end()
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
std::vector<ll> v[3];
ll n;
int memo[100005][3];
ll dp(ll i, ll last)
{
	// cout << i << endl;
	if (i == n)
		return 0;
	if (memo[i][last] != -1)
		return memo[i][last];
	if (last == 0)
		return memo[i][last]=max(v[1][i] + dp(i + 1, 1), v[2][i] + dp(i + 1, 2));
	if (last == 1)
		return memo[i][last]=max(v[0][i] + dp(i + 1, 0), v[2][i] + dp(i + 1, 2));
	return memo[i][last]=max(v[1][i] + dp(i + 1, 1), v[0][i] + dp(i + 1, 0));

}
void solve()
{
	memset(memo, -1, sizeof(memo));
	cin >> n;
	rep(i, n)
	{
		ll x, y, z;
		cin >> x >> y >> z;
		v[0].pb(x);
		v[1].pb(y);
		v[2].pb(z);
	}
	reverse(entire(v[0]));
	reverse(entire(v[1]));
	reverse(entire(v[2]));
	cout << max(max(v[0][0] + dp(1, 0), v[1][0] + dp(1, 1)), v[2][0] + dp(1, 2)) << endl 	;

}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast
	int T = 1;
	// cin >> T;
	while (T--)
	{
		solve();
	}
	return 0;
}


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

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

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

  int all = pow(3, N);
  // 似ている数列の数は3^N これから、全部奇数となるものを引く
  // もとが偶数→奇数(+1,-1)の2通り. よって、偶数の個数^2(たぶん)

  int count = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] % 2 == 0) count++;
  }
  //  cout << count << endl;

  int count_even_number = pow(2, count);
  cout << all - count_even_number << endl;

  return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    int m,d;
    cin >> m >> d;

    int ans = 0;
    repm(i,1,m+1){
        repm(j,1,d+1){
            int d1 = j%10;
            int d10 = j/10;
            if(d1 != 1 && d10 != 1 && d1*d10 == i){
                ans++;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>

using namespace std;
using lli = long long int;
// #define DEBUG
#ifdef DEBUG
#define debug(var) cout << (#var) << ": " << (var) << endl;
template<class T> void dump_array_impl(const T& a) {
  bool first = true;
  for (auto&& x : a) {
    if (!first) cout << ", "; else first = false; cout << x;
  }
}
#define debug_array(a) cout<<(#a)<<": ";dump_array_impl(a);cout<<endl
#else
#define debug(var) {}
#define debug_array(a) {}
#endif
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i];
}
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n;
vector<bool> sieve;
vector<lli> a;
int main() {
  sieve = vector<bool>(55555*5, true);
  sieve[0] = sieve[1] = false;
  for (lli i=2; i<=sieve.size(); ++i) {
    if (sieve[i])
      for (lli j=2*i; j<=sieve.size(); j+=i) sieve[j] = false;
  }
  cin >> n;
  for (lli i=2; i<=55555; ++i) {
    if (sieve[i] && i%5==1) a.push_back(i);
  }
  for (lli i=0; i<n; ++i) {
    if (i>0) cout << ' ';
    cout << a[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a , b , count = 0 ,s;
  
  scanf("%d %d",&a,&b);
  
  for(int i = a;i <= b;i++){
    int temp = i;
    int k = temp%10;
    s = temp;
    temp = s/10;
    int l = temp%10;
    s = temp;
    temp = s/10;
    int n = temp%10;
    s = temp;
    temp = s/10;
    int m = temp%10;
    s = temp;
    temp = s/10;
    int p = temp%10;
    if(k==p&&l==m){
      count ++;
    }
  }
  
   printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
using namespace std;
const int MAX=110;
bool dp[MAX];
int n,m;
int main(){
    scanf("%d",&n);
    dp[0]=1;
    for(int i=1;i<=n;i++){
        if(i<4);
        else if(i<7) dp[i]=dp[i-4];
        else if(dp[i-4]==1||dp[i-7]==1) dp[i]=1;
    }
    if(dp[n]) printf("Yes");
    else printf("No");
}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    char x, y;
    cin >> x >> y;
    if (x < y) {
        cout << "<" << endl;
    }
    else if (x > y) {
        cout << ">" << endl;
    }
    else {
        cout << "=" << endl;
    }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)

# 昔同じ問題を atcoder で見た？
n = int(input())
edges = []
paths = {}
for i in range(n-1):
    a, b = list(map(int, input().split(' ')))
    edges.append((a, b))
    paths[a] = paths.get(a, []) + [b]
    paths[b] = paths.get(b, []) + [a]
# print(edges)
# print(paths)
colors = {}  # (a->b) 1 とか
current = 1
biggest = 1
def f(current, prev, prev_color):
    global biggest
    color = 0
    for vertex in paths[current]:
        if vertex == prev:
            continue
        color += 1
        if color == prev_color:
            color += 1
        biggest = max(biggest, color)
        colors[(current, vertex)] = color
        f(vertex, current, color)
f(1, None, None)

print(biggest)
for a, b in edges:
    print(colors[(a, b)])
# pypy3

Measured memory_bytes: 228872
#define taskname "test"

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long lli;
typedef pair<int, int> pii;
const int maxn = 45;
const int inf = 1e6;
int n, m;
char ice[maxn][maxn];
int pi, pj;

int sum[maxn][maxn];

int dp[maxn][maxn][maxn][maxn];

void read_input()
{
    cin >> n >> m;
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
        {
            cin >> ice[i][j];
            if(ice[i][j] == 'P')
            {
                pi = i;
                pj = j;
            }
        }
}

inline int get_sum(int li, int lj, int ri, int rj)
{
    return sum[ri][rj] - sum[li - 1][rj] - sum[ri][lj - 1] + sum[li - 1][lj - 1];
}

bool p_inside(int li, int lj, int ri, int rj)
{
    return pi >= li && pi <= ri && pj >= lj && pj <= rj;
}

void minim(int&tar, int val)
{
    if(tar > val) tar = val;
}

int DP(int li, int lj, int ri, int rj)
{
    if(dp[li][lj][ri][rj] != -1) return dp[li][lj][ri][rj];
    int res = inf;
    for(int i = li - 1; i > 0; --i)
        for(int j = lj - 1; j > 0; --j)
            minim(res, DP(i, j, ri, rj) + get_sum(i, lj, li - 1, rj) + get_sum(li, j, ri, lj - 1));
    for(int i = li - 1; i > 0; --i)
        for(int j = rj + 1; j <= m; ++j)
            minim(res, DP(i, lj, ri, j) + get_sum(i, lj, li - 1, rj) + get_sum(li, rj + 1, ri, j));
    for(int i = ri + 1; i <= n; ++i)
        for(int j = rj + 1; j <= m; ++j)
            minim(res, DP(li, lj, i, j) + get_sum(li, rj + 1, ri, j) + get_sum(ri + 1, lj, i, rj));
    for(int i = ri + 1; i <= n; ++i)
        for(int j = lj - 1; j > 0; --j)
            minim(res, DP(li, j, i, rj) + get_sum(li, j, ri, lj - 1) + get_sum(ri + 1, lj, i, rj));
    return dp[li][lj][ri][rj] = res;
}

void solve()
{
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j)
            sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + (ice[i][j] == '#');
    fill_n(&dp[0][0][0][0], sizeof(dp) / sizeof(dp[0][0][0][0]), -1);
    dp[1][1][n][m] = 0;
    int ans = inf;
    for(int li = 1; li <= n; ++li)
        for(int lj = 1; lj <= m; ++lj)
            for(int ri = li; ri <= n; ++ri)
                for(int rj = lj; rj <= m; ++rj)
                    if(p_inside(li, lj, ri, rj))
                        minim(ans, DP(li, lj, ri, rj) + min(get_sum(li, lj, pi, pj), min(get_sum(li, pj, pi, rj),
                                                        min(get_sum(pi, lj, ri, pj), get_sum(pi, pj, ri, rj)))));
    cout << ans << '\n';
}

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


Measured memory_bytes: 16384
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 100000000;

int main() {
    ll a,b,x,ans;
    cin >> a >> b >> x;
    if (b==0) {
        cout << 1 << endl;
    }
    else if (a==0) {
        cout << b/x +1 << endl;
    }
    else {
        cout << b/x - (a-1)/x << endl;
    }
}



Measured memory_bytes: 256
package main

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

var (
	reader io.Reader = os.Stdin
	writer io.Writer = os.Stdout
)

func main() {
	reader = os.Stdin
	writer = os.Stdout
	run()
}

func run() {
	input := readStringsFromStdin()
	var results []string

	for _, in := range input {
		a, _ := strconv.Atoi(in[0])
		b, _ := strconv.Atoi(in[2])
		op := in[1]

		switch op {
		case "+":
			results = append(results, strconv.Itoa(a+b))
		case "-":
			results = append(results, strconv.Itoa(a-b))
		case "*":
			results = append(results, strconv.Itoa(a*b))
		case "/":
			results = append(results, strconv.Itoa(a/b))
		}
	}

	fmt.Fprintln(writer, strings.Join(results, "\n"))
}

// readStringsFromStdin parses lines of inputs into 2D string array.
func readStringsFromStdin() [][]string {
	out := [][]string{}
	scanner := bufio.NewScanner(reader)

	for scanner.Scan() {
		strs := strings.Split(scanner.Text(), " ")

		if strs[1] == "?" {
			break
		}

		out = append(out, strs)
	}

	return out
}



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

using ll = long long;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

const ll INF = (ll)1e11;

using namespace std;

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

    int N;
    cin >> N;

    int ans = 0, lastA = 0, firstB = 0, both = 0;
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        char pr = '_';
        for (int j = 0; j < s.length(); ++j) {
            if (pr == 'A' && s[j] == 'B') {
                ++ans;
            }
            pr = s[j];
        }
        if (s[0] == 'B' && s[s.length() - 1] == 'A') {
            ++both;
        } else if (s[s.length() - 1] == 'A') {
            ++lastA;
        } else if (s[0] == 'B') {
            ++firstB;
        }
    }

    ans += max(0, both - 1);
    if (both > 0) {
        if (lastA > 0) {
            ++ans;
            --lastA;
        }
        if (firstB > 0) {
            ++ans;
            --firstB;
        }
    }
    ans += min(lastA, firstB);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int A[] = new int[n];
		int i, j, key;
		for(i=0; i<n; i++){
			A[i] = sc.nextInt();
		}
		print(A);
		for(i=1; i<n; i++){
			key = A[i];
			j = i - 1;
			while(j>=0 && A[j]>key){
				A[j+1] = A[j];
				j--;
			}
			A[j+1] = key;
			print(A);
		}
	}
	public static void print(int A[]){
		for(int i=0; i<A.length; i++){
			if(i!=0) System.out.print(" ");
			System.out.print(A[i]);
		}
		System.out.println();
	}
}

Measured memory_bytes: 25996
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N 200005
// #define MAX 200005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"
const int inf = (int)1e18 + 10;
vecp v;
int a[N] , b[N];
bool cmp(pii a , pii b){
  if(a.ss == b.ss)
      return (a.ff > b.ff);
  else
     return (a.ss < b.ss);
}
signed main(){
  fast;
   int n ; 
  cin >> n;
  for(int i = 1 ; i <= n ; i++){
    cin >> a[i] >> b[i];
    v.pb(mp(a[i] , b[i]));
  }
  sort(v.begin() , v.end() , cmp);
  int t = 0;
  for(int i = 0 ;i < n ; i++){
        t += v[i].ff;
        if(t <= v[i].ss)
          continue;
        else{
          cout << "No\n";
          return 0;
        }
  }

  cout << "Yes\n";
    
}	

Measured memory_bytes: 8432
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const ll MOD = 1e9 +7;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,n;
    cin>>n>>x;
    cout<<3*(n-gcd(n,x))<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
void ABC100(void);
void ABC101(void);
void ABC102(void);
void ABC103(void);
void ABC104(void);
void ABC105(void);
void ABC106(void);
void ABC107(void);
void ABC108(void);
void ABC109(void);

int main(void){
    ABC100();
}

void ABC100(){
    int a,b;
    cin>>a>>b;
    if(a<=8&&b<=8)cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
}

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

using namespace std;

int main()
{
  string S;
  cin >> S;
  
  string T;
  for (uint64_t i = 0; i < S.size(); ++i) {
    if (S[i] == 'A' || S[i] == 'C') {
      T.push_back(S[i]);
    } else {
      if ((i + 1 < S.size()) && (S[i + 1] == 'C')) {
        T.push_back('D');
        ++i;
      } else {
        T.push_back(S[i]);
      }
    }
  }
  
  uint64_t Q = 0, A = 0;
  for (uint64_t i = 0; i < T.size(); ++i) {
    if (T[i] == 'A') {
      ++A;
    } else if (T[i] == 'D') {
      Q += A;
    } else {
      A = 0;
    }
  }
  cout << Q << endl;
  
  return 0;
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

string S;
int main(int argc, char **argv)
{
	cin >> S;
	ll N = S.size();
	ll res{(N*(N-1))/2+1};

	vector<ll> cnt(26, 0);
	for (auto &e : S)
	{
		++cnt[e-'a'];
	}

	ll tmp{0};
	REP(i, 26)
	{
		res -= cnt[i] * (cnt[i]-1) / 2;
	}

	std::cout << res << std::endl;
}


Measured memory_bytes: 640
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,ans=0;

int main()
{
	cin>>n;
	repn(i,2000000)
	{
		if(n/i!=0&&(n-i)%i==0&&(n-i)/i>i) ans+=(n-i)/i;//,cout<<i<<endl;
	}
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
double q;
while(scanf("%lf", &q)!= EOF && q != -1) {
double x, a;
x=q/2;
while(1){
if(fabs(x*x*x-q)<0.00001*q) break;
x=x-((x*x*x-q)/(3*x*x));
x = x;
}
printf("%.7f\n",x);                
}                            
return 0; 
}


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, int> pii;
#define f(i, l, r) for (int i = l; i <= r; i++)
#define rf(i, r, l) for (int i = r; i >= l; i--)
#define all(x) (x).begin(), (x).end()
#define sf(a) scanf("%d",&a)
#define llsf(a) scanf("%lld", &a)
#define l l
#define r r
#define lch (o << 1)
#define rch (o << 1 | 1)
#define mid ((l + r) >> 1)
#define mem(x, y) memset(x, y, sizeof(x))

const int inf = 2e9 + 7;
const ll INF = INT64_MAX;
double eps = 1e-6;
int mod = 1e9 + 7;
const int N = 1e6 + 10;
const double pi = acos(-1.0);

ll f[N];
ll exgcd(ll a, ll b, ll & x, ll & y) {
	ll c;
	return !b ? (x = 1, y = 0, a) : (c = exgcd(b, a % b, y, x), y -= (a / b) * x, c);
}
ll C(int a,int b) {
	if (a > b)swap(a, b);
	b = a + b - 2; a = a - 1;
	ll x, y; exgcd(f[a] * f[b - a] % mod, mod, x, y); if (x < 0)x += mod;
	return f[b] * x % mod;
}
int main() {
#ifdef local
	freopen("in.txt", "r", stdin);
#endif
	f[0] = 1;
	f(i, 1, 2e5)f[i] = f[i - 1] * i % mod;
	int h, w, a, b; cin >> h >> w >> a >> b;
	ll res = 0;
	f(i, 1, h - a) {
		res = (res + C(i, b + 1) * C(h - i + 1, w - b-1) % mod) % mod;
	}
	res = (res + C(h-a,b+1)*C(a,w-b)%mod) % mod;
	cout << res;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
using ll = long long;

int main(){
    int n,l,m=1000,ans=0,temp;
    cin >> n >> l;
    for(int i=0;i<n;i++){
        if(m>abs(i+l)){
            m = abs(i+l);
            temp = i+l;
        }
        ans+=i+l;
    }
    cout << ans-temp << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n, m, R;
  cin >> n >> m >> R;
  vector<int> r(R);
  REP(i, R) {
    cin >> r[i];
    r[i]--;
  }
  sort(ALL(r));
  int dist[n][n];
  REP(i, n) REP(j, n) {
    if (i == j)
      dist[i][j] = 0;
    else
      dist[i][j] = 1e9;
  }
  REP(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    dist[a][b] = dist[b][a] = c;
  }
  REP(k, n) REP(i, n) REP(j, n) {
    dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
  }
  int ans = 1e9;
  do {
    int tmp = 0;
    REP(i, R - 1) tmp += dist[r[i]][r[i + 1]];
    ans = min(tmp, ans);
  } while (next_permutation(ALL(r)));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
s = input()

flag = True
for i in range(len(s)):
    if i%2 == 0:
        if s[i] != "h":
            flag =False
            break
    else:
        if s[i] != "i":
            flag = False
            break

if len(s) == 1 or len(s) % 2 != 0:
    flag=False

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	max := -9999999999999999
	p := a + b
	if p > max {
		max = p
	}

	m := a - b
	if m > max {
		max = m
	}

	ml := a * b
	if ml > max {
		max = ml
	}

	fmt.Println(max)
}


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

using namespace std;
#define ll long long
#define ld long double

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int a, b;
    cin >> a >> b;
    int ansA = 0, ansB = 0;
    for(int i=a;i>0;i--) {
        ansA += (int)(pow(10, i - 1) + 0.5) * b;
    }
    for(int i=b;i>0;i--) {
        ansB += (int)(pow(10, i - 1) + 0.5) * a;
    }
    if(a < b) {
        cout << ansB << '\n';
    }
    else {
        cout << ansA << '\n';
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    bool flag=true;
    while (flag){
        c -= b;
        if(c<=0){
            cout << "Yes";
            flag = false;
            break;
        }

        a -= d;
        if(a<=0){
            cout << "No";
            flag = false;
            break;
        }
    }
    

    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;

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

int main(){
	int n,m;
	cin >>n >>m;
	if(n < m){
		int temp;
		temp = m;
		m = n;
		n = temp;
	}
	cout << gcd(n,m) << endl;
	return 0;
}

Measured memory_bytes: 3076
import java.util.PriorityQueue;
import java.util.Scanner;

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

		int N = sc.nextInt();
		
		PriorityQueue<String> pq = new PriorityQueue<>();

		for(int i=0; i < N; i++) {
			pq.add(sc.next());
		}
		
		int[]  C = new int[4];
		while(!pq.isEmpty()) {
			String word = pq.poll();
			switch(word) {
			case "AC":
				C[0] ++;
				break;
			case "WA":
				C[1] ++;
				break;
			case "TLE":
				C[2] ++;
				break;
			case "RE":
				C[3] ++;
				break;
			}
			
		}
		
		
		System.out.println("AC x " + C[0]);
		System.out.println("WA x " + C[1]);
		System.out.println("TLE x " + C[2]);
		System.out.println("RE x " + C[3]);


	}
}



Measured memory_bytes: 63576
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v<10050:
                ans[v]+=1
for i in range(n):
    print(ans[i+1])


Measured memory_bytes: 9252
# -*- coding: utf-8 -*-

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

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

print(-1,-1,-1)


Measured memory_bytes: 2940
N = int(input())
A, B = list(map(int, input().split()))
P = list(map(int, input().split()))

P.sort()

c1, c2, c3 = 0, 0, 0
for i, p in enumerate(P, 1):
    if p <= A:
        c1 = i
    if (p > A) and (p <= B):
        c2 = i
    if p > B:
        c3 = i


if c1 <= c2 <= c3:
    print(min((c1), (c2 - c1), (c3 - c2)))
else:
    print(0)


Measured memory_bytes: 3064
import java.util.*;
class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int cnt=0,in;
		while(true) {
			cnt++;
			in = Integer.parseInt(s.next());
			if(in==0)
				return;
			System.out.printf("Case %d: %d\n",cnt,in);
		}
	}
}

Measured memory_bytes: 57544
def main():
    a, v = [int(x) for x in input().split()]
    b, w = [int(x) for x in input().split()]
    t = int(input())
    distance = abs(b - a)
    closing = v - w
    try:
        need = distance / closing
    except ZeroDivisionError:
        if distance == 0:
            need = 0
        else:
            need = 10 ** 9 + 10

    if 0 <= need <= t:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


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

typedef long long ll;
const int MAX_N = 30;    // Change as necessary
const ll  MODD = 1000000009; //

char A[MAX_N][MAX_N];
int H,W;

int ctr;

void f(int I,int J){
  if(A[I][J] != '#') return;
  
  if(A[I+1][J] == '#' && A[I][J+1] == '#'){
    cout << "Impossible" << endl;
    exit(0);
  }
  
  if((I && A[I-1][J] == '#') || (J && A[I][J-1] == '#')){
    cout << "Impossible" << endl;
    exit(0);
  }
  
  if(I == H-1 && J == W-1){
    ctr++;
    return;
  }
  
  A[I][J] = 'w';
  
  f(I+1,J);
  f(I,J+1);
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  cin >> H >> W;
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++)
      cin >> A[i][j];
  
  f(0,0);
  
  cout << (ctr == 1 ? "Possible" : "Impossible") << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    K,S = (int(x) for x in input().split())

    count = 0

    for x in range(K+1):
        for y in range(K+1):
            z = S - (x + y)
            if z >= 0 and z <= K:
                count += 1

    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void)
{
	int n, m, ok = 1;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &m);
		if (m % 2 == 0) {
			if (m % 3 == 0 || m % 5 == 0) continue;
			else ok--;
		}
	}
	if (ok == 1) {
		printf("APPROVED\n");
	}
	else {
		printf("DENIED\n");
	}

	return 0;
}


Measured memory_bytes: 128
use proconio::input;

fn main() {
    use std::cmp::max;
    input! {
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    };
    let ans = max(max(max(a * c, a * d), b * c), b * d);
    println!("{}", ans);
}


Measured memory_bytes: 2172
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define LL long long
#define MOD 1000000007
#define INF 2000000000000
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
ll N, M, K, H, W, L, R, l, r, u, d, sum, Q;
LL ans;
LL no;
bool b, bb[100001];
string s, t;
int main() {
	cin >> N>>K;
	ans = 0;
	vector<LL> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());

		for (int i = 0; i < N-K; i++) {
			ans += v[i];
		}

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



Measured memory_bytes: 1792
def sget; gets.chomp; end
def iget; sget.to_i; end
def saget; gets.chomp.split; end
def iaget; saget.map {|a| a.to_i }; end

w = sget
counts = {}
w.split(//).each {|c|
    counts[c] ||= 0
    counts[c] += 1
}
puts counts.keys.all? {|k| counts[k] % 2 == 0 } ? "Yes" : "No"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define p pair<int,int>
#define mk make_pair
#define rep(i,n) for(int i=0; i < (n);++i)
using namespace std;
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;}

const int INF = 2147483647;
const long long inf = 1ll << 60;
const long long mod = 1000000007;

int dx[4] = {1,0,-1,0};int dy[4] = {0,-1,0,1};
int main() {
    int n,m,r; cin >> n >> m >> r;
    vector<vector<pair<int,int> > >g(n);
    for(int i=0;i<m;i++){
        int a,b,c; cin >> a >> b >> c;
        g[a].push_back(make_pair(b,c));
    }
    priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >q;
    q.push(make_pair(r,0));
    vector<int> table(n,INF);
    while(!q.empty()){
        int now = q.top().first;
        int d = q.top().second;
        q.pop();
        if(table[now] <=  d) continue;
        table[now] = d;
        for(int i=0;i<g[now].size();i++){
            if(d+g[now][i].second <= table[g[now][i].first]){
                q.push(make_pair(g[now][i].first,d+g[now][i].second));
            }
        }
    }
    for(int i=0;i<n;i++){
        if(table[i]==INF) cout << "INF" << endl;
        else cout << table[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 20328
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
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;
}


void solve(long long N, long long M){
    cout << N*(N-1)/2+M*(M-1)/2 << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 256
//区間加算、区間sum

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;


class LazySegmentTree {
public:
    int N;
    vector<ll> node, lazy;

    LazySegmentTree(int _N, ll *a) {
        N = 1;
        while(N < _N) N *= 2;
        node.resize(2 * N - 1, 0);
        lazy.resize(2 * N - 1, 0);

        for(int i = 0; i < _N; i++){
            int k = i + N - 1;
            node[k] = a[i];
        }
        for(int i = N - 2; i >= 0; i--) {
            node[i] = node[2 * i + 1] + node[2 * i + 2];
        }
    }

    LazySegmentTree(vector<ll> a) {
        int sz = a.size();
        N = 1;
        while(N < sz) N *= 2;
        node.resize(2 * N - 1, 0);
        lazy.resize(2 * N - 1, 0);

        for(int i = 0; i < sz; i++){
            int k = i + N - 1;
            node[k] = a[i];
        }
        for(int i = N - 2; i >= 0; i--) {
            node[i] = node[2 * i + 1] + node[2 * i + 2];
        }
    }

    //[a, b) に c を加算
    void update(int a, int b, ll c) {
        Update(a, b, c, 0, 0, N);
    }

    void Update(int a, int b, ll c, int k, int l, int r) {
        eval(k, l, r);

        //範囲外
        if(b <= l || r <= a) return;

        //完全被覆
        else if(a <= l && r <= b) {
            lazy[k] += (r - l) * c;
            eval(k, l, r);
        }

        //一部被覆
        else {
            Update(a, b, c, 2 * k + 1, l, (l + r) / 2);
            Update(a, b, c, 2 * k + 2, (l + r) / 2, r);
            node[k] = node[2 * k + 1] + node[2 * k + 2];
        }

        return;
    }

    //[a, b)の合計
    ll query(int a, int b) {
        return Query(a, b, 0, 0, N);
    }

    ll Query(int a, int b, int k, int l, int r) {
        eval(k, l, r);

        //範囲外
        if(b <= l || r <= a) return 0;

        //完全被覆
        else if(a <= l && r <= b) {
            return node[k];
        }

        //一部被覆
        else {
            ll v1 = Query(a, b, 2 * k + 1, l, (l + r) / 2);
            ll v2 = Query(a, b, 2 * k + 2, (l + r) / 2, r);
            return v1 + v2;
        }
    }

    void eval(int k, int l, int r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2 * k + 1] += lazy[k] / 2;
                lazy[2 * k + 2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
        return;
    }
};

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

    vector<ll> ans;

    LazySegmentTree sg = LazySegmentTree(vector<ll>(N, 0));
    for(int q = 0; q < Q; q++) {
        int id, s, t, x;
        cin >> id;

        if(id == 0) {
            cin >> s >> t >> x;
            sg.update(s - 1, t, x);
        }
        else {
            cin >> s >> t;
            ans.push_back(sg.query(s - 1, t));
        }
    }

    for(ll val : ans) {
        cout << val << endl;
    }

    return 0;
}


Measured memory_bytes: 8700
b = input()
if 'RSR' == b or 'RSS' == b or 'SSR' == b or 'SRS' == b:
    print(1)
elif 'RRS' == b or 'SRR' == b:
    print(2)
elif 'RRR' == b:
    print(3)
else:
    print(0)

Measured memory_bytes: 9032