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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  Solver(LL n) : n(n){};

  void solve() {
  }
};
class Solver2 {
 public:
  int n, x, y;
  vector<vector<int>> dp;
  Solver2(LL n, LL x, LL y) : n(n), x(x), y(y), dp(n, vector<int>(n)){};

  void solve() {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        dp[i][j] = abs(i - j);
      }
    }
    --x;
    --y;
    dp[x][y] = 1;
    dp[y][x] = 1;
    for (int _ = 0; _ < 4; ++_) {
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
          dp[i][j] = min(dp[i][j], dp[i][x] + dp[x][j]);
          dp[i][j] = min(dp[i][j], dp[i][y] + dp[y][j]);
        }
      }
    }
    vector<int> cnt(n);
    for (int i = 0; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
        cnt[dp[i][j]]++;
      }
    }
    for (int i = 1; i < n; ++i) {
      cout << cnt[i] << endl;
    }
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, x, y;
  std::cin >> n >> x >> y;

  Problem::Solver2 sol(n, x, y);
  sol.solve();
  return 0;
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}

int main() {
    int k,s;
    cin >> k >> s;
    int cnt = 0;
    repe(i,k) {
        repe(j,k) {
            if (s-i-j <= k && s-i-j >=0) {
                cnt++;
            }
        }
    }
    cout << cnt << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define MAX 10000000000

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

  int n; cin >> n;

  vector< vector< P > > f(n);
  for(int i = 0; i < n; i++){
    int u, k; cin >> u >> k;
    for(int j = 0; j < k; j++){
      int v, c; cin >> v >> c;
      f[u].push_back(make_pair(v, c));
    }
  }

  priority_queue< P, vector<P>, greater<P> > que;
  vector<ll> d(n, MAX);
  d[0] = 0;
  que.push(make_pair(0, 0));

  while(!que.empty()){
    P q = que.top(); que.pop();
    if(q.first > d[q.second]) continue;
    
    for(int i = 0; i < f[q.second].size(); i++){
      if(d[ f[q.second][i].first ] > d[q.second] + f[q.second][i].second){
        d[ f[q.second][i].first ] = d[q.second] + f[q.second][i].second;
        que.push(make_pair(d[ f[q.second][i].first ], f[q.second][i].first));
      }
    }
  }

  for(int i = 0; i < n; i++){
    cout << i << " " << d[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 6092
#include <bits/stdc++.h>
#define INF 1000000007
#define MAX_D 10
using namespace std;

int ps[MAX_D];
int cs[MAX_D];

int solve(short st, int d, int g) {
    int max_not_comp = 0, point = 0, count = 0;
    for (int i = 0; i < d; i++) {
        if (st & (1 << i)) {
            point += (i + 1) * 100 * ps[i] + cs[i];
            count += ps[i];
        } else {
            max_not_comp = i + 1;
        }
    }
    if (point >= g)
        return count;
    if (!max_not_comp)
        return INF;
    int count_max_not_comp = 1 + (g - point - 1) / (max_not_comp * 100);
    if (count_max_not_comp < ps[max_not_comp - 1])
        return count + count_max_not_comp;
    return INF;
}

int main() {
    int d, g;
    cin >> d >> g;
    for (int i = 0; i < d; i++) {
        cin >> ps[i] >> cs[i];
    }
    int res = INF;
    for (short i = 0; i < (1 << d); i++) {
        res = min(res, solve(i, d, g));
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
	read::<String>().split_whitespace()
		.map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
	(0..n).map(|_| read_vec()).collect()
}

pub trait LexicalPermutation {
	/// Return `true` if the slice was permuted, `false` if it is already
	/// at the last ordered permutation.
	fn next_permutation(&mut self) -> bool;
}
impl<T> LexicalPermutation for [T] where T: Ord {
	/// Original author in Rust: Thomas Backman <serenity@exscape.org>
	fn next_permutation(&mut self) -> bool {
		// These cases only have 1 permutation each, so we can't do anything.
		if self.len() < 2 { return false; }

		// Step 1: Identify the longest, rightmost weakly decreasing part of the vector
		let mut i = self.len() - 1;
		while i > 0 && self[i-1] >= self[i] {
			i -= 1;
		}

		// If that is the entire vector, this is the last-ordered permutation.
		if i == 0 {
			return false;
		}

		// Step 2: Find the rightmost element larger than the pivot (i-1)
		let mut j = self.len() - 1;
		while j >= i && self[j] <= self[i-1]  {
			j -= 1;
		}

		// Step 3: Swap that element with the pivot
		self.swap(j, i-1);

		// Step 4: Reverse the (previously) weakly decreasing part
		self[i..].reverse();

		true
	}
}

fn main() {
	let bingo: Vec<Vec<usize>> = read_vec2(3);
	let n = read();
	let mut b: Vec<usize> = Vec::new();
	for _ in 0..n {
		b.push(read());
	}

	let mut bingo_result = vec![vec![false; 3]; 3];

	for bi in b {
		for i in 0..3 {
			for j in 0..3 {
				if bingo[i][j] == bi {
					bingo_result[i][j] = true;
				}
			}
		}
	}

	let mut flag = false;
	for i in 0..3 {
		if bingo_result[i][0] && bingo_result[i][1] && bingo_result[i][2] {
			flag = true;
			break;
		}
	}
	for i in 0..3 {
		if bingo_result[0][i] && bingo_result[1][i] && bingo_result[2][i] {
			flag = true;
			break;
		}
	}
	if bingo_result[0][0] && bingo_result[1][1] && bingo_result[2][2] {
		flag = true;
	}
	if bingo_result[2][0] && bingo_result[1][1] && bingo_result[0][2] {
		flag = true;
	}

	if flag {
		println!("Yes");
	} else {
		println!("No");
	}
}


Measured memory_bytes: 4352
#include<cstdio>
#define ll long long
using namespace std;
int main(){
	int n,ans=0,now;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&now);
		while(!(now&1)) now>>=1,ans++;
	}
	
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
def divisors(x):
    DIVISORS = []
    for i in range(1, int(x**0.5) + 1):
        if x % i == 0:
            DIVISORS.append(i)
            if i != x**0.5:
                DIVISORS.append(x // i)
    DIVISORS.sort()
    return DIVISORS


n = int(input())

A = divisors(n); B = A[::-1]

ans = float("inf")
for a, b in zip(A, B):
    tmp = max(len(str(a)), len(str(b)))
    ans = min(ans, tmp)

print(ans)


Measured memory_bytes: 3188
from math import gcd
n = int(input())
if n == 2:
  a, b = map(int,input().split())
  g = gcd(a, b)
else:
  a, b, c = map(int,input().split())
  g = gcd(a, b)
  g = gcd(g, c)

lst = []
app = lst.append
for i in range(1, int(g ** (1/2)) + 1):
  if not g % i:
    if i ** 2 != g:
      app(i)
      app(g // i)
    else:
      app(i)
lst.sort()
for i in lst:
  print(i)


Measured memory_bytes: 5680
n = int(input())
x = list(map(int, input().split())) # list()
xsorted = sorted(x)
mannaka=n//2
median_a = xsorted[mannaka-1]#3
median_b = xsorted[mannaka]#4
'''
print(x)
print(xsorted)
print(mannaka)
print(median_a)
print(median_b)
'''
for i in range(n):
    if(x[i]<=median_a):
        print(median_b)
    else:
        print(median_a)


Measured memory_bytes: 25220
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	int N=in(),A=in(),B=in(),C=in(),D=in();
	string S=in<string>();
	vector<int> V(N);
	REP(i,N){
		V[i] = S[i]=='#' ? 1 : 0;
	}
	auto start_s = V.begin()+A-1,end_s = V.begin()+C;
	auto start_f = V.begin()+B-1,end_f = V.begin()+D;
	auto res_s = search_n(start_s,end_s,2,1);
	auto res_f = search_n(start_f,end_f,2,1);

	if(res_s!=end_s || res_f!=end_f){
		cout << "No" << endl;
		return 0;
	}

	if(D<C){
		auto res = search_n(start_f-1,end_f+1,3,0);
		if(res==end_f+1){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 1360
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=1e5+10;
int main()
{
	int n,m,q,k;
	cin>>n;
	int ans=n%10;
	if(ans==2||ans==4||ans==5||ans==7||ans==9) cout<<"hon";
	else if(ans==0||ans==1||ans==6||ans==8) cout<<"pon";
	else cout<<"bon";
}


Measured memory_bytes: 3536
#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>
using namespace std;
typedef long long int ll;

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


const int MAX_N = 10010, MAX_W = 10010, MAX_V = 10010;


ll a[200010];

ll tmp = 0;

ll l[100010], r[100010];

int main()
{
	ll N, Q;
	string S;
	cin >> N >> Q;
	cin >> S;
	for (ll i = 0; i < Q; i++)
	{
		cin >> l[i] >> r[i];
	}
	
	for (ll i = 0; i < N; i++)
	{
		if (i == 0)
		{
			a[0] = 0;
			continue;
		}
		if (S[i - 1] == 'A' && S[i] == 'C')
		{
			tmp++;
			
		}
		a[i] = tmp;
	}

	for (ll i = 0; i < Q; i++)
	{
		//クエリ読み込み
		ll tmp2 = a[r[i] - 1] - a[l[i] - 1];
		cout << tmp2 << endl;
	}
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}

int dp[65][2][2][2];
int l, r;
int32_t main(){_
   
   cin >> l >> r;

   const int N = 61;
   for (int i = 0; i < 2; ++i)
   {
      for (int j = 0; j < 2; ++j)
      {
         dp[0][i][j][1] = 1;
      }
   }

   for (int idx = 0; idx <= N; ++idx)
   {
      int bit_R = (r & (1LL << idx)) > 0;
      int bit_L = (l & (1LL << idx)) > 0;
      for (int equal_R = 0; equal_R < 2; ++equal_R)
      {
         for (int equal_L = 0; equal_L < 2; ++equal_L)
         {
            for (int start = 0; start < 2; ++start)
            {
               for (int i = 0; i < 2; ++i)
               {
                  for (int j = 0; j < 2; ++j)
                  {
                     if(j > i)
                        continue;
                     bool tnf1 = equal_R, tnf2 = equal_L;
                     if(equal_R == 1 and i > bit_R){
                        continue;
                     }
                     else if(equal_R == 1 and i < bit_R){
                        tnf1 = 0;
                     }

                     if(equal_L == 1 and j < bit_L){
                        continue;
                     }
                     else if(equal_L == 1 and j > bit_L){
                        tnf2 = 0;
                     }

                     if(start == 0){
                        if(i != j)
                           continue;
                     }
                     bool nstart = start;
                     nstart |= (i > 0 && j > 0);
                     dp[idx+1][equal_L][equal_R][start] += dp[idx][tnf2][tnf1][nstart];
                     dp[idx+1][equal_L][equal_R][start] %= mod;
                  }
               }  
            }
         }
      }
   }

   int ans = dp[N+1][1][1][0];
   cout<<ans;

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

struct edge{
  ll to;
  ll cost;
  edge(ll to, ll cost): to(to), cost(cost) {}
};
int N, Q, K;
vector<vector<edge>> G;
ll dist[101010];
void rec(int v, ll sum, int p = -1){
  dist[v] = sum;
  for (auto nv: G[v]){
    if (nv.to == p) continue;
    rec(nv.to, sum + nv.cost, v);
  }
}

int main(){
  cin >> N;
  G.resize(N);
  rep(i, N - 1){
    ll a, b, c; cin >> a >> b >> c;
    a--, b--;
    G[a].emplace_back(edge(b, c));
    G[b].emplace_back(edge(a, c));
  }
  cin >> Q >> K; K--;
  rec(K, 0, -1);
  rep(i, Q){
    ll x, y; cin >> x >> y;
    x--, y--;
    cout << dist[x] + dist[y] << endl;
  }
}


Measured memory_bytes: 14336
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <utility>
#include <cstdio>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    int N,h[100005]={},dp[100005]={};
    cin>>N;
    rep(i,N){
        cin>>h[i];
    }
    dp[0] = 0;
    dp[1] = abs(h[0]-h[1]);
    repp(i,2,N){
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[N-1]<<endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#include <cstdlib> //絶対値 abs()
using namespace std;


int main(){
	int n;
	cin >> n;
	string s,t;
	cin >> s >> t;

	vector<char> ans(2*n);

	for(int i=0; i<n; i++){
		ans[i*2] = s[i];
		ans[i*2+1] = t[i];
	}

	for(int i = 0; i<2*n;i++){
		cout << ans[i];
	}
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("atcoder-problems/abc110_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string S, T;
  cin >> S >> T;

  map<char, char> m;
  rep(i, S.size()) {
    if (!m.count(S[i])) {
      m[S[i]] = T[i];
    } else {
      char t = m[S[i]];
      if (t != T[i]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  m.clear();
  rep(i, S.size()) {
    if (!m.count(T[i])) {
      m[T[i]] = S[i];
    } else {
      char s = m[T[i]];
      if (s != S[i]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
 
  cout << "Yes" << endl;
}

Measured memory_bytes: 916
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

ll n;

double dp[310][310][310];
double rec(ll i, ll j, ll k) {
    if (dp[i][j][k] >= 0) return dp[i][j][k];
    if (i==0 && j==0 && k==0) return 0.0;

    double res = 0.0;
    if (i > 0) res += rec(i-1, j, k) * i;
    if (j > 0) res += rec(i+1, j-1, k) * j;
    if (k > 0) res += rec(i, j+1, k-1) * k;
    res += n;
    res *= 1.0 / (i + j + k);
    return dp[i][j][k] = res;
}


int main() {
    cin >> n;
    ll a=0, b=0, c=0;
    rep(i, n) {
        ll tmp;
        cin >> tmp;
        if (tmp == 1) a++;
        else if (tmp == 2) b++;
        else c++;
    }
    memset(dp, -1, sizeof(dp));
    cout.precision(10);
    cout << rec(a, b, c) << endl;
}

Measured memory_bytes: 233088
n = int(input())
p_list = list(map(int, input().split()))

count = 0
for i in range(1, n-1):
    if (p_list[i-1] < p_list[i] and p_list[i] < p_list[i+1]) or (p_list[i+1] < p_list[i] and p_list[i] < p_list[i-1]):
        count += 1

print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#define int long long
using namespace std;
const int Mod=1e9+7;
long long n;
int ksm(long long x,long long y) {
        int b=y,ans=1;
        while (x>0) {
                if (x&1) ans=(ans*b)%Mod;
                b=(b*b)%Mod;
                x>>=1;
        }
        return ans;
}
signed main()
{
        scanf("%lld",&n);
        cout<<((((((ksm(n,10)%Mod+Mod)%Mod)-((ksm(n,9)*2%Mod+Mod)%Mod)+Mod)%Mod)+((ksm(n,8)%Mod+Mod)%Mod))+Mod)%Mod<<"\n";
        return 0;
}


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

const ll mod = 1000000007;
const double eps = 1e-8;

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

bool check(ll N, ll K) {
    while (N % K == 0) N /= K;
    N %= K;
    return N == 1;
}

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

    ll ans = 0;

    // 最初割り切れない場合
    vector<ll> d1;
    for (ll i=1; i*i<=N-1; ++i) {
        if ((N-1) % i == 0) {
            if (i != 1) d1.push_back(i);
            if (i * i != N-1) d1.push_back(N / i);
        }
    }
    ans += d1.size();

    // 最初割り切れる場合
    vector<ll> d2;
    for (ll i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            if (i != 1) d2.push_back(i);
            if (i * i != N) d2.push_back(N / i);
        }
    }
    for (ll k: d2) {
        if (check(N, k)) ans ++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
int main(void){
   int W,H,x,y,r;
   scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
   if((0 + r <= x && x <= W - r) && (0+r <= y && y <= H-r)) printf("Yes\n");
   else printf("No\n");
   return 0; 
}



Measured memory_bytes: 2108
#coding:utf-8
N = int(input())
preList = list(input().split())
inList = list(input().split())

def recon(l,r):
    if l >= r:
        return
    global pos
    c = preList[pos]
    index = inList.index(c)
    pos += 1
    recon(l,index)
    recon(index+1,r)
    
    global answer
    answer.append(c)

answer = []
pos = 0
recon(0,N)

answer = " ".join(answer)
print(answer)



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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;
const ll MOD=1e9+7;

const int MAX = 1000000;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
    ll x,y;
    cin>>x>>y;
    if ((2*y-x)%3!=0){
        cout<<0<<endl;
        return 0;
    }
    ll num1=(2*x-y)/3,num2=(2*y-x)/3;
    COMinit();
    cout<<COM(num1+num2,num1)<<endl;
    

    return 0;
}


Measured memory_bytes: 23680
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int w,h;

void to_valid(int &a, int limit) {
  if(a <= 0) a = 1;
  if(a > limit) a = limit;
}

void update(int &x, int &y, int vec, int amount) {
  x += dx[vec] * amount;
  y += dy[vec] * amount;
  to_valid(x, w);
  to_valid(y, h);
}

int main(){
  while(cin >> w >> h && !(w == 0 && h == 0)){
	string str;
	int cx = 1,cy = 1;
	int vec = 0;
	while(cin >> str && str != "STOP"){
	  if(str == "FORWARD"){
		int k;
		cin >> k;
		update(cx, cy, vec, k);
	  }else if(str == "RIGHT"){
		vec = (vec + 1) % 4;
	  }
	  else if(str == "LEFT"){
		vec = (vec + 3) % 4;
	  }else if(str == "BACKWARD"){
		int k;
		cin >> k;
		update(cx, cy, vec ^ 2, k);
	  }else {
		assert(false);
	  }
	}
	cout << cx << " " << cy << endl;
  }
  return 0;
}

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

const int INF=1e9;

vector<int> dp(100100,INF);

int main(){
    int N; cin >> N;
    int h[N];
    for(int i=0;i<N;i++){
        cin >> h[i];
    }
    dp[0]=0;
    for(int i=0;i<N-1;i++){
        dp[i+1]=min(dp[i+1],dp[i]+abs(h[i+1]-h[i]));
        dp[i+2]=min(dp[i+2],dp[i]+abs(h[i+2]-h[i]));
    }
    cout << dp[N-1] << endl;
}

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

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        String S;
        S = sc.next();
        String T;
        T = sc.next();

        final Solver solver = new Solver();
        solver.solve(S, T);
    }
}

class Solver {
    public void solve(String S, String T) {
        System.out.println(T + S);
    }
}



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

#define MAX_N 5000
vector<int> win[MAX_N + 1];
bool pr[MAX_N + 1];
int n, m;
int rank[MAX_N], depth;

void output(int i){
	pr[i] = true;
	if(!win[i].empty()){
		for(int j = 0; j < win[i].size(); j++){
			if(!pr[win[i][j]]) output(win[i][j]);
		}
	}
	
	printf("%d\n", i);
	rank[depth] = i; depth++;
}

int main(){
	int a, b;
	
	for(int i = 1; i <= MAX_N; i++) pr[i] = false;
	
	scanf("%d", &n);
	scanf("%d", &m);
	for(int i = 0; i < m; i++){
		scanf("%d%d", &a, &b);
		win[b].push_back(a);
	}
	
	depth = 0;
	for(int i = 1; i <= n; i++){
		if(!pr[i]) output(i);
	}
	
	for(int i = 0; i < n - 1; i++){
		if(!win[rank[i + 1]].empty()){
			for(int j = 0; j < win[rank[i + 1]].size(); j++){
				if(win[rank[i + 1]][j] == rank[i]) break;
				if(j + 1 == win[rank[i + 1]].size()){
					printf("1\n");
					return 0;
				}
			}
		}
	}
	printf("0\n");
	
	return 0;
}

Measured memory_bytes: 1776
#include <stdio.h>

int main(){
    int i,N,max,min;
    int a;

    max = 0;
    min = 1000;
  
    scanf( "%d", &N );
    
    for( i = 0; i < N; i++){
        scanf( "%d", &a );
    
        if( a > max){
            max = a;
        }
        if( a < min ){
            min = a;
        }
    }
    
    printf("%d\n",max-min);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int n,a[100005],x,y;
int main()
{
    cin>>n;
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
        x=max (x,a[i]);
    }
    x++;
    for (int i=1;i<n;i++)
    {
        if (a[i]==a[i-1])
        {
            a[i]=x;
            y++;
            x++;
        }
    }
    cout<<y;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>
#include <set>
#include <cmath>
#include <sstream>
#include <numeric>
#include <set>

using namespace std;

int main()
{
    int n;
    int t, a;
    std::vector<double> heights;
    std::cin >> n;
    std::cin >> t >> a;

    for(int i = 0; i < n; i++)
    {
        int h;
        std::cin >> h;
        heights.push_back(h);
    }

    std::vector<double> temperature;

    for(auto& h : heights)
    {
        double temp = t - h * 0.006;
        temperature.push_back(temp);
    }

    std::vector<double> diff;
    for(auto& temp : temperature)
    {
        double d = std::abs(a - temp);
        diff.push_back(d);
    }
    int ans = std::min_element(diff.begin(), diff.end()) - diff.begin();

    std::cout << ans + 1;
    return EXIT_SUCCESS;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (s == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << 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;

void solve() {
    string s;
    cin >> s;
    int i = 0, j = s.size() - 1, ans = 0;
    while (j - i > 0) {
        if (s[i] == s[j]) {
            i++;
            j--;
            continue;
        }
        if (s[i] == 'x') {
            i++;
            ans++;
            continue;
        }
        if (s[j] == 'x') {
            j--;
            ans++;
            continue;
        }
        ans = -1;
        break;
    }
    cout << ans << endl;
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 512
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	ans := float64(0.0)
	for i := 1; i <= n; i++ {
		if i >= k {
			ans += 1.0 / float64(n)
		} else {
			x := math.Ceil(math.Log2(float64(k) / float64(i)))
			ans += (1.0 / float64(n)) * math.Pow(0.5, x)
		}
	}
	fmt.Printf("%.10f\n", ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  vector<queue<int>> S(n);
  while (q--) {
    int op, t;
    cin >> op >> t;
    if (op == 0) {
      int x;
      cin >> x;
      S[t].push(x);
    } else if (op == 1) {
      if (S[t].size()) cout << S[t].front() << endl;
    } else if (op == 2) {
      if (S[t].size()) S[t].pop();
    }
  }

  return 0;
}


Measured memory_bytes: 4332
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        
        long[] a = new long[n+1];
        long[] b = new long[m+1];
        for(int i=0; i<n; i++){
            a[i+1] = Long.parseLong(sc.next());
        }
        for(int i=0; i<a.length-1; i++){
            a[i+1] += a[i];
        }
        for(int i=0; i<m; i++){
            b[i+1] = Long.parseLong(sc.next());
        }
        for(int i=0; i<b.length-1; i++){
            b[i+1] += b[i];
            //System.out.println(b[i+1]);
        }
        
        int max = 0;
        for(int i=0; i<a.length; i++){
            int ub = m+1;
            int lb = 0;
            long l = k - a[i];
            //System.out.println(a[i]);
            if(l<0){
                break;
            }
            for(int j=0; j<100; j++){
                int mid = (ub+lb)/2;
                if(b[mid]<=l){
                    lb = mid;
                }else{
                    ub = mid;
                }
            }
            int tmp = i+lb;
            //System.out.println(lb);
            //System.out.println("  "  + i);
            //System.out.println("  "  + l);
            //System.out.println("  "  + b[lb]);
            max = Math.max(max, tmp);
        }
        
        System.out.println(max);
        
    }
    
}


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

int main(){
	int n,l;cin>>n>>l;
	int m=500,s=0,a;
	for(int i=1;i<=n;++i){
		int f=l+i-1;
		s+=f;
		if(abs(f)<m)m=abs(f),a=f;
	}
	printf("%d",s-a);
	return 0;
}


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

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

const long long INF = 1LL << 60;

int main(){
    int64_t A,B,C,K;
    cin >> A >> B >> C >> K;
    int64_t ansX = (K <= A ? K : A) + ((K - A) <= B ? 0 : -1 * (K - A - B));
    cout << ansX << endl;
}

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

const long long MOD = 1000000007;

void solve(long long N, long long M, std::vector<long long> a) {
    vector<long long> dp(N + 1);
    set<long long> set;
    for (long long i = 0; i < M; i++) {
        set.insert(a[i]);
    }

    dp[0] = 1;
    for (long long i = 1; i <= N; i++) {
        if (set.find(i) != set.end()) {
            continue;
        }
        if (i == 1) {
            dp[i] = (dp[i - 1]) % MOD;
        } else {
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
        }
    }
    cout << dp[N] % MOD << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can
// remove this line by using your custom template)
int main() {
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> a(M);
    for (int i = 0; i < M; i++) {
        scanf("%lld", &a[i]);
    }
    solve(N, M, std::move(a));
    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926

typedef long long int ll;

//ll chk[55];
//ll num[55];
//ll num2[55];
//ll num[ten5];
//ll num2[ten5];
//char cmap[10][10];
//priority_queue<long long int> pq;   //big at front
//stack<int> stk;
//vector<pair<ll,ll>> vint;
//vector<ll> vtime;
//deque<ll> deq[55];
//list<int> li;
//set<int> sint;
//set<ll> sll;
//map<ll,ll> mp;


int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,n1=0,n2=0,n3,range;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=1;
    long long int a,a1,a2,a3,a4,a5,a6;
    a=a1=a2=a3=a4=a5=a6=0;
    //float f,g,h;
    //string s,s1;
    //char now,pre,c;
    cin>>n>>m;
    a1=a2=m;
    for(i=1;i<n;i++)
    {
        cin>>m;
        a1=max(a1,m);
        a2=min(a2,m);
    }
    cout<<a1-a2;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007

using namespace std;


int main(void){
	int n,m;
	cin>>n>>m;
	pair<ll,int> s[n];
	rep(i,n)cin>>s[i].first>>s[i].second;
	sort(s,s+n);
	ll ans=0,cnt=0;
	rep(i,n){
		if(cnt+s[i].second > m){
			ans+=(m-cnt)*s[i].first;
			break;
		}
		ans+=s[i].second*s[i].first;
		cnt+=s[i].second;
	}
	cout<<ans<<endl;
	return 0;

}


Measured memory_bytes: 1792
import java.util.*;

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

    int N = sc.nextInt();

    long power = 1L;
    for(int i = 1 ; i <= N ;  i ++){
      power = (power * i) % 1000000007 ;
    }

    System.out.println(power);

  }
}


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

using namespace std;

int main() {
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  if ((b - a) % 2) {
    puts("Borys");
  } else {
    puts("Alice");
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
typedef pair<int,int> pi;
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
const int maxn = 210;

int n;
int ans[maxn];

int query(int x) {
	cout << "?";
	for (int i =x;i<x+n;i++) {
		cout << " " << i;
	}
	cout << "\n"; cout.flush();
	string res; cin >> res;
	if (res == "Red") return 1;
	else return 0;
}

int test(vector <int> v, int x) {
	cout << "?";
	for (auto i: v) {
		cout << " " << i;
	}
	cout << " " << x << "\n"; cout.flush();
	string res; cin >> res;
	if (res == "Red") return 1;
	else return 0;
}

int32_t main() {
	cin >> n;
	
	int prev = query(1);
	int high = 1 + n;
	int low = 1;
	
	while (high - low > 1) {
		int mid = (high + low) / 2;
		int res = query(mid); 
		if (res == prev) low = mid;
		else high = mid;
	}
	
	ans[low] = prev;
	ans[low + n] = !prev;
	
	vector <int> v1,v2;
	for (int i = low+1; i < low + n; i++) {
		v1.push_back(i);
	}
	
	for (int i = 1; i <= low-1;i++) {
		ans[i] = test(v1,i);
		v2.push_back(i);
	}
	
	for (int i = low + n + 1; i <= n*2; i++) {
		ans[i] = test(v1, i);
		v2.push_back(i);
	}
	
	for (int i = low+1; i < low + n;i++) {
		ans[i] = test(v2,i);
	}
	cout << "! ";
	for (int i =1;i<=2*n;i++) {
		if (ans[i]) cout << "R";
		else cout << "B";
	}
  cout.flush();
}





Measured memory_bytes: 724
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INF = (1 << 21);
static const int BLACK = 2;
static const int WHITE = 0;
static const int GLAY = 1;

int n, M[MAX][MAX];

int prim(){
	int d[MAX], p[MAX], color[MAX];
	for (int i = 0; i < n; i++){
		d[i] = INF;
		p[i] = -1;
		color[i] = WHITE;
	}
	d[0] = 0;
	while (1){
		int u = -1;
		int minv = INF;
		for (int v = 0; v < n; v++){
			if (minv > d[v] && color[v] != BLACK){
				minv = d[v];
				u = v;
			}
		}
		if (u == -1)break;
		color[u] = BLACK;
		for (int v = 0; v < n; v++){
			if (color[v] != BLACK && M[u][v] != INF){
				if (d[v] > M[u][v]){
					d[v] = M[u][v];
					p[v] = u;
					color[v] = GLAY;
				}
			}
		}
	}
	int sum = 0;
	for (int i = 0; i < n; i++){
		if (p[i] != -1)sum += M[i][p[i]];
	}
	return sum;
}

int main(){
	cin >> n;
	int e;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			cin >> e;
			M[i][j] = (e == -1) ? INF : e;
		}
	}
	cout << prim() << endl;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k, a, b;
	cin >> k >> a >> b;
	if(a + 2 >= b){
		cout << k + 1 << endl;
		return 0;
	}
	k -= a - 1;
	int ans = (k / 2) * b - (k / 2 - 1) * a + (k % 2);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
using namespace std;
int main()
{
	int n,a[100010];
	while(~scanf("%d",&n))
	{
		long long b;
		if(n==1)
		{
			scanf("%lld",&b);
			if(b==1)
			{
				printf("0\n");
			}
			else
			{
				printf("1\n");
			}
			continue;
		}
		memset(a,0,sizeof(a));
		int sum=0;
		for(int i=0;i<n;i++)
		{
			scanf("%lld",&b);
			if(b>100000)
			{
				sum++;
			}
			else
			{
				a[b]++;
			}
		}
		for(int i=0;i<=100000;i++)
		{
			if(a[i]>i)
			{
				sum+=a[i]-i;
			}
			else if(a[i]<i)
			{
				sum+=a[i];
			}
		}
		printf("%d\n",sum);
	}
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	long long int ans = 1;
	cin >> n;
	for(int i = 1; i <= n; i++ ) {
		ans *= i;
		ans %= 1000000007;
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    map<string, int> mp;
    rep(i, N) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }

    ll ans = 0;
    for(auto& p: mp) {
        int i = p.second;
        ans += (ll)i*(i-1)/2;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11136
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
            }
            long ans = 0;
            for (int i = 0; i < n; i++) {
                if (a[i] == 0) continue;
                ans += a[i] / 2;
                a[i] %= 2;
                if (a[i] == 1) {
                    if (i + 1 < n && a[i + 1] != 0) {
                        a[i]--;
                        a[i + 1]--;
                        ans++;
                    }
                }
            }
            out.println(ans);
        }

    }
}



Measured memory_bytes: 57764
#include <stdio.h>

int main(void)
{
  long long n, a, b;
  long long count = 0;

  scanf("%lld %lld %lld", &n ,&a, &b);

  count += (n / (a + b)) * a;
  n =  n % (a + b);

  if (n > a) {
    count += a;
  } else count += n;

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

  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Map<Integer, Integer> fact = new HashMap<>();
		for(int i = 2; i <= N; i++)
			fact.put(i, 0);
		for(int i = 2; i <= N; i++) {
			int x = i;
			for(int j = 2; j <= Math.sqrt(i); j++) {
				if(x % j == 0) {
					int n = 0;
					while(x % j == 0) {
						x /= j;
						n++;
					}
					fact.put(j, fact.get(j)+n);
				}
			}
			if(x > 1)
				fact.put(x, fact.get(x)+1);
		}
		int sf = 0, tf = 0, ft = 0, f = 0, t = 0;
		for(int i : fact.values()) {
			if(i >= 74)
				sf++;
			if(i >= 24)
				tf++;
			if(i >= 14)
				ft++;
			if(i >= 4)
				f++;
			if(i >= 2)
				t++;
		}
		System.out.println(sf+tf*(t-1)+ft*(f-1)+f*(f-1)/2*(t-2));
	}

}

Measured memory_bytes: 25044
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(c>a && c<b)
    {
        printf("\n");
        printf("Yes");


    }
    else if (c<a || c>b )
    {
        printf("\n");
        printf("No");
    }
    else if (a=b=c)
    {
        printf("\n");
        printf("Yes");

    }












    return 0;
}

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

int main() {
  long long int n,q,l,r;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<long long int> counts;
  long long int count = 0;
  counts.push_back(count);
  for (long long int i=1; i<n; i++) {
    if (s[i]=='C' && s[i-1]=='A') count++;
    counts.push_back(count);
  }
  for (long long int i=0; i<q; i++) {
    cin >> l >> r;
    cout << counts[r-1]-counts[l-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1908
n,m=map(int,input().split())
d=dict()
c=0
p=0
for _ in range(m):
    a,b=map(str,input().split())
    if a not in d:
        if b=="WA":
            d[a]=["WA",1]
        else:
            c+=1
            d[a]=["AC",1]
    else:
        if b=="WA":
            if d[a][0]=="AC":
                continue
            else:
                d[a][1]+=1
        else:
            #print(d[a][0])
            if d[a][0]=="AC":
                continue
            c+=1
            #print(d[a][1])
            d[a][0]="AC"
            p+=d[a][1]
#print(d)
print(c,p)


Measured memory_bytes: 25288
using System;

class Solver {
  public void solve() {
    int n = int.Parse(Console.ReadLine());
    int pt = 0, px = 0, py = 0;
    for (int i = 0; i < n; i++) {
      var buf = Console.ReadLine().Split();
      int t = int.Parse(buf[0]);
      int x = int.Parse(buf[1]);
      int y = int.Parse(buf[2]);
      int dt = t - pt;
      int dx = x - px;
      int dy = y - py;
      int dist = Math.Abs(dx) + Math.Abs(dy);
      if (dist > dt) {
        Console.WriteLine("No");
        return;
      }
      if (dist%2 != dt%2) {
        Console.WriteLine("No");
        return;
      }
      pt = t; px = x; py = y;
    }
    Console.WriteLine("Yes");
  }
}

/* Main */
class ReSha {
  static void Main() {
    new Solver().solve();
  }
}

Measured memory_bytes: 15164
int main(void){
  int n,k,a;
  
  scanf("%d %d",&n,&k);
  
  int i,c=0;
  
  for(i=0; i<n; i++){
    scanf("%d",&a);
    if(a >= k)
      c ++;
  }
  
  printf("%d",c);
}

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

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<int> count(N);
  for (int i = 0; i < M; ++i){
    int a, b;
    cin >> a >> b;
    --a; --b;
    ++count[a]; ++count[b];
  }
  bool ans = all_of(begin(count), end(count), [](int n) { return n % 2 == 0; });
  cout << (ans ? "YES" : "NO") << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 10e9
#define INFL 10e18;
#define mod 1000000007
//#define mod 998244353
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modinv(ll a){
	return powm(a,mod-2)%mod;
}

int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s,t;
    cin>>s>>t;
    int i,flag=1;
    for(i=0;i<s.length();i++)
    {
    	if(s[i]!=t[i])
    	{
    		flag=0;
    		break;
		}
	}
	if(flag)
	cout<<"Yes";
	else
	cout<<"No";

}

Measured memory_bytes: 3640
#!usr/bin/env python3

import sys


def main():
    m, n = [int(col_row) for col_row in sys.stdin.readline().split()]
    matrix = [[0 for col in range(n)] for row in range(m)]
    vector = [0 for row in range(n)]

    for row in range(m):
        lst = [int(element) for element in sys.stdin.readline().split()]
        for col in range(n):
            matrix[row][col] += lst[col]

    for row in range(n):
        lst = [int(element) for element in sys.stdin.readline().split()]
        vector[row] += lst[0]

    for row in range(m):
        sum_of_row = 0
        for col in range(n):
            sum_of_row += matrix[row][col] * vector[col]
        print(sum_of_row)


if __name__ == '__main__':
    main()

Measured memory_bytes: 8024
import java.util.Scanner; 
class Main { 
public static void main(String args[]) { 
int one=0;
int two=0;
int three=0;
Scanner sc = new Scanner(System.in); 
for(int i=0;i<=9;i++){
int n=sc.nextInt();
if(n>one){
three=two;
two=one;
one=n;
}else if (n>two){
three = two;
two = n;
}
else if(n>three){
three = n;
}
}
System.out.println(one);
System.out.println(two);
System.out.println(three);
 } }


Measured memory_bytes: 26192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int H,W;
char S[25][25];
/*------------------------------------/
for library*/
bool IsIn(int x,int y){
    return 0<=x&&x<H&&0<=y&&y<W;
}
/*------------------------------------*/
int d[25][25][25][25];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    
    cin>>H>>W;
    rep(i,H)rep(j,W){
        cin>>S[i][j];
    }
    int ans = 0;
    rep(sx,H)rep(sy,W)rep(i,H)rep(j,W){
        d[sx][sy][i][j] = -1;
        if(S[sx][sy] == '#')continue;
        if(sx == i && sy == j)d[sx][sy][i][j] = 0;
    }
    rep(sx,H)rep(sy,W){
        if(S[sx][sy] == '#')continue;
        queue<pair<int,int>> q;
        q.push({sx,sy});
        while(!q.empty()){
            int x = q.front().first;
            int y = q.front().second;
            q.pop();
            rep(i,4){
                int nx = x + dx[i];
                int ny = y + dy[i];
                if(!IsIn(nx,ny))continue;
                if(d[sx][sy][nx][ny] != -1)continue;
                if(S[nx][ny] == '#')continue;
                d[sx][sy][nx][ny] = d[sx][sy][x][y]+1;
                q.push({nx,ny});
            }
        }
    }
    rep(sx,H)rep(sy,W)rep(i,H)rep(j,W){
        chmax(ans, d[sx][sy][i][j]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1280