akhauriyash/Code-Regression huggingface dataset:
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const int M=1000000007;
const int MM=998244353;
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=5e5+5;


ll f(ll a,ll b){
  ll c=0;
  while(a||b){
    a/=10;
    b/=10;
    c++;
  }
  return c;
}


int main()
{ 

IOS;


ll n;cin>>n;

ll x;cin>>x;

vl a(n);

FOR(i,n)cin>>a[i];

ll c=0;

c+=max(0ll,a[0]-x);

a[0]=min(a[0],x);

for(int i=1;i<n;i++){
  if(a[i]+a[i-1]<=x)continue;
  ll dif=a[i]+a[i-1]-x;
  c+=dif;
  a[i]-=dif;

}

cout<<c;

//end_routine();

return 0;
 
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, K;
    cin >> N >> K;

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

    int ans = INF;
    for (int i = 0; i < N-K+1; i++) {
        int sum = 0;
        if (x[i] < 0 && x[K+i-1] <= 0) {
            sum += abs(x[i]);
        } else if (x[i] < 0 && x[K+i-1] > 0) {
            sum += abs(x[i]);
            sum += abs(x[K+i-1] - x[i]);
        } else if (x[i] > 0 && x[K+i-1] > 0) {
            sum += abs(x[K+i-1]);
        }

        ans = min(ans, sum);
    }

    reverse(x.begin(), x.end());
    for (int i = 0; i < x.size(); i++) {
        x[i] = -x[i];
    }

    for (int i = 0; i < N-K+1; i++) {
        int sum = 0;
        if (x[i] < 0 && x[K+i-1] <= 0) {
            sum += abs(x[i]);
        } else if (x[i] < 0 && x[K+i-1] > 0) {
            sum += abs(x[i]);
            sum += abs(x[K+i-1] - x[i]);
        } else if (x[i] > 0 && x[K+i-1] > 0) {
            sum += abs(x[K+i-1]);
        }

        ans = min(ans, sum);
    }

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

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    int n;
    cin >> n;
    map<int,int> count;
    rep(i,0,n){
        int a;
        cin >> a;
        ++count[a];
    }
    int x=0,y=0;
    for(auto it=count.begin(); it!=count.end(); ++it){
        int k=it->second;
        if(k%2!=0) k%=2;
        else k=2;
        if(k==1) ++x;
        if(k==2) ++y;
    }
    cout << x+y-y%2 << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


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

int total;
int ls[10];
int vs[2];

int main() {
  while (1) {
    total = 0;
    for (int i=0; i<10; i++) {
      if (scanf("%d", &ls[i]) != 1) return 0;
      getchar();
      total += ls[i];
    }
    scanf("%d,%d", &vs[0], &vs[1]);

    double p = (double(vs[0])/(vs[0]+vs[1])) * total;
    int sum = 0;
    for (int i=0; i<10; i++) {
      sum += ls[i];
      if (sum >= p) {
        printf("%d\n", i+1);
        break;
      }
    }
  }
}

Measured memory_bytes: 2708
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  long N, M;
  cin >> N >> M;

  long long h[N];
  for (int i = 0; i < N; ++i)
    cin >> h[i];

  vector<long long> r[N];
  for (int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    if (h[a - 1] <= h[b - 1])
      r[a - 1].push_back(b - 1);
    if (h[b - 1] <= h[a - 1])
      r[b - 1].push_back(a - 1);
  }

  long long ret = 0;
  for (int i = 0; i < N; ++i) {
    if (r[i].size() == 0)
      ++ret;
  }

  cout << ret << endl;

  return 0;
}

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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout<<setprecision(15);

    //I don't care about anybody, and fuck ratings! I'll go to google!
    int a, b; cin>>a>>b;
    cout<<max(0, a-2*b)<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int s = 0, mini = 1e9;
	for(int i = 0; i < 5; i++){
		int x;
		cin >> x;
		s += 10 * (ceil((double)x / 10));
		if(x % 10 < mini && x % 10 != 0)
			mini = x % 10;	
	}
	if(mini == 1e9)
		return cout << s, 0;
	cout << s - 10 + mini;
}


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

int main() {
  int64_t N,sum=0;
  cin >> N;
  vector<int> tmp(N);
  map<int64_t,int64_t> a;
  for(int i=0;i<N;i++) {
    cin >> tmp.at(i);
    a[tmp.at(i)]++;
  }
  
  for(auto x : a) {
    sum+=x.second*(x.second-1)/2;
  }
  for(int i=0;i<N;i++) {
    cout << sum-a[tmp.at(i)]+1 << endl;
  }
  
}

Measured memory_bytes: 10240
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const double pi = 3.14159265;
const ll LLINF = 1LL << 50;
using namespace std;



int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((abs(a - b) <= d&&abs(b - c) <= d) || abs(a - c) <= d)Yes;
    else No;
    return 0;
}


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


int main() {
  int a, b, c;
  cin >> a >> b >> c;
  string ans = "NO";
  if(b - a == c - b) ans = "YES";
  
  cout << ans << endl;
  return 0;
  
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	static Scanner s=new Scanner(System.in);
	static int n=s.nextInt();
	public static void main(String[] $){
		System.out.println(f(0,0,0));
	}
	static int f(long v,int f,int d){
		return v>n?0:f/7+f(v*10+7,f|1,d+1)+f(v*10+5,f|2,d+1)+f(v*10+3,f|4,d+1);
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#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;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

/* example
    int n=scc.scc();
    scc.build(n,g);
    (g:outside)
*/
struct SCC{
    vector<int> used,cmp,vs;
    vector<vector<int>> ori;
    vector<vector<int>> v,rv;
    SCC(){}
    SCC(int n):used(n),cmp(n,-1),v(n),rv(n){}
 
    void add_edge(int x,int y){
        v[x].push_back(y);
        rv[y].push_back(x);
    }
    void dfs(int x){
        used[x]=true;
        for(auto to:v[x]) if(!used[to]) dfs(to);
        vs.push_back(x);
    }
 
    void rdfs(int x,int k){
        cmp[x]=k;
        for(auto to:rv[x]) if(cmp[to]==-1) rdfs(to,k);
    }
 
    int scc(){
        for(int i=0;i<used.size();i++) if(!used[i]) dfs(i);
        reverse(vs.begin(),vs.end());
        int k=0;
        for(auto x:vs) if(cmp[x]==-1) rdfs(x,k++);

        ori.resize(k);
        for(int i=0;i<used.size();i++) ori[cmp[i]].push_back(i);

        return k;//k:size
    }

    void build(int k,vector<vector<int>> &g){
        g.resize(k);
        for(int i=0;i<v.size();i++){
            for(auto to:v[i]){
                int x=cmp[i],y=cmp[to];
                if(x!=y) g[x].push_back(y);
            }
        }
    }
};

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

  int N,M;
  cin>>N>>M;
  vector<int> A(M),B(M);
  rep(i,M) cin>>A[i]>>B[i];

  SCC scc(N);
  rep(i,M) scc.add_edge(A[i],B[i]);
  int V=scc.scc();
  vector<vector<int>> cmp(V);
  rep(i,N) cmp[scc.cmp[i]].push_back(i);

  cout<<V<<"\n";
  rep(i,V){
      cout<<cmp[i].size();
      for(auto c:cmp[i]) cout<<" "<<c;
      cout<<"\n";
  }

  return 0;
}


Measured memory_bytes: 112796
#include<bits/stdc++.h>
//#include<unordered_map>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<bitset>
#include<sstream>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl
#define wa()  cout<<"No"<<endl
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
#define SZ(x) x.size()
#define epp empty()
#define all(x) x.begin(),x.end()
#define PA pair<int,int>
#define asd signed QP;scanf("%d",&QP);while(QP--)
typedef vector<int> VE;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;}
int lowbit(int x){return x&-x;}
const int dx[4]={0,0,1,-1};
const int dy[4]={1,-1,0,0};
//
const double eps=1e-6;
const int mod=1e9+7;
const int modd=mod-1;
//
const int maxm=3e6+5;
int a[maxm];
void solve(){
    int n=re;asd{
        int x=re;n-=x;
    }
    if(n>=0)pr(n);
    else pr(-1);
}
signed main(){
//    while(1)
        solve();
    return 0;
}
/*

*/


Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b;
	cin>>a>>b;
	for(int i=1;i<=b;i++){
		if((a*i)%b==0){
			cout<<a*i<<endl;
			break;
		}
	}
	return 0;
}

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

int main() {
   int N; cin >> N;
   vector<int>F(50);
   F[0] = F[1] = 1;
   for (int i = 2; i <= N; i++) F[i] = F[i - 1] + F[i - 2];
   
   cout << F.at(N) << endl;
}


Measured memory_bytes: 3096
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
    int tate,yoko,i=0,j=0,k=0;
    while(cin>>tate>>yoko){
        if(tate==0||yoko==0) break;
        for(i=1;i<=tate;i++){
            for(j=1;j<yoko;j++){
                if(i%2==1){
                    if(j%2==1)cout<<"#";
                    else cout<<".";
                    }
                else{
                    if(j%2==1)cout<<".";
                    else cout<<"#";
                }
            }
            if (yoko%2==0){
                if(i%2==1) cout<<"."<<endl;
                else cout<<"#"<<endl;
                }
            else{
                if(i%2==1) cout<<"#"<<endl;
                else cout<<"."<<endl;
            }
        }
    cout<<endl;
    }
    return 0;
}

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

int main() {
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    double theta = (60*h - 11*m) * M_PI / 360, c;
    c = sqrt(a*a + b*b - 2*a*b* cos(theta));
    cout << fixed << setprecision(9) << c << endl;
}

Measured memory_bytes: 4044
import java.util.Scanner;

public 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();
        
        String result;
        if (a < b && b < c) {
            result = "Yes";
        } else {
            result = "No";
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 17160
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define int long long
#define FILE_IO freopen("input.txt","r",stdin)/#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for (auto &it : t) cout << it << " ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
    int n;
    cin >> n;
    vector<int> b(n);
    for (int i = 0; i < n - 1; i++) cin >> b[i];
    
    vector<int> copy;
    copy.push_back(b[0]);
    for (int i = 0; i + 2 < n; i++){
		int val = min(b[i], b[i + 1]);
	    copy.push_back(val);
	}
	int ret = 0;
	for (auto it : copy) ret += it;
	ret += b[n - 2];
	cout << ret << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

int main(){
    int x;
    cin>>x;
    cout<<(x>=30 ? "Yes" : "No")<<endl;
    
    return 0;
}

Measured memory_bytes: 3580
n, a, b = map(int, input().split())
mod = 10**9 + 7
 
 
def nCr(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
 
 
print((pow(2, n, mod)-1-nCr(n, a, mod)-nCr(n, b, mod)) % mod)

Measured memory_bytes: 3064
//
//AtCoder Beginner Contest 143
//A - Curtain
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int a, b;

    cin >> a >> b;

    int ans = a - 2 * b;
    if (ans < 0 ) ans = 0;
    cout << ans << endl;
    return 0;
}


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

le = len(str(N))
al = ['3','5','7']
al2 = []
for i in range(le-1):
    al1 = []
    for n in al:
        a = int(str(n)+'3')
        b = int(str(n)+'5')
        c = int(str(n)+'7')
        al1.append(a)
        al1.append(b)
        al1.append(c)
        al2.append(a)
        al2.append(b)
        al2.append(c)
    al = al1

cnt = 0
for n in al2:
    if n <= N:
        if all(str(n).count(c) > 0 for c in '753'):
            cnt += 1

print(cnt)

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



// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    // Failed to predict input format
    int N;
    vector<int> A = vector<int>(1001);
    cin >> N;
    bool ok = true;
    for(int i=0; i < N; i++){
        cin >> A[i];
        if(A[i]%2 == 0 && !(A[i]%3 == 0) && !(A[i]%5 == 0)){
            ok = false;
        }
    }
    if(ok){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def f(x):
    info = {}
    col = x
    tmp = 2
    while tmp <= int(x ** 0.5) + 1:
        cnt = 0
        while col % tmp == 0:
            col //= tmp
            cnt += 1
        if cnt >= 1:
            info[tmp] = cnt
        tmp += 1
    if col != 1:
        info[col] = 1
    return info


n, p = map(int, input().split())
ans = 1
info_p = f(p)
for i, j in info_p.items():
    ans *= i ** (j//n)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	int n;
	cin >> n;
	if(n%7 == 0){
		cout<<"thu"<<endl;
	}
	if(n%7==1){
		cout<<"fri"<<endl;
	}
	if(n%7==2){
		cout<<"sat"<<endl;
	}
	if(n%7==3){
		cout<<"sun"<<endl;
	}
	if(n%7==4){
		cout<<"mon"<<endl;
	}
	if(n%7 == 5){
		cout<<"tue"<<std::endl;
	}
	if(n%7==6){
		cout<<"wed"<<endl;
	}

}



Measured memory_bytes: 3068
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) (v).begin(), (v).end()



int main() {

	ll N;
	cin >> N;
	vector<pair<ll, ll>> ab(N), cd(N);
	rep(i, N) cin >> ab[i].first >> ab[i].second;
	rep(i, N) cin >> cd[i].first >> cd[i].second;
	sort(all(ab), [](pair<ll, ll> x, pair<ll, ll> y) {
		if (x.second != y.second)return x.second < y.second;
		else return x.first < y.first;
	});
	sort(all(cd));

	ll ans = 0;
	ford(i, 0, N) {
		rep(j, cd.size()) {
			if (ab[i].first < cd[j].first && ab[i].second < cd[j].second) {
				cd.erase(cd.begin() + j);
				++ans;
				break;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
import math

q = int(input())
s = []
for i in range(q):#h:高さ
    s.append([int(m) for m in input().split()])

def doublecount(dc, i):
    if dc >= s[i][0] and dc >= s[i][1]:
        return -2
    elif dc >= s[i][0] or dc >= s[i][1]:
        return -1
    else:
        return 0


count = 0
for i in range(q):
    t = int(math.sqrt(s[i][0] * s[i][1]))
    if t * (t + 1) < s[i][0] * s[i][1]:
        count = t * 2
        count += doublecount(t, i)
        print(count)
    else:
        if t * t < s[i][0] * s[i][1]:
            count = t * 2 - 1
            count += doublecount(t, i)
            print(count)
        else:
            count = (t - 1) * 2
            count += doublecount(t - 1, i)
            print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int n;
vector<ld> v;
vector<pair<ld,ld>> t;

ld fm(ld x){
    ld ansv=inf;
    for(int i=0;i<n+2;i++){
        ld l=t[i].fi;
        l*=1.00000;
        ld r=t[i].se;
        r*=1.00000;
        ld sa;
        if(x>=0 && x<=l){
            sa=v[i]+(l-x)*1.000000;
        }
        else if(x>=l && x<=r){
            sa=v[i];
            sa*=1.000000;
        }
        else{
            sa=v[i]+(x-r)*1.000000;
        }
        if(sa<ansv)
            ansv=sa;
    }
    return ansv;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    ld count=0.00000;
    t.pb(mp(0.00000,0.00000));
    for(int i=0;i<n;i++){
        ld k;
        cin>>k;
        t.pb(mp(count,count+k));
        count+=k;
    }
    t.pb(mp(count,count));
    v.pb(0.000);
    for(int i=0;i<n;i++){
        ld k;
        cin>>k;
        v.pb(k);
    }
    v.pb(0.000);
    vector<ld> ans;
    for(ld i=0;i<=count;i+=0.500000){
        ld k=fm(i);
        ans.pb(k);
    }
    ld countans=0.00000;
    for(int i=0;i<ans.size()-1;i++){
        ld sa=0.25000*(ans[i]+ans[i+1]);
        countans+=sa;
    }
    cout<<setprecision(9)<<countans<<endl;

    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    int n,ai;
    int a,b,c;
    a=b=c=0;
    cin>>n;
    rep(i,n){
        cin>>ai;
        ai%=3;
        if(ai==0) ++a;
        else if(ai==1) ++b;
        else ++c;
    }
    if(b==0&&c==0) cout<<1<<endl;
    else cout<<min(b,c)*2+1+a+min(2,abs(b-c)-1)<<endl;
    return 0;
}


Measured memory_bytes: 3100
N = int(input())
p = list(map(int, input().split()))
temp = [number for number in p]
for i in range(N):
    if temp[i] != i + 1:
        temp[temp[i]-1], temp[i] = temp[i], temp[temp[i]-1]
        break
p.sort()
if temp == p:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main(){
	
	int H, W;
	
	cin >> H >> W;
	
	string f[100];
	
	int DP[100][100];
	
	for(int i = 0; i < H; i++){
		cin >> f[i];
	}
	
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			DP[i][j] = 100000;
		}
	}
	
	DP[0][0] = 0;
	
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(i != 0){
				DP[i][j] = min(DP[i][j], DP[i - 1][j] + (f[i - 1][j] - '0'));
			}
			if(j != 0){
				DP[i][j] = min(DP[i][j], DP[i][j - 1] + (f[i][j - 1] - '0'));
			}
		}
	}
	
	cout << DP[H - 1][W - 1] << endl;
	
	return 0;
	
}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
const long long m = 1e9+7;
const long long maxn = 2e6+1;
long long fact[maxn];
int k, n;
string s;

int bigmod(int a, int b) 
{
    if(b == 0) return 1 % m;
    int x = bigmod(a, b/2);
    x = (long long) x * x % m;
    if(b&1) x = (long long) x * a % m;
    return x;
}


int comb(int n, int r) {
    if(n < 0 || r < 0) return 0;
    if(n < r) return 0;
    int ans = (long long) ((long long) fact[n] * bigmod(fact[r], m-2) % m) * bigmod(fact[n-r], m-2) % m;
    return ans;
}

int main()
{
    fact[0] = fact[1] = 1;
    for(int i = 2; i <= maxn-1; i++) fact[i] = (long long) fact[i-1] * i % m;
    
    cin >> k >> s;
    n = (int)s.size()-1;
    int ans = 0;
    for(int i = n; i <= n+k; i++) {
        ans = (ans + (long long) ((long long) comb(i,n) * (bigmod(26, (n+k)-i)) % m) * bigmod(25, (i-n)) % m) % m;
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 20944
//
// Created by 李青坪 on 2018/10/26.
//

#include <cstdlib>
#include <cstdio>

using namespace std;

void print(int tree[], int n){
    for (int i = 1; i <= n; ++i) {
        printf("node %d: key = %d, ", i, tree[i]);
        if (i != 1){
            printf("parent key = %d, ", tree[i/2]);
        }
        if (i*2 <= n){
            printf("left key = %d, ", tree[i*2]);
        }
        if (i*2+1 <= n){
            printf("right key = %d, ", tree[i*2+1]);
        }
        printf("\n");
    }
}

int main(){
    int n;
    scanf("%d", &n);
    int tree[n+1];
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &tree[i]);
    }
    print(tree, n);
}
/*
5
7 8 1 2 3
 */


Measured memory_bytes: 2768
import java.util.Scanner;

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

        for (int i = 0; i <N ; i++) {
            nums[i]=sc.nextInt();
        }
        for (int i = N-1; i >0 ; i--) {

            if(nums[i-1] > nums[i] ){
                int diff =nums[i-1] - nums[i];
                if(diff>1){
                    System.out.println("No");
                    return;
                }else if(diff==1){
                    nums[i-1]--;
                }
            }
        }
        System.out.println("Yes");
    }
}


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

int main() {

  string a, b;
  int c, d;
  c = d = 0;
  cin >> a >> b;
  
  for ( int i = 0; i < a.size(); i++){
  
    if (a.at(c) != b.at(c)){
      d++;
    }
  c++;
  }
  
  cout << d;
}


Measured memory_bytes: 3892
#include<iostream>
using namespace std;
#define REP(i,n) for(unsigned int i=0;i<(n);i++)
#define MAX 101
#define INF (1<<21)
#define NONE -1
#define WHITE 0
#define GRAY 1
#define BLACK 2


int node[MAX][MAX];
int N;

int prim()
{
	int cost[MAX];
	int color[MAX];
	int parent[MAX];
	REP(i, N)
	{
		cost[i] = INF;
		color[i] = WHITE;
		parent[i] = NONE;
	}

	cost[0] = 0;
	
	while (true)
	{
		int min_index = NONE;
		int min_value = INF;
		REP(i, N)
		{
			if (color[i] !=BLACK)
			{
				if (cost[i] < min_value)
				{
					min_index = i;
					min_value = cost[i];
				}
			}
		}
		if (min_index == NONE)break;
		color[min_index] = BLACK;
		REP(i, N)
		{
			if (color[i] != BLACK)
			{
				if (node[min_index][i] != INF)
				{
					if (cost[i] > node[min_index][i])
					{
						cost[i] = node[min_index][i];
						parent[i] = min_index;
						color[i] = GRAY;
					}
				}
			}
		}
	}
	int ans = 0;
	REP(i, N)
	{
		if (parent[i]!=NONE)
		{
			ans += node[i][parent[i]];
		}
	}
	return ans;
}


int main()
{
	REP(i, MAX)
	{
		REP(j, MAX)
		{
			node[i][j] = INF;
		}
	}
	cin >> N;
	REP(i, N)
	{
		REP(j, N)
		{
			int tmp;
			cin >> tmp;
			if (tmp == -1)
			{
				node[i][j] = INF;
			}
			else node[i][j] = tmp;
		}
	}
	cout << prim() << endl;
	return 0;
}

Measured memory_bytes: 3120
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int x, y, a, b, c; std::cin >> x >> y >> a >> b >> c;
    std::vector<std::pair<long long, int>> p(a + b + c);
    for (int i = 0; i < a; i++) std::cin >> p[i].first, p[i].second = 0;
    for (int i = a; i < a + b; i++) std::cin >> p[i].first, p[i].second = 1;
    for (int i = a + b; i < a + b + c; i++) std::cin >> p[i].first, p[i].second = 2;
    std::sort(p.rbegin(), p.rend());
    long long ans = 0;
    int cnta = 0, cntb = 0, cntc = 0;
    for (int i = 0; i < a + b + c; i++) {
        if (cnta + cntb + cntc >= x + y) break;
        long long v; int t;
        std::tie(v, t) = p[i];
        if (t == 0) {
            if (cnta >= x) continue;
            cnta++;
            ans += v;
        }
        if (t == 1) {
            if (cntb >= y) continue;
            cntb++;
            ans += v;
        }
        if (t == 2) {
            cntc++;
            ans += v;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 4992
/*________________________Bismillahir Rahmanir Rahim___________________
                                                                      |
|                    /\     |     | |\    |     /\     |-------        |
|                   /  \    |     | | \   |    /  \    |               |
|                  /----\   |-----| |  \  |   /----\   |-----          |
|                 /      \  |     | |   \ |  /      \  |               |
|                /        \ |     | |    \| /        \ |               |
|                     14th batch CSE , ID : 12008029                   |
|                     Comilla University                               |
|                     Email : sheikhahnafshifat@gmail.com              |
|______________________________________________________________________*/
#include<bits/stdc++.h>
#include<string>
#include<iostream>
using namespace std;
#define ll                      long long
#define MAX                     1000007
#define pb(x)                   push_back(x)
#define mp(x,y)                 make_pair(x,y)
#define vii                     vector<int>
#define vll                     vector<long long>
#define vp                      vector<pair<ll, ll> >
#define v_min(a)                *min_element(a.begin(),a.end())
#define v_max(a)                *max_element(a.begin(),a.end())
#define v_sum(a)                accumulate(a.begin(),a.end(),0)
#define un(a)                   a.erase(unique(a.begin(),a.end()),a.end())
#define SORT(a)                 sort(a.begin(),a.end())
#define AHNAF                   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define gcd(a,b)                __gcd(a,b)
#define lcm(a,b)                ((a)*(b))/gcd(a,b)
#define YES                     cout<<"YES"<<endl
#define NO                      cout<<"NO"<<endl
#define testcase(t)             int t;cin>>t;while(t--)
#define reverse(a)              reverse(a.begin(),a.end())
#define ff                      first
#define ss                      second

int main()
{
    AHNAF;
    int n;cin>>n;
    if(n%10==2 || n%10==4 || n%10==5 ||  n%10==7 || n%10==9) cout<<"hon";
    else if(n%10==0 || n%10==1 || n%10==6 ||  n%10==8) cout<<"pon";
    else cout<<"bon";
}




Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)


ll L[2000] = {};
int main() {
	ll n; cin >> n;
	rep(i, 0, n)cin >> L[i];
	sort(L, L + n);

	ll res = 0;
	rep(i, 0, n) {
		rep(j, i+1, n) {
			rep(k, j+1, n) {
				if (L[i] + L[j] > L[k])res++;
			}
		}
	}
	cout << res;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int n,t,a,temp;
    int i,ans,deff;
    
    int min = 10000000;
    scanf("%d %d %d",&n,&t,&a);
    int h[n];
    for (i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    for (i=0;i<n;i++){
        temp = t*1000-h[i]*6;
        if (a*1000>temp){
            deff = a*1000-temp;
        }else{
            deff = temp-a*1000;
        }
        if (min>deff){
            min =deff;
            ans = i+1;
        }
    }
    printf("%d",ans);
    return 0;
}


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

int main(){
  string S;
  cin>>S;
 if(S[0]==S[1]&&S[2]==S[3]&&S[1]!=S[2]){
   cout<<"Yes"<<endl;
   return 0;
 }
     if(S[0]==S[2]&&S[1]==S[3]&&S[1]!=S[2]){
   cout<<"Yes"<<endl;
   return 0;
 }
 if(S[0]==S[3]&&S[2]==S[1]&&S[1]!=S[0]){
   cout<<"Yes"<<endl;
   return 0;
 }
cout<<"No"<<endl;
}


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

using namespace std;

typedef long long ll;
const int maxn = (int) 1e5 + 1;

int n, w;
int   p[maxn], c[maxn];
bool u[101][maxn];
ll dp[101][maxn];
int main() {
    cin >> n >> w;
    u[0][0] = 1;
    for(int i = 1; i <= n; i++){
        cin >> p[i] >> c[i];
    }
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= w; j++){
            u[i][j] = u[i - 1][j];
            dp[i][j] = dp[i - 1][j];
            if(j >= p[i] && u[i - 1][j - p[i]] > 0){
                u[i][j] = 1;
                dp[i][j] = max(dp[i][j], dp[i - 1][j - p[i]] + c[i]);
            }
        }
    }
    ll mx = 0;
    for(int i = 1; i <= w; i++){
        if(u[n][i]){
            mx = max(mx, dp[n][i]);
        }
    }
    cout << mx;
}


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

int main(){
  int a[3]; for(int i; i<3; i++) cin >> a[i];
  int ans=1e7;
  for(int i; i<3; i++){
    int im = i%3; int jm = (i+1)%3;
    if(ans > a[im]+a[jm]) ans = a[im]+a[jm];
  }
  cout << ans << "\n";
}

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

int N,M;
vector<int> ale[MAX];
vector<int> color(MAX,-1);

//いつもの親登録だと、ループにハマる。せっかくだし色を使う.
void dfs(int v,int clr){
    color[v] = clr;
    for(int u : ale[v]){
        if(color[u]!=-1)continue;
        dfs(u,clr);
    }
}   

int main(){
    cin>>N>>M;
    rep(i,M){
        int x,y,z;cin>>x>>y>>z;x--;y--;
        ale[x].push_back(y);
        ale[y].push_back(x);
    }
    int clr = 0;
    rep(i,N){
        if(color[i]!=-1)continue;
        dfs(i,clr);
        clr++;
    }
    cout<<clr<<endl;
    return 0;
}

Measured memory_bytes: 9216
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#define int long long
using namespace std;
const int N=1e5+500,inf=1e18;

int gti(void)
{
    char c=getchar();
    int ret=0,st=1;
    for (;!isdigit(c);c=getchar()) if (c=='-') st=-1;
    for (;isdigit(c);c=getchar()) ret=ret*10+c-'0';
    return ret*st;
}

struct P
{
    int b,c;
    bool operator<(const P &y)const
    {
        return b>y.b||(b==y.b&&c>y.c);
    }
}p[N];

struct Treap
{
    struct T{int s[2],val,id,tot,sum;}t[N];
    int rt,cnt;
#define ls t[v].s[0]
#define rs t[v].s[1]
    void pu(int v)
    {
        t[v].tot=t[ls].tot+t[rs].tot+1;
        t[v].sum=t[v].val+t[ls].sum+t[rs].sum;
    }
    void split(int v,int k,int &x,int &y)
    {
        if (!v) return (void)(x=y=0);
        if (k<=t[ls].tot)
            split(ls,k,x,y),ls=y,y=v;
        else split(rs,k-t[ls].tot-1,x,y),rs=x,x=v;
        pu(v);
    }
    int merge(int a,int b)
    {
        if (!a||!b) return a|b;
        int v;
        if (t[a].id<t[b].id)
            v=a,rs=merge(rs,b);
        else v=b,ls=merge(a,ls);
        pu(v);
        return v;
    }
    int getrank(int v,int val)
    {
        if (!v) return 1;
        if (t[v].val<val)
            return t[ls].tot+1+getrank(rs,val);
        return getrank(ls,val);
    }
    void insert(int val)
    {
        int k=getrank(rt,val),x,y;
        split(rt,k-1,x,y);
        t[++cnt]=(T){{0,0},val,rand(),1,val};
        rt=merge(x,cnt);
        rt=merge(rt,y);
    }
    void clear(void)
    {
        rt=cnt=0;
    }
    int query(int k)
    {
        int x,y,ret;
        split(rt,t[rt].tot-k,x,y);
        ret=t[y].sum;
        rt=merge(x,y);
        return ret;
    }
}t;

int ans[N];
#undef int
int main(void)
#define int long long
{
    int x=gti(),y=gti(),z=gti(),sum=0,n=x+y+z;
    for (int i=1;i<=n;i++)
    {
        int a=gti();
        p[i].b=gti()-a,p[i].c=gti()-a;
        sum+=a;
    }
    sort(p+1,p+1+n);
    int sum2=0;
    for (int i=1;i<=n;i++)
    {
        sum2+=p[i].b,t.insert(p[i].c-p[i].b);
        if (i>=y)
            ans[i]=sum2+t.query(i-y);
    }
    t.clear();
    for (int i=n;i>=1;i--)
    {
        if (i<=y+z)
            ans[i]+=t.query(y+z-i);
        t.insert(p[i].c);
    }
    int mx=-inf;
    for (int i=y;i<=y+z;i++)
        mx=max(mx,ans[i]);
    printf("%lld\n",mx+sum);
    return 0;
}


Measured memory_bytes: 7168
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()

def point(k):
    if k=="r": return P
    if k=="s": return R
    if k=="p": return S

p=0

ser=True



for i in range(0,K):
    p+=point(T[i])
    for j in range(i+K,N,K):
        if T[j-K]==T[j]:
            if ser==True:
                ser=False
            else:
                ser=True
                p+=point(T[j])
        else:
            p+=point(T[j])
            ser=True
    ser=True


print(p)


Measured memory_bytes: 3316
#include <iostream>
using namespace std;
const int N = 8;
void bom(int,int);
int where[N][N];
int main(){
  int n,x,y,i,j,l,flag;
  string S[N];
  cin >> n;
  l=1;
  while(n){
    for(i=0;i<N;i++)
      for(j=0;j<N;j++)
	where[i][j]=0;//???????????±?????????????????¨??????=1
    for(i=0;i<N;i++){
      cin >> S[i];
    }
    cin >> x >> y;
    x--;
    y--;
    S[y][x]='0';
    bom(y,x);
    while(1){
      flag=0;
      for(i=0;i<N;i++){
	for(j=0;j<N;j++){
	  if(where[i][j]==1&&S[i][j]=='1'){
	    flag=1;
	    S[i][j]='0';
	    bom(i,j);
	  }
	}
      }
      if(flag==0) break;
    }
    cout << "Data " << l << ':' << endl;
    for(i=0;i<N;i++) cout << S[i] << endl;
    n--;
    l++;
  }
  return 0;
}
void bom(int y,int x){
  int cpy,cpx,cnt;
  where[y][x]=1;
  cpy=y;
  cnt=0;
  while(1){
    cpy--;
    if(cpy<0) break;
    where[cpy][x]=1;
    cnt++;
    if(cnt==3) break;
  }
  cpx=x;
  cnt=0;
  while(1){
    cpx--;
    if(cpx<0) break;
    where[y][cpx]=1;
    cnt++;
    if(cnt==3) break;
  }
  cpy=y;
  cnt=0;
  while(1){
    cpy++;
    if(cpy==N) break;
    where[cpy][x]=1;
    cnt++;
    if(cnt==3) break;
  }
  cpx=x;
  cnt=0;
  while(1){
    cpx++;
    if(cpx==N) break;
    where[y][cpx]=1;
    cnt++;
    if(cnt==3) break;
  }
}

Measured memory_bytes: 1208
n,m = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
x,ans = sorted(x),0
for i in range(n):
    if m>=x[i][1]:
        ans+=x[i][0]*x[i][1]
        m-=x[i][1]
    else:
        ans+=x[i][0]*m
        break
print(ans)

Measured memory_bytes: 22376
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

string N;
string N_rev;

int main(void)
{
	cin >> N;
	N_rev = N;
	reverse(N_rev.begin(), N_rev.end());
	
	if(N == N_rev) cout << "Yes";
	else cout << "No";
	
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

vector<vector<P>> g;

vector<int> dist;
void dijkstra(int s){
	priority_queue<P, vector<P>, greater<P>> que;
	dist[s] = 0;
	que.push({dist[s], s});
	while(!que.empty()){
		auto v = que.top();
		que.pop();
		int d = v.first;
		int now = v.second;
		if(d > dist[now])continue;
		for(auto nv : g[now]){
			int to = nv.first;
			int cost = nv.second;
			if(dist[now] + cost < dist[to]){
				dist[to] = dist[now] + cost;
				que.push({dist[to], to});
			}
		}
	}
}

int main(){
  int k;
  cin >> k;
  g.resize(k);
  for(int i = 0; i < k; ++i){
  	g[i].push_back({(i + 1) % k, 1});
  	if(i){
  		g[i].push_back({(i * 10) % k, 0});
  	}
  }

  dist.assign(k, INF);
  dijkstra(1);
  cout << dist[0] + 1 << endl;
  return 0;
}


Measured memory_bytes: 6780
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
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<ll> vl;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
template <class Key, class Compare = less<Key>> // find_by_order, order_of_key (for multiset: pair(val, time of insertion))
using Tree = tree<Key, null_type, Compare, rb_tree_tag, tree_order_statistics_node_update>;






void Solution() {

  int n;
  cin >> n;

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

  sort(a, a+n);

  cout << a[n-1] - a[0];

}


int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  #ifdef _DEBUG
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  #endif
  Solution();
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<vector>
#include<set>
#include<deque>
#include<queue>
#include<math.h>
#include<chrono>
#include<list>
#include<random>
#include<bitset>
#include<assert.h>
#include<ctime>
#include<cstdio>
#include <unordered_map>
using namespace std;
ifstream fi("zinput.txt");
ofstream fo("output.txt");
#define fast_input() {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
#define ll long long
#define For(i,n) for (int(i) = 0; (i)< (int)(n); (i)++)
#define For1(i,n) for (int(i) = 1; (i) <= (int)(n); (i)++)
#define Forlr(i,l,r) for (int(i) = (int)(l); (i) <= (int)(r); (i)++)
#define Forrl(i,r,l) for (int(i) = (int)(r); (i) >= (int)(l); (i)--)
#define all(a) a.begin(), a.end() 
#define pb push_back
#define pp pop_back
#define mp make_pair
#define PI 3.14159265
#define putno return cout <<"NO", 0;
#define putyes return cout <<"YES", 0;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef map<int, int> mii;
//const ll MOD = 1e9 + 7;
const int N = 1e5 + 5;
//DSU
/*
int p[ N], r[N];
void init(int n) {
	For(i, n) {
		p[i] = i;
	}
}
int get(int x) {
	if (p[x] != x) {
		p[x] = get(p[x]);
	}
	return p[x];
}
bool uni(int x, int y) {
	x = get(x); y = get(y);
	if (x == y) {
		return false;
	}
	if (r[x] >= r[y]) {
		p[y] = x;
	}
	else {
		p[x] = y;
	}
	if (r[x] == r[y]) {
		r[x]++;
	}
	return true;
}
*/

// So mu
/*
int power(int x, unsigned int y, int p)
{
	int res = 1; // Initialize result

	x = x % p; // Update x if it is more than or
	// equal to p

	while (y > 0)
	{
		// If y is odd, multiply x with result
		if (y & 1)
			res = (res*x) % p;

		// y must be even now
		y = y >> 1; // y = y/2
		x = (x*x) % p;
	}
	return res;
}
*/

// ReadHexa
/*
bitset<16400> b[4101];
void readHexa()
{
	For(i, n)
	{
		string st;
		cin>> st;
		For(j, m/4)
		{
			int x;
			if (st[j] >= 'A' && st[j] <= 'F')
				x = st[j] - 'A' + 10;
			else x = st[j] - '0';
			for (int k = 4; k; --k, x >>= 1)
				b[i][j * 4 + k] = x & 1;
		}
	}
}
*/

// nChoosek
/*
ll nChoosek(ll n, ll k)
{
	if (k > n) return 0;
	if (k * 2 > n) k = n - k;
	if (k == 0) return 1;

	ll result = n;
	for (ll i = 2; i <= k; ++i) {
		result *= (n - i + 1);
		result /= i;
	}
	return result;
}
*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*
MIKUNO - 15/02/1999
*/
int n, m, k, cnt, rs, q;
int x, y;
//	priority_queue <ll, vector<ll>, greater<ll> > q;
//ll n, m, q, k, pos, t, cnt, rs1, check;
ll maxx = -1e9, minn = 1e9;
int ma = -1e9, mi = 1e9;
const int maxn = 2*N;
const ll MOD = 1e9 + 7;

int main()
{
	fast_input();
	ll n;
	cin >> n;
	ll rs = 0;
	For(i, 5)
	{
		ll t;
		cin >> t;
		//cout << (n + t - 1) / t << " ";
		rs = max(rs, (n + t - 1) / t - 1ll);
	}
	cout << rs + 5;
}

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

int main(){
	int a,b;
  	cin >> a >> b;
	if(b%a==0){
		cout << a+b << endl;
	}else{
		cout << b-a << endl;
	}

	return 0;
}




Measured memory_bytes: 256
program friendships
  implicit none
  integer :: n, k, m, x, i, j
  read(*,*) n, k
  m = ((n-1)*(n-2))/2
  if (k.gt.m) then
    write(*,'(i0)') -1
    stop
  end if
  write(*,'(i0)') n-1+m-k
  do i = 2, n
    write(*,'(i0,x,i0)') 1, i
  end do
  x = 0
  do i = 2, n-1
    do j = i+1, n
      if (x.eq.m-k) stop
      x = x+1
      write(*,'(i0,x,i0)') i, j
    end do
  end do
  stop
end program friendships

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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, K; string S; cin >> N >> K >> S; K--;
	S[K] = tolower(S[K]);
	cout << S << endl;

	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> p(n);
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        p[i] = make_pair(a, i+1);
    }
    sort(p.begin(), p.end());
    for (int i = 0; i < n; ++i) {
        cout << p[i].second;
        if (i != n-1) cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstdio>
#define EPS 10e-6
#define rep(i, a, b) for(int i = a; i < b; i++)
using namespace std;
typedef long long ll;
int a, b, c, d, e, f;

int main(){
	while(cin >> a >> b >> c >> d >> e >> f){
		double det;
		det = 1/(double)(a*e - b*d);
		double x = (c*e - b*f) * det;
		double y = (a*f - c*d) * det;
		if(x > -EPS) x = abs(x);
		if(y > -EPS) y = abs(y);
		printf("%.3f %.3f\n", x, y);
	}
	
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n; cin >> n;
    vector <ll> v(n);

    for(ll i=0; i<n; ++i) cin >> v[i];

    ll a, ans = 0;
    for(ll i=1; i<n; ++i)
    {
        if(v[i] < v[i-1]){
            a = v[i-1]-v[i];
            ans += a;
            v[i] += a;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4736