akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define rep(i,a,n) for( int i = a ; i < n ; i++ )
#define prep( i, a , n ) for ( int i = a ; i>= n ; i--)
#define   pr pair<int,int>
const int N = 1e5 + 5 , M=N,inf=(int)1e9;
const int mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
ll ans ;
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
vector < int > h[N];
void solve(){
    int n ;
    cin >> n ;
    vector < int > a(n) ;
    for( int i = 0 ;i < n ; i++)    cin >> a[i] ;
    vector < int > dp(n,0);
    dp[1] = abs(a[1]-a[0]);
    for( int i = 2 ; i< n ; i++){
        dp[i] = min(dp[i-1] + abs(a[i]-a[i-1]) , dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout << dp[n-1] ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
   //cin >> q;
    while(q--)
        solve();
}
/*
    ---------------- lemmas-----------------------------------
   1)
   2)
   3)

*/


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

int main(void)
{
	string str, temp;
	int count = 0;
	while (cin >> str)
	{
		temp = str;
		reverse(str.begin(), str.end());
		if (temp == str) count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn=1e5+100;
const int mod=1e9+7;
ll A[maxn], B[maxn], C[maxn];
string s;
ll pwr(ll num, ll pw)
{
    ll res=1;
    while(pw>0)
    {
        if(pw&1)res=(res*num)%mod;
        num=(num*num)%mod;
        pw>>=1;
    }
    return res;
}
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    string s;
    cin>>s;
    int q=0, a=0;
    for(int i=0; i<sz(s); i++)
    {
        if(s[i]=='A')a++;
        if(s[i]=='?')q++;
        A[i]=(a*pwr(3, q)+q*pwr(3, q-1))%mod;
    }

    for(int i=1; i<sz(s); i++)
    {
        B[i]=B[i-1];
        if(s[i]=='B')B[i]=(B[i]+A[i-1])%mod;
        if(s[i]=='?')B[i]=((B[i]+A[i-1])%mod+(B[i-1]*2)%mod)%mod;
    }

    ll ans=0;

    for(int i=2; i<sz(s); i++)
    {
        C[i]=C[i-1];
        if(s[i]=='C')C[i]=(C[i]+B[i-1])%mod;
        if(s[i]=='?')C[i]=((C[i]+B[i-1])%mod+(C[i-1]*2)%mod)%mod;
    }
    cout<<C[sz(s)-1]<<"\n";
    return 0;
}


Measured memory_bytes: 2768
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


int main()
{

    int a,b,h;
    cin >> a>>b >>h;


      cout << (a+b)*h /2;

    return 0;
}


Measured memory_bytes: 256
/*

*/
#include<bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,a,n) for(int i=(a);i<(n);i++)
#define repe(i,a) for(auto &i:a)

void in(){} template<typename Head,typename... Tail> void in(Head&& head,Tail&&... tail){cin>>head;in(forward<Tail>(tail)...);}

void flagfunc3(bool flag){cout<<(flag?"Yes\n":"No\n");}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int a,b,c,k,cnt=0;
  in(a,b,c,k);
  while(a>=b){cnt++;b*=2;}
  while(b>=c){cnt++;c*=2;}
  flagfunc3(cnt<=k);
}

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

namespace C_sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var p = Console.ReadLine();

            s += s;

            if (s.Contains(p))
            {
                Console.WriteLine("Yes");
            }
            else{
                Console.WriteLine("No");
            }
        }
    }
}



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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int ans=1; int cnt=0;
  int n; cin>>n;
  for (int i=2; i<=n; i++) {
    int x=i; int res=0;
    while (x%2==0) {
      x=x/2; res++;
    }
    if (res>cnt) {
      cnt=res; ans=i;
    }
  }
  out(ans);
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <cstring>
#include <map>
using namespace std;

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

struct State {
    int dis;
    int x,y,turn;
    State(int x,int y,int turn,int dis) : x(x), y(y), turn(turn) , dis(dis) {;}
};

map<char,int> idx;
int memo[1<<8][30][30];

int bfs(vector<string> &mp) {
    const int h = mp.size();
    const int w = mp[0].length();

    int nx,ny,gx,gy;

    for(int i=0; i<(1<<8); ++i)
        for(int j=0; j<30; ++j)
            for(int k=0; k<30; ++k)
                memo[i][j][k] = -1;

    for(int i=0; i<h; ++i) {
        for(int j=0; j<w; ++j) {
            if(mp[i][j] == '@') {
                nx = j; ny = i;
                mp[i][j] = '.';
            } else if(mp[i][j] == '<') {
                gx = j; gy = i;
                mp[i][j] = '.';
            }
        }
    }

    queue<State> Q;
    Q.push(State(nx,ny,0,0));

    while(!Q.empty()) {
        State st = Q.front(); Q.pop();
        int x = st.x, y = st.y;
        if(x == gx && y == gy) return st.turn;

        if(memo[st.dis][x][y] != -1) continue;
        memo[st.dis][x][y] = st.turn;

        for(int dir = 0; dir<4; ++dir) {
            int nx = x + dx[dir], ny = y + dy[dir];
            if(nx < 0 || nx >= w || ny < 0 || ny > h-1 || mp[ny][nx] == '#')
                continue;

            State ns(nx,ny,st.turn+1,st.dis);

            if(isupper(mp[ny][nx]) && (st.dis>>(idx[mp[ny][nx]]))%2 == 0) {
//                cout<<"blocked "<<mp[ny][nx]<<endl;
                continue;
            }

            if(isupper(mp[ny][nx])) {
                // cout<<nx<<" "<<ny<<" "<<st.dis<<" "<<mp[ny][nx]<<" ";
                // cout<<(st.dis>>(idx[mp[ny][nx]]))<<endl;
                Q.push(ns);
            }else if(islower(mp[ny][nx])) {
                if(!(idx.find(toupper(mp[ny][nx])) == idx.end()))
                    ns.dis ^= (1<<idx[toupper(mp[ny][nx])]);

//                cout<<"new dis "<<ns.dis<<" push "<<idx[toupper(mp[ny][nx])]<<endl;
                Q.push(ns);
            }else{
                Q.push(ns);
            }
        }
    }

    return -1;
}

int main() {
    int W,H;
    while(cin>>W>>H, W|H) {
        idx.clear();
        vector<string> mp;
        string s;
        for(int i=0; i<H; ++i) {
            cin>>s;
            mp.push_back(s);
        }

        int nc = 0;
        for(int i=0; i<H; ++i)
            for(int j=0; j<mp[i].length(); ++j)
                if(isupper(mp[i][j]) && idx.find(mp[i][j]) == idx.end())
                    idx[mp[i][j]] = nc++;


        cout<<bfs(mp)<<endl;
    }
}

Measured memory_bytes: 2276
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int32_t N;
  string S;
  cin >> N >> S;

  int32_t result = 0;
  for (int32_t start = 1; start < N; ++start) {
    vector<bool> S1_match(256, false);
    vector<bool> both_match(256, false);
    for (int32_t i = 0; i < start; ++i) {
      S1_match[S.c_str()[i]] = true;
    }
    for (int32_t i = start; i < N; ++i) {
      if (S1_match[S.c_str()[i]]) {
        both_match[S.c_str()[i]] = true;
      }
    }
    int32_t count = 0;
    for (int32_t i = 0; i < 256; ++i) {
      if (both_match[i]) {
        ++count;
      }
    }
    result = max(result, count);
  }
  cout << result << endl;

  return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

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

int memo[22][22][22][22];
int H, W;
string G[22];

int solve(int sy, int sx, int gy, int gx) {

  if(sy == gy || sx == gx) return 0;

  int& ret = memo[sy][sx][gy][gx];
  if(ret + 1) return ret;

  set<int> s;
  REP(i, sy, gy) REP(j, sx, gx) {
    if(G[i][j] == 'X') continue;
    int a = solve(sy, sx, i, j);
    int b = solve(sy, j + 1, i, gx);
    int c = solve(i + 1, sx, gy, j);
    int d = solve(i + 1, j + 1, gy, gx);
    s.insert(a ^ b ^ c ^ d);
  }

  int r = 0;
  while(s.count(r)) r++;

  return ret = r;
}

int main() {

  minus(memo);

  cin >> H >> W;
  rep(i, H) cin >> G[i];
  cout << (solve(0, 0, H, W) > 0 ? "First" : "Second") << endl;
  
  return 0;
}

Measured memory_bytes: 4124
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define _GLIBCXX_DEBUG
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
const ll INF = 9223372036854775807;

int main() {
  string S;cin >> S;
  if (S == "ABC") cout << "ARC" << endl;
  else if (S == "ARC") cout << "ABC" << endl;
}

Measured memory_bytes: 3596
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	int ans = 0;
	int tmp;
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int x, y, z;
	x = min(a, k);
	y = min(b, max(0, k-a));
	z = min(c, max(0, k -a -b));
	cout << x - z << endl;
}

Measured memory_bytes: 3640
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n+1), b(n);
    for(int i=0; i<n+1; ++i)
        cin >> a[i];
    for(int i=0; i<n; ++i)
        cin >> b[i];

    long long ans = 0;
    for(int i=0; i<n; ++i){
        int x = min(a[i], b[i]);
        ans += x;
        a[i] -= x;
        b[i] -= x;
        int y = min(a[i+1], b[i]);
        ans += y;
        a[i+1] -= y;
        b[i] -= y;
    }
    cout << ans << endl;

    return 0;
}


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

using namespace std;

int main() {
  int K, N;
  cin >> K >> N;
  vector<int> v;
  for (int i = 0; i < N; i++) {
    int t;
    cin >> t;
    v.push_back(t);
  }
  int m = 0;
  for (int i = 1; i < N; i++) {
    m = max(m, v[i] - v[i - 1]);
  }
  m = max(m, K - v[v.size() - 1] + v[0]);
  cout << K - m;
}

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

int main() {
    int h,w;

    cin >> h >> w;

    string s[h];

    bool flag[h][w];

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            flag[i][j] = true;
        }
    }

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


    for(int he = 0; he < h; he++){
        bool black_flag = false;
        for(int wi = 0; wi < w; wi++){
            if(s[he][wi] == '#'){
                black_flag = true;
            }
        }
        if(!black_flag){
            for(int wi = 0; wi < w; wi++){
                flag[he][wi] = false;
            }
        }
    }

    for(int wi = 0; wi < w; wi++){
        bool black_flag = false;
        for(int he = 0; he < h; he++){
            if(s[he][wi] == '#'){
                black_flag = true;
            }
        }
        if(!black_flag){
            for(int he = 0; he < h; he++){
                flag[he][wi] = false;
            }
        }
    }

    for(int he=0; he<h; he++){
        bool write_flag = false;
        for(int wi=0; wi<w; wi++){
            if(flag[he][wi]) {
                cout << s[he][wi];
                write_flag = true;
            }
        }
        if(write_flag){
            cout << endl;
        }
    }

    return 0;
}

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

int N,K;
string S;

signed main() {
  cin >> N >> K >> S;

  vector<int> r;
  for(int i=1; i<N; i++) if(S[i]!=S[i-1])  r.push_back(i);

  if(r.size() <= K*2) cout << N -1 << endl;
  else cout << N - (r.size() - K*2) - 1 << endl;
}


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

using namespace std;

typedef long long int64;

int N, A, B;
int64 v[50];


void dfs(int idx, int end, int beet, int64 sum, vector< int64 > &s, vector< int64 > &t)
{
  if(idx == end) {
    if(s[beet] < sum) {
      s[beet] = sum;
      t[beet] = 1;
    } else if(s[beet] == sum) {
      ++t[beet];
    }
    return;
  }
  dfs(idx + 1, end, beet + 1, sum + v[idx], s, t);
  dfs(idx + 1, end, beet, sum, s, t);
}

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

  int mid = N / 2;
  vector< int64 > big1(mid + 1, -1), big2((N - mid) + 1, -1);
  vector< int64 > sz1(mid + 1, 0), sz2((N - mid) + 1, 0);
  dfs(0, mid, 0, 0, big1, sz1);
  dfs(mid, N, 0, 0, big2, sz2);

  pair< int64, int > ret(0, 0);

  for(int i = 0; i < big1.size(); i++) {

    for(int j = 0; j < big2.size(); j++) {

      if(A <= i + j && i + j <= B) {
        if(ret == make_pair(0LL, 0) || (big1[i] + big2[j]) * ret.second > ret.first * (i + j)) {
          ret = {big1[i] + big2[j], i + j};
        }
      }
    }
  }

  cout << fixed << setprecision(10) << (long double) ret.first / ret.second << endl;

  int64 ret2 = 0;
  for(int i = 0; i < big1.size(); i++) {
    for(int j = 0; j < big2.size(); j++) {
      if(A <= i + j && i + j <= B) {
        if((big1[i] + big2[j]) * ret.second == ret.first * (i + j)) {
          ret2 += 1LL * sz1[i] * sz2[j];
        }
      }
    }
  }

  cout << ret2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <string>
#include <set>
using namespace std;

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

const int inf = 1001001000;
const int mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

    set<int> s;

    rep(i, a,min(a+k,b)){
        s.insert(i);
    }

    rep(i, max(a,b-k+1), b+1){
        s.insert(i);
    }

    for(auto e: s) cout << e << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jiglypuff
#define ld long double
#define itn int
#define pir pair<int, int> 
#define all(x) (x).begin(), (x).end()
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x1, ld y1, ld x2, ld y2)
{
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
	return (a * (a + 1LL)) / 2;
}
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 1, -1, 0, 0, -1, -1, 1, 1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };


const int N = 1e5 + 30;
const lli mod = 998244353;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-6;

lli bp(lli a, lli b = mod - 2LL)
{
	lli ret = 1;
	while (b)
	{
		if (b & 1) ret *= a, ret %= mod;
		a *= a;
		a %= mod;
		b >>= 1;
	}
	return ret;
}
ostream& operator<<(ostream& c, pir a)
{
	c << a.fr << " " << a.sc;
	return c;
}




lli a, b, x, n;
int main()
{
	fastio;
	cin >> a >> b >> n;
	x = min(n, b - 1LL);
	cout << ((a * x) / b) - a * (x / b);
	return 0;
}


/*


  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/



Measured memory_bytes: 3696
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<cstdio>

using namespace std;

double EPS = 1e-10;
const double PI = acos(-1);

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
  
  bool operator == ( const point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

double areaPol(vector<point> t, int n){
  t.push_back(t[0]);
  int tsz=t.size();
  double area=0;
  for(int i=0;i<tsz-1;i++){
    area+=(t[i].x-t[i+1].x)*(t[i].y+t[i+1].y);
  }
  return abs(area)/2.0;
}

int main(void){
  point p;
  vector<point>t;
  int n=0;
  double x,y;
  char k;

  while(cin>>x>>k>>y){
    p.x = x;
    p.y = y;
    t.push_back(p);
    n++;
 }

  printf("%.6f\n",areaPol(t,n));

  return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N, C;
  cin >> N >> C;
  const int MAX = 1e5+10;
  VI tms(MAX);
  vector<vector<PII>> ps(C);
  REP(i,N){
	int s, t, c;
	cin >> s >> t >> c;
	ps[c-1].PB(MP(s,t));
  }
  REP(c,C){
	if(ps[c].empty()) continue;
	SORT(ps[c]);
	int b = ps[c][0].FF, e = ps[c][0].SS;
	FOR(i,1,SZ(ps[c])){
	  if(e == ps[c][i].FF){
		e = ps[c][i].SS;
	  }
	  else{
		tms[b-1]++;
		tms[e]--;
		b = ps[c][i].FF;
		e = ps[c][i].SS;
	  }
	}

	tms[b-1]++;
	tms[e]--;
  }

  int ans = 1, crt = 0;
  REP(i,MAX){
	crt += tms[i];
	maxi(ans, crt);
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main()
{
  int N, M, C; cin >> N >> M >> C;
  vector<int> B(M);
  for (int i = 0; i < M; ++i) cin >> B[i];

  vector<vector<int>> A(N, vector<int>(M));
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      cin >> A[i][j];
    }
  }

  int ans = 0;
  for (int i = 0; i < N; ++i) {
    int sum = 0;
    for (int j = 0; j < M; ++j) {
      sum += A[i][j] * B[j];
    }
    if (sum > -C) ans++;
  }

  cout << ans;
}

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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[";
    REP(i, vec.size()) {
        if (i > 0) cout << ", ";
        os << vec[i];
    }
    os << "]";

    return os;
}

struct Node {
    Node() : id_(-1), parent_(nullptr), left_(nullptr), right_(nullptr){};
    ~Node(){};

    Node* find_root() {
        if (!parent_) return this;

        return parent_->find_root();
    }

    void preorder_walk() {
        cout << " " << id_;
        if (left_) left_->preorder_walk();
        if (right_) right_->preorder_walk();
    }

    void inorder_walk() {
        if (left_) left_->inorder_walk();
        cout << " " << id_;
        if (right_) right_->inorder_walk();
    }

    void postorder_walk() {
        if (left_) left_->postorder_walk();
        if (right_) right_->postorder_walk();
        cout << " " << id_;
    }

    int id_;
    Node *parent_;
    Node *left_;
    Node *right_;
};

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

    int n;
    cin >> n;

    Node T[n];


    REP(i, n) {
        int id, left, right;
        cin >> id >> left >> right;
        T[id].id_ = id;

        if (left > -1) {
            T[left].parent_ = T + id;
            T[id].left_ = T + left;
        }

        if (right > -1) {
            T[right].parent_ = T + id;
            T[id].right_ = T + right;
        }

    }

    Node* root = T[0].find_root();

    cout << "Preorder" << endl;
    root->preorder_walk();
    cout << endl;

    cout << "Inorder" << endl;
    root->inorder_walk();
    cout << endl;

    cout << "Postorder" << endl;
    root->postorder_walk();
    cout << endl;
}


Measured memory_bytes: 3204
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int Brank(vint v, int num)
{
	rep(i, v.size() - num + 1)
	{
		rep(j, num)
		{
			if(v[i + j] != -1) break;
			else if(j + 1 == num) return i;
		}
	}
	
	return -1;
}

int main()
{
    for(int n; cin >> n;)
	{
		queue<int>  que; // id
		vint store(17, -1); // time
		int nxt = 0, start;
		
		for(int time = 0; ; time++)
		{
			// ツ行ツ療アツづ可嘉つヲツづゥ
			if(time % 5 == 0)
			{
				if(nxt == n) start = time;
				
				que.push(nxt++);
			}
			
			// ツ店ツつゥツづァツ出ツつキ
			rep(i, 17)
				store[i] = (store[i] == time ? -1 : store[i]);
			
			// ツ店ツづ可禿シツづェツづゥ
			while(!que.empty())
			{
				int id = que.front();
				int num = (id % 5 == 1 ? 5 : 2);
				
				int index = Brank(store, num);
				
				if(index != -1)
				{
					if(id == n)
					{
						cout << time - start << endl;
						goto ng;
					}
					
					int span = 17 * (id % 2) + 3 * (id % 3) + 19; 
					REP(i, index, index + num) 
					{
						store[i] = time + span;
					}
					
					que.pop();
				}
				else 
				{
					break;
				}
			}
		}
		
	ng:;
		
	}
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
        }

        Arrays.sort(array);
        final int a = array[n - 1];
        int b = array[0];

        for (int i = 1; i < n - 1; i++) {
            if (a % 2 == 0) {
                if (Math.abs(a / 2 - array[i]) < Math.abs(a / 2 - b)) {
                    b = array[i];
                }
            } else if (Math.abs(a / 2 - array[i]) < Math.abs(a / 2 - b) || Math.abs(a / 2 + 1 - array[i]) < Math.abs(a / 2 + 1 - b)) {
                b = array[i];
            }
        }

        System.out.println(a + " " + b);
    }
}


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

using namespace std;

const int N = 2e5+3;

vector<int> g[N];
int x[N];
int val[N];

void dfs(int r,int f){
    int l = g[r].size();
    val[r]+=x[r];
    for(int i =0;i<l;i++){
        int v = g[r][i];
        if(v==f) continue;
        val[v]+=val[r];
        dfs(v,r);
    }
}
int32_t main(){

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

    int n,q;
    cin>>n>>q;
    for(int i = 1;i<n;i++){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    for(int i= 0; i<q;i++){
        int a,b;
        cin>>a>>b;
        x[a]+=b;
    }
    dfs(1,0);
    for(int i=1; i<=n;i++){
        cout<<val[i]<<' ';
    }
    return 0;
}

Measured memory_bytes: 27136
N=int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
  
A=0
z=1
q=factorization(N)
if N==1:
    print(0)
else:  
    for i in range(len(q)):
        for j in range(1,101):
            z=q[i][0]**j
            if N%z==0:
                A+=1
                N=N/z
            else:
                break
    print(A)

Measured memory_bytes: 9440
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

kijun = ord("a")
kijun2 = ord("z")

s = readline().rstrip().decode('utf-8')

if kijun <= ord(s) <= kijun2:
    print("a")
else:
    print("A")

Measured memory_bytes: 61716
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,s=INT_MAX,y;
    cin>>n;
    long long arr[n+1];
    for(long long i=1;i<=(n);i++)
    cin>>arr[i];
    for(long long t=1;t<n;t++)
    {
        long long sum=0,sum1=0;
    for(long long i=1;i<=(n);i++)
    {
        if(i<=t)
            sum+=arr[i];
        else if(i>t)
            sum1+=arr[i];

    }
    y=abs(sum-sum1);
    s=min(s,y);

    }
    cout<<s;

}


Measured memory_bytes: 256
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()

Measured memory_bytes: 24804
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val nums = readLine()!!.split(" ").map { it.toInt() }
    for (i in 0 until n) {
        val num = nums[i]
        if (num % 2 == 0 && (num % 3 != 0 && num % 5 != 0)) {
            return println("DENIED")
        }
    }
    println("APPROVED")
}

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

ans = 0

for i in range(1, n+1):
    if i % 2 == 0:
        continue
    count = 0
    for j in range(1, i+1):
        if i % j == 0:
            count += 1
    if count == 8:
        ans += 1

print(ans)

Measured memory_bytes: 2940
from collections import deque

h, w = map(int, input().split())
Black = deque([])
Black_grid = [[-1 for _ in range(w)] for _ in range(h)]

for i in range(h):
    a = str(input())
    for j in range(w):
        if a[j] == '#':
            Black.append([j,i])
            Black_grid[i][j] = 0

Move = [[-1,0],[1,0],[0,-1],[0,1]]

while Black:
    now = Black.popleft()
    x = now[0]
    y = now[1]
    for move in Move:
        x_next = x + move[0]
        y_next = y + move[1]
        if x_next < 0 or x_next >= w or y_next < 0 or y_next >= h:
            continue
        elif Black_grid[y_next][x_next] >= 0:
            continue
        else:
            Black.append([x_next, y_next])
            Black_grid[y_next][x_next] = Black_grid[y][x] + 1

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, Black_grid[i][j])
    
print(ans)

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

void push(int);
int pop(void);

int stack[100];
int top = 0;

int main(){
  int x,f1,f2;
  char s[100];
  
  stack[0] = 0;

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      f1 = pop();
      f2 = pop();
      push(f1+f2);
    } else if ( s[0] == '-' ){
      f1 = pop();
      f2 = pop();
      push(f2-f1);
    } else if ( s[0] == '*' ){
      f1 = pop();
      f2 = pop();
      push(f1*f2);
    } else {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",pop());

  return 0;
}

void push(int num){
    stack[top] = num;
    top++;
}

int pop(void){
    top--;
    return stack[top];
}



Measured memory_bytes: 2108
s = list(str(input()))
n = len(s)
ans = [0] * n
for ri in range(2):
    cnt = 0
    for i in range(n):
        if s[i] == "R":
            cnt += 1
        else:
            ans[i] += cnt // 2
            ans[i - 1] += (cnt + 1) // 2
            cnt = 0

    s.reverse()
    ans.reverse()
    for i in range(n):
        if s[i] == "L":
            s[i] = "R"
        else:
            s[i] = "L"

print(" ".join(map(str, ans)))

Measured memory_bytes: 11180
N,T=map(int,input().split())


min_cost=-1
for _ in range(N):
    cost,time=map(int,input().split())
    if(time<=T):
        if(min_cost==-1 or cost <min_cost):
            min_cost=cost

if(min_cost==-1):
    print("TLE")
else:
    print(min_cost)

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

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

int H,W;
vector<vector<int>> field;
int cnt;

bool seen[510][510];
void dfs(int h,int w){
  seen[h][w] = true;

  for(int dir=0;dir<8;dir++){
    int nh=h+dx[dir];
    int nw=w+dy[dir];

    if(nh<0 || nh>=H || nw<0 || nw>=W) continue;
    if(field[nh][nw] == 0) continue;

    if(seen[nh][nw]) continue;

    dfs(nh,nw);
  }
}

int main(){
  cin >> W >> H;
  while(H!=0 || W!=0){
    field.resize(H);
    for(int i=0;i<H;i++){
      field[i].resize(W);
    }
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        cin >> field[i][j];
      }
    }

    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        seen[i][j] = false;
      }
    }
    cnt = 0;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        if(seen[i][j]) continue;
        if(field[i][j] == 1){
          dfs(i,j);
          cnt++;
        }
      }
    }

    cout << cnt << endl;
    cin >> W >> H;
  }
}


Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#define LL long long
#define front top
using namespace std;
const double PI = acos(-1.0);

int smax(int ary[]) {
	int m = 0;
	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
		if (m < ary[i]) m = ary[i];
	return m;
}

int nmax(int ary[]) {
	int max = 0, num;
	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
		if (max < ary[i]) {
			max = ary[i];
			num = i;
		}
	return max, num;
}

bool dfs(int q,int value) {
	return false;
}

int max2(int a, int b) {
	if (a < b) a = b;
	return a;
}

int min2(int a, int b) {
	if (a > b) a = b;
	return a;
}

int max3(int a, int b, int c) {
	return max2(a, max2(b, c));
}

int min3(int a, int b, int c) {
	return min2(a, min2(b, c));
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
		cout << "Possible" << endl;
	else
		cout << "Impossible" << endl;
	return 0;
}

Measured memory_bytes: 256
a = input()
hl = int(len(a)/2)
first = a[:hl]
last = a[:hl+(len(a)%2-1):-1]
ans = 0
# print(first)
# print(last)
for fi,la in zip(first,last):
    if fi != la :
        ans += 1
print(ans)

Measured memory_bytes: 8984
N=int(input())
s1=input()
s2=input()

i=0

ans=1

prev=-2

if(N==1):
	print(3)

elif(i+1<N):

	if(s1[i]==s1[i+1]):
		ans*=6
		i+=2
		prev=1

	else:
		ans*=3
		i+=1
		prev=2


	while(i<N):
	
		if(i+1<N):

			if(prev==1 and s1[i]==s1[i+1]):

				ans*=3
				i+=2
				prev=1

			elif(prev==2 and s1[i]==s1[i+1]):

				ans*=2
				i+=2
				prev=1

			elif(prev==1):

				i+=1
				prev=2

			elif(prev==2):

				ans*=2
				i+=1
				prev=2

		elif(i<N):

			if(prev==1):

				i+=1
				prev=2

			elif(prev==2):

				ans*=2
				i+=1
				prev=2	
			
			
	print(ans%1000000007)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s1,s2;
  cin>>s1>>s2;
  int c=0;
  for(int i=0;i<3;i++)
  {
    if(s1[i]==s2[i])
      c++;
  }
  cout<<c;
  return 0;
}


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

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

using namespace std;


int main(){

    long long n;
    cin >> n;

    vector<int> ans;
    long long tmp = n;
    long long times = -2;
    while(tmp!=0){
        if(tmp%times!=0){
            ans.push_back(1);
            tmp -= times/(-2);
        }
        else ans.push_back(0);
        times *= -2;
    }

    if(n==0){
        cout << 0 << endl;
        return 0;
    }

    for(long long i=ans.size()-1;i>=0;i--){
        cout << ans[i];
    }
    cout << endl;

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;


struct Dice
{
	int label[6];

	void create()
	{
		for (int i = 0; i < 6; i++)
		{
			cin >> label[i];
		}
	}

	void roll(string s)
	{
		int buf[6];
		for (int i = 0; i < 6; i++)
		{
			buf[i] = label[i];
		}

		if (s == "E")
		{
			label[0] = buf[3];
			label[2] = buf[0];
			label[3] = buf[5];
			label[5] = buf[2];
		}
		else if (s == "N")
		{
			label[0] = buf[1];
			label[1] = buf[5];
			label[4] = buf[0];
			label[5] = buf[4];
		}
		else if (s == "S")
		{
			label[0] = buf[4];
			label[1] = buf[0];
			label[4] = buf[5];
			label[5] = buf[1];
		}
		else if (s == "W")
		{
			label[0] = buf[2];
			label[2] = buf[5];
			label[3] = buf[0];
			label[5] = buf[3];
		}
	}

	bool operator ==(Dice d)
	{
		for (int i = 0; i < 6; i++)
		{
			if (label[i] != d.label[i])
			{
				return false;
			}
		}
		return true;
	}
};

int main()
{
	Dice dice0, dice1;
	dice0.create();
	dice1.create();

	string output = "No";
	string ls[] = { "E", "N", "S", "W" };

	for (int i = 0; i < 100000; i++)
	{
		dice0.roll(ls[rand() % 4]);

		if (dice0 == dice1)
		{
			output = "Yes";
			break;
		}
	}

	cout << output << endl;
}


Measured memory_bytes: 3212
import fractions

N=int(input())
alist=list(map(int,input().split()))

lcm=1
for a in alist:
  lcm=lcm*a//fractions.gcd(lcm,a)
  
#print(lcm)
answer=0
for a in alist:
  answer+=(lcm-1)%a
  
print(answer)

Measured memory_bytes: 5344
#include"bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;

#define double long double
#define int long long
#define pb push_back 
#define Z(c) (int)(c).size()
#define L(c) c[Z(c)-1]
#define F first
#define S second
#define nl "\n"
#define mii map<int,int> 
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define rep(i,iv,n) for(int (i)=(iv);(i)<(n);++(i))
#define FO fflush(stdout) 
#define D1(x) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<nl
#define D2(x,y) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<nl
#define D3(x,y,z) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<nl
#define tr(it,ct) for(auto &(it) : (ct))
#define pi acos(-1)
#define prt(ct) for(auto &(it) : (ct)) cerr<<it<<" "; cerr<<nl
#define prtp(ct) for(auto &(it) : (ct)) cerr<<it.F<<" "<<it.S<<nl; cerr<<nl

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;
typedef vector< pii > vp;
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> baap;

void swap(char &a,char &b)
{ auto tm=a; a=b; b=tm; }

void mina(int &a,int b)
{ a=(a<b?a:b); }

void maxa(int &a,int b)
{ a=(a>b?a:b); }

  const int mod=1000000007;
  const int mod2=998244353;
  const int INF=1e16+18;
  const int N=1e5+15;
  const int M=1e3+13;

 vi v[N];
 vi adj[N];
 int dp[N];

 int dfs(int x){

    if(dp[x]!=-1) return dp[x];
    dp[x]=0;
    tr(i,adj[x])
    maxa(dp[x],dfs(i)+1);
    return dp[x];
 }

 void fft()              
 {  rep(i,0,N) dp[i]=-1;
   int n,m; cin>>n>>m; 
   rep(i,0,m){
     int x,y; cin>>x>>y;
     v[x].pb(y); adj[y].pb(x);
   }

   vi a;
   rep(i,1,n+1) if(!Z(v[i])) a.pb(i);

                 
   int ans=0;
         
   tr(i,a) maxa(ans,dfs(i));

   cout<<ans;

 }

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

   
   int tc=1;                         
 //  cin>>tc;

  rep(i,1,tc+1)
  { // cout<<"Case #"<<i<<": ";
   fft();
   if(i<tc)
   cout<<nl;
  }

 return 0; 
}

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

int main() {
    int n; cin >> n;
    vector<pair<int, int>> p;
    for (int i = 0; i < n; i++) {
        int x, l; cin >> x >> l;
        p.emplace_back(x+l, x-l);
    }
    sort(p.begin(), p.end());
    int curr = -2e9, ans = 0;
    for (int i = 0; i < n; i++) {
        if (curr <= p[i].second) {
            ans++; curr = p[i].first;
        }
    }
    cout << ans << endl;
}

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

int main()
{
    long long int n,i,j,k;
    cin>>n;
    vector<long long int> a(n),b(n),c(n),x(n),y(n),z(n);


    for(i=0;i<n;i++)
        cin>>a[i]>>b[i]>>c[i];

    x[0]=a[0];
    y[0]=b[0];
    z[0]=c[0];


    for(i=1;i<n;i++)
    {
        x[i]=a[i]+max(y[i-1],z[i-1]);
        y[i]=b[i]+max(x[i-1],z[i-1]);
        z[i]=c[i]+max(x[i-1],y[i-1]);
    }

    cout<<max(x[n-1],max(y[n-1],z[n-1]));
    return 0;


}


Measured memory_bytes: 4992
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
var [n,k]=arr.shift().split(" ").map(Number);
var x =arr.map(Number);
x.length=n;
var d=(x[x.length-1]+1)-x[0];
var a=[];
for(var i=0;i<x.length-1;i++)a.push(x[i+1]-x[i]-1);
a.sort((a,b)=>b-a);
var sum=0;
for(var i=0;i<k-1;i++){
   if(i>a.length-1)break;
   sum+=a[i];
}
console.log(d-sum);


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

int main(){
        int N;
        int d[100];

        cin >> N;
        for (size_t i = 0; i < N; i++) {
                cin >> d[i];
        }


        int num[100+1]={};
        for (size_t i = 0; i < N; i++) {
                num[d[i]]++;
        }

        int res = 0;
        for (size_t i = 1; i <= 100; i++) {
                if(num[i]) res++;
        }

        cout << res << endl;

        return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 1000 + 5;
const int OO = 1e9;
const int mod = 1e9 + 7;

string s1,s2;

int main() {

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

    cin >> s1 >> s2;
    reverse(s1.begin(),s1.end());
    cout << (s1==s2 ? "YES" : "NO") << '\n';

    return 0;

}

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

class Handan
{
public:
    int a;
    char s[5];
};

int main(){
    Handan handan;
    cin >> handan.a;
    cin >> handan.s;
    if(handan.a >= 3200){
        cout << handan.s;
        return 0;
    }else{
        cout << "red";
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char *argv[])
{
	long long n;
	scanf("%lld",&n);
	long long a[n],b[n],max=-1,min=100000000000000,i,c[n],ans,an;
	for(i=0;i<n;i++){
		scanf("%lld %lld",&a[i],&b[i]);
		c[i]=a[i]+b[i];
	}
	for(i=0;i<n;i++){
		if(c[i]>max)
			max=c[i];
		if(c[i]<min)
			min=c[i];
	}
	ans=max-min;
	max=-1000000000000000;
	for(i=0;i<n;i++)
		if((a[i]-b[i])>max)
			max=a[i]-b[i];
	an=max;
	max=-1000000000000000;
	for(i=0;i<n;i++)
		if((b[i]-a[i])>max)
			max=b[i]-a[i];
	an+=max;
	if(an<0)an*=(-1);
	max=ans;
	if(an>max)
		max=an;
	printf("%lld\n",max);
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,L;
  cin >> N >> L;
  vector<string> vec(N);
  for(int i = 0 ;i<N; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());

  string S;
  for(int i = 0 ;i<N; i++){
    S += vec.at(i);
  }
  cout << S << endl;
}

Measured memory_bytes: 256
n = int(input())
t = 0
h = 0
for _ in range(n):
    a_lst = input().rstrip().split(" ")
    #print(a_lst)
    b_lst = sorted(a_lst)
    #print(b_lst)
    if a_lst[0] == a_lst[1]:
        t += 1
        h += 1
    elif a_lst == b_lst:
        h += 3
    else:
        t += 3
print(t, h)


Measured memory_bytes: 5596
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
if 1 in A:
    cnt = 0
    ans = 0
    for i in A:
        if i == cnt + 1:
            ans += 1
            cnt += 1
    print(N-ans)
    
else:
    print(-1)

Measured memory_bytes: 26268
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

#define rep(i,n) for(int i=0;i<int(n);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,i,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

void solve(){
	int A, B, C;
	cin >> A >> B >> C;
	if((A + B) >= C){
		cout << "Yes";
	}else {
		cout << "No";
	}
	cout << endl;
}

int main(){
	solve();
	return 0;
}

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

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

    int ans = 0;
    for(int i=0;i<n;i++){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
            ans += 1;
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
my %LD;
$LD{'A'} = 0;
$LD{'B'} = 1;
$LD{'C'} = 2;
$LD{'D'} = 3;
$LD{'E'} = 4;
$LD{'F'} = 5;
$LD{'G'} = 6;
$LD{'H'} = 7;
$LD{'I'} = 8;
$LD{'J'} = 9;
$LD{'K'} = 10;
$LD{'L'} = 11;
$LD{'M'} = 12;
$LD{'N'} = 13;
$LD{'O'} = 14;
$LD{'P'} = 15;
$LD{'Q'} = 16;
$LD{'R'} = 17;
$LD{'S'} = 18;
$LD{'T'} = 19;
$LD{'U'} = 20;
$LD{'V'} = 21;
$LD{'W'} = 22;
$LD{'X'} = 23;
$LD{'Y'} = 24;
$LD{'Z'} = 25;
my %DL;
$DL{'0'} = 'A';
$DL{'1'} = 'B';
$DL{'2'} = 'C';
$DL{'3'} = 'D';
$DL{'4'} = 'E';
$DL{'5'} = 'F';
$DL{'6'} = 'G';
$DL{'7'} = 'H';
$DL{'8'} = 'I';
$DL{'9'} = 'J';
$DL{'10'} = 'K';
$DL{'11'} = 'L';
$DL{'12'} = 'M';
$DL{'13'} = 'N';
$DL{'14'} = 'O';
$DL{'15'} = 'P';
$DL{'16'} = 'Q';
$DL{'17'} = 'R';
$DL{'18'} = 'S';
$DL{'19'} = 'T';
$DL{'20'} = 'U';
$DL{'21'} = 'V';
$DL{'22'} = 'W';
$DL{'23'} = 'X';
$DL{'24'} = 'Y';
$DL{'25'} = 'Z';
my $N = glob <>;
my @S = split(//o, <>);
foreach my $s (@S) {
  chomp($s);
  next if ($s eq '');
  my $i = ($LD{$s}+$N)%26;
  print $DL{$i};
}

Measured memory_bytes: 2176
/* Alohomora */
#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define inp(i,a,n) for(i=0;i<n;i++) {cin>>a[i];}
#define op(i,a,n)  for(i=0;i<n;i++) {cout<<a[i]<<" ";}
#define pb         push_back
#define mp         make_pair
#define mod1        987654319 
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
ll fact(ll n){ if(n==0){return 1;}return (n*fact(n-1))%mod1;}
ll power(ll x, ll y,ll mod){ll out = 1;while (y > 0){if (y & 1) out=(out*x)%mod;y = y>>1;x = (x*x)%mod;}return out%mod;}
ll inverse(ll a){return power(a,mod1-2,mod1);}
ll gcd(ll a,ll b){if(b==0){return a;}gcd(b,a%b);}
ll a[2000000];
void sieve(){ll i,j;fli(i,2,1000001){if(a[i]==0){for(j=i*i;j<1000001;j+=i){a[j]=1;}}}}
map<ll,vector<ll> >m1;
vector<ll>v1;
bool compar(const pair<ll,ll> &a, const pair<ll,ll> &b) 
{ 
    return (a.second < b.second);
} 
ll level[1000000];
vector<ll>root;
void comp()
{
	ll i,j,l,r,n,q,k,u,v,c,d;
	cin>>n>>d;
	vector<vector<ll> >v1(n+1);
	fl(i,n)
	{
		fl(j,d)
		{
			cin>>c;
			v1[i].pb(c);
		}
	}
	ll temp,count=0;
	map<ll,ll>m1;
	fli(i,1,10000)
	{
		m1[i*i]=1;
	}
	fl(i,n)
	{
		fli(j,i+1,n)
		{
			temp=0;
			fl(k,d)
			{
				temp+=(v1[i][k]-v1[j][k])*(v1[i][k]-v1[j][k]);	
			}
			if(m1[temp]==1)
			{
				count++;
			}
		}
	}
	cout<<count<<"\n";
} 
int main()
{
	speedup;
	ll i=0,t;
	ll n;
	//cin>>t;
	t=1;
	while(t--)
	{
	 comp();
	}
}

Measured memory_bytes: 2944
#include <iostream>
#include <algorithm>
#include <set>

using namespace std;
int check[200000];
int main() {
    int N, K;
    cin >> N >> K;
    int P[200000];
    for (int i=0; i<N; i++) cin >> P[i];

    set<int> tmp;
    for (int i=0; i<K; i++) {
        tmp.insert(P[i]);
    }

    int sorted = 0;
    int before = -1;
    for (int i=0; i<N; i++) {
        if (before < P[i]) {
            sorted++;
            if (sorted >= K) check[i] = 1;
        } else {
            sorted = 1;
        }
        before = P[i];
        //cerr << sorted << endl;
    }
        
    //for (int i=0; i<N; i++) cerr << check[i]; cerr << endl;

    int ans = 1;
    int checked = check[K-1];
    for (int left=0; left+K<N; left++) {
        // right element
        int appendIdx = left + K;
        int appendVal = P[appendIdx];
        int minimum = *tmp.lower_bound(-1);

        auto searchIte = tmp.lower_bound(appendVal);
        if (check[left+K]) {
            // same to original
            if (checked == 0) ans++;
            checked = 1;
        } else {
            if (searchIte != tmp.end()) {
                // changed in appending
                ans++;
            } else {
                int delVal = P[left];
                if (delVal != minimum) {
                    // changed in deleting
                    ans++;
                }
            }
        }
        tmp.erase(P[left]);
        tmp.insert(appendVal);
    }
    cout << ans << endl;
        
    return 0;
}



Measured memory_bytes: 10368