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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int H,N; cin >> H >> N;
    VI A(N), B(N);
    int mx = 0;
    REP(i,N){
        cin >> A[i] >> B[i];
        mx = max(A[i], mx);
    }
    int dp[N+1][H+mx+1]; REP(i,N+1)REP(j,H+mx+1) dp[i][j] = (int)INF;
    REP(i,N+1) dp[i][0] = 0;

    int ans = (int)INF;
    REP(i,N)REP(j,H+A[i]){
        if(j+1-A[i] >= 0){
            chmin(dp[i+1][j+1], dp[i][j+1-A[i]] + B[i]);
            chmin(dp[i+1][j+1], dp[i+1][j+1-A[i]] + B[i]);
        }
        chmin(dp[i+1][j+1], dp[i][j+1]);
        if(j+1 >= H) chmin(ans, dp[i+1][j+1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 44032
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define pb push_back
#define pf push_fron
#define INF 1e9
#define PI acos(-1)
typedef long long ll;



int main() {
	
	string str;
	char al[30];
	bool check[30] = { false };
	cin >> str;

	if (str == "zyxwvutsrqponmlkjihgfedcba") {
		cout << "-1" << endl;
		return 0;
	}

	for (int i = 0; i < 26; i++) {
		al[i] = i + 'a';
	}

	for (int i = 0; i < str.size(); i++) {
		for (int j = 0; j < 26; j++) {
			if (str[i] == al[j]) {
				if (check[j]) {
					cout << "-1" << endl;
					return 0;
				}

				check[j] = true;
			}
		}
	}

	int pos;
	char p;
	if (str.size() == 26) {
		for (int i = 24; i >= 0; i--) {
			if (str[i + 1] > str[i]) {
				pos = i + 1;
				break;
			}
		}
		for (int i = 25; i >= pos; i--) {
			if (str[i] > str[pos - 1]) {
				p = str[i];
				break;
			}
		}
		str = str.substr(0, pos);
		str[pos-1] = p;
		cout << str << endl;
		return 0;
	}

	for (int i = 0; i < 26; i++) {
		if (check[i] == false) {
			if (str.size() == 26) {
				str[str[str.size() - 1]] = al[i];
				break;
			}
			else {
				str += al[i];
				break;
			}
		}
	}

	cout << str << endl;

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var value string
	fmt.Scan(&value)

	var count, maxLength int
	var isMatched bool

	targetChars := [4]string{"A", "T", "C", "G"}

	for _, char := range value {
		isMatched = false
		for _, targetChar := range targetChars {
			if targetChar == string(char) {
				isMatched = true
			}
		}

		if isMatched {
			count++
		} else {
			count = 0
		}

		if count > maxLength {
			maxLength = count
		}
	}

	fmt.Println(maxLength)
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
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...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 998244353;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int n;
  scanf("%d", &n);
  vector<int> d(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &d[i]);
  }
  if (d[0] != 0) {
    puts("0");
    return 0;
  }
  sort(d.begin(), d.end());
  int pre = -1, cnt = 1;
  bool found = false;
  int ret = 1;
  for (int i = 0, j; i < n; i = j) {
    if (d[i] != pre + 1) {
      found = true;
      break;
    }
    int64 cur = 1;
    for (j = i; j < n && d[j] == d[i]; ++j) {
      cur = cur * cnt % MOD;
    }
    ret = ret * cur % MOD;
    cnt = j - i;
    if (i == 0 && cnt > 1) {
      found = true;
      break;
    }
    pre = d[i];
  }
  if (found) {
    puts("0");
  } else {
    printf("%d\n", ret);
  }
  return 0;
}


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

using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;
using ii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vii = vector<ii>;
using vvii = vector<vii>;
using vd = vector<ld>;

template<class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<class TIn, class TOut = null_type>
using order_tree = tree<TIn, TOut, less<TIn>, rb_tree_tag,
	tree_order_statistics_node_update>;
// .find_by_order(int r) and .order_of_key(TIn v)

constexpr int INF = 2000000010;
constexpr ll LLINF = 9000000000000000010LL;
constexpr ld PI = acos(-1);

void solve() {
	ll H, W, N;
	cin >> H >> W >> N;

	vector<set<int>> blocks(W);
	for (int i = 0; i < N; ++i) {
		int x, y;
		cin >> x >> y;
		--x, --y;
		blocks[y].insert(x);
	}
	for (int y = 0; y < W; ++y) blocks[y].insert(H);

	int ans = INF;
	int x = 0, moves = 0;
	for (int y = 0; y < W; ++y) {
		++moves;
		auto it = blocks[y].lower_bound(x);
		if (*it != x+1) {
			// Can move right.
			++x;
			ans = min(ans, moves + (*it)-x);
		} else {
			ans = min(ans, moves);
			break;
		}
		if (y+1 < W) {
			bool stuck = false;
			while (x < H) {
				it = blocks[y+1].lower_bound(x);
				if ((*it) == x) {
					it = blocks[y].lower_bound(x);
					if ((*it) == x+1) {
						stuck = true;
						break;
					} else ++x, ++moves;
				} else break;
			}
			if (stuck) break;
		}
	}

	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(12);
	
	solve();
	
	return 0;
}


Measured memory_bytes: 28416
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>
#include<type_traits>

using namespace std;
using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;
constexpr ll LONGINF = 1050000000000000000;

struct edge {
	int from, to, cost;

	bool operator < (const edge& x) const {
		return cost < x.cost;
	}
};

class UnionFind {
private:
	std::vector<int> parent;
	std::vector<int> height;
	std::vector<int> m_size;

public:
	UnionFind(int size_) : parent(size_), height(size_, 0), m_size(size_, 1) {
		for (int i = 0; i < size_; ++i) parent[i] = i;
	}
	void init(int size_) {
		parent.resize(size_);
		height.resize(size_, 0);
		m_size.resize(size_, 1);
		for (int i = 0; i < size_; ++i) parent[i] = i;
	}
	int find(int x) {
		if (parent[x] == x) return x;
		return parent[x] = find(parent[x]);
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		int t = size(x) + size(y);
		m_size[x] = m_size[y] = t;
		if (height[x] < height[y]) parent[x] = y;
		else parent[y] = x;
		if (height[x] == height[y]) ++height[x];
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		if (parent[x] == x) return m_size[x];
		return size(parent[x] = find(parent[x]));
	}
};

int main() {
	int n; cin >> n;
	vector<tuple<int, int, int>> xx(n);
	vector<tuple<int, int, int>> yy(n);

	vector<vector<pair<int, int>>> cost_graph(n);//cost_graph[辺の重み][to]=fromと定義

	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		xx[i] = make_tuple(x, y, i);
		yy[i] = make_tuple(y, x, i);
	}

	sort(xx.begin(), xx.end());
	sort(yy.begin(), yy.end());

	vector<edge> e;

	for (int i = 1; i < n; i++) {
		edge X;
		X.from = get<2>(xx[i]); X.to = get<2>(xx[i - 1]); X.cost = abs(get<0>(xx[i - 1]) - get<0>(xx[i]));
		e.emplace_back(X);
		X.from = get<2>(xx[i - 1]); X.to = get<2>(xx[i]); X.cost = abs(get<0>(xx[i - 1]) - get<0>(xx[i]));
		e.emplace_back(X);
	}
	for (int i = 1; i < n; i++) {

		edge X;
		X.from = get<2>(yy[i]); X.to = get<2>(yy[i - 1]); X.cost = abs(get<0>(yy[i - 1]) - get<0>(yy[i]));
		e.emplace_back(X);
		X.from = get<2>(yy[i - 1]); X.to = get<2>(yy[i]); X.cost = abs(get<0>(yy[i - 1]) - get<0>(yy[i]));
		e.emplace_back(X);
	}

	sort(e.begin(), e.end());

	UnionFind uf(n);

	ll ans = 0;

	for (auto w : e) {
		if (!uf.same(w.to, w.from)) {
			ans += w.cost;
			uf.unite(w.from, w.to);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 13168
list=input().split()
stack=[]

for x in list:
    if x=='+':
        a=stack.pop()
        b=stack.pop()
        stack.append(a+b)
    elif x=='-':
        a=stack.pop()
        b=stack.pop()
        stack.append(b-a)  
    elif x=='*':
        a=stack.pop()
        b=stack.pop()
        stack.append(a*b)
    else:
        stack.append(int(x))
        
print(stack[-1])


Measured memory_bytes: 5600
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define SORT(x) (sort(x.begin(),x.end()))
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    double N,ans,A[107];cin >> N;
    rep(i,N){
        cin >> A[i];
        ans+=(1/A[i]);
    }
    printf("%lf",1/ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#include <cmath>
#include <map>
#include <utility>
#include <numeric>
#include <set>
#include <map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define INF 999999999
#define atcoder 1e9+7

using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {

	string s;
	cin >> s;
	sort(s.begin(), s.end());

	for (char c = 'a'; c <= 'z'; c++) {
		bool found = false;
		for (int i = 0; i < s.length(); i++) {
			if (s[i] == c) {
				found = true;
			}
		}
		if (!found) {
			cout << c << endl;
			return 0;
		}
	}
	cout << "None" << endl;

	return 0;
}


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

int main() {
    int n;
    cin >> n;
    int count = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x % 2) count++;
    }

    if (count % 2) cout << "NO" << endl;
    else cout << "YES" << endl;

    return 0;
}


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

constexpr int INFI = 1145141919;

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

    int N;
    std::cin >> N;

    std::vector<int> d;
    for(int i=0; i<N; i++){
        int buf;
        std::cin >> buf;
        d.push_back(buf);
    }

    std::sort(d.begin(), d.end());

    if(N%2!=0){
        std::cout << 0;
    }else{
        std::cout << d.at(N/2) - d.at(N/2-1);
    }

    return 0;
}


Measured memory_bytes: 892
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)

typedef string::const_iterator State;


int number(State &begin){
	int ret = 0;
	while(isdigit(*begin)){
		ret*=10;
		ret+=*begin-'0';
		begin++;
	}
	return (ret+1)/2;
}


int exp(State &begin){
	begin++;
	if(isdigit(*begin)){
		int ret = number(begin);
		begin++;
		return ret;
	}
	else{
		vector<int> res;
		while(*begin=='['){
			int t = exp(begin);
			res.pb(t);
		}
		begin++;
		
		int ret=0;
		sort(all(res));
		rep(i,(res.size()+1)/2)ret+=res[i];
		return ret;
	}
}


int main(){
	int n;
	cin>>n;
	while(n--){
		string s;
		cin>>s;
		State begin = s.begin();
		cout<<exp(begin)<<endl;
	}
}

Measured memory_bytes: 3244
(*
let () => Scanf.scanf "%d" (fun n -> Array.init n (fun ))
(fun n k x y ->
  let rest = max (n-k) 0
  let former = min n k in
  former*x + rest*y) 
  |> Printf.printf "%d\n"
*)

let () = Scanf.scanf "%d %d %d %d"
(*
let n = read_int ()
let k = read_int ()
let x = read_int ()
let y = read_int ()
*)
(fun n k x y ->
  let rest = max (n-k) 0 in
  let former = min n k in
  former*x + rest*y)
  |> Printf.printf "%d\n"


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


int main(void) {

  long long int ans = 1;
  long long int n;
  cin >> n;
  for(int i=1; i<=n; i++) ans *= i;
  cout << ans << endl;
  return 0;
}

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

int main() {
  long long S,T,ans;
  cin >> S>>T;
  ans=0;
 if(S>T){
   for(int i=0;i<S;i++){
     ans*=10;
     ans+=T;
   }
 }
  else{
     for(int i=0;i<T;i++){
     ans*=10;
     ans+=S;
   }
  }
  cout <<ans<< endl;
}


Measured memory_bytes: 256
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>

using namespace std;

int main(){
    int N;
    string S,SW,SB;
    cin >> N;
    cin >> S;
    int b=0;
    int w=0;
    SW = S;

    int BL[N];
    int WH[N];

    REP(i, S.length()){
        if(S[i]!='.'){
            w++;
        }
        WH[i]=w;
    }

    for(int i=S.length()-1 ; i>=0 ; i--){
        if(S[i]!='#'){
            b++;
        }
        BL[i]=b;
    }

    int ans=INT_MAX;
    REP(i,N-1){
        if(ans>BL[i+1]+WH[i]){
            ans=BL[i+1]+WH[i];
        }
    }
    if(BL[0]<ans){
        ans=BL[0];
    }
    if(WH[N-1]<ans){
        ans=WH[N-1];
    }

    cout << ans << endl;
}


Measured memory_bytes: 2172
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
using namespace std;

void bubblesort(vector<int> A,int N){
    bool flag=1;
    int counter=0;
    while(flag){
        flag=0;
        for(int i=N-1;i>0;--i){
            if(A[i]<A[i-1]){
                int buf=A[i];
                A[i]=A[i-1];
                A[i-1]=buf;
                counter++;
                flag=1;
            }
        }
    }
    for(int i=0;i<N;++i){
        if(i!=0)cout<<" ";
        cout<<A[i];
    }
    cout<<endl<<counter<<endl;
}

int N;
vector<int> A;

int main(){
    cin>>N;
    A.resize(N);
    for(int i=0;i<N;++i){
        cin>>A[i];
    }
    bubblesort(A,N);
    return 0;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int MOD=1000000007;
int INF=100100100100100;
string s[10];
signed main(){
  int h,w,k;cin>>h>>w>>k;
  int ans=0;
  rep(i,h)cin>>s[i];
  rep(i,(1<<h)){
    rep(j,(1<<w)){
      int sum=0;
      rep(x,h){
        rep(y,w){
          if((i>>x)%2 && (j>>y)%2 && s[x][y]=='#')sum++;
        }
      }
      if(sum==k){
        //cout<<i<<" "<<j<<" "<<sum<<endl;
        ans++;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3624
#pragma GCC optimize ("O3")
#include <vector>
#include <functional>
#include <deque>
#include <stdexcept>

template<typename T, typename Container = ::std::vector<T>, typename Compare = ::std::greater<typename Container::value_type>>
class sliding_window {
    using iterator_type = typename Container::const_iterator;
    using value_compare = Compare;
    using value_type = T;
    using const_reference = const value_type &;

    iterator_type right_bound, left_bound, end;
    value_compare comp;
    size_t length;
    ::std::deque<value_type> val;

public:
    void push() {
        if (left_bound == end) {
            throw ::std::runtime_error("already reached to the end");
        }
        const auto &tmp = *left_bound;
        while (!val.empty() && comp(val.back(), tmp))val.pop_back();
        val.push_back(tmp);
        ++left_bound;
        ++length;
    }

    void pop() {
        if (right_bound == left_bound) {
            throw ::std::runtime_error("interval is empty");
        }
        const auto &tmp = *right_bound;
        if (tmp == val.front())val.pop_front();
        ++right_bound;
        --length;
    }

    sliding_window(iterator_type _begin, iterator_type _end, const Compare &_comp = Compare()) : length(0),
                                                                                                 right_bound(_begin),
                                                                                                 left_bound(_begin),
                                                                                                 end(_end), comp(_comp),
                                                                                                 val({}) {}

    const size_t size() const {
        return length;
    }

    const_reference top() const {
        return val.front();
    }

    void resize(size_t n) {
        if (n < length) {
            while (n < length) {
                pop();
            }
        } else {
            while (n > length) {
                push();
            }
        }
    }

    void forward() {
        if (left_bound != end)push();
        pop();
    }

};

#include <iostream>
#include <algorithm>

int main() {
    unsigned long long N, M, K;
    scanf("%llu%llu%llu", &N, &M, &K);

    std::vector<unsigned long long> A(N), dp1(N), dp2(N);
    for (auto &i : A)scanf("%llu", &i);

    std::copy(A.begin(), A.end(), dp1.begin());

    for (unsigned long long i = 1; i != K; ++i) {
        sliding_window<unsigned long long, std::vector<unsigned long long>, std::less<>> slidingWindow(
                dp1.begin(), dp1.end());
        std::transform(A.begin(), A.end(), dp2.begin(), [&i](auto a) { return a * (i + 1); });

        for (unsigned long long j = 0; j != N; ++j) {
            if (j >= i)dp2[j] += slidingWindow.top();
            if (slidingWindow.size() == M)slidingWindow.pop();
            slidingWindow.push();
        }

        std::swap(dp1, dp2);
    }

    std::cout << *std::max_element(dp1.begin(), dp1.end()) << std::endl;

    return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    int N, K;
    cin >> N >> K;
    ll a = K;
    FOR(i, N, 1)
    {
        a *= K - 1;
    }
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



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

#ifndef ONLINE_JUDGE
	if(fopen("INPUT.txt","r"))
	{
	freopen ("INPUT.txt" , "r" , stdin);
	freopen ("OUTPUT.txt" , "w" , stdout);
	}
#endif  

	int n;
	cin>>n;
	vector<pair<int,int> >ans;
	if(n&1)
	{
		for(int i=1;i<=n-1;i++)
		{
			for(int j=i+1;j<=n-1;j++)
			{
				if(i+j==n)
					continue;
				ans.push_back({i,j});
			}
		}
		for(int i=1;i<=n-1;i++)
			ans.push_back({i,n});
	}
	else
	{
		for(int i=1;i<=n;i++)
		{
			for(int j=i+1;j<=n;j++)
			{
				if(i+j==n+1)
					continue;
				ans.push_back({i,j});
			}
		}		
	}
	cout<<ans.size()<<"\n";
	for(auto i:ans)
		cout<<i.first<<" "<<i.second<<'\n';
	
}


Measured memory_bytes: 512
#include<iostream>

#include<cstdio>

using namespace std;

double S,L,r;

int main(){

    cin>>r;

    S=r*r*3.14159265358979323846264338;

    L=2.0*r*3.14159265358979323846264338;

    printf("%f %f",S,L);

    return 0;

}

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

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

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

    return arr

N,P = map(int,input().split())
F = factorization(P)
ans = 1
for a,b in F:
  ans *= a**(b//N)
print(ans)

Measured memory_bytes: 3064
/*
@author: sharrad99
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
  
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	string s;
	cin >> s;

	if(s[2] == s[3] and s[4] == s[5]) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    char s[11], t[11];
    scanf("%s%s",s,t);
    int ans = 0;
    int i;
    for(i = 0; s[i]; i++)
        if(s[i] == t[i])
            ans ++;
    if(i == ans){
        printf("Yes");
    }
    else{
        printf("No");
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  while (1){
    if (S.size() >= 5){
      if (S.substr(S.size() - 5) == "dream"){
        S = S.substr(0, S.size() - 5);
        continue;
      }
    }
    if (S.size() >= 7){
      if (S.substr(S.size() - 7) == "dreamer"){
        S = S.substr(0, S.size() - 7);
        continue;
      }
    }
    if (S.size() >= 5){
      if (S.substr(S.size() - 5) == "erase"){
        S = S.substr(0, S.size() - 5);
        continue;
      }
    }
    if (S.size() >= 6){
      if (S.substr(S.size() - 6) == "eraser"){
        S = S.substr(0, S.size() - 6);
        continue;
      }
    }
    break;
  }
  if (S.empty()){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 544
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    H,W = (int(_) for _ in input().split())

    ans = INF
    for h in range(1,H):
        if W%2 == 0:
            a= h*W//2
            b= h*W//2
        else:
            a= h*(W-1)//2
            b= h*(W+1)//2
        c= (H-h)*W
        s_max = max(a,b,c)
        s_min = min(a,b,c)
        ans = min(ans,s_max - s_min)

        a= h*W
        if (H-h)%2 == 0:
            b= (H-h)//2*W
            c= (H-h)//2*W
        else:
            b= (H-h-1)*W
            c= (H-h+1)*W
        s_max = max(a,b,c)
        s_min = min(a,b,c)
        ans = min(ans,s_max - s_min)
        
    for w in range(1,W):
        if H%2 == 0:
            a= w*H//2
            b= w*H//2
        else:
            a= w*(H-1)//2
            b= w*(H+1)//2
        c= (W-w)*H
        s_max = max(a,b,c)
        s_min = min(a,b,c)
        ans = min(ans,s_max - s_min)

        a= w*H
        if (W-w)%2 == 0:
            b= (W-w)//2*H
            c= (W-w)//2*H
        else:
            b= (W-w-1)//2*H
            c= (W-w+1)//2*H
        s_max = max(a,b,c)
        s_min = min(a,b,c)
        ans = min(ans,s_max - s_min)
        
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include <iostream>

using namespace std;

int main()
{
	int n, start, end;
	cin>>n;
	cin>>start>>end;
	int val = 1;
	
	for(int i = 1; val < end; i++){	
		val = i*n;
		if ((val >= start) && (val <= end)){
			cout<<"OK"<<endl;
			return 0;
		}
		
	}
	
	cout<<"NG"<<endl;
	return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    string S;
    cin >> S;
    ll A = stoll(S.substr(0, 2));
    ll B = stoll(S.substr(2, 2));
    bool YYMM = 1 <= B && B <= 12 && 0 <= A && A <= 99;
    bool MMYY = 1 <= A && A <= 12 && 0 <= B && B <= 99;
    if(YYMM && MMYY) cout << "AMBIGUOUS";
    else if(YYMM) cout << "YYMM";
    else if(MMYY) cout << "MMYY";
    else cout << "NA";
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define pb push_back
#define pu push
#define mp make_pair
#define fi first
#define sc second

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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(){
    cin.tie(0);
    ios::sync_with_stdio(false);

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

    ll a = 0;
    REP (i, 1, N + 1) {
        if (i % K == 0) a++;
    }

    ll b = 0;
    REP (i, 1, N + 1) {
        if (i % K == K / 2) {
            b++;
        }
    }

    ll ans = a * a * a;
    if (K % 2 == 0) {
        ans += b * b * b;
    }

    COUT(ans);
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split())) + [0]

ans = 0
while any(h):
    c = 0
    for i in range(n + 1):
        if h[i] == 0:
            if c > 0:
                ans += 1
            c = 0
        else:
            h[i] -= 1
            c += 1

print(ans)

Measured memory_bytes: 3060
from collections import deque

n,m=map(int, input().split())

route = deque([ [0] for i in range(n)])

for i in range(m):
    a,b=map(int, input().split())
    a-=1
    b-=1
    route[a].append(b)
    route[b].append(a)

mi = deque([10**6] * n)
mi[0] = 0
check = deque([n] * n)
end = deque([0] * n)
end[0] = 1

que = deque([0])
while len(que) != 0:
    t = que.popleft()
    for j in route[t]:
        if mi[j] > mi[t] + 1:
            que.append(j)
            mi[j] = mi[t] + 1
            check[j] = t

print('Yes')
for i in range(1,n):
    print(check[i]+1)


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

/*                    ॐ Shree ॐ                     */
/* ॐ ॐ ॐ
ॐ भूर् भुवः स्वः
तत् सवितुर्वरेण्यं
भर्गो देवस्य धीमहि
धियो यो नः प्रचोदयात्
*/
using namespace std;
typedef long long int ll;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
// online submission
#endif
	int n;
	cin>>n;
	if(n%10==3){
		cout<<"bon";
	}
	else if(n%10==0||n%10==1||n%10==6||n%10==8){
		cout<<"pon";
	}
	else{
		cout<<"hon";
	}
}

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}


inline int addmod(int x,int y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(int x,int y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(int x,int y)
{
    return (x%mod *1LL* y%mod)%mod;
}
inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}

struct data
{
    lli a,b;
    data(lli aa, lli bb)
    {
        a = aa;
        b = bb;
    }
};

bool operator<(data A,  data B)
{
    return (A.a*A.b < B.a*B.b);
}

int main()
{
    ///freopen("output.txt","w",stdout);
   // freopen("input.txt","r",stdin);
    FastIO;
    lli n,k;

    while(cin>>n)
    {

        cin>>k;

        lli a[n],b[n];


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

        }

        sort(b,b+n);
        sort(a,a+n);

        lli lo=0, hi = 1e15, mid , ans = -1;

        ans = hi;

        while(lo<=hi){

            mid = (lo+hi)/2;
            lli kk = k;

            for(int i=0,j=n-1 ; i<n; i++, j--)
            {
                lli now = a[i]*b[j];

                if(now<=mid) continue;



                lli x = (now - mid)/b[j];
                if((now - mid)%b[j]) x++;

                kk -= x;

                assert((a[i]-x)*b[j] <= mid);

                if(kk<0)break;
            }

            if(kk>=0){
                hi = mid-1;
                ans = mid;
            }
            else lo = mid+1;
        }

        cout<<ans<<endl;break;


    }


    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  string A;
  cin >> A;
  
  string B;
  cin >> B;
  
  string C;
  cin >> C;
  
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (A.at(i) == B.at(i) && B.at(i) == C.at(i)) {
    } else if (A.at(i) != B.at(i) && B.at(i) != C.at(i) && C.at(i) != A.at(i)){
      count = count + 2;
    } else {
      count++;
    }
  }
 
  cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
  int i,j,k,n,*a,b=0;

  scanf("%d",&n);

  if(n < 1 || n > 10000) return 0;
  a = (int *)malloc(n * sizeof(int));

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

    scanf("%d",&a[i]);

    if(a[i] < 2 || a[i] > 100000000) return 0;

    k=0;

    if(a[i] !=2 && a[i]%2 == 0) continue;

    j = 3;
    
    while(j <= sqrt(a[i])){
	if(a[i]%j==0) k++;
	j = j+2;     
      }
    
    if(k==0) { 
      ++b; 
    }
  }
  free(a);
  printf("%d\n",b); 

  return 0;
}



Measured memory_bytes: 2072
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;

void main()
{
    auto N = readln.chomp.to!int;
    auto AS = readln.split.to!(int[]);

    if (N == 1) {
        writeln("0");
        return;
    } else if (N == 2) {
        writeln(AS[0] == AS[1] ? "1" : "0");
        return;
    }

    int cnt;
    for (size_t i = 1; i < N-1; ++i) {
        if (AS[i-1] == AS[i]) {
            ++cnt;
            AS[i] = AS[i+1] + 1;
        }
    }
    if (AS[$-2] == AS[$-1]) ++cnt;

    writeln(cnt);
}

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

typedef int64_t ll;

template <class T1, class T2>
using dict = std::unordered_map<T1, T2>;

int main(){
    int N;
    cin >> N;
    if (N%10==9 || (int)(N/10)==9) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
from collections import deque


def main():
    from sys import stdin
    readline = stdin.readline

    from builtins import max, min, range

    INF = 10 ** 6

    H, W = map(int, readline().split())
    Ch, Cw = map(lambda x: int(x) - 1, readline().split())
    Dh, Dw = map(lambda x: int(x) - 1, readline().split())
    S = [readline()[:-1] for _ in range(H)]

    t = [[INF] * W for _ in range(H)]
    for h in range(H):
        th = t[h]
        Sh = S[h]
        for w in range(W):
            if Sh[w] == '#':
                th[w] = -1

    t[Ch][Cw] = 0
    q = deque([(Ch, Cw)])
    a = 0
    warpq = []
    while q:
        while q:
            warpq.append(q[0])
            h, w = q.popleft()
            if h - 1 >= 0 and t[h - 1][w] > a:
                q.append((h - 1, w))
                t[h - 1][w] = a
            if h + 1 < H and t[h + 1][w] > a:
                q.append((h + 1, w))
                t[h + 1][w] = a
            if w - 1 >= 0 and t[h][w - 1] > a:
                q.append((h, w - 1))
                t[h][w - 1] = a
            if w + 1 < W and t[h][w + 1] > a:
                q.append((h, w + 1))
                t[h][w + 1] = a

        if t[Dh][Dw] != INF:
            break

        a += 1
        for h, w in warpq:
            for i in range(max(0, h - 2), min(H, h + 3)):
                ti = t[i]
                for j in range(max(0, w - 2), min(W, w + 3)):
                    if ti[j] > a:
                        ti[j] = a
                        q.append((i, j))
        warpq.clear()

    if t[Dh][Dw] == INF:
        print(-1)
    else:
        print(t[Dh][Dw])


main()


Measured memory_bytes: 23492
N, K = [int(x) for x in input().split()]
A = list()
for _ in range(K):
    input()
    A.append([int(x) for x in input().split()])

m = [False] * N

for a in A:
    for aa in a:
        m[aa - 1] = True

print(len([x for x in m if not x]))

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

using namespace std;


#define ld long double
#define F first
#define S second
//
#define int long long
#define ll long long
#define db(x)                cerr<<#x<<": "<<x<<endl
#define db2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define db3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define db4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define db5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define db6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
//
#define mem(x,y) memset(x,y,sizeof(x))
#define bitcount    __builtin_popcount
//
#define pii pair<int, int>
#define all(v) v.begin(),v.end()
//
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define vi vector<int>
#define vvi vector< vector<int> >
#define si set<int>
#define pb push_back
#define lp(i,a,b) for(int i=a;i<b;i++)
#define rloop(i,a,b) for(int i=a;i>=b;i--)
#define mk make_pair
const int N=3e3+5;
const int mod=1e9+7;
const int mod1=998244353;
const int inf=1e16+7;
using namespace std;

double dp[N][N];
double pr[N];
int n;
bool vis[N][N];
double rec(int i,int h=0){
  //  db2(i,h);
    if(i==n){
        int  t=n-h;
        if(h>t) return  1.0;
        else return 0;
    }
    if(vis[i][h]) return dp[i][h];
    vis[i][h]=1;
   // if(dp[i][h]>1e-8) return dp[i][h];
    double ans1=rec(i+1,h+1)*pr[i];
    double ans2=rec(i+1,h)*(1.0-pr[i]);
    return dp[i][h]=ans1+ans2;
    
}
void solve(){
  //  memset(dp,-1,sizeof(dp));
    
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>pr[i];
   // db("F");
    cout<<fixed<<setprecision(15)<<rec(0,0);
    //db("DEW");
}


int32_t main() {
    IOS;
    
    int t;
    //cin>>t;
    t=1;
    for(int i=1;i<=t;i++){
       solve();
    }
   
}

















Measured memory_bytes: 79744
void main() {
    dchar[] c1 = readln.chomp.to!(dchar[]);
    dchar[] c2 = readln.chomp.to!(dchar[]);
    reverse(c2);
    writeln(c1 == c2 ? "YES" : "NO");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

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

int main(){
	int a,b,c;
	
	cin >> a >> b >> c;
	if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5)){
		cout << "YES" << endl;
	}
	else cout << "NO" << endl;
}

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

using namespace std;

int main(){
    int N;
    int L;
    cin >> N >> L;

    vector<int> vec(N+1);
    int ans = 0;
    int num = 101;
    for (int i = 1; i <= N; i++)
    {
        /* code */
        //cout << vec[i] << endl;
        vec[i] += L + i - 1;
        ans += vec[i];

        //cout << "vec:" << vec[i] << endl;
        if(abs(vec[i] < abs(num))){
          //  cout << "vec2:" << vec[i] << endl;
            num = vec[i];
        }
    }
    cout << ans - num << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
int read(){
	int f=1,x=0; char c=getchar();
	while (c>'9' || c<'0') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=x*10+c-'0'; c=getchar();}
	return f*x;
}
int n,d,x,a,sum;
int main(){
	cin>>n>>d>>x;
	for(int i=1;i<=n;i++){
		a=read();
		for(int j=1;j<=d;j+=a)sum++;
	}
	cout<<sum+x<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h;
  int w;
  cin >> h >> w;
  vector<string> vec(h);
  for (int i = 0; i < h; i++) {
    cin >> vec.at(i);
  }
 
  for(int i = 0; i < w + 2; i++){
    cout << '#';
  }
  cout << endl;

  for (int i = 0; i < h; i++) {
    cout << '#' << vec.at(i) << '#' << endl;
  }

  for(int i = 0; i < w + 2; i++){
    cout << '#';
  }
  cout << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main( ){
  int x,y,r,w;

  scanf("%d %d",&x,&y);

  if(x < y){
    w = x;
    x = y;
    y = w;
  }
  r = x % y;
  while(r!=0){
    x = y;
    y = r;
    r = x % y;
  }
  printf("%d\n",y);
  return 0;
}



Measured memory_bytes: 2140
fun main(args: Array<String>) {
    val (n, a) = readLine()!!.split(' ').map(String::toInt)
    val x = readLine()!!.split(' ').map(String::toInt)
    val dp = Array(n + 1) { LongArray(50 * n + 1) { 0L } }
    dp[0][0] = 1
    for (i in 0 until n)
        for (j in i downTo 0)
            for (k in 0..(50 * i))
                dp[j + 1][k + x[i]] += dp[j][k]

    var ans: Long = 0
    for (i in 1..n)
        ans += dp[i][i * a]
    println(ans)
}

Measured memory_bytes: 38364
#include<bits/stdc++.h>
using namespace std;
map<int,int>STATUS;
map<int,bool>NIBO;
int main ()
{
  	int problem,submission,penalty=0,ac=0;

    cin >> problem >> submission;
    for(int i=0;i<submission;i++){
        int id;
        string verdict;
        cin >> id >> verdict;

        if(verdict=="AC"){
                if(NIBO[id]==0){penalty+=STATUS[id];ac++;}
                NIBO[id]=1;
        }
        else if(verdict=="WA"){
                STATUS[id]++;
        }
    }
    cout<<ac<<" "<<penalty<<endl;

    return 0;
}


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


int main(void){
  int N;
  cin >> N;
  int count = 0;
  for(int i = 1; i <= N; i++){
    if(i % 2 == 1){
      int cc = 0;
     for(int j = 1; j <= i; j++){ 
     	if(i % j == 0)cc++;
     }
      if(cc == 8) count++;
    }    
  }
  cout << count;
  return 0;
}
  


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define TYPE long long
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
long long A[100002], B[100002], C[100002];
int main() {
	long long N;
	scanf("%lld", &N);
	//int *A = (int *)malloc(sizeof(int)*N);
	//int *B = (int *)malloc(sizeof(int)*N);
	//int *C = (int *)malloc(sizeof(int)*N);

	//int tmp;
	long long tmp;

	long long ans = 0;
	for (int i = 0; i < N; i++)
	{
		scanf("%lld", &A[i]);
	}
	for (int i = 0; i < N; i++)
	{
		scanf("%lld", &B[i]);
	}
	for (int i = 0; i < N; i++)
	{
		scanf("%lld", &C[i]);
	}
	qsort(A, N, sizeof(TYPE), cmp);
	qsort(B, N, sizeof(TYPE), cmp);
	qsort(C, N, sizeof(TYPE), cmp);
	//printf("\n");
	//for (int i = 0; i < N; i++)
	//{
	//	printf("%lld ", A[i]);
	//}
	//printf("\n");
	//for (int i = 0; i < N; i++)
	//{
	//	printf("%lld ", B[i]);
	//}
	//printf("\n");
	//for (int i = 0; i < N; i++)
	//{
	//	printf("%lld ", C[i]);
	//}
	//printf("\n");
	int j = 0, k = 0;
	for (int i = 0; i < N; i++)
	{
		//j = 0, k = 0;
			while (A[j] < B[i] && j < N)
		{
			j++;
		}
			while (B[i] >= C[k] && k < N)
		{
			k++;
		}
		tmp = j*(N-k);
		ans += tmp;

		//printf("ab[%d]:%lld bc[%d]:%lld ", i, ab[i],i,bc[i]);
		//printf("tmp[%d]:%lld\n", i, tmp[i]);
		//printf("ans:%lld\n", ans);
	}

	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 3324
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	string s;
	cin >> s;

	string str[] = { "SUN","MON","TUE","WED","THU","FRI","SAT" };

	for(int i = 0; i < 7; i++)
		if (s == str[i]) {
			cout << 7 - i << endl;
		}



	return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int s;
	cin >> s;
	map<int,int> mp;
	mp[s]++;
	int i = 2;
	while (true) {
		if (s % 2 == 0) {
			s /= 2;
		}
		else {
			s = 3*s + 1;
		}

		if (mp[s] == 1) {
			cout << i << endl;
			return 0;
		}
		mp[s]++;
		i++;
	}
	return 0;
}


Measured memory_bytes: 256