akhauriyash/Code-Regression huggingface dataset:
// Problem : C - Sum of gcd of Tuples (Easy)
// Contest : AtCoder - AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;

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

int main()
{
	int k;cin>>k;
	ll ans=0;
	rep(a,1,k)
		rep(b,1,k)
			rep(c,1,k) 
				ans+=gcd(gcd(a,b),c);
	cout<<ans<<endl;
	return 0;
}



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

int main() {
	vector<vector<int>> a(3, vector<int>(3)), c(3, vector<int>(3));
	rep(i, 3) rep(j,3) {
		cin >> a[i][j];
	}
	int n;
	cin >> n;
	vector<int> b(n);
	rep(i, n) cin >> b[i];
 	string ans = "Yes";
	rep(x, n) {
		rep(i, 3) rep(j, 3) {
			if(a[i][j] == b[x]) c[i][j] = 1;
		}
	}
	bool is_bingo = false;
	// yoko
	rep(i, 3){
		bool ok = true;
		rep(j, 3) {
			if(c[i][j] == 0) ok = false; 
		}
		if(ok) is_bingo = true;
	} 
	//tate
	rep(j, 3){
		bool ok = true;
		rep(i, 3) {
			if(c[i][j] == 0) ok = false; 
		}
		if(ok) is_bingo = true;
	} 
	{
		bool ok = true;
		rep(i, 3) {
			if(c[i][i] == 0) ok = false; 
		}
		if(ok) is_bingo = true;
	} 
	{
		bool ok = true;
		rep(i, 3) {
			if(c[2-i][i] == 0) ok = false; 
		}
		if(ok) is_bingo = true;
	} 
	if(is_bingo) ans = "Yes";
	else ans = "No";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;


int yakusuu(int num){
    
    int ret = 0;
    for(int i = 1; i <= num; i++){
        if(num % i == 0)ret++;
        
        
        
    }
    
    return ret;
}


int main(){


    int n;
    cin >> n;
    
    int wk;
    int ans = 0;
    for(int i = 1; i <=n;i += 2){
        wk = yakusuu(i);
        
        if(wk == 8)ans++;
        
        
    }
    
    cout << ans << endl;

  
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;

    string S[H + 1];
    int wnum = 0;

    for (int i = 0; i < H; i++) {
        cin >> S[i];
        for (int j = 0; j < W; j++) {
            if (S[i][j] == '.') wnum++;
        }
    }

    int INF = 1 << 30;
    vector<vector<int>> d(H, vector<int>(W, INF));

    queue<pair<int, int>> q;

    d[0][0] = 1;
    q.push({0, 0});

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

    while (!q.empty()) {
        pair<int, int> p = q.front();
        int x = p.first;
        int y = p.second;

        q.pop();

        for (int i = 0; i < 4; i++) {
            int nx = x + dx[i];
            int ny = y + dy[i];

            if (nx >= 0 && nx < H && ny >= 0 && ny < W) {
                if (S[nx][ny] == '.' && d[x][y] + 1 < d[nx][ny]) {
                    d[nx][ny] = d[x][y] + 1;
                    q.push({nx, ny});
                }
            }
        }
    }
    if (d[H - 1][W - 1] == INF) {
        // 訪れなかった=ゴール不可能
        cout << -1 << endl;
    } else {
        cout << wnum - d[H - 1][W - 1] << endl;
    }

    return 0;
}

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

int n, k, c;
bool check(string s) {
  int last_idx;
  bool first_flag = false;
  int cnt = 0;
  REP(i, n) {
    if (s[n - 1 - i] == 'o' && first_flag == 0) {
      last_idx = n - 1 - i;
      first_flag = true;
      cnt++;
    } else if (s[n - 1 - i] == 'o' && first_flag == 1) {
      if (last_idx - (n - 1 - i) > c) {
        last_idx = n - 1 - i;
        cnt++;
      }
    }
  }
  if (cnt >= k) {
    return true;
  } else {
    return false;
  }
}

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

  VI L;
  VI R;
  int idx = 0;
  bool flag = false;
  REP(i, n) {
    if (L.size() > k) break;
    if (s[i] == 'o' && flag == false) {
      idx = i;
      L.push_back(i);
      flag = true;
    } else if (s[i] == 'o') {
      if (i - idx > c) {
        idx = i;
        L.push_back(i);
      }
    }
  }

  reverse(s.begin(), s.end());
  flag = false;
  REP(i, n) {
    if (R.size() > k) break;

    if (s[i] == 'o' && flag == false) {
      idx = i;
      R.push_back(n - 1 - i);
      flag = true;
    } else if (s[i] == 'o') {
      if (i - idx > c) {
        idx = i;
        R.push_back(n - 1 - i);
      }
    }
  }
  SORT(R);

  REP(i, L.size()) {
    if (L[i] == R[i]) {
      ANS(L[i] + 1);
    }
  }
  return 0;
}


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

using namespace std;

int main(void){
   int N;
   cin >> N;
   string str[N] = {};
   map<std::string,int> s;
   for (int i = 0;i < N;i++){
       cin >> str[i];
   }
   s["AC"] = 0;
   s["WA"] = 0;
   s["TLE"] = 0;
   s["RE"] = 0;
   for (int i = 0;i < N;i++){
       s[str[i]]++;
   }
   cout <<"AC x "<< s["AC"] << endl;
   cout << "WA x " << s["WA"] << endl;
    cout << "TLE x "<< s["TLE"] << endl;
    cout << "RE x " << s["RE"] << endl;
}

Measured memory_bytes: 6756
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

//Main
var sc = bufio.NewScanner(os.Stdin)

func solution(y, i, X int) int {

	if y >= X {
		return i
	}
	i++
	return solution(y+y/100, i, X)
}

func main() {
	sc.Split(bufio.ScanWords)
	X := nextInt()
	i := 0
	fmt.Println(solution(100, i, X))
}


Measured memory_bytes: 2196
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <ctime>
#include <list>
using namespace std;
static const double EPS = 1e-6;
typedef long long ll;
typedef pair<int,int> PI;
#ifndef M_PI
const double M_PI=acos(-1);
#endif
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int((a).size()))
#define F first
#define S second
int dx[]={0,1,0,-1,0,0},dy[]={1,0,-1,0,0,0};
int dz[]={0,0,0,0,1,-1};

int n;
double sx[30],sy[30],sz[30];

double dist(double x,double y,double z,int id){
  double tx=x-sx[id];
  double ty=y-sy[id];
  double tz=z-sz[id];
  return sqrt(tx*tx+ty*ty+tz*tz);
}

double rad(double x,double y,double z){
  double ret=dist(x,y,z,n-1);
  rep(i,n-1)ret=max(ret,dist(x,y,z,i));
  return ret;
}

typedef struct _node{
  double x,y,z,r;
  int wh;
  _node(double x,double y,double z,int wh):
    x(x),y(y),z(z),wh(wh),r(rad(x,y,z)){};

  bool operator<(const _node& rn)const{
    if(rn.wh!=wh)return rn.wh<wh;
    return rn.r<r;
  }
}node;

int tx[]={1,1,1,1,-1,-1,-1,-1};
int ty[]={1,1,-1,-1,1,1,-1,-1};
int tz[]={1,-1,1,-1,1,-1,1,-1};
double len[1000];

void solve(){
  rep(i,n)scanf("%lf%lf%lf",sx+i,sy+i,sz+i);
  len[0]=100;
  for(int i=1;i<1000;++i)
    len[i]=len[i-1]/2;
  double ans=10000;
  rep(i,n)rep(j,i)
    ans=min(ans,rad((sx[i]+sx[j])/2,
                    (sy[i]+sy[j])/2,
                    (sz[i]+sz[j])/2));

  priority_queue<node> q;
  q.push(node(50,50,50,0));
  int cu=0;
  int bwh=-1;
  while(!q.empty()){
    node cur=q.top();
    q.pop();
    if(cu==75 && cur.wh==bwh)continue;
    if(cu==75)cu=0,bwh=cur.wh;
    ++cu;
    double rr=len[cur.wh];    
    if(ans<cur.r-rr*sqrt(3)*2+EPS)continue;
    ans=min(ans,cur.r);
    if(cur.wh>25)continue;
    //printf("%.5f %.5f %.5f %.5f %.7f %d\n",cur.x,cur.y,cur.z,cur.r,ans,cur.wh);

    rep(i,8)
      q.push(node(cur.x+rr*tx[i],cur.y+rr*ty[i],cur.z+rr*tz[i],cur.wh+1));
  }

  printf("%.5f\n",ans);
}

main(){
  while(cin>>n,n)
    solve();
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <ios>
using namespace std;

vector<long long> fill_dp0(int N, vector<long long> &A);
vector<long long> fill_dp1(int N, vector<long long> &A);

int main() {
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<long long> A(3 * N, 0LL);
    for (auto & a : A) cin >> a;

    // dp0[t]: A[:N + t] のうち、上位N個の総和
    auto dp0 = fill_dp0(N, A);

    // dp1[t]: A[N + t:] のうち、下位N個の総和
    auto dp1 = fill_dp1(N, A);

    long long ans = dp0[0] - dp1[0];
    for (int i = 0; i <= N; ++i){
        ans = max(ans, dp0[i] - dp1[i]);
    }
    cout << ans << endl;
    return 0;
}

vector<long long> fill_dp0(int N, vector<long long> &A){
    // dp0[t]: A[:N + t] のうち、上位N個の総和
    vector<long long> dp0(N + 1, 0);
    long long s = 0LL;
    multiset<long long> topN;
    for (int i = 0; i != N; ++i){
        s += A[i];
        topN.insert(-A[i]);
    }
    dp0[0] = s;
    for (int i = N; i != 2 * N; ++i){
        topN.insert(-A[i]);
        auto it_min = topN.end();
        --it_min;
        s += A[i];
        s += *it_min;
        topN.erase(it_min);
        dp0[i - N + 1] = s;
    }
    return dp0;
}


vector<long long> fill_dp1(int N, vector<long long> &A){
    // dp1[t]: A[N + t:] のうち、下位N個の総和
    vector<long long> dp1(N + 1, 0);
    long long s = 0LL;
    multiset<long long> topN;
    for (int i = 2 * N; i != 3 * N; ++i){
        s += A[i];
        topN.insert(A[i]);
    }
    dp1[N] = s;
    for (int i = 2 * N - 1; i >= N; --i){
        topN.insert(A[i]);
        auto it_max = topN.end();
        --it_max;
        s += A[i];
        s -= *it_max;
        topN.erase(it_max);
        dp1[i - N] = s;
    }
    return dp1;
}


Measured memory_bytes: 8832
#include<stdio.h>
#include<stdlib.h>
#define nil -1
typedef struct{
  int p;
  int l;
  int r;
  int depth;
  
}Node;
Node N[100000];
int depth[100000];

int CalcDepth(int , int);

int main(){

  int i,j,n,id,key,degree,tmp,root;
 
  
  scanf("%d",&n);

  for(i=0;i<n;i++)
    N[i].p=N[i].l=N[i].r=nil;

  for(i=0;i<n;i++){
    scanf("%d%d",&id,&degree);
    tmp=0;
    for(j=0;j<degree;j++){
      scanf("%d",&key);
      N[key].p=id;
      if(j==0) N[id].l=key;
      else N[tmp].r=key;

      tmp=key;
    }
  }

  for(i=0;i<n;i++){
    if(N[i].p==-1) root=i;
  }
  CalcDepth(0,root);/*i???RootNode?????????*/
  
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, ",i,N[i].p,N[i].depth);
    
    if(N[i].p==nil) printf("root, [");
    else if(N[i].l==nil) printf("leaf, [");
    else   printf("internal node, [");
      
    j=N[i].l;
    while(j!=nil){
      if(j==N[i].l) printf("%d",j);
      else printf(", %d",j);
      j=N[j].r;
	}
    printf("]\n");
  }


return 0;
}

int CalcDepth(int deep ,int parent){

  int i;

  N[parent].depth=deep;
  if(N[parent].l==nil){
    return 0;
  }

  for(parent=N[parent].l;parent!=nil;parent=N[parent].r){
    CalcDepth(deep+1,parent);
  }
}

Measured memory_bytes: 2172
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
#define ll long long 
#define jaldi_chal  ios_base::sync_with_stdio(0); cin.tie(0);
#define tr(c,i) for(auto i=(c).begin(); i != (c).end(); i++)
#define REP(i,k) for( ll i=0;i<k;i++)
#define REW(i,a,b) for(ll i=a;i<=b;i++)
#define M 1000000007
#define F first
#define dbg(x)  cout<<#x<<" " <<x<<endl;
#define S second
#define inf 1e10
#define endl "\n"


int main() {
jaldi_chal
ll n;
cin>>n;
ll a[n+1],b[n+1],c[n+1];
REW(i,1,n)
{
    cin>>a[i]>>b[i]>>c[i];
}

ll dp[n+1][3];

dp[1][0]=a[1];
dp[1][1]=b[1];
dp[1][2]=c[1];

REW(i,2,n)
{
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
    dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
}

ll ans=max(dp[n][0],dp[n][1]);
ans=max(ans,dp[n][2]);
cout<<ans;


	return 0;
}

Measured memory_bytes: 4992
let (p1, p2, p3) = (257, 251, 1000000007)

let pow x n =
  let rec doit i acc =
    if i = n then acc
    else doit (i + 1) (acc*x mod p3) in
  doit 0 1

let solve a (h, w) b (r, c) =
  let make_hash v (y, x) =
    let h1 = Array.make_matrix y x 0 in
    let c1 = pow p1 c in
    let rec duduwa i =
      if i < y then begin
        let rec calc_z j acc =
          if j = c then acc
          else calc_z (j + 1) ((acc*p1 + Char.code v.(i).(j)) mod p3) in
        let rec aux j z =
          if j = x - c then h1.(i).(j) <- z
          else begin
            h1.(i).(j) <- z;
            let new_z = (z*p1 - (Char.code v.(i).(j))*c1 + Char.code v.(i).(j+c)) mod p3 in
            aux (j + 1) (if new_z < 0 then new_z + p3 else new_z)
          end in
        aux 0 (calc_z 0 0);
        duduwa (i + 1)
      end in
    duduwa 0;
    let h2 = Array.make_matrix y x 0 in
    let c2 = pow p2 r in
    let rec doit j =
      if j < x then begin
        let rec calc_z i acc =
          if i = r then acc
          else calc_z (i + 1) ((acc*p2 + h1.(i).(j)) mod p3) in
        let rec aux i z =
          if i = y - r then h2.(i).(j) <- z
          else begin
            h2.(i).(j) <- z;
            let new_z = (z*p2 - h1.(i).(j)*c2 + h1.(i+r).(j)) mod p3 in
            aux (i + 1) (if new_z < 0 then new_z + p3 else new_z)
          end in
        aux 0 (calc_z 0 0);
        doit (j + 1)
      end in
    doit 0;
    h2 in
  let s = make_hash a (h, w) in
  let t = make_hash b (r, c) in
  let rec doit = function
    | (i, _) when i > h - r -> ()
    | (i, j) when j > w - c -> doit (i + 1, 0)
    | (i, j) ->
      if s.(i).(j) = t.(0).(0) then Printf.printf "%d %d\n" i j;
      doit (i, j + 1) in
  doit (0, 0)

let input_array y x =
  let a = Array.make_matrix y x '\000' in
  let rec doit = function
    | (i, _) when i = y -> a
    | (i, j) when j = x -> doit (i + 1, 0)
    | (i, j) ->
      a.(i).(j) <- Scanf.scanf "%c " (fun c -> c);
      doit (i, j + 1) in
  doit (0, 0)

let () =
  let (h, w) = Scanf.scanf "%d %d\n" (fun h w -> (h, w)) in
  let a = input_array h w in
  let (r, c) = Scanf.scanf "%d %d\n" (fun r c -> (r, c)) in
  let b = input_array r c in
  if h >= r && w >= c then solve a (h, w) b (r, c)

Measured memory_bytes: 46392
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;
using namespace chrono;
 
typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

//#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define loop(x,n) for(int x = 0; x < n; ++x)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;

string get_str() {
    string temp;
    cin >> temp;
    return temp;
}
int get_int() {
    int temp;
    cin >> temp;
    return temp;
}

void solve() {



}

int x, n, a[301];

int main() {
    
    cin >> x >> n;
    
    loop(i, n) {
        int z; cin >> z;
        a[101+z] = 1;
    }
    for(int i=0; i <= 100; i++) {
        int z = 101+x-i;
        int y = 101+x+i;

        if(a[z] == 0) {
            cout << x-i << endl;
            break;
        }
        if(a[y] == 0) {
            cout << x + i << endl;
            break;
        }
    }


}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n)     for (ll i = 0; i < n; ++i)
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
#define repin(a, n)  \
    vector<ll> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
    vector<string> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
    vector<double> a(n); \
    rep(i, n) { cin >> a[i]; }
#define in(a) \
    ll a;     \
    cin >> a;
#define ins(a) \
    string a;  \
    cin >> a;
#define ind(a) \
    double a;  \
    cin >> a;
template <class T>
inline void out(T a) {
    cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x)  (x).begin(), (x).end()    //昇順
#define rall(x) (x).rbegin(), (x).rend()  //降順
#define yes     out("Yes");
#define no      out("No");
ll mod = 1000000007;

ll mmul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }

int main() {
    in(n);
    repin(a, n);

    ll ans = 0;
    ll sum = 0;

    rep(i, n) {
        sum += a[i] % mod;
    }
    rep(i, n - 1) {
        sum -= a[i];
        ans += mmul(a[i], sum);
    }

    out(ans % mod);
}

Measured memory_bytes: 4844
N = int(input())
n = 0
lis = [int(i) for i in input().split()]
while True:
    lis2 = []
    for i in lis:
        if i %2 == 0:
            lis2.append(int(i/2))
        else:
            print(n)
            exit()
    lis = lis2
    n+=1

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

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

int main()
{
  int x;
  cin >> x;
  ll ans = x / 500 * 1000;
  x %= 500;
  ans += x / 5 * 5;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

int main() {
    int ans = 0;
    std::string s, t; std::cin >> s >> t;
    size_t n = s.size();
    rep(i,n)
        if (s[i] != t[i]) ++ans;
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 3844
#include<stdio.h>
int main(){
    int a[1000],b[1000], j,k=0,i,n,m=0,h;
	
	scanf("%d", &n);
	
	for(j=0; j< n;j++){
		scanf("%d", &a[j]);
	}
	
	for(j=0; j<n; j++){
	if(a[j]%2==0){
		b[k]=j;
		k++;
	}
	}
		
	for(j=0; j<k;j++){
		i=a[b[j]];
		if(i%3==0||i%5==0){
			m++;
		}
	}
	
		if(m==k){
	printf("APPROVED \n");
		    return 0;
		}
		
		else{
			
	printf("DENIED \n");
		    return 0;
		}
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int k = sc.nextInt();
		sc.close();
		if (e - a <= k) {
			System.out.println("Yay!");
		}
		else {
			System.out.println(":(");
		}
	}
}


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

int main()
{
   int c=0;
	string s,tmp;

   cin >> s;
   tmp=s.substr(0,1);

//cout << tmp << " 0"<< endl;

   for(int i=1; i<=s.length(); i++){
      if(i>=s.length()){
        c++;
//cout << tmp << " 1"<< endl;
      }
      else if(s.substr(i,1) != tmp){
        c++;
//cout << tmp << " 2" << endl;
        tmp=s.substr(i,1);
      }
      else{
        c++;
//cout << tmp << " 3" << endl;
        tmp=s.substr(i,2);
        i++;
      }
   }
     cout << c << endl;

	return 0;
}


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

n = int(input())
a = list(map(int, input().split()))

ans = 0 
d = {}
for i in a:
    if i not in d:
        d[i] = 1 
    else:
        d[i] += 1

d = sorted(d.items(), key=lambda x:x[0], reverse=True)
area = 1 
cnt = 0 
allone = True
for i in d:
    if i[1] != 1:
        allone = False
        if i[1] >= 4:
            if cnt == 0:
                area = i[0]*i[0]
                break
        if cnt == 2:
            break
        area *= i[0]
        cnt += 1

if allone:
    print(0)
else:
    print(area)


Measured memory_bytes: 21772
S = input()
N = len(S)

if S[::-1] != S:
    print("No")
    exit()

ss = S[:(N - 1) // 2]
# print(ss)
if ss[::-1] != ss:
    print("No")
    exit()

sss = S[(N + 3) // 2 - 1:]
# print(sss)
if sss[::-1] != sss:
    print("No")
    exit()

print("Yes")


Measured memory_bytes: 3060
n  = int(input())

w_list = [[0]*n]*n

for i in range(n):
  w_list[i] = input().split()
  w_list[i].append(i+1)
  
w_list.sort(key = lambda l: (l[0], -int(l[1])))
print(*[w[-1] for w in w_list], sep  = '\n')

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

#define ll long long
#define db double
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;

const ll mod = 1000000007;
ll po(ll k, ll n ){ 
      if(n==1) return k%mod;
      else{
        ll a=po(k,n/2)%mod;
        if(n%2==0) return (a*a)%mod;
        else return (((a*a)%mod)*k)%mod;
      }
}


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  //#ifndef ONLINE_JUDGE
  //freopen("input.txt", "r" , stdin);
  //freopen("output.txt", "w" , stdout);
  //#endif
  int t=1;
  //cin >> t;
  while(t--){
    int a,b;
    cin >> a>>b;
    if(a-2*b>0) cout << a-2*b << endl;
    else cout << "0" << endl;
  }

  return 0;
}


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

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	string s;
	cin >> n >> s;
	vector<int> ans;
	for (int i = 0; i < 4; i++) {
		ans.resize(n);
		ans[0] = i % 2;
		ans[1] = i / 2;
		for (int j = 1; j < n - 1; j++) {
			if (s[j] == 'o') {
				if (ans[j] == 0) ans[j + 1] = ans[j - 1];
				else ans[j + 1] = !ans[j - 1];
			}
			else {
				if (ans[j] == 0) ans[j + 1] = !ans[j - 1];
				else ans[j + 1] = ans[j - 1];
			}
		}
		if (s[0] == 'o') {
			if ((ans[0] == 0) ^ (ans[1] == ans.back())) continue;
		} else {
			if ((ans[0] == 0) ^ (ans[1] != ans.back())) continue;
		}
		if (s.back() == 'o') {
			if ((ans.back() == 0) ^ (ans[0] == ans[n - 2])) continue;
		} else {
			if ((ans.back() == 0) ^ (ans[0] != ans[n - 2])) continue;
		}
		for (int j = 0; j < n; j++) {
			cout << "SW"[ans[j]];
		}
		cout << endl;
		return 0;
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 976
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
int power(int x,int n)
{
  if(n==0)return 1;
  int temp=power(x,n/2);
  if(n%2==0)return temp*temp;
  return x*temp*temp;
}
int32_t main()
{
   fastio
   int n,m;
   cin>>n>>m;
   vector<int>v[10];
   int num=power(2,n);
   int p[m];
   rep(i,m)
   {
     int k;
     cin>>k;
     rep(j,k)
       {
         int a;
         cin>>a;
         v[i].pb(a);
       }
   }
   rep(i,m)cin>>p[i];
   int ans=0;
   for(int i=0;i<num;i++)
   {
     int flag=0;
     for(int j=0;j<m;j++)
     {
       int c=0;
       for(int p=0;p<v[j].size();p++)
       {
         int temp=v[j][p];
         temp--;
         if((1<<temp) & i)c++;
       }
       c=c%2;
       if(c==p[j])continue;
       else {flag=1;break;}
     }
     if(flag==0)ans++;
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <random>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define reach(i,a)	for(auto i:a)
#define rep(i,n)	for(int i=0;i<(int)n;i++)
#define REP(i,n)	for(int i=0;i<=(int)n;i++)
#define srep(i,a,n)	for(int i=a;i<(int)n;i++)
#define SREP(i,a,n)	for(int i=a;i<=(int)n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define pb	push_back
#define fst	first
#define scn second
int bitcnt(ll x) {
	x = ((x & 0xAAAAAAAAAAAAAAAA) >> 1) + (x & 0x5555555555555555);
	x = ((x & 0xCCCCCCCCCCCCCCCC) >> 2) + (x & 0x3333333333333333);
	x = ((x & 0xF0F0F0F0F0F0F0F0) >> 4) + (x & 0x0F0F0F0F0F0F0F0F);
	x = ((x & 0xFF00FF00FF00FF00) >> 8) + (x & 0x00FF00FF00FF00FF);
	x = ((x & 0xFFFF0000FFFF0000) >> 16) + (x & 0x0000FFFF0000FFFF);
	x = ((x & 0xFFFFFFFF00000000) >> 32) + (x & 0x00000000FFFFFFFF);
	return x;
}
int bitcnt(int x) {
	x = ((x & 0xAAAAAAAA) >> 1) + (x & 0x55555555);
	x = ((x & 0xCCCCCCCC) >> 2) + (x & 0x33333333);
	x = ((x & 0xF0F0F0F0) >> 4) + (x & 0x0F0F0F0F);
	x = ((x & 0xFF00FF00) >> 8) + (x & 0x00FF00FF);
	x = ((x & 0xFFFF0000) >> 16) + (x & 0x0000FFFF);
	return x;
}
ll gcd(ll a, ll b) {
	return a%b == 0 ? b : gcd(b, a%b);
}
#define debug(x)	cout<<"case #" << x << ": " << endl
#define DEBUG 0
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ld eps = 1e-9;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };

int main() {
	int n, d;	cin >> n >> d;
	vector<int> dist(n);
	vector<int> left(n + 1);
	left[0] = d;
	for (int i = 0; i < n; i++) {
		cin >> dist[i];
		left[i + 1] = min(left[i], abs(left[i] - dist[i]));
	}
	int q;	cin >> q;
	vector<pii> query(q);
	for (int i = 0; i < q; i++) {
		cin >> query[i].fst;	query[i].fst--;
		query[i].scn = i;
	}
	vector<bool> ret(q, false);
	sort(query.begin(), query.end());
	reverse(query.begin(), query.end());
	int reach = 1;
	int s = 0;
	for (int i = n - 1; i >= 0; i--) {
		while (s < q&&query[s].fst == i) {
			if (left[i] < reach)	ret[query[s].scn] = true;
			else	ret[query[s].scn] = false;
			s++;
		}
		if (2 * reach > dist[i])	reach += dist[i];
	}
	for (int i = 0; i < q; i++)	cout << (ret[i] ? "NO" : "YES") << endl;
	return 0;
}

Measured memory_bytes: 9856
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

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

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll N, M;
    cin >> N >> M;
    if (N > M) swap(N, M);
    if (N == 1) {
    	if (M == 1) cout << 1 << endl;
    	else if (M == 2) cout << 0 << endl;
    	else cout << M - 2 << endl;
    	return 0;
    }
    cout << (N - 2) * (M - 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	string s;
	int i = 0, j = 0;
	int a, b;
	int bj = 0;
	cin >> s;
	vector<int>ans((int)s.length(), 0);

	while (i != (int)s.length() && j != (int)s.length()) {
		for (i = bj; i != s.length() && s[i] == 'R'; i++);
		for (j = i; j != s.length() && s[j] == 'L'; j++);
		a = i - bj;
		b = j - i;
		//cout << a << " " << b << endl;
		if (a % 2 == 0) {
			ans[i - 1] += a / 2;
			ans[i] += a / 2;
		}
		else {
			ans[i - 1] += a / 2 + 1;
			ans[i] += a / 2;
		}

		if (b % 2 == 0) {
			ans[i - 1] += b / 2;
			ans[i] += b / 2;
		}
		else {
			ans[i - 1] += b / 2;
			ans[i] += b / 2 + 1;
		}
		bj = j;
	}
	for (i = 0; i < (int)s.length(); i++)cout << ans[i] << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <numeric>

std::vector<size_t> solve(const std::string s){
	std::vector<size_t> ponds;
	size_t sum = 0,end = 0;

	for(size_t i = 0; i < s.size(); ++i){

		if(i >= end && sum != 0){
			ponds.push_back(sum);
			sum = 0;
		}

		if(s[i] == '\\'){
			int depth = -1;
			const size_t size = s.size();
			for(size_t j = i+1; j < size; ++j){
				switch(s[j]){
					case '\\':
						--depth;
						break;
					case '/':
						++depth;
						if(depth == 0){
							sum += j-i;
							if(end < j) end = j;
							goto END;
						}
				}
			}
			END:;
		}

	}

	return ponds;
}

int main(){
	std::ios::sync_with_stdio(false);
	std::string s;
	std::cin >> s;
	auto ret = solve(s);
	std::cout << std::accumulate(ret.begin(),ret.end(),size_t(0)) << std::endl;
	std::cout << ret.size();
	for(auto&& v : ret){
		std::cout << ' ' << v;
	}
	std::cout << std::endl;
}

Measured memory_bytes: 3280
#include <iostream>
#include <vector>
#include <string>
#include <queue>
using namespace std;

int dx[]={0, 1, 0, -1}, dy[]={1, 0, -1, 0};

bool avail(int px, int py, int h, int w, vector<vector<bool>>& checked){
  return 0<=px && px<h && 0<=py && py<w && !checked[px][py];
}

int main(){
  int h, w, ch, cw, dh, dw;
  cin >> h >> w >> ch >> cw >> dh >> dw;
  ch--;
  cw--;
  dh--;
  dw--;
  vector<string>s(h);
  for(int i=0; i<h; i++)cin >> s[i];
  vector<vector<bool>>checked(h, vector<bool>(w, false));
  vector<vector<int>>cost(h, vector<int>(w, -100000000));
  priority_queue<pair<int, pair<int, int>>>Q;
  Q.push(make_pair(0, make_pair(ch, cw)));
  cost[ch][cw]=0;
  while(!Q.empty()){
    pair<int, pair<int, int>>p = Q.top();
    int px=p.second.first, py=p.second.second;
    Q.pop();
    checked[px][py]=true;
    for(int i=0; i<4; i++){
      if(avail(px+dx[i], py+dy[i], h, w, checked)){
        if(s[px+dx[i]][py+dy[i]]=='.'){
          if(cost[px+dx[i]][py+dy[i]]<p.first){
            cost[px+dx[i]][py+dy[i]]=p.first;
            Q.push(make_pair(p.first, make_pair(px+dx[i], py+dy[i])));
          }
        }
      }
    }
    for(int i=-2; i<=2; i++){
      for(int j=-2; j<=2; j++){
        if(avail(px+i, py+j, h, w, checked)){
          if(s[px+i][py+j]=='.'){
            if(cost[px+i][py+j]<p.first-1){
              cost[px+i][py+j]=p.first-1;
              Q.push(make_pair(p.first-1, make_pair(px+i, py+j)));
            }
          }
        }
      }
    }
  }
  if(-cost[dh][dw]<100000000)cout << -cost[dh][dw];
  else cout << -1;
  /*
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cerr << cost[i][j] << ' ';
    }
    cerr << endl;
  }
  */
  return 0;
}

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (abs(a - c) <= d) {
		cout << "Yes" << endl;
	}
	else if (abs(a - b) <= d && abs(c - b) <= d) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

Measured memory_bytes: 256
n, m = gets.chop.split.map(&:to_i)

# 本番の回答
# return puts 0 if n == 1 && m == 1

# if n == 0 || n == 1
#   child = factorial(m)
#   mother = 2 * factorial(m - 2)
#   return puts child / mother
# else
#   n_child = factorial(n)
#   n_mother = 2 * factorial(n - 2)
#   n_count = child / mother

#   m_child = factorial(m)
#   m_mother = 2 * factorial(m - 2)
#   m_count = child / mother

#   return puts n_count + m_count
# end

# def factorial(number)
#   number = 0 if number.nil?
#   (1..number).inject(1,:*)
# end

n_count = (n * (n -1)) / 2
m_count = (m * (m -1)) / 2

puts n_count + m_count


Measured memory_bytes: 1788
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
m = map(int,read().split())
ST = zip(m,m)

out_edge = [[] for _ in range(N+1)]
in_edge = [[] for _ in range(N+1)]

for s,t in ST:
    out_edge[s].append(t)
    in_edge[t].append(s)

out_deg = [len(x) for x in out_edge]

achieve_prob = [0]*(N+1)
achieve_prob[1] = 1.0
for n in range(2,N+1):
    achieve_prob[n] = sum(achieve_prob[p]/out_deg[p] for p in in_edge[n])

# その頂点に辿り着くまでの回数期待値
# いらなかったっぽい
# expected_to = [0]*(N+1)
# for n in range(2,N+1):
#     expected_to[n] = 1 + sum(expected_to[p]*achieve_prob[p]/out_deg[p] for p in in_edge[n])/achieve_prob[n]

# その頂点に辿り着いてからの回数期待値
expected_from = [0]*(N+1)
for n in range(N-1,0,-1):
    expected_from[n] = 1+sum(expected_from[c] for c in out_edge[n])/out_deg[n]

current_time = expected_from[1]

improve = 0
for n in range(1,N):
    if out_deg[n] == 1:
        continue
    x = expected_from[n]
    d = out_deg[n]
    y = (d*(x-1)-max(expected_from[c] for c in out_edge[n]))/(d-1) + 1
    value = (x-y)*achieve_prob[n]
    if improve < value:
        improve = value

answer = current_time - improve
print(answer)

Measured memory_bytes: 29724
#include <stdio.h>
 
int main(){
    int a,b;
    scanf("%d %d",&a,&b);

    if(a>b){
        printf("a > b\n");
    }else if(a<b){
        printf("a < b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REP(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define REP1(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Int = long long;

//INT_MAX = 2147483647;
//LLONG_MAX = 9223372036854775807;
//ULLONG_MAX = 18446744073709551615;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n,k;
    cin >> n >> k;
    map<int,int> a;
    REP1(i,1,n) a[i] = 0;
    rep(i,k){
        int d;
        cin >> d;
        rep(i,d){
            int aa;
            cin >> aa;
            a[aa]++;
        }
    }
    int cnt = 0;
    for(auto itr = a.begin();itr != a.end();++itr){
        int val = itr->second;
        if(val == 0) cnt++;
    }

    cout << cnt <<endl;
    
    
    return 0;
}

Measured memory_bytes: 3652
H, W = map(int, input().split())
S = [input() for _ in range(H)]

# そのマスを含めてLeft, Right, Up, Downにそれぞれ何マス分明かりを照らせるかを配列に記録
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]

for i in range(H):
	for j in range(W):
		if S[i][j] == ".":
			if j == 0:
				L[i][j] = 1
			else:
				L[i][j] = L[i][j - 1] + 1

for i in range(H):
	for j in range(W - 1, -1, -1):
		if S[i][j] == ".":
			if j == W - 1:
				R[i][j] = 1
			else:
				R[i][j] = R[i][j + 1] + 1

for j in range(W):
	for i in range(H - 1, -1, -1):
		if S[i][j] == ".":
			if i == H - 1:
				D[i][j] = 1
			else:
				D[i][j] = D[i + 1][j] + 1

for j in range(W):
	for i in range(H):
		if S[i][j] == ".":
			if i == 0:
				U[i][j] = 1
			else:
				U[i][j] = U[i - 1][j] + 1


ans = 0
X = [[0] * W for _ in range(H)]
for i in range(H):
	for j in range(W):
		X[i][j] = L[i][j] + R[i][j] + D[i][j] + U[i][j] - 3
	ans = max(ans, max(X[i]))

print(ans)


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

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

typedef long long ll;

int main(){
  string s, t, tmp; cin >> s;

  if( s == "" ){
    cout << "YES" << endl;
    return 0;
  }
  
  int i = 0, l = 0, flag = 0;
  while( 1 ){
    tmp = "";
    if( s[i] == 'd' && i + 4 <= s.size() ){
      REP( j, 5 ) tmp += s[i + j];
      if( tmp == "dream" ){
	t += "dream";
	flag = 0;
	i += 5;
      }
      else break;
    }else if( s[i] == 'e' && i + 4 <= s.size() ){
      REP( j, 5 ) tmp += s[i + j];
      if( tmp == "erase" ){
	t += "erase";
	flag = 0;
	i += 5;
      }
      else break;
    }else if( s[i] == 'a' && i + 2 <= s.size() && flag == 1 ){
      REP( j, 3 ) tmp += s[i + j];
      if( tmp == "ase" ) {
	t += "ase";
	flag = 0;
	i += 3;
      }
      else break;
    }else{
      break;
    }
    
    if( i + 1 < s.size() && s[i + 1] == 'r' && s[i] == 'e' && tmp == "dream" ) {
      t += "er";
      i += 2;
      flag = 1;
    }
    if( i < s.size() && s[i] == 'r'&& ( tmp  == "erase" || tmp == "ase" ) ) {
      t += "r";
      i++;
    }

    if( s == t ){
      cout << "YES" << endl;
      return 0;
    }
  }

  cout << "NO" << endl;
}
  



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


using namespace std;

int main() {


    
    int n;
    cin >> n;
    int arr[n];
    int counter = 0,  count = 0, m = 0;
    for (int i=0;i<n;i++) {
        cin >> arr[i];
        if (i != 0)
        if (arr[i] <= arr[i-1]) {
            counter++;
        } else {
            m = max(counter, m);
            counter = 0;
        }
    }
    m = max(counter, m);
    cout << m;

    return 0;
}

Measured memory_bytes: 640
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var s = 0L;

            for (var i = 1L; i <= n; i++)
            {
                if ((i % 3) == 0 || (i % 5) == 0)
                {
                }
                else
                {
                    s += i;
                }
            }

            Console.WriteLine(s);
        }
    }
}

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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }

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

    string A;
    std::cin >> A;

    vector<ll> char_table(26, 0);
    REP(i, A.size()) {
        char_table[A[i] - 'a']++;
    }

    ll num = 0;
    REP(i, 26) {
        num += (char_table[i] * (char_table[i] - 1)) / 2;
    }

    std::cout << ((ll)A.size() * (A.size() - 1)) / 2 - num + 1 << std::endl;

    return 0;
}


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

using namespace std;

typedef long long LL;
#define N 300000

LL n,m,ans,a[N],b[N],A[N],B[N];

void solve(){
	for (LL i=1;i<=n;++i){
		b[i]=m-a[i];
		A[i]=A[i-1]+(a[i]-a[i-1])*(n-i*2);
	}
	reverse(b+1,b+n+1);
	for (LL i=1;i<=n;++i)
		B[i]=B[i-1]+(b[i]-b[i-1])*(n-i*2);
	for (LL i=1;i<=n;++i){
		LL j=(n-i+1)/2,k=n-i-j;
		if (j>k) ans=max(ans,a[i]*(n-i+1)+B[j]-b[j]*(n-j*2-1)+(A[i+k]-A[i])-(a[i+k]-a[i])*(n-(i+k)*2-2));
		else ans=max(ans,a[i]*(n-i+1)+B[j]-b[j]*(n-j*2-2)+(A[i+k]-A[i])-(a[i+k]-a[i])*(n-(i+k)*2-1));
	}
}

int main(){
	scanf("%lld%lld",&m,&n);
	for (LL i=1;i<=n;++i) scanf("%lld",a+i);
	solve();
	for (LL i=1;i<=n;++i) a[i]=m-a[i];
	reverse(a+1,a+n+1);
	solve();
	printf("%lld\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 8320
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var line = cin.ReadLine;

            string[] a = line.Split(" ");

            var w = a[1] + a[0];


            WriteLine(w);
    


        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 26152
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
ll n;
//ld ;
//string s;

int main() {
    cin >> n;
    ll count = 0;
    ll lst = 200001;
    for(ll i=0;i<n;i++){
        ll p;
        cin >> p;
        if(lst > p){
            count++;
            lst = p;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
if n<m:
    l=sorted(list(map(int,input().split())))
    s=[]
    for i in range(m-1):s.append(l[i+1]-l[i])
    s.sort(reverse=True)
    ans=l[-1]-l[0]
    if m>1:
        for i in range(n-1):ans-=s[i]
    print(ans)
else:print(0)

Measured memory_bytes: 13960
#include <bits/stdc++.h>
using namespace std;
void _fast () { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); }
template<class T> bool chmax(T& a,T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a,T b) { if (a > b) { a = b; return 1; } return 0; }

int main() { _fast();
	vector<int> a(5);
	for (int i = 0; i < 5; i++) cin >> a[i];
	for (int i = 0; i < 5; i++) {
		if (a[i] != i + 1) {
			cout << i + 1 << '\n';
		}
	}
	
	return 0;
}

Measured memory_bytes: 3608
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<map>
#include<iostream>
#include<algorithm>
using namespace std; 
int n,t;
int a[200005];

int main()
{
	cin>>n>>t;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	int ans=t;
	for(int i=2;i<=n;i++)
	{
		int temp;
		temp=a[i]-a[i-1];
		if(temp>=t)
		   ans+=t;
		else
		   ans+=temp;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
import numpy
d = int(input())
c = list(map(int,input().split()))
s = [[2 for j in range(26)] for i in range(d)]
k = [1]*26
for i in range(d):
    if i%36 == 0:
        k = [1]*26
    x = sum(k)
    if x >= 36 - i%36:
        q = 0
        for i in range(26):
            if k[i] == 1:
                q = i
                break
    else:
        q = numpy.argmax(s[i])
    print(q+1)
    k[q] = 0

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k, p;
string s, t;
ld w;

// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	vll a(3);
	cin>>a[0]>>a[1]>>a[2];
	sort(all(a));

	if(a[0] + a[1] == a[2]) cout<<"Yes\n";
	else cout<<"No\n";
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

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

int main() {
	int tr, l;
	long long th[100000], ans = 10000000000, nmin, nhi;
	for (int i = 0; i < 100000; i++) th[i] = 1000000001;
	cin >> tr >> l;
	for (int i = 0; i < tr; i++) cin >> th[i];
	stable_sort(th, th + 100000);
	for (long long i = 0; i < tr - l + 1; i++) {
		nmin = th[i];
		nhi = th[i + l - 1];
		if (ans > nhi - nmin) ans = nhi - nmin;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408