akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{	
  long long int h,a,sum=0,p,i;
  cin>>h>>a;
  for(i=0;i<a;i++)
      {
        cin>>p;
        sum+=p;
      }
      if(sum>=h)
      cout<<"Yes\n";
      else cout<<"No\n";
   return 0;
  
  
}


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

using namespace std;

const int N = 1e5 + 2;
int a[N], n, f[N], g[N];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	f[1] = a[1];
	for (int i = 2; i <= n; ++i)
		f[i] = __gcd(f[i - 1], a[i]);
	g[n] = a[n];
	for (int i = n - 1; i >= 1; --i)
		g[i] = __gcd(g[i + 1], a[i]);
	f[0] = g[n + 1] = -1;
	int res = f[n];
	for (int i = 1; i <= n; ++i) {
		int prev = i - 1;
		int next = i + 1;
		if (f[prev] < 0) res = max(res, g[next]);
		else if (g[next] < 0) res = max(res, f[prev]);
		else res = max(res, __gcd(f[prev], g[next]));
	}
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <cmath>
#include <map>
#include <vector>
#include <set>
using namespace std;

char str[10];

int main()
{
    int T;
    long long a=0LL,b=0LL,x,y;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%lld%s%lld",&x,str,&y);
        if(str[0]=='(')
            a+=y;
        else
            b+=y;
        if(a==b)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1172
#include<iostream>
using namespace std;
int n,h,w,x,y,s;
main()
{
    cin>>n>>h>>w;
    for(int i=0;i<n;i+=2)
    {
        cin>>x>>y;
        s+=x+y>w?w*2-x-y:x+y;
    }
    cout<<s*h<<endl;
}


Measured memory_bytes: 3088
n = int(input())
c = [int(input()) for i in range(n)]
MOD = 10**9 + 7

dp = [0]*(n+1)
dp[0] = 1
memo = {}
for i in range(n):
    if c[i] not in memo:
        memo[c[i]] = i
        dp[i+1] = dp[i]
    else:
        if c[i]==c[i-1]:
            dp[i+1] = dp[i]
            memo[c[i]] = i
            continue
        # memo[c[i]]からiの区間を変えるとき
        dp[i+1] += dp[memo[c[i]]+1]
        # memo[c[i]]からiの区間を変えないとき
        dp[i+1] += dp[i]
        
        memo[c[i]] = i
        dp[i+1] %= MOD
print(dp[-1] % MOD)

Measured memory_bytes: 81240
n, p = map(int, input().split())

def pf(x):
    pf = {}
    for i in range(2, int(x ** 0.5) + 1):
        while x %  i == 0:
            if not i in pf:
                pf[i] = 0
            pf[i] += 1
            x //= i           
    if x > 1:
        pf[x] = 1
    return pf
            
ans = 1
pf = pf(p)
for k, v in pf.items():
    while v >= n:
        v -= n
        ans *= k
        
print(ans)

Measured memory_bytes: 3188
S=input();l=-1;r=-1
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        l=i+1;r=i+2
        break

if l<0 and len(S)>2:
    for i in range(len(S)-2):
        if S[i]==S[i+2]:
            l=i+1;r=i+3;
            break
print(l,r)

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

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

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////
vmint f, finv, inv;

void finit(ll N) {
	f.assign(N + 1, 1);
	finv.assign(N + 1, 1);
	inv.assign(N + 1, 1);
	inv[1] = 1;

	repn(i, N) {
		f[i] = f[i - 1] * i;
		if (i > 1)inv[i] = -inv[MOD % i] * (MOD / i);
		finv[i] = finv[i - 1] * inv[i];
	}
}

mint com(ll a, ll b) {
	if (a < 0 || b < 0 || a < b) { return 0; }
	return f[a] * finv[b] * finv[a - b];
}

int main() {
	ll N, M;
	cin >> N >> M;
	
	vll div;
	for (ll i = 2; i * i <= M; i++) {
		if (M % i == 0) {
			ll c = 0;
			while (M % i == 0) { M /= i; c++; }
			div.push_back(c);
		}
	}

	if (M > 1) { div.push_back(1); }
	mint ans = 1;


	finit(N+100);
	for (ll x : div) {
		ans *= com(N+x-1, x);
	}
	cout << ans << endl;
}

Measured memory_bytes: 5648
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

#define DEBUG

#ifdef DEBUG
#define var_dump(...) fprintf(stdout, __VA_ARGS__)
#define dump(a) cout << a << "\n";
#else
#define var_dump(...) 42
#define dump(a) 42
#endif

// https://beta.atcoder.jp/contests/abc073/tasks/abc073_b

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

    int sum = 0;
    int l, r;
    REP(i, N) {
        cin >> l >> r;
        sum += r - l + 1;
    }

    cout << sum << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	int count[8],dealt;
	vector<int> V;
};


int main(){

	int W,M;
	scanf("%d %d",&W,&M);

	bool check[M+1][W+1],work[M+1][W+1];
	int count[W+1];

	for(int row = 0; row <= M; row++){
		for(int col = 0; col <= W; col++)check[row][col] = false;
	}

	for(int num = 1; num <= W-1; num++)count[num] = 0;

	int tmp,height,ans = 0;
	for(int loop = 0; loop < M; loop++){
		scanf("%d",&tmp);
		count[tmp]++;

		for(height = M; height >= 1; height--){
			if(check[height][tmp-1] == true || check[height][tmp+1] == true || check[height][tmp] == true)break;
		}
		height++;
		check[height][tmp] = true;
		ans = max(ans,height);
	}

	int ans_table[W+1];
	for(int col = 1; col <= W; col++)ans_table[col] = col;

	for(int row = 1; row <= M; row++){
		for(int col = 1; col <= W-1; col++){
			if(check[row][col])swap(ans_table[col],ans_table[col+1]);
		}
	}

	queue<Info> Q;
	Info first;
	first.dealt = 0;
	for(int num = 1; num <= W-1; num++)first.count[num] = count[num];
	Q.push(first);

	int work_table[W+1],tmp_max_height;
	bool FLG;

	while(!Q.empty()){

		if(Q.front().dealt == M){

			for(int row = 1; row <= M; row++){
				for(int col = 0; col <= W; col++)work[row][col] = false;
			}

			tmp_max_height = 0;

			for(int i = 0; i < Q.front().V.size(); i++){
				tmp = Q.front().V[i];

				for(height = M; height >= 1; height--){
					if(work[height][tmp-1] == true || work[height][tmp+1] == true || work[height][tmp] == true)break;
				}
				height++;
				work[height][tmp] = true;
				tmp_max_height = max(tmp_max_height,height);
			}

			for(int col = 1; col <= W; col++)work_table[col] = col;

			for(int row = 1; row <= M; row++){
				for(int col = 1; col <= W-1; col++){
					if(work[row][col])swap(work_table[col],work_table[col+1]);
				}
			}

			FLG = true;
			for(int col = 1; col <= W; col++){
				if(ans_table[col] != work_table[col]){
					FLG = false;
					break;
				}
			}
			if(FLG){
				ans = min(ans,tmp_max_height);
			}
			Q.pop();
		}else{

			for(int num = 1; num <= W-1; num++){
				if(Q.front().count[num] == 0)continue;

				Info next_info;
				for(int k = 1; k <= W-1; k++)next_info.count[k] = Q.front().count[k];
				for(int k = 0; k < Q.front().V.size(); k++)next_info.V.push_back(Q.front().V[k]);
				next_info.V.push_back(num);
				next_info.count[num]--;
				next_info.dealt = Q.front().dealt+1;
				Q.push(next_info);
			}
			Q.pop();
		}
	}

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

	return 0;
}

Measured memory_bytes: 3620
# D
import collections

def combinations_count(n, r):
    return n*(n-1) // 2

N = int(input())
A = list( map(int,input().split()))
c = dict(collections.Counter(A))
su = 0
for i in c.values():
    if (i >= 2):
        su += combinations_count(i, 2)

for i in A:
    if (c[i]  >= 3):
        print(su - combinations_count(c[i],2) + combinations_count(c[i]-1,2))
    elif (c[i] == 2):
        print(su - 1)
    else:
        print(su)


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

int main(){
  int N;
  string S;
  cin >> N >> S;
  
  if(N%2==1){
    cout << "No" << endl;
  }else if(S.substr(0,N/2) != S.substr(N/2,N/2)){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<climits>
 
#define MOD (1000000007)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX 2000
 
using namespace std;
 
typedef long long ull;
typedef pair<int,int> ii;
 
struct Data{
  int  to,cost;
  Data(int to=IINF,int cost=IINF):to(to),cost(cost){}
};
 
// Library - topological sort - begin 
template<typename T>
bool visit(const T& G,int v,vector<int>& order,vector<int>& color)
{
  color[v] = 1;
  for(__typeof((G[v]).begin()) e = G[v].begin();e != G[v].end();e++)
    {
      if(color[e->to] == 2)continue;//このvisit以外のvisitで訪れた
      if(color[e->to] == 1)return false;//このvisitで訪れた
      if(!visit(G,e->to,order,color))return false;
    }
  order.push_back(v);
  color[v] = 2;
  return true;
}
 
template<typename T>
bool topologicalSort(const T& G,vector<int>& order)
{
  int SizeG = G.size();
  vector<int> color(SizeG); 
  for(int u=0;u<SizeG;u++)
    if(!color[u] && !visit(G,u,order,color))
      return false;
  reverse(order.begin(),order.end());
  return true;
}
// Library - topological sort - end
 
int V,E,S,D;
vector<vector<Data> > tmp_G,tmp_rG;
vector<int>  G[MAX];
vector<int> rG[MAX];
vector<int> vs;
bool used[MAX];
int cmp[MAX];
ull dp[MAX];
 
inline void add_edge(int from,int to){
  G[from].push_back(to);
  rG[to].push_back(from);
}
 
void dfs(int v){
  used[v] = true;
  for(int i=0;i<G[v].size();i++)if(!used[G[v][i]])dfs(G[v][i]);
  vs.push_back(v);
}
 
void rdfs(int v,int k){
  used[v] = true;
  cmp[v] = k;
  for(int i=0;i<rG[v].size();i++)if(!used[rG[v][i]])rdfs(rG[v][i],k);
}
 
int scc(){
  memset(used,0,sizeof(used));
  vs.clear();
  for(int v=0;v<V;v++)if(!used[v])dfs(v);
  memset(used,0,sizeof(used));
  int k = 0;
  for(int i = vs.size()-1; i >= 0 ; i-- )if(!used[vs[i]])rdfs(vs[i],k++);
  return k;
}
 
int main(){
 
  cin >> V >> E;
  rep(i,E){
    cin >> S >> D;
    assert(1 <= S && S <= V);
    assert(1 <= D && D <= V);
    add_edge(S-1,D-1);
  }
  int nV = scc();
  rep(i,nV)dp[i] = -1;
 
  set<int> OUT_counter[nV];
  rep(i,V)rep(j,G[i].size()){
    if(cmp[i] == cmp[G[i][j]])continue;
    OUT_counter[cmp[i]].insert(cmp[G[i][j]]);
  }
 
  tmp_G.clear(),tmp_rG.clear();
  tmp_G.resize(nV),tmp_rG.resize(nV);
  rep(i,nV)for(int j : OUT_counter[i]){
    tmp_G[i].push_back(j);
    tmp_rG[j].push_back(i);
  }
 
  vector<int> order;
  topologicalSort(tmp_G,order);
 
  rep(i,nV)if(tmp_rG[order[i]].empty())dp[order[i]] = 2ULL;
 
  ull ans = 1;
  rep(i,nV){
    int cur = order[i];
    ull cost = 1;
    rep(j,tmp_rG[cur].size()) cost = ( cost * dp[tmp_rG[cur][j].to] ) % MOD;
    if(!tmp_rG[cur].empty())  dp[cur] = ( cost + 1ULL ) % MOD;
    if(tmp_G[cur].empty())    ans = ( ans * dp[cur] ) % MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1588
#include<stdio.h>
#include<stdlib.h>

int main(){
  int N,i,j,A[100],minj,temp,count=0;

  scanf("%d",&N);
  if(N<1 || N>100){
    exit(1);
  }

  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
    if(A[i]<0 || A[i]>100){
      exit(8);
    }
  }
 
  for(i=0;i<=N-1;i++){
    minj=i;

    for(j=i;j<=N-1;j++){
      if(A[j]<A[minj]){
	minj=j;
      }
    }

    temp=A[i];
    A[i]=A[minj];
    A[minj]=temp;

    if(i!=minj){
      count++;
    }
  }
  
  for(i=0;i<N-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[N-1]);

  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)

//変数
string S;

//解法
void solve() {

	int ans = 700;
	rep(i, 3) {
		if (S[i] == 'o') {
			ans += 100;
		}
	}
	cout << ans;

	return;
}

int main() {
	//入力
	cin >> S;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);

void Main() {
  int a, b;
  cin >> a >> b;
  if (a + b >= 10)
    cout << "error" << endl;
  else
    cout << a + b << endl;
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"flag"
	"fmt"
	"io"
	"math/big"
	"os"
)

var reader *bufio.Reader
var writer *bufio.Writer

var inputFile = flag.String("input", "", "")

func init() {
	flag.Parse()
	var i io.Reader
	if *inputFile != "" {
		i, _ = os.Open(*inputFile)
	} else {
		i = os.Stdin
	}
	reader = bufio.NewReaderSize(i, 1<<20)
	writer = bufio.NewWriterSize(os.Stdout, 1<<20)
}

func println(a ...interface{}) {
	_, _ = fmt.Fprintln(writer, a...)
}

func printf(format string, a ...interface{}) {
	_, _ = fmt.Fprintf(writer, format, a...)
}

func scanf(format string, a ...interface{}) {
	_, _ = fmt.Fscanf(reader, format, a...)
}

func scan(a interface{}) {
	_, _ = fmt.Fscan(reader, a)
}

func NextInt64() int64 {
	var res int64
	scan(&res)
	return res
}

func NextInt() int {
	var res int
	scan(&res)
	return res
}

func NextIntArray(n int) []int {
	res := make([]int, n)
	for i := range res {
		scan(&res[i])
	}
	return res
}

func NextInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		scan(&res[i])
	}
	return res
}

func NextString() string {
	var res string
	scan(&res)
	return res
}

func NextBigInt() *big.Int {
	n := new(big.Int)
	n, _ = n.SetString(NextString(), 10)
	return n
}

func AbsInt64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func MinInt64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func MaxInt64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func MaxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	defer writer.Flush()

	n := NextInt()

	k := NextInt()

	a := NextIntArray(n)


	dp := make([]bool, k + 1)

	for i, x := range dp {
		if x {
			continue
		}
		for _, t := range a {
			if i + t <= k {
				dp[i + t] = true
			}
		}
	}

	if dp[k] {
		println("First")
	} else {
		println("Second")
	}
}


Measured memory_bytes: 768
n,m,l = map(int,input().split())
abe = [list(map(int,input().split())) for i in range(m)]
dist = [[10**18 for i in range(n)] for i in range(n)]
for a,b,e in abe:
  dist[a-1][b-1] = e
  dist[b-1][a-1] = e
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j])
for i in range(n):
  for j in range(n):
    if dist[i][j] <= l:
      dist[i][j] = 1
    else:
      dist[i][j] = 10**18
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j])
q = int(input())
for i in range(q):
  s,t = map(int,input().split())
  x = dist[s-1][t-1]-1
  if x == 10**18-1:
    print(-1)
  else:
    print(x)

Measured memory_bytes: 65624
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define ull unsigned long long
#define min(a,b) (a)<(b)?(a):(b)
#define max(a,b) (a)>(b)?(a):(b)

struct moji{
	char alp;
	struct moji *next;
	struct moji *back;
};

int main(){
	char s[100010];
	scanf("%s",s);
	struct moji *top = (struct moji*)malloc(sizeof(struct moji));
	struct moji *last = top;
	top->alp = s[0];
	top->next = NULL; top->back = NULL;
	for(int i=1;s[i]!=0;i++){
		last->next = (struct moji*)malloc(sizeof(struct moji));
		(last->next)->back = last;
		last = last->next;
		last->alp = s[i];
		last->next = NULL;
	}
	int Q;
	scanf("%d",&Q);
	rep(i,0,Q){
		int t;
		scanf("%d",&t);
		if( t==1 ){
			struct moji *temp=top;
			top=last; last=temp;
		}else{
			int f; char c;
			scanf("%d %c",&f,&c);
			struct moji *data;
			if( f==1 ) data=top;
			else data=last;
			if( data->next==NULL ){
				data->next = (struct moji*)malloc(sizeof(struct moji));
				(data->next)->back = data;
				data = data->next;
				data->alp = c;
				data->next = NULL;
				if(f==1) top = data;
				else last = data;
			}else{
				data->back = (struct moji*)malloc(sizeof(struct moji));
				(data->back)->next = data;
				data = data->back;
				data->alp = c;
				data->back = NULL;
				if(f==1) top = data;
				else last = data;
			}
		}
	}
	struct moji *data=top;
	if( top->next == NULL ){
		while( data!=NULL ){
			printf("%c",data->alp);
			data = data->back;
		}
	}else{
		while( data!=NULL ){
			printf("%c",data->alp);
			data = data->next;
		}
	}
	return 0;
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
int main(){
// 	#ifndef ONLINE_JUDGE
//     // for getting input from input.txt
//     freopen("input.txt", "r", stdin);
//     // for writing output to output.txt
//     freopen("output.txt", "w", stdout);
// 	#endif

    char string1[100];
    int i, length;
    int flag = 0,flag1=0,flag2=0;
    
     cin >> string1;
    
    length = strlen(string1);
    int length1 = (length-1)/2;
    for(i=0;i < length ;i++){
        if(string1[i] != string1[length-i-1]){
            flag = 1;
            break;
    }
    }
    for(i=0;i < length1 ;i++){
        if(string1[i] != string1[length1-i-1]){
            flag1 = 1;
            break;
    }
    }
    int length2=length - length1 -1;
    for(i= 0 ;i < length-length1-1;i++){
        if(string1[length1+i+1] != string1[length-i-1]){
            flag2 = 1;
            break;
    }
    }
    if (flag||flag1||flag2) {
        cout << "No"; 
    }    
    else {
        cout << "Yes"; 
    }
    
    return 0;

    return 0;
}

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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}

typedef vector<int> V;
typedef vector<V> VV;
int main(){
    int N,M;
    cin>>N>>M;
    V x(M),y(M);
    REP(i,M){
        cin>>x[i]>>y[i];
        x[i]--;
        y[i]--;
    }
    reverse(ALL(x));
    reverse(ALL(y));
    V ok(N,1);
    VV death(N,V(N,-2));
    REP(i,N){
        death[i][i]=-1;
        REP(j,M){
            int a=x[j];
            int b=y[j];
            if(death[i][a]!=-2&&death[i][b]!=-2)ok[i]=0;
            if(death[i][a]==-2&&death[i][b]==-2)continue;
            if(death[i][b]==-2)death[i][b]=j;
            if(death[i][a]==-2)death[i][a]=j;  
        }
    }
    int res=0;
    REP(i,N)FOR(j,i+1,N){
        if(!ok[i])continue;
        if(!ok[j])continue;
        if(death[i][j]!=-2)continue;
        if(death[j][i]!=-2)continue;
        int ans=1;
        REP(k,N){
            if(death[i][k]==-2)continue;
            if(death[j][k]==-2)continue;
            if(death[i][k]!=death[j][k])ans=0;
        }

        res+=ans;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

// AtCoder
// #include <atcoder/all>
// using namespace atcoder;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    // vector<ll > a(4); rep (i, 4) cin >> a[i];
    // ll ans = (ll)1e18;
    // rep (i, 4) { rep (j, i + 1, 4) { chmin(ans, a[i] * a[j]); }}
    // cout << ans << "\n";
    ll a, b, c, d; cin >> a >> b >> c >> d;
    vector<ll> x{a, b}, y{c, d};
    if (a * b <= 0) x.push_back(0);
    if (c * d <= 0) y.push_back(0);
    ll ans = (ll)-2e18;
    for (auto p : x) {
        for (auto q : y) {
            chmax(ans, p * q);
        }
    }
    cout << ans << "\n";
    /***************************************************/
    /* Submit this code from the browser if using ACL! */
    /***************************************************/
    return 0;
}

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

#define pb push_back
#define fi first
#define se second
#define mem(x,n) memset(x,n,sizeof(x))
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define foreach(it,l) for(auto it=(l).begin();it!=(l).end();it++)
#define pnl printf("\n")
#define endl '\n'
#define len(x) (x).length()

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<int> VI;
const double EPS=1e-10;
//const double PI=acos(-1.0);
const int INF=1<<30;
const LL LLINF=1ll<<60;
const int MOD=1e9+7;
const int xx[8]={1,0,-1,0,1,-1,1,-1};
const int yy[8]={0,1,0,-1,-1,1,1,-1};

void fastio(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); }

/***********************************\
     _____ _             _
    /  __ \ |           (_)
    | /  \/ | __ _ _ __  _  ___
    | |   | |/ _` | '_ \| |/ _ \
    | \__/\ | (_| | |_) | |  __/
     \____/_|\__,_| .__/|_|\___|
                  | |
                  |_|
\***********************************/

char input[1005][1005];


struct node{
	int x,y;
};
int n,m,k;
int dist[1005][1005];

int bfs(int x,int y){
	queue<node> q;
	q.push({x,y});
	dist[x][y]=0;
	
	while(!q.empty()){
		node temp=q.front(); q.pop();
		int tempx=temp.x;
		int tempy=temp.y;
		for(int i=0;i<4;i++){
			int tx=tempx+xx[i];
			int ty=tempy+yy[i];
			
			if(tx<0||tx>n||ty<0||ty>m||input[tx][ty]=='#') continue;
			
			else if(dist[tempx][tempy]+1<dist[tx][ty]){
				q.push({tx,ty}); 
				dist[tx][ty]=dist[tempx][tempy]+1;
			}
		}
	}
	
	int ans=INF;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(dist[i][j]!=INF&&dist[i][j]<=k){
				ans=min(ans,min(i,min(n-i-1,min(j,m-j-1))));
			}
		}
	}
	
	if(ans%k!=0) ans/=k,ans++;
	else ans/=k;
	ans++;
	return ans;
}

int main(){
	scanf("%d%d%d",&n,&m,&k);
	getchar();
	for(int i=0;i<n;i++){
		scanf("%s",input[i]);
		for(int j=0;j<m;j++){
			dist[i][j]=INF;
		}
	}
	
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(input[i][j]=='S'){
				ans=bfs(i,j);
				break;
			}
		}
	}
	printf("%d\n",ans);
	
	return 0;
}


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

int const MAXN = 1e5;
int const INF = 3e5;

// u: escape, v: chase
int par[MAXN], u, v, N;
std::vector<int> G[MAXN];

int dfs(int x, int p) {
  par[x] = p;
  int dist = INF;
  for(auto c: G[x]) if(c != p) {
    dist = std::min(dist, dfs(c, x)); 
  }
  if(x == u) return 0;
  return dist+1;
}

int dfs2(int x) {
  int dist = 0;
  for(auto c: G[x]) if(c != par[x]) {
    dist = std::max(dist, dfs2(c)+1); 
  }
  return dist;
}

int main() {
  std::cin >> N >> u >> v; --u; --v;
  for(int i = 0; i < N-1; ++i) {
    int A, B; std::cin >> A >> B; --A; --B;
    G[A].push_back(B);
    G[B].push_back(A);
  }
  int n = dfs(v, -1);
  for(int i = 0; i < (n-1)/2; ++i) u = par[u];
  int ans = dfs2(u) + n - (n-1)/2 - 1;
  std::cout << ans << std::endl;
  return 0;
}


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

using std::cin;
using std::cout;
using std::endl;

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

    std::vector<int> line(length);

    for (auto i = 0; i < length; i++) {
        cin >> line.at(i);
    }

    int min;
    int swap_cnt = 0;
    for (auto i = 0; i < length; i++) {
        min = i;
        for (auto j = i; j < length; j++) {
            if (line.at(j) < line.at(min)) {
                min = j;
            }
        }
        if (min != i) {
            int tmp = line.at(i);
            line.at(i) = line.at(min);
            line.at(min) = tmp;
            swap_cnt++;
        }
    }

    for (auto i = 0; i < length; i++) {
        if (i != 0) {
            cout << " ";
        }
        cout << line.at(i);
    }
    cout << endl;

    cout << swap_cnt << endl;

    return 0;
}

void swap(int* a, int* b)
{
    int tmp = *a;
    *a = *b;
    *b = tmp;
}

Measured memory_bytes: 1196
a,b = map(int,input().split())

def f(n):
    if n%4==0:
        return n
    elif n%4==1:
        return 1
    elif n%4==3:
        return 0
    else:
        return (n // 4) * 4 + 3

print(f(a-1) ^ f(b))

Measured memory_bytes: 3060
while True:
	n = int(input())
	if n == 0:
	    break
	a = [0]*10
	for i in range(n):
	    a[int(input())] += 1
	for i in range(10):
		if a[i] == 0:
		    print('-')
		else:
		    print('*'*a[i])



Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int a, b, c; scanf("%d%d%d", &a, &b, &c);
	
	int ans = std::max(0, c - a);
	if(ans > b) printf("NA\n");
	else printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 3228
package main

import (
	"fmt"
	"strings"
)

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

	if s[0] != 'A' {
		fmt.Println("WA")
		return
	}

	var cnt int
	for i, c := range s {
		if i > 0 && c != 'C' {
			if !isLower(string(c)) {
				fmt.Println("WA")
				return
			}
		}

		if i > 1 && i < len(s)-1 && c == 'C' {
			cnt++
		}
	}
	if cnt != 1 {
		fmt.Println("WA")
		return
	}

	fmt.Println("AC")
}

func isLower(s string) bool {
	return s == strings.ToLower(s)
}


Measured memory_bytes: 640
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const int N = 6010;

int n, m;
int dp[N][2 * N];
int rev[2 * N];

ll inq(ll x, ll y)
{
    if (!y) return 1;
    ll l = inq(x, y / 2);
    if (y % 2) return l * l % m * x % m;
    return l * l % m;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < 2 * N; i++) rev[i] = inq(i, m - 2);
    dp[0][N] = 1;
    for (int i = 2; i <= 3 * n; i++) dp[0][N] = 1LL * dp[0][N] * i % m;
    for (int si = 0; si <= 3 * n; si++)
    {
        for (int bal = 1; bal + 1 < 2 * N; bal++)
        {
            for (int x = 1; x <= 3; x++)
            {
                int nbal = bal + (x == 1) - (x == 2);
                dp[si + x][nbal] = (dp[si + x][nbal] + 1LL * dp[si][bal] * rev[si + x]) % m;
            }
        }
    }
    long long ans = 0;
    for (int i = N; i <= N + 3 * n; i++)
    {
        ans += dp[3 * n][i];
    }
    cout << ans % m;
}


Measured memory_bytes: 282240
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int main(){
  int n,m;
  while(cin>>n&&n){
    int dp[210],cop[210];
    vector<int> v[1010];
    for(int i=0;i<n;i++){
      int x,y;cin>>x>>y;
      v[x].push_back(y);
      dp[i]=mod;
    }
    cin>>m;
    for(int i=0;i<m;i++){
      int x,y;cin>>x>>y;
      v[x].push_back(y);
      dp[i+n]=mod;
    }
    dp[n+m]=mod;
    for(int i=0;i<1010;i++){
      for(int j=0;j<=n+m;j++)cop[j]=dp[j];
      for(int j=0;j<v[i].size();j++){
	int it=lower_bound(dp,dp+n+m,v[i][j])-dp;
	cop[it]=min(cop[it],v[i][j]);
      }
      for(int j=0;j<=n+m;j++)dp[j]=cop[j];
    }
    int ans=0;
    while(true){
      if(dp[ans]==mod)break;
      ans++;
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

int main(){
    char s[4];
    scanf("%s", s);
    map <char, int> freq;
    for(int i = 0; i < 4; i++){
        freq[s[i]]++;
        if(freq[s[i]] >= 3)
            return puts("No"), 0;
    }
    for(auto x : freq){
        if(x.second != 2)
            return puts("No"), 0;
    }
    puts("Yes");
    return 0;
}


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

int main() 
{
    int n, k, q;
    cin >> n >> k >> q;
    int a[q];
    rep(i,q) cin >> a[i];
    rep(i,q) a[i]--;

    int P[n];
    rep(i,n) P[i] = k-q;
    rep(i,q) P[a[i]]++;
    rep(i,n) {
        if (P[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    long long N;
    cin >> N;
    long long m[5]={};
    rep(i,N){
        string x;
        cin >> x;
        if(x[0]=='M') m[0]++;
        if(x[0]=='A') m[1]++;
        if(x[0]=='R') m[2]++;
        if(x[0]=='C') m[3]++;
        if(x[0]=='H') m[4]++;
    }
    long long ans=0;
    for(int i=0;i<3;i++){
        for(int j=i+1;j<4;j++){
            for(int k=j+1;k<5;k++){
                ans+=m[i]*m[j]*m[k];
            }
        }
    }
    cout << ans << endl;


}


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

int main(){
    int n;
    cin>>n;
    vector<P>x,y;
    vector<bool>seen(n,false);
    rep(i,n){
        int a,b;
        cin>>a>>b;
        x.push_back(P(a,b));
    }
    rep(i,n){
        int a,b;
        cin>>a>>b;
        y.push_back(P(a,b));
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    int ans=0;
    rep(i,n){
        bool ok=false;
        int p=0,mx=-1;
        rep(j,n){
            if(seen[j])continue;
            if(y[i].first>x[j].first){
                if(y[i].second>x[j].second){
                    if(mx<x[j].second){
                        ok=true;
                        mx=x[j].second;
                        p=j;
                    }
                }
            }
        }
        if(ok)seen[p]=true,ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3608
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#pragma comment("-Wl,--stack=1024000000")
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#define eprintf(...) 0
#else
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#endif
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){int ret=1;do{if(y&1)ret=(ll)ret*x%md;x=(ll)x*x%md;}while(y>>=1);return ret;}
inline int Rand(){return rand()*32768+rand();}
int n;
string s;
vector<int>a,b;
string dp[3005];
int ind[6005];
int main(){
	cin>>n>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='a')ind[i]=a.size(),a.push_back(i);
		else ind[i]=b.size(),b.push_back(i);
	}
	dp[n]="";
	for(int i=n-1;i>=0;i--){
		if(a[i]<b[i]){
			int p=i;
			while(p<n&&min(a[p],b[p])<=b[i])p++;
			dp[i]="ab"+dp[p];
		}else{
			int p=i;
			while(p+1<n&&b[p+1]<a[p])p++;
			for(int j=b[i];j<s.size();j++){
				if(ind[j]>=i&&ind[j]<=p)dp[i].push_back(s[j]);
			}
			dp[i]+=dp[p+1];
		}
		dp[i]=max(dp[i],dp[i+1]);
	}
	cout<<dp[0]<<endl;
	return 0;
}

Measured memory_bytes: 14592
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int H, W; 
    cin >> H >> W; 
    char c[60][60]; 
    for (int i = 1; i <= H; ++i){
    for(int j = 1; j <= W; ++j){ cin >> c[i][j]; 
     }
    }
    int d[60][60] = {0}; 
    for (int i = 1; i <= H; ++i){
    for(int j = 1; j <= W; ++j){
      if(c[i][j] == '#') d[i][j] = 1;
      else d[i][j] = 0; 
     }
    } 
    for (int i = 1; i <= H; ++i){
    for (int j = 1; j <= W; ++j){ 
      int X = d[i-1][j-1] + d[i-1][j]+ d[i-1][j+1] + d[i][j-1] + d[i][j+1] + d[i+1][j+1]+ d[i+1][j] + d[i+1][j-1]; 
      if(c[i][j] == '.') cout << X ; 
    else cout << '#';
    }
    cout << endl; 
    }
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    string a, b, c;
    cin >> a >> b >> c;

    if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N;cin>>N;
    if(N/100==N%10)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using vi = vector<int>;

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;}

#define P (1'000'000'007)

int dp[3003][3003] = {0};

signed main() {
    int n, t;
    cin >> n >> t;

    vector<pair<int, int>> vp;

    rep(i, n) {
        int a, b;
        cin >> a >> b;

        vp.push_back({a, b});
    }

    sort(all(vp), [](const auto& l, const auto& r) { return l.first < r.first; });

    dp[0][0] = 0;

    rep(j, n) {
        for(int i = 0; i <= t; ++i) {
            chmax(dp[i + 1][j + 1], dp[i][j + 1]);
            chmax(dp[i + 1][j + 1], dp[i + 1][j]);
            if (i + vp[j].first <= t) {
                chmax(dp[i + vp[j].first][j + 1], dp[i][j] + vp[j].second);
            }
        }
    }

    int ans = 0;
    rep(j, n) {
        chmax(ans, dp[t - 1][j] + vp[j].second);
    }

    // dev(dp, t + 1, n + 1);

    cout << ans;

    return 0;
}

Measured memory_bytes: 73696
/*-----rk_98-----*/
#include<bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define mod 1000000007
#define eps 1e-9
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
using namespace std;
int main()
{
    //fast();
    string s;
	ll d;
	cin>>s>>d;
	ll n= s.length();
	ll dp[n+2][d][2];
	memset(dp,0,sizeof dp);
	dp[0][0][0] = 1;
	for(ll i=0 ; i< n; i++)
	{
		for(ll j = 0 ; j < d ;j++)
		{
			for(ll k = 0; k <= 1 ; k++)
			{
				for(ll digit = 0 ;digit <10 ; digit++)
				{
					if(digit> s[i] - '0' && !k)
					{
						break;
					}
					dp[i+1][(j + digit) % d][k || (digit < s[i] -'0')] = 
					(dp[i+1][(j + digit) % d][k || (digit < (s[i] -'0'))] + dp[i][j][k] ) % mod;
				}
			}
		}
	}
	cout<<(dp[n][0][0] + dp[n][0][1] -1 +mod) % mod<<endl;
}


Measured memory_bytes: 15872
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

constexpr int MOD = 1e9+7;
struct mint
{
	int v;
	mint():v(0){}
	mint(int v):v((v+MOD)%MOD){}
	mint operator-()const{ return mint(0) - *this; }
	mint& operator+=(const mint& a){ if((v+=a.v)>=MOD) v-=MOD; return *this; }
	mint& operator-=(const mint& a){ if((v+=MOD-a.v)>=MOD) v-=MOD; return *this; }
	mint& operator*=(const mint& a){ (v*=a.v)%=MOD; return *this; }
	mint& operator/=(const mint& a){ (*this) *= a.inv(); return *this; }
	mint operator+(const mint& a)const{ return mint(*this) += a; }
	mint operator-(const mint& a)const{ return mint(*this) -= a; }
	mint operator*(const mint& a)const{ return mint(*this) *= a; }
	mint operator/(const mint& a)const{ return mint(*this) /= a; }
	bool operator<(const mint& a)const{ return v < a.v; }
	bool operator==(const mint& a)const{ return v == a.v; }
	mint pow(int k)const{ mint r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }
	mint inv()const{ return pow(MOD-2); }
	static mint comb(int n, int k) {
		if(n-k<k) k=n-k;
		mint num(1), dom(1);
		for(int i=0;i<k;i++) { num*=n-i; dom*=i+1; }
		return num/dom;
	}
};
std::istream& operator>>(std::istream&i,mint&a){ int t; i>>t; a=mint(t); return i; }
std::ostream& operator<<(std::ostream&o,const mint&a){ o<<a.v; return o; }


signed main() {
	int n,k;
	std::cin >> n >> k;
	std::vector<int> a(n);
	for(auto&&x:a) std::cin >> x;
	// dp[i][j] up to ith child, j candies
	std::vector<std::vector<mint> > dp(n+1,std::vector<mint>(k+1,0));
	dp[0][0] = 1;
	rep(i,n) {
		std::vector<mint> ac(k+2,0);
		rep(j,k+1) ac[j+1] = ac[j]+dp[i][j];
		rep(j,k+1) {
			dp[i+1][j] = ac[j+1] - ac[std::max(0ll,j-a[i])];
		}
	}
	print(dp[n][k]);

	return 0;
}


Measured memory_bytes: 80256
import bisect
from itertools import accumulate
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
acc = list(accumulate(a))
ans = 10**18
for i in range(1,n-2):
  suml = acc[i]
  sumr = acc[n-1]-acc[i]
  ql = bisect.bisect_left(acc,suml/2)
  if ql == 0:
    ansl1 = [suml-acc[ql],acc[ql]]
    ansl2 = [suml-acc[ql],acc[ql]]
  else:
    ansl1 = [suml-acc[ql],acc[ql]]
    ansl2 = [suml-acc[ql-1],acc[ql-1]]
  qr = bisect.bisect_left(acc,sumr/2+suml)
  if qr == i:
    ansr1 = [acc[n-1]-acc[qr],acc[qr]-suml]
    ansr2 = [acc[n-1]-acc[qr],acc[qr]-suml]
  else:
    ansr1 = [acc[n-1]-acc[qr],acc[qr]-suml]
    ansr2 = [acc[n-1]-acc[qr-1],acc[qr-1]-suml]
  for ansl in (ansl1,ansl2):
    for ansr in (ansr1,ansr2):
      ans = min(ans,max(ansl+ansr)-min(ansl+ansr))
print(ans)


Measured memory_bytes: 82936
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

const int INF = 500002;
int p[102];
P dp[102][102][502];
bool visited[102][102][502];
int n;

P dfs(int pos, int r, int ex){
    if(pos == n) return P(0, 0);
    if(visited[pos][r][ex]) return dp[pos][r][ex];
    int pay = 1000;
    while(pay < p[pos]) pay += 1000;
    int nex = ex + pay - p[pos];
    int nr = r + nex / 500;
    nex %= 500;
    P ret = dfs(pos+1, r, ex);
    if(nr > 0){
        P res = dfs(pos+1, nr-1, nex);
        ret = max(ret, P(res.first + 1, res.second - p[pos]));
    }else{
        P res = dfs(pos+1, nr, nex);
        ret = max(ret, P(res.first, res.second - p[pos]));
    }
    dp[pos][r][ex] = ret;
    visited[pos][r][ex] = true;
    return ret;
}

int main(){
    while(true){
        cin >> n;
        if(n == 0) break;

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

        memset(visited, 0, sizeof(visited));
        P ans = dfs(0, 0, 0);
        cout << ans.first << " " << -ans.second << endl;
    }

    return 0;
}

Measured memory_bytes: 28044
#include <stdio.h>
int main()
{
	int t=0;
	int i=0;
	int A=0;
	int B=0;
	int C=0;
	
	scanf("%d %d %d",&A,&B,&C);
	
	t=C/A;
	
	printf("%d\n",B*t);
	return 0;
}

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

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; }

int main() {
    ll k;
    cin >> k;
    ll ans = 0;
    for (ll a = 1; a <= k; a++) {
        for(ll b = 1; b <= k; b++){
            for(ll c = 1; c <= k; c++){
                ans += gcd(a, gcd(b, c));
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0024
{
    class Program
    {
        static void Main(string[] args)
        {
            var rStr = Console.ReadLine();

            string S = rStr.Split(' ')[0];
            string T = rStr.Split(' ')[1];

            rStr = Console.ReadLine();

            int A = int.Parse(rStr.Split(' ')[0]);
            int B = int.Parse(rStr.Split(' ')[1]);

            rStr = Console.ReadLine();

            if (S == rStr)
            {
                A -= 1;
            }
            else if (T == rStr)
            {
                B -= 1;
            }

            Console.WriteLine(A + " " + B);

        }
    }
}


Measured memory_bytes: 27500
var
a:array[0..105] of string;
n,i,j:integer;
begin
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n-1 do
  for j:=i+1 to n do
    if a[i]+a[j]>a[j]+a[i] then
      begin
        a[0]:=a[i];
        a[i]:=a[j];
        a[j]:=a[0];
      end;
for i:=1 to n do write(a[i]);
end.

Measured memory_bytes: 128