akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n)
    {
        if(n & 1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return result;
}

struct HASH{
  size_t operator()(const pair<long long,long long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

const double N=1e9;

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

    int n;
    cin>>n;
    double s[n];
    for(int i=0;i<n;i++)
    	cin>>s[i];

    ll b[n]={0};

    for(int i=0;i<n;i++)
    	b[i] = llround(s[i]*N);

    unordered_map<pair<ll,ll>,ll,HASH> mp;
    mp.reserve(1<<12);
	
    for(int i=0;i<n;i++)
    {
    	ll two=0,five=0;
    	while(b[i] && (b[i]%2==0))
    	{
    		b[i]/=2;
    		two++;
    	}

    	while(b[i] && (b[i]%5==0))
    	{
    		b[i]/=5;
    		five++;
    	}

    	mp[{two,five}]++;
    }

    ll ans=0;
    for(auto x1:mp)
    {
    	for(auto x2:mp)
    	{
    		if(x1.first.first+x2.first.first>=18 && x1.first.second+x2.first.second>=18)
    		{
    			if(x1<x2)
    				ans+=x1.second*x2.second;
    			else if(x1==x2)
    				ans+=(x1.second*(x1.second-1))/2;
    		}	
    	}
    }

    cout<<ans<<endl;

    
    return 0;
}


Measured memory_bytes: 6928
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int min = b;
        int max = b;
        long  sum = b;
        for(int i = 0 ;i<a-1 ;i++){
            int c = in.nextInt();
            if(min>c){
                min = c;
            }
            if(max<c){
                max = c;
            }
            sum += c;
        }
        System.out.println(min+" "+max+" "+sum);
    }
}



Measured memory_bytes: 41028
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long

using namespace std;

string str;

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int a, b;
    ios::sync_with_stdio(false);
    cin >> a >> b;
    cin >> str;
    int cnt = 0;
    for(auto it : str) {
        if(it == '-')
            cnt++;
    }
    if(str[a] == '-' && cnt == 1)
        cout << "Yes";
    else
        cout << "No";
    //cin.close();
    //cout.close();
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  int n;
  cin >> n;
  int mae=0,go=0,res=0;
  for(int i=0;i<n;i++){
    string s;
    cin >> s;
    if(s=="A") mae++;
    else go++;
    if(s=="Un" && mae>=go) res++;
  }
  if(mae==res && go==res) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

using namespace std;

int n, d;

double call(vector<double> a, vector<double> b, int j){
    if(d <= j) return 0;
    double sum = call(a, b, j+1);
    return sum += pow(a[j] - b[j], 2);
}

double getDit(vector<double> a, vector<double> b){
    double sum = call(a, b, 0);
    return sqrt(sum);
}

void print(vector<double> a){
    for(int i = 0; i < a.size(); i++){
        cout << a[i] << " ";
    }
    cout << endl;
}

int main(void){
    cin >> n >> d;
    vector<vector<double> > a(n, vector<double>(d));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            cin >> a[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            double dis = getDit(a[i], a[j]);
            int t = (int)dis;
            if(dis == (double)t) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if not l[i] == l[j] and not l[j] == l[k] and not l[k] == l[i]:
                if l[i] + l[j] > l[k] and l[j] + l[k] > l[i] and l[k] + l[i] > l[j]:
                    ans += 1
print(ans)

Measured memory_bytes: 9204
import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        String ans = s.substring(0, k-1) + s.substring(k-1, k).toLowerCase() + s.substring(k);

        System.out.println(ans);
    }

    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}

Measured memory_bytes: 22996
#include<stdio.h>
int min(int x, int y){return x > y ? y : x;}
int main(void){
    int i, j, k;
    int h, w;
    int c[10][10];
    int a[10], tmp;

    scanf("%d%d", &h, &w);
    for(i = 0; i < 10; i++){
        for(j = 0; j < 10; j++){
            scanf("%d", &c[i][j]);
        }
    }

    for(i = 0; i < 10; i++){
        a[i] = 0;
    }

    for(i = 0; i < h; i++){
        for(j = 0; j < w; j++){
            scanf("%d", &tmp);
            if(tmp == -1){
                continue;
            }else{
                a[tmp]++;
            }
        }
    }

    for(k = 0; k < 10; k++){
        for(i = 0; i < 10; i++){
            for(j = 0; j < 10; j++){
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }

    int ans = 0;
    for(i = 0; i < 10; i++){
        ans += a[i] * c[i][1];
    }
    printf("%d\n", ans);
    return 0;
}

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

int main() {
  string str;
  int tmpNear = 9999;
  int tmpSa = 0;
  
  cin >> str;

  for(int i = 0; i < str.size() - 2; i++){
    tmpSa = stoi(str.substr(i, 3));
    tmpSa = abs(tmpSa - 753);
    
    if(tmpNear >= tmpSa) tmpNear = tmpSa;
  }
  
  cout << tmpNear;
}


Measured memory_bytes: 256
// if both points not on the edge, it doesn't matter

// what if both points on the same edge

#include <stdio.h>
#include <algorithm>
#include <map>

int t1,t2,t3,t4,t5;

int r,c,n;
int xa[100005];
int ya[100005];     // int 'y1' redeclared as ...
int xb[100005];
int yb[100005];

std::map<int,int> e;

int st[200005];
int st2=0;

int get(int u,int v)
{
    if (u==0) return v+1;
    if (v==c) return 300000000+u;
    if (u==r) return 600000000-v;
    if (v==0) return 900000000-u;
    return -1;
}

int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    scanf("%d%d%d",&r,&c,&n);
    for (int i=0; i<n; i++) scanf("%d%d%d%d",xa+i,ya+i,xb+i,yb+i);
    // do matching bracket stuff
    for (int i=0; i<n; i++) {
        t1=get(xa[i],ya[i]);
        t2=get(xb[i],yb[i]);
        //printf("%d %d\n",t1,t2);
        if (t1==-1 || t2==-1) continue;
        e[t1]=i;
        e[t2]=i;
    }
    for (std::pair<int,int> p:e) {
        if (st2 && st[st2-1]==p.second) st2--;
        else st[st2++]=p.second;
    }
    printf(st2?"NO":"YES");
}


Measured memory_bytes: 11520
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n = int(input())
es=[[] for _ in range(n)] 
d = [0]*n 
used=[True]*n
for i in range(n-1):
    a,b,c = map(int,input().split())
    a,b = a-1, b-1
    es[a].append((b,c))
    es[b].append((a,c))


def dfs(s,dist):
    used[s]=False
    for v,x in es[s]:
        if used[v]:
            d[v]=dist+x
            dfs(v,dist+x)
q,k=map(int,input().split())
dfs(k-1,0)
for i in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])

Measured memory_bytes: 136496
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    int sl = s.length();
    int tl = t.length();
    int i,j;
    int count=0, countMax=1001;
    for(i=0;i<=sl-tl;i++){
        count=0;
        for(j=0;j<tl;j++){
            if(s[i+j]!=t[j])count++;
        }
        if(count<countMax)countMax=count;
    }
    cout << countMax << endl;
    return 0;
}

Measured memory_bytes: 3612
k = int(input())

a = [7 % k]
if a[0] == 0:
    print(1)
    exit()
for i in range(1, k):
    a.append((10*a[i - 1] + 7) % k)
    if a[i] % k == 0:
        print(i + 1)
        exit()

print(-1)

Measured memory_bytes: 140956
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(a) (a).begin(), (a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x, 0, sizeof(x))
#define MINF(x) memset(x, 0x3f, sizeof(x))
#define MMINUS(a) memset(a, 0xff, sizeof(a))
#define ten(n) ((int)1e##n)

const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const double EPS = 1.0 / INF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

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

using namespace std;

//===================================== template =========================================================

int main()
{
    cin.tie(nullptr); ios_base::sync_with_stdio(false);
    string S; cin >> S;
    int N = S.size();
    vector<pair<int, int>> dp(N);
    dp[0] = make_pair(0, S[0] == '1');
    FOR(i, 1, N-1) {
        if (S[i] - '0' == 0) {
            if (dp[i-1].second == 1) {
                int val = dp[i-1].first + 2;
                val == i+1 ?  dp[i] = make_pair(val, 2) : dp[i] = make_pair(val, 1);
            }
            else if (dp[i-1].second == 0) dp[i] = dp[i-1];
            else dp[i] = make_pair(dp[i-1].first, 0); 
        } else {
            if (dp[i-1].second == 0) {
                int val = dp[i-1].first + 2;
                val == i+1 ?  dp[i] = make_pair(val, 2) : dp[i] = make_pair(val, 0);
            }
            else if (dp[i-1].second == 1) dp[i] = dp[i-1];
            else dp[i] = make_pair(dp[i-1].first, 1); 
        }
    }

    cout << dp[N-1].first << endl;
}


Measured memory_bytes: 1232
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <set>
#include <map>
#include <list>

using namespace std;

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

const ll MOD = 1000000007;
const ll inf = (ll) 1e18;

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

  int n;
  cin >> n;
  string s;
  cin >> s;

  list<char> slime;
  for (int i = 0; i < n; i++) slime.push_back(s[i]);
  auto it = slime.begin();
  while (it != slime.end()) {
    auto it2 = it; it2++;
    if (it2 == slime.end()) break;
    if (*it == *it2) slime.erase(it2);
    else it++;
  }

  cout << slime.size() << endl;

  return 0;
}


Measured memory_bytes: 3536
#include <iostream>
#include <string>
#include <algorithm>
#define MAX 100
using namespace std;
int main()
{
	string a, b;
  	cin >> a >> b;
	sort(a.begin(), a.end());
  	sort(b.begin(), b.end(), greater<char>());
	for (int i = 0; i < min(a.size(), b.size()); i++){
    	if (a[i] < b[i]){
        	cout << "Yes";
          	return 0;
        } else if (a[i] > b[i]) {
        	cout << "No";
          	return 0;
        }
    }
  	if (a.size () < b.size()){
    	cout << "Yes";
        return 0;
    } else {
    	cout << "No";
       	return 0;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(c) c.begin(), c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main() {
    string A, B, C;
    cin >> A >> B >> C;

    if (A[A.length() - 1] == B[0] && B[B.length() - 1] == C[0]) {
        cout << "YES";
    } else {
        cout << "NO";
    }
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from collections import Counter
N = int(input())
S = []
for i in range(N):
    s = input()
    S.append(s)
S = Counter(S).most_common()
a = []
b = []
for i in S:
    a.append(i[0])
    b.append(i[1])
c = []
for i in range(b.count(max(b))):
    c.append(a[i])
c.sort()
print(*c, sep="\n")

Measured memory_bytes: 45040
#include<cstdio>
#include<cmath>
using namespace std;
int H,W,D,A;
int Q,L,R;
int px[900001],py[900001];
int d[900001];
int main()
{
	scanf("%d%d%d",&H,&W,&D);
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
		{
			scanf("%d",&A);
			px[A]=i;
			py[A]=j;
			
		}
	for(int i=D+1;i<=H*W;i++)
		d[i]=d[i-D]+abs(px[i]-px[i-D])+abs(py[i]-py[i-D]);
	scanf("%d",&Q);
	while(Q--)
	{
		scanf("%d%d",&L,&R);
		printf("%d\n",d[R]-d[L]);
	}
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a,inc=(b-a)/abs(b-a); i!=b ; i+=inc)
#define deb(x) cout<<#x<<"->"<<x<<endl;
#define print(arr,a,b) for(int i=a;i!=b;i++){cout<<arr[i]<<" ";}cout<<endl;
using ll=long long int;
int arr_min(int arr[],int a,int b){ int min=arr[0]; for(int i=a;i!=b;i++){if(min>arr[i]) min=arr[i];}return min;}
int arr_max(int arr[],int a,int b){ int max=arr[0]; for(int i=a;i!=b;i++){if(max<arr[i]) max=arr[i];}return max;}

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

	#ifndef ONLINE_JUDGE
      	freopen("input.txt", "r", stdin);
      	freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t-->0){
    	ll n,k;
    	cin>>n>>k;
    	ll y=n+1;
    	ll mod=1000000007;
    	ll arr[n+1];
    	arr[0]=0;
    	ll total=0;

       if(k-1>n){
       	cout<<0<<endl;
       	return 0;
       }
    	for(int i=1;i<=n;i++)
    	{
    		arr[i]=(i+arr[i-1]);
    	}
    	//print(arr,0,n+1);
    	for(int i=k;i<=n;i++)
    	{
    		// deb(arr[n]);
    		// deb(arr[n-k]);
    		// deb(arr[i-1]);
    		total=(total%mod+((arr[n]-arr[n-i])-arr[i-1]+1)%mod)%mod;
    		// deb(total);

    	}
    	cout<<total+1<<endl;
    	
    	
    }
    return 0;
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

const int MX = 1e5 + 1;
vector<int> adj[MX + MX + 6];
int vis[MX + MX + 6];
int X, Y;

void dfs(int u) {
    if (vis[u])return;
    vis[u] = true;
    if (u > MX)Y++;
    else X++;

    for (int nxt : adj[u])
        dfs(nxt);
}

int main() {

#ifndef ONLINE_JUDGE
    //freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif

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

    int n, a, b;
    cin >> n;
    loop(i, n) {
        cin >> a >> b;
        b += MX;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    long long ans = 0;
    range(i, 1, MX + MX + 2) {
        if (!vis[i]) {
            X = Y = 0;
            dfs(i);
            ans += 1LL * X * Y;
        }
    }

    cout << ans - n << endl;

    return 0;
}


Measured memory_bytes: 10752
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        final int N = Integer.parseInt(sc.next());
        final int T = Integer.parseInt(sc.next());
        final int A = Integer.parseInt(sc.next());
        int ans = 0;
        double min = 1e6;
        
        for (int i = 0; i < N; i++) {
            int h = Integer.parseInt(sc.next());
            double b = T - h * 0.006;
            double abs = Math.abs(A - b);
            min = Math.min(min, abs);
            if (min == abs) {
                ans = i + 1;
            }
        }
        
        out.println(ans);
        
        out.flush();
    }
}

Measured memory_bytes: 22356
N= int(input())
h = list(map(int, input().split()))
n = 0
ans = []

for i in range(N-1):
    if h[i+1]<=h[i]:
        n += 1
    else:
        ans.append(n)
        n=0
else:
    ans.append(n)

print(max(ans))

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

int main() {
	int n,m;
	cin >> n >> m;
	vector<int> a(n);
	int total = 0;
	rep(i,n) {
		cin >> a[i];
		total += a[i];
	}
	sort(a.begin(), a.end(), greater<int>());
	if (4*m*a[m-1]>=total) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long int

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

	if (x >= 30) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3604
using System;
using System.Collections.Generic;
using System.Linq;

public class program{
    public static void Main(){
        Console.ReadLine();
        var S = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        Console.ReadLine();
        var T = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        var C = T.Count(t => binarySearch(S, t) != -1);
        Console.WriteLine(C);
    }

    public static int binarySearch(int[] array, int key){
        int left = 0;
        int right = array.Length;
        while(left < right){
            int mid = (left + right) / 2;
            if(array[mid] == key) return mid;
            else if(key < array[mid]) right = mid;
            else left = mid + 1;
        }
        return -1;
    }
}



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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;

const int mod = 998244353;
const ll inf = 3e18 + 5;

int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }  

int main(){
    string s;
    cin >> s;
    int n = s.size();
    vi a(n, 1);
    for(int i=n-1; i>=0; i--){
        if(s[i]=='R'){
            if(s[i+1]=='L')
                a[i]=1;
            else
                a[i]+=a[i+1];
        }
    }
    for(int i=0; i<n; i++){
        if(s[i]=='L'){
            if(s[i-1]=='R')
                a[i]=1;
            else
                a[i]+=a[i-1];
        }
    }
    vi res(n);
    for(int i=0; i<n; i++){
        if(s[i]=='R'){
            if(a[i]%2 == 0)
                res[i+a[i]]++;
            else
                res[i+a[i]-1]++;
        }
        if(s[i]=='L'){
            if(a[i]%2 == 0)
                res[i-a[i]]++;
            else
                res[i-a[i]+1]++;
        }   

    }
    for(int x : res)
        cout << x << " ";
}

Measured memory_bytes: 1408
a_i, b_i, K = gets.chomp.split(' ').map(&:to_i)
a = a_i
b = b_i
if a_i != 0
  a -= K
  a = 0 if a < 0
end
if b_i != 0 && K - a_i > 0
  b = b - (K - a_i).abs
  b = 0 if b < 0
end
puts "#{a} #{b}"


Measured memory_bytes: 1788
#include<bits/stdc++.h> 
using namespace std ; 
int main()
{


  int n ; cin >> n ; 
  int a[n] ; 
  for(int i = 0 ; i < n-1 ; i++)
  cin >> a[i] ; 
  
  int sum = a[0] ; 
  
  for(int i = 0 ; i < n-2 ; i++)
    {sum += min(a[i] , a[i+1]) ; }
  
  sum += a[n-2] ;
  cout << sum << endl ; 
  
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define Gput(a,b) G[a].push_back(b)
int main() {
 ll n;
 cin>>n;
 vec d(n);
 loop(i,n){
  cin>>d[i]; 
 }
 sort(all(d));
   ll mid1=(n-1)/2,mid2=mid1+1;
   putout(d[mid2]-d[mid1]);

 
 
 
 
 
 
 
 
 
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> H(N + 2);
  for (int i = 1; i <= N; i++) cin >> H[i];

  int ans = 0;
  for (int h = 0; h <= 100; h++) {
    for (int i = 1; i <= N; i++) {
      if (h < H[i] and h >= H[i + 1]) {
        ans++;
      }
    }
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

void mybuild_tree(vector<long long int>& mytree, const vector<long long int>& data, int index, int l, int r) {
    if (l == r) {
        mytree[index] = data[l];
    } else {
        int m = (l + r) / 2;
        mybuild_tree(mytree, data, index * 2 + 1, l, m);
        mybuild_tree(mytree, data, index * 2 + 2, m + 1, r);
        mytree[index] = mytree[index * 2 + 1] + mytree[index * 2 + 2];
    }
}

void myupdate_tree(vector<long long int>& mytree, int index, int l, int r, int target_l, int target_r, int val) {
    if (r < target_l || target_r < l) return;
    if (l == r && l >= target_l && r <= target_r) {
        mytree[index] += val;
        return;
    }

    int m = (l + r) / 2;
    myupdate_tree(mytree, index * 2 + 1, l, m, target_l, target_r, val);
    myupdate_tree(mytree, index * 2 + 2, m + 1, r, target_l, target_r, val);
    mytree[index] = mytree[index * 2 + 1] + mytree[index * 2 + 2];   
}

long long int myquery_tree(vector<long long int>& mytree, int index, int l, int r, int target_l, int target_r) {
    if (r < target_l || l > target_r) return 0;
    if (l >= target_l && r <= target_r) return mytree[index];

    int m = (l + r) / 2;
    long long int res =  myquery_tree(mytree, index * 2 + 1, l, m, target_l, target_r) + myquery_tree(mytree, index * 2 + 2, m + 1, r, target_l, target_r);
    return res;
}

int main() {
    long long int n, k;
    cin >> n >> k;
    vector<long long int> v(n, 0), pre;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        v[i] -= k;
    }
    pre = v;
    for (int i = 1; i < n; i++) {
        pre[i] += pre[i - 1];
    }
    vector<pair<long long int, int>> vp;
    for (int i = 0; i < n; i++) {
        vp.push_back(make_pair(pre[i], i));
    }
    sort(vp.begin(), vp.end());
    long long int res = 0;
    vector<long long int> mytree(4 * n, 0);
    for (int i = 0; i < n; i++) {

        long long int val = vp[i].first;
        if (val >= 0) res++;
        int index = vp[i].second;
        res += myquery_tree(mytree, 0, 0, n - 1, 0, index);
        myupdate_tree(mytree, 0, 0, n - 1, index, index, 1);
    }
    cout << res << endl;
}









Measured memory_bytes: 15780
# 169A
# A * B を整数として出力せよ

# 1.入力をプログラムで扱えるように受け取ること
a, b = map(int, input().split())
# print(a, b)

# 2.受け取った入力値を使って適切に処理する（計算）こと
answer = a * b


# 3.計算した結果を出力すること
print(answer)


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

int
main()
{
	char cards[200];
	char temp_cards[200];
	int n_shuffles;
	int n_cards;
	int h;
	int ni, hi, ci;
	for (;;)
	{
		scanf("%s", cards);
		n_cards = strlen(cards);

		if (strcmp(cards, "-") == 0)
			break;

		scanf("%d", &n_shuffles);
		for (ni = 0; ni < n_shuffles; ni++)
		{
			ci = 0;
			scanf("%d", &h);
			for (hi = h; hi < n_cards; hi++)
			{
				temp_cards[ci] = cards[hi];
				ci++;
			}
			for (hi = 0; hi < h; hi++)
			{
				temp_cards[ci] = cards[hi];
				ci++;
			}
			for (ci = 0; ci < n_cards; ci++)
			{
				cards[ci] = temp_cards[ci];
			}
		}
		puts(cards);
	}
}

Measured memory_bytes: 584
S = input()
N = len(S)
a = [0]*(N+1)
b = ['']*(N+1)
s = ''
for i in range(1, N+1):
    s += S[i-1]
    b[i] = s
    if s != b[i-1]:
        a[i] = a[i-1]+1
        s = ''
    else:
        a[i] = a[i-1]
print(a[N])


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

int main()
{
int a,b,c;
cin >> a >> b >> c;
a = a * 100 + b * 10 + c;
if(a % 4 == 0){cout << "YES" << endl;}
else cout << "NO" << endl;
return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,sum_v=0,sum_c=0;
    cin>>n;
    
    vector<int> v(n);
    vector<int> c(n);
    
    for(int i=0;i<n;i++) cin>>v.at(i);
    for(int i=0;i<n;i++) cin>>c.at(i);
    
    for(int i=0;i<n;i++) {
        if(v.at(i)/(double)c.at(i)>1) {
            sum_v+=v.at(i);
            sum_c+=c.at(i);
        }
    }
    
    cout<<sum_v-sum_c<<"\n";
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

vector<int> f(vector<int> &a) {
    int n = a.size();
    vector<int> res(n);
    rep(i, n) res[i] = a[i] ^ a[(i + 1) % n];
    return res;
}

// Morris-Pratt
template<typename T>
struct MP {
    int n;
    T t;
    vector<int> a;

    MP() {}

    MP(const T &t) : t(t) {
        n = t.size();
        a = vector<int>(n + 1);
        a[0] = -1;
        int j = -1;
        for (int i = 0; i < n; ++i) {
            while (j != -1 && t[j] != t[i]) j = a[j];
            j++;
            a[i + 1] = j;
        }
    }

    int operator[](int i) { return a[i]; }

    vector<int> findAll(const T &s) {
        vector<int> res;
        int j = 0;
        for (int i = 0; i < s.size(); ++i) {
            while (j != -1 && t[j] != s[i]) j = a[j];
            j++;
            if (j == n) {
                res.push_back(i - j + 1);
                j = a[j];
            }
        }
        return res;
    }
};

int main() {
    int N;
    cin >> N;
    vector<int> a(N), b(N);
    rep(i, N) cin >> a[i];
    rep(i, N) cin >> b[i];

    vector<int> xa = f(a);
    vector<int> xb = f(b);

    MP<vector<int>> mp(xa);
    xb.insert(xb.end(), xb.begin(), xb.end());
    vector<int> res = mp.findAll(xb);
    vector<int> ks;
    for (int p:res) ks.push_back(N - p);
    sort(ks.begin(), ks.end());
    for (int k: ks) {
        if (k >= N) continue;
        int x = a[k] ^b[0];
        cout << k << " " << x << endl;
    }
}

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

int main(){
  long N,X,M;
  std::cin >> N >> X >> M;

  //ループ発見用table
  long table[100000]={};

  //ループ中の値を格納
  std::vector<long> P;

  //ループの発見
  long now=X;
  while(table[now]==0){
    P.push_back(now);
    table[now]=1;
    now=(now*now)%M;
  }

  //ループの始まりと終わりを定義,決定
  long end=P.size();
  long start;
  for(long i=0; i<P.size(); i++){
    if(P[i]==now){
      start=i;
      break;
    }
  }

  //ループ内の合計値
  long loop=0;
  for(long i=start; i<end;i++){
    loop+=P[i];
  }

  //ループの輪のサイズとループする回数の定義
  long loop_size = end-start;
  long loop_num = (N-start)/loop_size;

  //A0~ループ前までの合計
  long result=0;
  for(long i=0; i<start; i++){
    result+=P[i];
  }

  //ループ中の値を加算
  result+=loop_num*loop;

  //ループ終わり~最後までの合計を加算
  for(long i=start; i<start+((N-start)%loop_size);i++){
    result+=P[i];
  }

  //出力
  std::cout << result << std::endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i <= (n); ++i){
    if(i%3==0) continue;
    if(i%5==0) continue;
    else ans += i;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;
typedef vector<pp> vpp;
typedef unsigned int i64;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define all(e) (e).begin(), (e).end()
#define pb push_back

template <typename T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}


template <typename T>
void printV(vector<T> A) {
  if (A.empty()) cerr << "EMTPY\n";
  else { 
    cerr << "[";
    for (int i = 0; i < A.size() -1 ; ++i) {
      cerr << A[i] << ", ";
    }
    if (A.size()) cerr << A.back() << "]\n";
  }
}


template <typename T>
void printVV(vector<vector<T>> A) {
  cerr << "[";
  for (auto v : A) {
    printV<T>(v);
  }
  cerr << "]";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&& ...args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

int main(int argc, char **argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b; cin >> a >> b;
  if (a >= 10 || b >= 10) cout << -1 << endl;
  else cout << a * b << endl;
  return 0;
}



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

int a, b;
string s, t, u;
map<string, int> cnt;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> s >> t >> a >> b >> u;
	cnt[s] = a, cnt[t] = b;
	cnt[u]--;
	cout << cnt[s] << " " << cnt[t] << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<long> vl;
typedef vector<vector<long> > vvl;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    string forcast;
    string actual;
    cin >> forcast;
    cin >> actual;

    int hits = 0;
    for (int i = 0; i < actual.size(); ++i) {
        if (forcast[i] == actual[i]) {
            hits++;
        }
    }
    cout << hits << endl;
    return 0;
}


Measured memory_bytes: 384
m,d=map(int,input().split())
an=0

for i in range(1,m+1):
    for j in range(1,d+1):
        if j>10:
            if int(str(j)[0])>=2 and int(str(j)[1])>=2:
                if int(str(j)[0])*int(str(j)[1])==i:
                    an+=1

print(an)

Measured memory_bytes: 3060
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int c[] = new int[3];
    c[0]=sc.nextInt();
    c[1]=sc.nextInt();
    c[2]=sc.nextInt();
    Arrays.sort(c);
    if(c[2]==c[1]+c[0]){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }

  }
  

  
}


Measured memory_bytes: 21972
#include <iostream>
#include <queue>
#include <string>


class Baseball {
public:
    int score;                //得点
    int count;                //アウトカウント
    std::queue<int> runner;   //ランナー

    //コンストラクタ
    Baseball(int sc,int co){
        score = sc;
        count = co;
        while(!runner.empty()){
            runner.pop();
        }
    }
    
    //ヒット
    void hit(){
        if(runner.size() == 3){
            ++score;
        }
        else
            runner.push(1);
    }
    
    //ホームラン
    void homerun(){
        while(!runner.empty()){
            ++score;
            runner.pop();
        }
        ++score;
    }
    
    //アウト
    void out(){
        ++count;
    }
};


int main(){
    int n;
    std::string event;
    
    std::cin >> n;
    
    Baseball game(0,0);
    
    while(n > 0 && std::cin >> event){
        if(event == "HIT")
            game.hit();
        else if(event == "HOMERUN")
            game.homerun();
        else
            game.out();
        
        if(game.count == 3){
            --n;
            std::cout << game.score << std::endl;
            game = Baseball(0,0);
        }
    }
}


Measured memory_bytes: 3020
#include<bits/stdc++.h>
using namespace std;
#define K 100002
bool dp[K][2];
int main() {
	int n,k;
  	cin>>n>>k;
  	int a[n];
  	for(int i=0;i<n;i++) {cin>>a[i];}
	for(int i=0;i<=k;i++) {
      for(int j=1;j>=0;j--) {
      	for(int t=0;t<n;t++) {
          if(j) {
            if(i<a[0]) {dp[i][j]=false;}
          	else {if(i-a[t]>=0) {dp[i][1]|=dp[i-a[t]][0];}}
          }
          else {
          	dp[i][0]=1^dp[i][1];
          }
        }
      }
    }
  if(dp[k][1]) {cout<<"First"<<endl;}
  else {cout<<"Second"<<endl;}
  	
return 0;
}


Measured memory_bytes: 3800
function main(input) {
  const [n, m, k] = input[0].trim().split(" ").map(i => parseInt(i));
  const a = input[1].trim().split(" ").map(i => parseInt(i));
  const b = input[2].trim().split(" ").map(i => parseInt(i));

  const a_sum = [0];
  const b_sum = [0];

  a.map((i,index)=>{
    a_sum[index+1]=a_sum[index]+i;
  });
  b.map((i,index)=>{
    b_sum[index+1]=b_sum[index]+i;
  });

  let ans = 0;
  let j = m;

  for(let i=0; i<n+1;i++){
    if(a_sum[i]>k){
      break;
    }
    while(b_sum[j] > k-a_sum[i]){
      j-=1;
    }
    ans = Math.max(ans, i+j)
  }
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 82192
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			if (s[0] <= 'Z') {
				Console.WriteLine("A");
			} else {
				Console.WriteLine("a");
			}

		}
	}
}


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

#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

struct combination {
    vector<mint> fact, ifact;

    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }

    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} combination(10000000);

int main() {

    int n, m;
    cin >> n >> m;
    if (n < m) swap(n, m);

    if (n == m) {
        mint mon = combination.fact[n];
        mint dog = combination.fact[n];
        cout << (mon * dog * 2).x << endl;

    } else if (n - 1 == m) {
        mint mon = combination.fact[n];
        mint dog = combination.fact[m];
        cout << (mon * dog).x << endl;

    } else {
        cout << 0 << endl;
    }

}

Measured memory_bytes: 156544
import java.util.Scanner;

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

        String c1 = sc.next();
        String c2 = sc.next();

        if (c1.charAt(0) == c2.charAt(2) && c1.charAt(1) == c2.charAt(1) && c1.charAt(2) == c2.charAt(0)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 23636
n = int(input())
h = list(map(int,input().split()))
su = sum(h)
count = 0
while sum(h) > 0:
  i = 0
  while i < n:
    if(h[i] == 0):
      i+=1
    else:
      count += 1
      while i < n and h[i] > 0:
        h[i] -= 1
        i += 1

print(count)


Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<vector<int> > tree(N, vector<int>());
    REP(i, N-1){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    int f = 0, s = 0;
    queue<pair<int, int> > que;
    que.push(make_pair(0, 0));
    que.push(make_pair(1, N-1));
    vector<int> used(N);
    while(!que.empty()){
        pair<int, int> n = que.front();que.pop();
        if(used[n.second])continue;
        used[n.second] = 1;
        if(n.first==0)f++;
        if(n.first==1)s++;
        REP(i, tree[n.second].size()){
            int next = tree[n.second][i];
            if(used[next])continue;
            que.push(make_pair(n.first, next));
        }
    }
    cout << (f > s ? "Fennec" : "Snuke") << endl;

    return 0;
}


Measured memory_bytes: 6272
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();
    double c = (a + b) / 2.0;
      int d = (a + b ) / 2;
      if(c == d){ System.out.println(d);
                }else{
        System.out.println( d + 1);
      }    
  }
}

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

#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,n)  for(int i=0;i<n;i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int main(){
	int n,x,x1,ans=0;
	cin>>n>>x;
	FOR(i,n){
		cin>>x1;
		ans=__gcd(ans,abs(x1-x));
		x=x1;
	}
	cout<<ans<<endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

int main() {
    int N;
    string S;
    cin >> N >> S;
    ll ans = 0;
    ll r,g,b;
    r = g = b = 0;
    rep(i,N){
        if(S[i] == 'R') r++;
        if(S[i] == 'G') g++;
        if(S[i] == 'B') b++;
    }
    ans = r*g*b;

    rep(i,N-2){
        for(int j = 1; j <= N / 2; j++){
            int J = i + j;
            int K = J + j;
            if(K > N-1) continue;
            if(S[i] == S[J] || S[J] == S[K] || S[i] == S[K]) continue;
            ans--;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632