akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n, init) for (int i = init, len = (n); i < len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define len(x) ((int)(x).size())
#define int long long
#define float long double
using namespace std;

template <class Key, class Value>
pair<Key, Value> findMaxValuePair(unordered_map<Key, Value> const &x) {
  return *max_element(
      x.begin(), x.end(),
      [](const pair<Key, Value> &p1, const pair<Key, Value> &p2) { return p1.second < p2.second; });
}

string padStart(int target, int len, char padString) {
  ostringstream ss;
  ss << setfill(padString) << right << setw(len) << target << flush;
  return ss.str();
}

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

  int N;
  cin >> N;

  int maxHeight = 0;
  int stand = 0;

  rep(i, N, 0) {
    int currentHeight;
    cin >> currentHeight;

    maxHeight = max(maxHeight, currentHeight);

    if (i == 0) {
      continue;
    }

    if (maxHeight <= currentHeight) {
      continue;
    };

    int currentStand = abs(maxHeight - currentHeight);
    stand += currentStand;
  }

  cout << stand << endl;

  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
ll const INF = 1e14;


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

int a,b,Q;
cin >> a >> b >> Q;
vl s(a), t(b), x(Q);
rep(i,a) cin >> s[i];
rep(i,b) cin >> t[i];
rep(i,Q) cin >> x[i];

s.emplace(s.begin(),-INF);
s.emplace(s.begin(),-INF*2);
s.emplace_back(INF);
s.emplace_back(INF*2);
  
t.emplace(t.begin(),-INF);
t.emplace(t.begin(),-INF*2);
t.emplace_back(INF);
t.emplace_back(INF*2);

rep(i,Q) {
    ll res = INF*2;
    ll u = upper_bound(all(s), x[i]) - s.begin();
    ll v = upper_bound(all(t), x[i]) - t.begin();
    for(int j = -1; j <= 1; ++j) {
        for(int k = -1; k <= 1; ++k) {
            chmin(res, abs(s[u+j] - x[i]) + abs(s[u+j] - t[v+k]));
            chmin(res, abs(t[v+k] - x[i]) + abs(s[u+j] - t[v+k]));
        }
    }
    cout << res << endl;
}
return 0;
}

Measured memory_bytes: 3680
package main

import (
	"fmt"
)

func main() {
	var N, M int
	fmt.Scanf("%d %d\n", &N, &M)
	A := make([]int, M)
	B := make([]int, M)
	for i := 0; i < M; i++ {
		fmt.Scanf("%d %d\n", &A[i], &B[i])
	}

	C := make([][]int, N+1)
	for i := 0; i <= N; i++ {
		C[i] = make([]int, 0)
	}
	for i := 0; i < M; i++ {
		C[A[i]] = append(C[A[i]], B[i])
		C[B[i]] = append(C[B[i]], A[i])
	}

	S := make([]int, N+1)
	now := make([]int, N)
	now_count := 0
	next := make([]int, N)
	next_count := 0

	S[1] = -1
	now[0] = 1
	now_count = 1

	for {
		for i := 0; i < now_count; i++ {
			for _, v := range C[now[i]] {
				if S[v] == 0 {
					S[v] = now[i]
					next[next_count] = v
					next_count++
				}
			}
		}

		if next_count == 0 {
			break
		}

		for i := 0; i < next_count; i++ {
			now[i] = next[i]
		}
		now_count = next_count
		next_count = 0
	}

	for i := 2; i <= N; i++ {
		if S[i] == 0 {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
	for i := 2; i <= N; i++ {
		fmt.Println(S[i])
	}
}


Measured memory_bytes: 20016
fun main(args: Array<String>) {
    val (t, legs) = getInts()

    val result = (0..t).firstOrNull {
        it * 2 + (t - it) * 4 == legs
    }

    if (result != null) {
        println("Yes")
    } else {
        println("No")
    }
}



fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }

Measured memory_bytes: 36428
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B,C,D;
  cin >> N >> A >> B >> C >> D;
  A-=1;
  B-=1;
  C-=1;
  D-=1;
  string S;
  cin >> S;
  S[B]='#';
  while(true){
    if(A==C && B==D){
      cout << "Yes" << endl;
      break;
    }
    else if(A!=C && S[A+1]=='.'){
      A=A+1;
    }
    else if(A!=C && S[A+2]=='.'){
      A=A+2;
    }
    else if(B!=D && S[B+1]=='.'){
      S[B]='.';
      B=B+1;
      S[B]='#';
    }
    else if(B!=D && S[B+2]=='.'){
      S[B]='.';
      B=B+2;
      S[B]='#';
    }
    else{
      cout << "No" << endl;
      break;
    }
  }
}

Measured memory_bytes: 640
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
#define INF (1<<25)
int N;
int pr[182];
int dp[1000002][2];
void init(){
  for(int i=0;i<=1000000;i++) for(int j=0;j<2;j++) dp[i][j]=INF;
}
void solve(){
  dp[0][0]=0;
  dp[0][1]=0;
  for(int i=0;i<=1000000;i++){
    if(dp[i][0]==INF) continue;
    for(int j=0;i+pr[j]<=1000000;j++){
      dp[i+pr[j]][0] = min(dp[i+pr[j]][0],dp[i][0]+1);
      if(pr[j]&1) dp[i+pr[j]][1] = min(dp[i+pr[j]][1],dp[i][1]+1);
    }
  }
}

int main(){
  for(int i=0;i<182;i++) pr[i] = (i+1)*(i+2)*(i+3)/6;
  //  for(int i=0;i<102;i++) printf("%d\n",pr[i]);
  //  for(int i=0;i<102;i++) if(!(i%2)) printf("%d\n",pr[i]);
  init();
  solve();
  while(1){
    scanf("%d",&N);
    if(!N) break;
    printf("%d %d\n",dp[N][0],dp[N][1]);
  }
}

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

#define Int register int
#define mod 1000000007
#define MAXN 5005

template <typename T> inline void read (T &t){t = 0;char c = getchar();int f = 1;while (c < '0' || c > '9'){if (c == '-') f = -f;c = getchar();}while (c >= '0' && c <= '9'){t = (t << 3) + (t << 1) + c - '0';c = getchar();} t *= f;}
template <typename T,typename ... Args> inline void read (T &t,Args&... args){read (t);read (args...);}
template <typename T> inline void write (T x){if (x < 0){x = -x;putchar ('-');}if (x > 9) write (x / 10);putchar (x % 10 + '0');}

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

int n,top = 1,to[MAXN << 1],nxt[MAXN << 1],head[MAXN],t[MAXN],g[MAXN],dp[MAXN][MAXN],siz[MAXN];
void Add_Edge (int u,int v){
	to[++ top] = v,nxt[top] = head[u],head[u] = top;
	to[++ top] = u,nxt[top] = head[v],head[v] = top;
}
void dfs (int u,int fa){
	siz[u] = dp[u][1] = 1;
	for (Int i = head[u];i;i = nxt[i]){
		int v = to[i];
		if (v == fa) continue;
		dfs (v,u);
		for (Int j = 0;j <= siz[u];++ j) t[j] = dp[u][j],dp[u][j] = 0;
		for (Int j = 0;j <= siz[u];++ j)
			for (Int k = 0;k <= siz[v];++ k)
				dp[u][j + k] = add (dp[u][j + k],mul (dp[v][k],t[j]));
		siz[u] += siz[v]; 
	}
	for (Int i = 1;i <= siz[u];++ i) dp[u][0] = dec (dp[u][0],mul (dp[u][i],i & 1 ? 0 : g[i]));
}

signed main(){
	read (n);
	for (Int i = 2,u,v;i <= n;++ i) read (u,v),Add_Edge (u,v);
	g[0] = 1;for (Int i = 2;i <= n;++ i) g[i] = mul (g[i - 2],i - 1);
	dfs (1,0),write (dec (0,dp[1][0])),putchar ('\n');
	return 0;
}

Measured memory_bytes: 58288
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (long int)n; i++)
using namespace std;

int main(){
  long int n;
  cin >> n;
  vector<long int> a(n),b(n);
  rep(i,n){
    cin >> a[i];
  }
  b = a;
  sort(b.begin(), b.end() );
  rep(i,n){
    if(a[i] == b[n-1]){
      cout << b[n-2];
    }else{
      cout << b[n-1];
    }
    cout << "\n";
  }
  return 0;
}


Measured memory_bytes: 4736
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <functional>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(var,init,end) for(int var=init;var<end;var++)
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main() {
	string S, T;
	string cmp_S="", cmp_T="";
	cin >> S;
	cin >> T;
	int mask_s[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
	int mask_t[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };

	int idx = 1;
	FOR(i, 0, S.length()) {
		char comp = S[i];
		if (mask_s[S[i] - 0x61] == 0) {
			mask_s[S[i] - 0x61] = idx;
			cmp_S += "["+to_string(idx)+"]";
			idx++;
		}
		else {
			cmp_S += "[" + to_string(mask_s[S[i] - 0x61]) + "]";
		}
	}

	idx = 1;
	FOR(i, 0, T.length()) {
		char comp = T[i];
		if (mask_t[T[i] - 0x61] == 0) {
			mask_t[T[i] - 0x61] = idx;
			cmp_T += "[" + to_string(idx) + "]";
			idx++;
		}
		else {
			cmp_T += "[" + to_string(mask_t[T[i] - 0x61]) + "]";
		}
	}

	if (cmp_T.compare(cmp_S)==0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

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


int main() {
    int k, q;
    cin >> k >> q;

    vector<int> raw_ds(k);
    int d;
    for(int i=0;i<k;++i){
        cin >> d;
        raw_ds[i] = d; 
    }

    int n, x, m;
    long long t;
    int num_zero;
    int num_neg;
    long long total;
    
    for(int i=0;i<q;++i){
        cin >> n >> x >> m;

        num_zero = num_neg = 0;
        total = x % m;
        for(int j=0;j<k;++j){
            d = raw_ds[j] % m;
            t = (n-1) / k;
            if( j < (n-1) % k ){
                if ( d == 0 ) num_zero += (t+1);
                total += ( d * (t+1) ) ;
            }else{ 
                if ( d == 0 ) num_zero += t;
                total += ( d * t );
            }
        }
        
        num_neg = total / m;
        
        cout << n - 1 - num_neg - num_zero << endl;
    }

    return 0;
    
}


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

int main() {
    int d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3636
package main

import (
	"io"
	"os"

	"fmt"
)

func Solve(in io.Reader, out io.Writer) {
	var n int
	fmt.Fscan(in, &n)

	var c int
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscan(in, &a)
		for a%2 == 0 {
			a = a / 2
			c += 1
		}
	}

	fmt.Fprintln(out, c)
}

func main() {
	Solve(os.Stdin, os.Stdout)
}


Measured memory_bytes: 1280
import sys
val1, val2 = sys.stdin.readline().rstrip().split()
val1 = int(val1)
val2 = int(val2)
if val1 > 0 and val1 < 10 and val2 > 0 and val2 < 10:
    print(val1 * val2)
else:
    print("-1")


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
#define MAX 100

long long int EU(long long int x, long long int y)
{
	long long int n;
	while (1)
	{
		n = x%y;
		if (n == 0) return y;
		x = y;
		y = n;
	}
}

int main()
{
	int n;
	long long int gcm, lcm;
	long long int t[MAX];
	
	cin >>n;
	cin >> t[0];
	gcm = t[0];
	lcm = t[0];
	for (int i = 1; i < n; i++)
	{
		cin >> t[i];
		gcm = EU(gcm, t[i]);
		lcm = lcm*(t[i] / EU(lcm, t[i]));
	}

	cout << lcm;

	return 0;

}


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

int main(){
	string s, t;
	cin >> s >> t;
	int ans = 0;
	rep(i, 3){
		if(s[i] == t[i]) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int sum = 0;
    int mx = 0;
    rep(i,5){
        int x,y=0;
        cin >> x;
        y = 10-x%10;
        if(y==10)y=0;
        sum += x;
        sum += y;
        mx = max(mx,y);
    }
    cout << sum - mx << endl;

}

Measured memory_bytes: 256
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()


def main():
    H, W = map(int, input().split())
    S = [input() for _ in range(H)]
    black = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] == '#': black += 1

    q = deque([(0, 0, 0)]) # (i, j, move_count)
    dist = -1
    visited = {(0, 0)}
    while q:
        i, j, c = q.popleft()
        if i == H - 1 and j == W - 1:
            dist = c
            break
        for di, dj in [(1, 0), (0, 1), (-1, 0), (0, -1)]:
            ni, nj = i + di, j + dj
            if (ni, nj) in visited: continue
            if 0 <= ni < H and 0 <= nj < W and S[ni][nj] == '.':
                q.append((ni, nj, c + 1))
                visited.add((ni, nj))

    if dist == -1:
        print(-1)
    else:
        print(H * W - black - dist - 1)


if __name__ == "__main__":
    main()


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


const int mod = 1e9+7;
typedef long long ll;

int n;
string s;

int cnt[26] = {0};

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

    for (int i = 0; i < n; i++){
        cnt[s[i] - 'a']++;
    }

    ll res = 1;
    for (int i = 0; i < 26; i++){
        if (cnt[i] > 0){
            res *= (cnt[i] + 1);
            res %= mod;
        }
    }
    cout << res - 1 << endl;
}

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

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

int main(void){
    string s; cin >> s;
    if(s.size() < 4){
        cout << "No" << endl;
        return 0;
    }
    if(s.substr(0, 4) == "YAKI"){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    tmp=str(i)
    n=len(tmp)
    c=0
    for j in range((n+1)//2):
        if tmp[j]==tmp[-j-1]:
            c+=1
    if c==(n+1)//2:
        ans+=1
print(ans)

Measured memory_bytes: 73700
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	K := oneInt()
	A := oneInt()
	B := oneInt()

	for i := 0; i < 10000; i++ {
		j := K * i
		if j <= B && j >= A {
			fmt.Print("OK")
			return
		}
	}
	fmt.Print("NG")
}

func exp(val int) float64 {
	var temp float64
	for index := 1; index <= val; index++ {
		temp += float64(index)
	}
	return temp / float64(val)
}

func searchAbove(slice []int, target int, index int) int {
	for i := index + 1; i < len(slice); i++ {
		v := slice[i]
		if v >= target {
			return i
		}
	}
	return -1
}

var sc = bufio.NewScanner(os.Stdin)

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}
func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

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

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}


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

int main() {
	double tmpdou;
	int tmpint; 
	int n,d;
	cin >> n >> d;
	tmpint=n/(1.0+2*d);
	tmpdou=n/(1.0+2*d);
  if(tmpint<tmpdou) tmpint++;
  cout << tmpint <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,M;
    cin >> N >> M;
    vector<ll> A(M);
    ll sum = 0;
    for(int i=0; i<M; i++){
        cin >> A[i];
        sum += A[i];
    }
    if(sum > N){
        cout << -1 << enld;
    }else{
        cout << N-sum << enld;
    }
    return 0;
}

Measured memory_bytes: 3736
#include <stdio.h>
#include <string.h>
int main ()
{
	int A, B;
	scanf ("%d %d", &A, &B);
	getchar ();
	char S[A+B+2] = {};
	scanf ("%s", &S);
	int len = strlen(S);
	int flag = 0;
	for (int i = 0; i < len; i++)
	{
		if (48 <= S[i] && S[i] <= 57)
		{
			continue;
		}
		else if (48 > S[i] || S[i] > 57)
		{
			if ( i == A)
			{
				flag = 1;
				continue;
			}
			else if ( i != A)
			{
				flag = 0;
				break;
			}
		}
	}
	flag ? printf("Yes\n") : printf("No\n");
return 0;
}

Measured memory_bytes: 1664
def main():
    inp=input()
    ch1=int(inp[0:2])
    ch2=int(inp[2:])
    if inp[0]==0:
        ch1=int(inp[1])
    if inp[2]==0:
        ch2=int(inp[-1])
    if ch1<=12 and ch1>=1:
        if ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1:
            print("AMBIGUOUS")
            return
        elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
    if ch1>12 or ch1<1:
        if ch2<=12 and ch2>=1:
            print("YYMM")
            return
        else:
            print("NA")
            return
main()

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

 
  int main(){
     lint N;
     cin >>N; lint A[N];
     rep(i,N)cin >> A[i];
     lint B[N];
     rep(i,N)cin>>B[i];
     lint counta=0,countb=0;
     rep(i,N){
         if(A[i]<B[i]){
             if((B[i]-A[i])%2==1){
                 B[i]++;
                 countb++;
             }
             counta+=(B[i]-A[i])/2;
         }
          if(A[i]>B[i]){
             countb+=(A[i]-B[i]);
         }
     }
     if(countb>counta)cout<<"No";
     else cout<<"Yes";

    }
     
  


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  cout << (n - 2) * 180 << endl;
  return 0;
}


Measured memory_bytes: 256
<?php
  fscanf(STDIN,"%d %d", $n, $m);
  $a = explode(" ",fgets(STDIN));
  $t = array_sum($a)/(4*$m);
  $count = 0;
  for ($i=0; $i<$n; $i++){
    if($t <= $a[$i]){
      $count++;
    }
  }
  if ($count >= $m){
    echo "Yes\n";
  } else {
    echo "No\n";
  }

?>


Measured memory_bytes: 4604
# -*- coding: utf-8 -*-
from bisect import bisect_left
def inpl(): return list(map(int, input().split()))

N = int(input())
A = []
B = []
for i in range(2**16):
    A.append(int(("0{}"*16).format(*list(bin(i)[2:].zfill(16))), 2))
for i in range(2**16):
    B.append(-int(("{}0"*16).format(*list(bin(i)[2:].zfill(16))), 2))

for j, b in enumerate(B):
    i = bisect_left(A, N-b)
    if i == len(A):
        continue
    a = A[i]
    if a+b == N:
        ans = [""]*32
        ans[::2] = list(bin(j)[2:].zfill(16))
        ans[1::2] = list(bin(i)[2:].zfill(16))
        print(int("".join(ans)))
        break

Measured memory_bytes: 54492
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fcout cout << fixed << setprecision(18)

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

  double L; cin >> L;
  double a = L / 3.0;
  double ans = a * a * a;
  fcout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

#define out(t) cout << (t) << "\n"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int uint;

int popcount(uint x) {
    x -= x >> 1 & 0x55555555;
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = x + (x >> 4) & 0x0F0F0F0F;
    return x * 0x01010101 >> 24;
}

int tzcnt(uint x) {
    return popcount(~x & x - 1);
}

struct Point {
    int x, y;

    Point(int p, int q) : x(p), y(q) {}
};

map<int, int> m;

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

    ll a, b, c, k;
    cin >> a >> b >> c >> k;

    ll ans = k & 1 ? b - a : a - b;

    if (ans >= 1e18) out("Unfair");
    else out(ans);
    
    int aaa;
    cin >> aaa;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,x;
	scanf("%d %d",&a,&b);
	x=b/a;
	if(a==1){
		printf("%d\n",b);
	}
	else	if(a>b||a==b){
		printf("%d\n",1);
	}
	else	if(b%a!=0){
		printf("%d\n",x+1);
	}
	else{
		printf("%d\n",b/a);
	}
	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
void rcmb(ll *x,ll s,ll r,function<void(ll *)>f){if(r==0){f(x);}else{if(s<0)return;rcmb(x,s-1,r,f);x[r-1]=s;rcmb(x,s-1,r-1,f);}}
void cmb(ll n,ll k,function<void(ll *)>f){ll x[k];rcmb(x,n-1,k,f);}
void prm(ll n,function<void(ll *)>f){ll x[n];for(ll i=0;i<n;i++)x[i]=i;do{f(x);}while(next_permutation(x,x+n));}
void prm(ll n,ll k,function<void(ll *)>f){cmb(n,k,[&](ll *c){prm(k,[&](ll *p){ll x[k];for(ll i=0;i<k;i++){x[i]=c[p[i]];}f(x);});});}
// prm(4, 2, [](ll *x){ cout << x[0] << "," << x[1] << "\n"; });


void solve(long long N, long long M, long long C, std::vector<long long> B, std::vector<std::vector<long long>> A){
	ll res = 0;
	REP(n, N) {
		ll sum = C;
		REP(m, M) {
			sum += A[n][m] * B[m];
		}
		if (sum > 0) res++;
	}
	cout << res << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long C;
    scanf("%lld",&C);
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&B[i]);
    }
    std::vector<std::vector<long long>> A(N, std::vector<long long>(M));
    for(int i = 0 ; i < N ; i++){
        for(int j = 0 ; j < M ; j++){
            scanf("%lld",&A[i][j]);
        }
    }
    solve(N, M, C, std::move(B), std::move(A));
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        String b = sc.next();
        int cnt = 0;
        int max = 0;
        for (int i = 0; i < a; i++) {
            if (b.charAt(i) == 'I') {
                cnt++;
            } else {
                cnt--;
            }
            if (cnt > max) max = cnt;
        }
        System.out.println(max);
    }
}


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

int main() {
    string S;
    cin >> S;
    int K = S.size();
    vector<vector<ll>> dp(K+1, vector<ll>(2, 0));
    dp[0][1] = 1;
    for (int i = 1; i <= K; i++) {
        int d = S[i-1]-'0';
        dp[i][0] = min(dp[i-1][0]+d, dp[i-1][1]+10-d);
        if (d <= 8) {
            dp[i][1] = min(dp[i-1][0]+d+1, dp[i-1][1]+9-d);
        }else {
            dp[i][1] = dp[i-1][1];
        }
    }
    cout << dp[K][0] << endl;
    return 0;
}


Measured memory_bytes: 55940
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O2")
// #pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
// #define int ll
#define pb push_back
#define pob pop_back
#define __bp __builtin_popcount
using pii = pair<int,int>;
using pil = pair<int,ll>;
using pli = pair<ll,int>;
using pdd = pair<ld,ld>;
using vint = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpli = vector<pli>;
#define F first
#define S second
const int N = 1e5+5;//(1 << 18) + 5;
//const ll inf = 1e18+7;
const int Inf = 1e9+7;
const ll INF = 1e18+7;
const int Mod = 1e9+7;
const ld eps = 1e-9;
#ifndef M_PI
#define M_PI 3.1415926535
#endif

void io()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr.tie(NULL);
//	freopen("sweets.in", "r", stdin);
//	freopen("sweets.out", "w", stdout);
//	cout << setprecision(7) << fixed;
}

int n;

vector<pii> keks;

void solve()
{
	cin >> n;
	keks.resize(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> keks[i].F >> keks[i].S;
	}
	sort(keks.begin(), keks.end(), [](pii &p1, pii &p2){return p1.F + p1.S < p2.F + p2.S;});
	// cerr << keks[0].F << ' ' << keks[0].S << '\n';
	// cerr << keks.back().F << ' ' << keks.back().S << '\n';
	ll a1 = abs(keks[0].F - keks.back().F) + abs(keks[0].S - keks.back().S);
	sort(keks.begin(), keks.end(), [](pii &p1, pii &p2){return p1.F - p1.S < p2.F - p2.S;});
	ll a2 = abs(keks[0].F - keks.back().F) + abs(keks[0].S - keks.back().S);
	cout << max(a1, a2);
}

signed main()
{
	io();
	int tt = 1;
//	cin >> tt;
	while (tt--) {
		// solve();
		solve();
//		cerr << '\n';

	}
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
typedef long long lol;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol x, k, d; cin >> x >> k >> d;
    lol newx = abs(x);
    lol numx = min(newx/d, k);
    newx -= d*numx;
    k -= numx;
    while(k >= 1 && (newx > abs(newx - d)))
    {
        newx = abs(newx - d);
        k--;
    }
    if(k != 0 && k%2 == 1)
    {
        newx = min(abs(newx - d), abs(newx + d));
    }
    result = newx;

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
int ctoi(char c);

int main(){
    int n;
    char s[200002];
    scanf("%s%n",s,&n);
    long int sum = 0;
    for(int i = 0;i < n; i++){
        sum += ctoi(s[i]);
    }
    if(sum%9==0){
        printf("Yes\n");
    }else
    {
        printf("No\n");
    }
    
    return 0;
}
int ctoi(char c){
    switch (c)
    {
    case '0':
        return 0;
    case '1':
        return 1;
    case '2':
        return 2;
    case '3':
        return 3;
    case '4':
        return 4;
    case '5':
        return 5;
    case '6':
        return 6;
    case '7':
        return 7;
    case '8':
        return 8;
    case '9':
        return 9;
    default:
        return 0;
    }
}


Measured memory_bytes: 1816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;

int main(){
  string s;
  cin >> s;
  bool flaga = false, flagb = false;
  int k = stoi(s);
  int a = k / 100, b = k % 100;
  if(0 < a && a < 13) flaga = true;
  if(0 < b && b < 13) flagb = true;
  if(flaga && flagb){
    cout << "AMBIGUOUS" <<endl;
  }else if(flaga){
    cout << "MMYY" <<endl;
  }else if(flagb){
    cout << "YYMM"<<endl;
  }else{
    cout << "NA"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

// 因数分解
inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

inline ll vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
        
        
    }
    else { // 発見できなかったとき
        return 0;
    }
}

void recursive_comb(ll *indexes, ll s, ll rest, std::function<void(ll *)> f) {
    if (rest == 0) {
        f(indexes);
    } else {
        if (s < 0) return;
        recursive_comb(indexes, s - 1, rest, f);
        indexes[rest - 1] = s;
        recursive_comb(indexes, s - 1, rest - 1, f);
    }
}

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

int main(){
    ll ans = 0;
    ll h, a;
    cin >> h >> a;
    
    ans = h / a;
    if(h % a != 0){
        ans ++;
    }
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
out = 0
for i in range(len(a)):
  flg = 1
  if i > 0 :
    for j in range(i):
      if not (a[j] <= a[i]):
        flg = 0
  if flg == 1:
    out += 1
print(out)

Measured memory_bytes: 3060
N, K = map(int, input().split())

cnt = 0
d = {}
for _ in range(N):
    a, b = map(int, input().split())
    if a in d:
        d[a] += b
    else:
        d[a] = b

sorted_d = sorted(d.items(), key=lambda x: x[0])
cnt = 0
for k, v in sorted_d:
    cnt += v
    if cnt >= K:
        print(k)
        break


Measured memory_bytes: 15076
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=acos(-1);
const int inf=1e9;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int h,w;
  char a[105][105]={};
  bool H[105]={},W[105]={};
  cin >> h >> w;
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cin >> a[i][j];
      if(a[i][j]=='#') {
        H[i]=true,W[j]=true;
      }
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      if(H[i]&&W[j]) {
        cout << a[i][j];
      }
    }
    if(H[i]) {
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	int plu,mis,x;
	cin>>a>>b;
	plu=a+b;
	mis=a-b;
	x=a*b;
	cout<<max(plu,max(mis,x))<<endl;
	return 0;
}

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

typedef pair<int, int> ii;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l4;

#define mp make_pair
#define pb push_back


const int maxn = 1e5+1;
int n, a[maxn];


int main()
{
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d", a+i);
  int i = 1;
  int ans = 0;
  while (i <= n)
    {
      while (i <= n && a[i] != i)
	++i;
      if (i > n)
	break;

      int old = i;
      while (i <= n && a[i] == i)
	++i;
      ans += (i-old+1)/2;
    }
  printf("%d\n", ans);
}


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

using namespace std;

int main()
{
    int n,ar[1000],br[1000],i,s=0,cr[1000],dr[1000];
    cin>>n;
    for (i=0;i<n;++i){

        cin>>ar[i];
        s+=ar[i];
        if (i==0)br[i]=ar[i];
        else{

            br[i]=br[i-1]+ar[i];

        }


    }
    for (i=0;i<n;++i){

        cr[i]=s-br[i];
        dr[i]=abs(br[i]-cr[i]);

    }
    sort(dr,dr+n);
    cout<<dr[0]<<endl;
    return 0;

}


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

int main()
{

  int N;

  cin>>N;

  int a[10005]={ };

  for(int i=1;i<=sqrt(N);i++){
    for(int j=1;j<=sqrt(N);j++){
      for(int k=1;k<=sqrt(10005);k++){

        if(i*i+j*j+k*k+i*j+i*k+j*k<=N){
          a[i*i+j*j+k*k+i*j+i*k+j*k]++;
        }
      }
    }
  }

  for(int i=1;i<=N;i++){

    cout<<a[i]<<endl;
    
  }

  return 0;
}


Measured memory_bytes: 3468
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>

using namespace std;
string s,s1;
int main(){
    cin>>s>>s1;
    bool prime=true;
    int slen=s.length();
    int sslen=s1.length();
    for(int i=0,j=sslen-1;i<slen&&j>=0;i++,j--){
        if(s[i]!=s1[j])
            {
                prime=false;
                break;
            }
    }
    if(prime)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int N1,N2,N3,N4;
	vector<int>ivec(10,'0');
	cin >> N1 >> N2 >> N3 >> N4;
	ivec[N1]=1;
	ivec[N2]=1;
	ivec[N3]=1;
	ivec[N4]=1;
	if(ivec[1]==1 && ivec[4]==1 && ivec[7]==1 && ivec[9]==1){cout << "YES";
	}
	 else {
	cout << "NO";}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
  rep(i,n) cin >> vec.at(i);
  int cnt=0;
  rep(i,n-2){
    if(vec.at(i+1) != max({vec.at(i),vec.at(i+1),vec.at(i+2)}) && vec.at(i+1) != min({vec.at(i),vec.at(i+1),vec.at(i+2)})){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int a,b;
    cin >> a>>b;
    string A;
    string B;
    for (int i = 0; i < b; i++){
        A += to_string(a);
    }
    for (int i = 0; i < a; i++){
        B += to_string(b);
    }

    if(A > B){
        cout << B << endl;
    } else {
        cout << A << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <map>
#include <string.h>
using namespace std;
#define N (200010)
map<int, int> mp;
char s[N];
#define inf N
int f[N];
int main(){
    scanf("%s", s);
    int n = strlen(s);
    mp[0] = 0;
    for (int i = 0, msk = 0; i < n; ++i){
        msk ^= 1 << (s[i] - 'a');
        f[i] = inf;
        for (int j = 0; j < 26; ++j){
            if (mp.find(msk^(1<<j)) != mp.end()){
                f[i] = min(f[i], mp[msk^(1<<j)]+1);
            }
        }
        if (mp.find(msk) == mp.end()){
            mp[msk] = f[i];
        }
        else {
            f[i] = min(f[i], mp[msk]+1);
            mp[msk] = min(f[i], mp[msk]);
        }
    }
    printf("%d\n", f[n-1]);
}

Measured memory_bytes: 10624
import java.util.*;

class Main{
    static Long n;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Integer k = sc.nextInt();
        String s = sc.next();

        if(s.length()>k){
            System.out.println(s.substring(0, k) + "...");
        }
        else{
            System.out.println(s);
        }

    }

}


Measured memory_bytes: 27092
#include <iostream>
#include <cstring>
 
using namespace std;
 
int nextInt() { int d; cin >> d; return d;}
 
bool fall(int field[][5], int H) {
  bool isFalledRet = false;
   
  for (int y = H - 1; y >= 0; y--) {
    for (int x = 0; x < 5; x++) {
      if (field[y][x] != 0) {
        int i;
        bool isFalled = false;
        for (i = y + 1; i < H; i++) {
          if (field[i][x] != 0) {
            break;
          }
          isFalled = true;
        }
        if (isFalled) {
          field[i - 1][x] = field[y][x];
          field[y][x] = 0;
          isFalledRet = true;
        }
      }
    }
  }
   
  return isFalledRet;
}
 
int dfs(int field[][5], int H) {
  // ???°?´?\?????£????3?£????????¬?£?§?¶???£??????£?????£???????£???????£?????£???????????¢?£????¢
  int score = 0;
  for (int y = 0; y < H; y++) {
    for (int x = 0; x < 3; x++) {
      if (x < 1) {
        if (field[y][0] != 0 && field[y][0] == field[y][1] && field[y][1] == field[y][2] &&
              field[y][2] == field[y][3] && field[y][3] == field[y][4]) {
          score += 5 * field[y][0];
          field[y][0] = 0;
          field[y][1] = 0;
          field[y][2] = 0;
          field[y][3] = 0;
          field[y][4] = 0;        
        }  
      }
      if (x < 2) {
        if (field[y][x] != 0 && field[y][x] == field[y][x + 1] && field[y][x + 1] == field[y][x + 2] && field[y][x + 2] == field[y][x + 3]) {
          score += 4 * field[y][x];
          field[y][x]     = 0;
          field[y][x + 1] = 0;
          field[y][x + 2] = 0;
          field[y][x + 3] = 0;
        }
      }     
      if (field[y][x] != 0 && field[y][x] == field[y][x + 1] && field[y][x + 1] == field[y][x + 2]) {
        score += 3 * field[y][x];
        field[y][x]     = 0;
        field[y][x + 1] = 0;
        field[y][x + 2] = 0;
      }
    }  
  }
   
  bool isFalled = fall(field, H);
  if (!isFalled) {
    return score;
  }
   
  int dfsScore = dfs(field, H);
  score += dfsScore;
  return score;
}
 
int main() {
  while (true) {
    int H = nextInt();
    if (H == 0) {
      break;
    }
     
    int field[H][5];
    memset(field, 0, sizeof(field));
     
    for (int y = 0; y < H; y++) {
      for (int x = 0; x < 5; x++) {
        int d = nextInt();
        field[y][x] = d;
      }
    }
    int ans = dfs(field, H);
    cout << ans << endl;
  }
 
  return 0;
}

Measured memory_bytes: 3052
import sys
 
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

import bisect

n,m=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

def hand(x):
  cnt=0
  for i in range(n):
    p=x-A[i]
    cnt+=n-bisect.bisect_left(A,p)
  return cnt

def main():
  l=0
  h=2*10**5+1
  mid=(l+h)//2
  
  while l+1<h:
    mid=(l+h)//2
    if hand(mid)<m:
      h=mid
    else:
      l=mid
  
  B=A[::-1]
  
  for i in range(n-1):
    B[i+1]+=B[i]
  
  B=B[::-1]
  
  ans=0
  cnt=0
  
  
  for i in range(n):
    y=l-A[i]+1
    index=bisect.bisect_left(A,y)
    if n==index:
      continue
    else:
      ans+=(n-index)*A[i]+B[index]
      cnt+=(n-index)
  
  ans+=(m-cnt)*l
  print(ans)

if __name__ == "__main__":
	main()
  

  
  

Measured memory_bytes: 53232
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	var in [][]int64
	for {
		x := nextInt(sc)
		y := nextInt(sc)
		if x == 0 && y == 0 {
			break
		}
		in = append(in, []int64{x, y})
	}

	for _, l := range in {
		var min, max int64
		if l[0] > l[1] {
			min = l[1]
			max = l[0]
		} else {
			min = l[0]
			max = l[1]
		}
		fmt.Printf("%d %d\n", min, max)
	}
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) int64 {
	i, err := strconv.ParseInt(nextString(sc), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}



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

int main(){
  int p[256]={},ans=0;
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++)
    p[s[i]]++;
  for(int i=0;i<256;i++)ans+=p[i]%2;
  cout<<ans/2<<endl;
  return 0;
}

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

using namespace std;

int arr[1000];
int main(){
 int n,k,a,sn,ans=0;
  cin>>n>>k;
  
  for(int i=0;i<k;i++)
  {
    cin>>sn;
    for(int j=0;j<sn;j++)
    {
      cin>>a;
      arr[a]++;
    }
  }
  for(int i=1;i<=n;i++)
  {
    if(arr[i]==0)
      ans++;
  }
  cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 3576
#include<stdio.h>
int main(void)
{
	int b,a,e,d,f,i,c;
	float y,x;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF)  {
			y=(float)(c*d-a*f)/(b*d-a*e);
			x=(float)(b*f-c*e)/(b*d-a*e);
		if(x<0.0001 && x>-0.0001){
			x=0;
		}
		if(y<0.0&&y>-0.0001){
			y=0;
		}	
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 1064
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    if sum([A[i][j] * B[j] for j in range(M)]) + C > 0:
        ans += 1
print(ans)

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

typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=a;i<(b);i++)
#define vi vector<int>
#define vii vector< vector<int> >

int main() {
    int max = 160;
    vi frag(max);
    rep(i, max) frag[i] = i*i;

    int n, d;
    cin >> n >> d;
    vii x(n, vi(0));
    int s;
    rep(i, n){
        rep(j, d){
            cin >> s;
            x.at(i).push_back(s);
        }
    }
    int result = 0;
    rep(i, n-1){
        REP(j, i+1, n){
            int distance = 0;
            rep(k, d){
                distance = distance + (x[i][k]-x[j][k]) * (x[i][k]-x[j][k]);
            }
            rep(k, max){
                if(distance == frag[k]) result++;
            }
        }
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits



def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))

def update(bit,i, dp):
    bit[i] = dp
    return bit

def query(bit, i):
    lis = [bit[j] for j in range(i)]
    return max(lis)


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n,m=MAP()

py = [LIST() for _ in range(m)]
py = [[i,x[0],x[1]] for i,x in enumerate(py)]
lis=py.copy()
lis.sort(key=lambda x: (x[1], x[2]))

ans = [""] * m

tmp=1
ct = 1

for x in lis:
    if tmp!=x[1]:
        tmp = x[1]
        ct = 1
    ans[x[0]] = '{:06}{:06}'.format(x[1], ct)
    ct += 1
        
for x in ans:
    print(x)

Measured memory_bytes: 42564