akhauriyash/Code-Regression huggingface dataset:
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.bitmanip;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto ai = readln.split.to!(int[]);
  auto q = readln.chomp.to!size_t;
  auto mi = readln.split.to!(int[]);

  auto ri = new bool[](q);

  foreach (i; 0..1 << n) {
    auto s = ai.indexed(i.bitsSet).sum;
    foreach (j, m; mi)
      if (s == m) ri[j] = true;
  }

  foreach (r; ri)
    writeln(r ? "yes" : "no");
}

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

int n;
cin>>n;
string s;
int ac=0,wa=0,tle=0,re=0;
for(int i=1;i<=n;i++)
{
    cin>>s;
    if(s=="AC")ac++;
    else if(s=="WA")wa++;
    else if(s=="TLE")tle++;
    else if(s=="RE")re++;
}
cout<<"AC"<<" "<<"x"<<" "<<ac<<endl;
cout<<"WA"<<" "<<"x"<<" "<<wa<<endl;
cout<<"TLE"<<" "<<"x"<<" "<<tle<<endl;
cout<<"RE"<<" "<<"x"<<" "<<re<<endl;

return 0;
}


Measured memory_bytes: 3656
# coding: utf-8

n = int(input())

i = 1
ans = ""
while i <= n:
    x = i
    if x % 3 == 0:
        ans += (" " + str(i))
    else:
        while x:
            if x % 10 == 3:
                ans += (" " + str(i))
                break
            else:
                x = x // 10
    i += 1
print(ans)


Measured memory_bytes: 5632
#include <iostream>
#include <vector>
#include <set>
#include <utility>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;

int main() {
  int n;
  cin >> n;
  int v = n;
  set<int> s{n};
  for(int i = 2; 1; i++) {
    if(v % 2 == 0) {
      v = v / 2;
    } else {
      v = 3 * v + 1;
    }
    auto r = s.insert(v);
    if(r.second == false) {
      cout << i;
      return 0;
    }
  }
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()

for i in range(1, 1001):
  if i*8//100 == A and i//10 == B:
    print(i)
    exit()
    
print(-1)

Measured memory_bytes: 5444
// 解き方はわかったが
// modをごにょるところがわからん

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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll N;
vector<ll> A;

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


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll 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 { 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 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint factrial(int n) {
  if (n == 0) return 1;
  mint x = factrial(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i, a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // Globalなvectorのリサイズ
  //A.resize(N);

  ll n, a, b;
  cin >> n >> a >> b;
  mint ans = factrial(n)-1;
  ans -= choose(n, a);
  ans -= choose(n, b);
  //cout << ans.x << endl;
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_map>

//#include"GraphAlgorithm.hpp"
//#include"DataStructure.hpp"
//using namespace graph_algorithm;
//using namespace data_structure;

using namespace std;

const double pi=4*atan(1.0);

int mod=1000000007;

pair<int,int> get_height(int root,const vector<vector<pair<int,int>>>& WeightEdges){
	if(WeightEdges.empty() || root<0 || WeightEdges.size()-1<root)return make_pair(-1,-1);

	pair<int,int> ans=make_pair(0,0);
	vector<bool> IsVisit(WeightEdges.size(),false);
	queue<pair<int,int>> Q;
	Q.push(make_pair(root,0));
	IsVisit[root]=true;

	while(!Q.empty()){
		auto now=Q.front();
		Q.pop();

		bool is_leaf=true;
		for(const auto& val:WeightEdges[now.first]){
			if(!IsVisit[val.first]){
				IsVisit[val.first]=true;
				is_leaf=false;
				Q.push(make_pair(val.first,now.second+val.second));
			}
		}

		if(is_leaf){
			if(now.second>ans.second){
				ans=now;
			}
		}
	}

	return ans;
}

int main() {
	int n;
	cin>>n;
	vector<vector<pair<int,int>>> Edges(n);
	for(int i=0;i<n-1;++i){
		int u,v,w;
		cin>>u>>v>>w;
		Edges[u].push_back(make_pair(v,w));
		Edges[v].push_back(make_pair(u,w));
	}

	auto farthest=get_height(0,Edges);
	farthest=get_height(farthest.first,Edges);

	cout<<farthest.second<<endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 9416
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		 Scanner sc = new Scanner(System.in);
		 
		 int a = sc.nextInt();
		 int b = sc.nextInt();
		 int c = sc.nextInt();
		 if(a<b && b<c){
			 System.out.println("Yes");
		
		 }else{
			 System.out.println("No");
		 }
		 
		 
		 
		 
	}
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> ans(n);
  for (int i = 0; i < n - 1; i++)
  {
    int a;
    cin >> a;
    ans[a - 1]++;
  }
  for (int x : ans)
  {
    cout << x << endl;
  }

  return 0;
}


Measured memory_bytes: 4044
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

int n,k,d,now;
int vis[1000];

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>n>>k;
  int ans  = 0;
  for(int i = 1;i <= k;i++){
    cin>>d;
    for(int j = 1;j <= d;j++){
      cin>>now;
      vis[now] = 1;
    }
  }
  for(int i = 1;i <= n;i++) if(!vis[i]) ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
long long N;
long long ans;
cin>>N;
ans=(N-1)*N/2;
cout<<ans<<"\n";
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int a[10];;
	int k;

	for(int i=0;i<5;i++)
		cin >> a[i];
	
	cin >> k;

	for(int i=0;i<5;i++)
	{
		for(int j=0;j<5;j++)
		{
			if(a[i]-a[j]>k)
			{
				cout << ":(" << endl;
				return 0;
			}
		}
	}
	cout << "Yay!" << endl;
	return 0;
}



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

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2*N-1], dneg[2*N-1];

bool X[N][N];

void initialize(){
    for(int i = 0;i<N;i++){row[i] = FREE, col[i] = FREE; }
    for(int i = 0;i<2*N-1;i++){dpos[i] = FREE, dneg[i] = FREE; }
}

void printBoard(){
    for(int i = 0;i<N;i++){
        for(int j = 0;j<N;j++){\
        if(X[i][j]){
            if(row[i] != j) return;
        }
    }
}
for(int i = 0;i<N;i++){
    for(int j = 0;j<N;j++){
        cout << ( (row[i] == j)? "Q" : ".");
    }
    cout << endl;
  }
}

void recursive(int i){
    if(i == N){
        printBoard(); return;
}

for(int j = 0;j<N;j++){
    if(NOT_FREE == col[j] || NOT_FREE == dpos[i+j] || NOT_FREE == dneg[i-j+N-1]) continue;
    row[i] = j; col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    recursive(i+1);
    row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}

int main(){
    initialize();
    
    for(int i = 0;i<N;i++)
    for(int j = 0;j<N;j++) X[i][j] = false;
    
    int k; cin >> k;
    for(int i = 0;i<k;i++){
        int r, c; cin >> r >> c;
        X[r][c] = true;
    }
    
    recursive(0);
    
    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>
#include <queue>
#include <regex>
#include <cassert>
#include <map>
// #include "bits/stdc++.h"

using namespace std;
//debug

#define rep(i, N, M) for (ll i = N; i < M; ++i)
#define rrep(i, N, M) for (ll i = N; i > M; --i)
#define pb push_back


typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;

typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef priority_queue<ll> pqll;
typedef priority_queue<pll, vector<pll>> pqpll;
typedef priority_queue<ll, vll, greater<ll>> pqll_greater;
typedef priority_queue<pll, vector<pll>, greater<pll>> pqpll_greater;


#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vec(a) vector<a>
#define _CRT_SECURE_NO_WARNINGS

template<class T, class S>
T atbit(T n, S i) {
	return (n >> i) % i;
}

template<class T>
T getbit(T i) {
	return 1LL << i;
}
template<class T>
T POW(T n, T m) {
	T res = 1;
	rep(i, 0, m) {
		res *= n;
	}
	return res;
}

ll power(ll x, ll y, ll mod) {
	if (y == 0)return 1;
	if (y == 1)return x % mod;
	if (y == 1)return x % mod;
	if (y % 2 == 0)return POW(power(x, y / 2, mod), 2LL) % mod;
	return ((POW(power(x, y / 2, mod), 2LL) % mod)*(x%mod)) % mod;
}
ll div(ll a, ll  b, ll mod) {
	return (a* power(b, mod - 2, mod)) % mod;
}

template<
	typename Inputs,
	typename Functor,
	typename T = typename Inputs::value_type>
	void sort_by(Inputs& inputs, Functor f) {
	std::sort(std::begin(inputs), std::end(inputs),
		[&f](const T& lhs, const T& rhs) { return f(lhs) < f(rhs); });
}

//#define TRANSFORM(v,w,func) decltype(v) w ; transform((v).begin(),(v).end(),back_inserter(w),func);

using namespace std;

ll MOD_NUM = POW(10LL, 9LL) + 7;




int main() {
	ll N;
	cin >> N;
	if (N == 1) {
		cout << "Hello World";
	}
	else {
		ll A, B;
		cin >> A >> B;
		cout << A + B;
	}
	return 0;





}


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (a > 0 && c > 0){
        c -= b;
        if (c <= 0){
            cout << "Yes" << endl;
            break;
        }
        
        a -= d;
        if (a <= 0){
            cout << "No" << endl;
            break;
        } 
    }

    return 0;
}

Measured memory_bytes: 3636
As = input()
Bs = input()

lenA, lenB = len(As), len(Bs)
if lenA > lenB:
    print('GREATER')
elif lenA < lenB:
    print('LESS')
else:
    for A, B in zip(As, Bs):
        A, B = int(A), int(B)
        if A > B:
            print('GREATER')
            break
        elif A < B:
            print('LESS')
            break
    else:
        print('EQUAL')


Measured memory_bytes: 3060
import math

"""
A = []
min_1 = 9
min_index = 0
for i in range(5):
    a = int(input())
    A.append(a)
    if (a%10 == 0):
        continue
    if (a%10 <= min_1):
        min_1 = a%10
        min_index = i

t = A.pop(min_index)
for a in A:
    if a%10 == 0:
        t += a
    else:
        t += ((a//10)+1)*10
print(t)
"""
def ten(a):
    return (a+9) // 10 * 10
def ichi(a):
    return ten(a) - a

A = []
for i in range(5):
    a = int(input())
    A.append(a)
B = [ten(a) for a in A]
C = [ichi(a) for a in A]
print(sum(B) - max(C))



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

const int MAX = 510000;
const int MOD = 1000000007;

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() {
    // 前処理
    COMinit();

    long long n,k;cin>>n>>k;
	for(int i=1;i<=k;++i){
		if(n-k>=i-1){
			cout<<COM(n-k+1,i)%MOD*COM(k-1,k-i)%MOD<<endl;
		}
		else cout<<0<<endl;
	}
}

Measured memory_bytes: 12160
import sys
input = sys.stdin.readline
N = int(input())
S = list(input())
dp = [[0,0] for _ in range(N)]
cnt = 0
ans = []
for i in range(1,N):
    if S[i] == "E":
        cnt += 1
dp[0][1] = cnt
ans.append(sum(dp[0]))
for j in range(1,N):
    if S[j-1] == "W":
        dp[j][0] = dp[j-1][0] + 1
    else:
        dp[j][0] = dp[j-1][0]
    if S[j] == "E":
        dp[j][1] = dp[j-1][1] - 1
    else:
        dp[j][1] = dp[j-1][1]
    ans.append(sum(dp[j]))
print(min(ans))

Measured memory_bytes: 111312
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
L=[list(map(int,input().split())) for i in range(N)]
dp = [[0] * 3 for _ in range(N+1)]
dp[0]=L[0]
for i in range(1,N):
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            dp[i][k]=(max(dp[i][k],dp[i-1][j]+L[i][k]))
print(max(dp[N-1]))

Measured memory_bytes: 49700
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

#include <bits/stdc++.h>
using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<Pl>;
using vvp = vector<vp>;

const int INF = 1<<29;
const long long LINF=1LL<<59;


void solve(long long N, std::vector<long long> a, std::vector<long long> b){
  vvl g(N);
  vl deg(N);
  rep(i,N-1){
    a[i]--; b[i]--;
    g[a[i]].pb(b[i]);
    g[b[i]].pb(a[i]);
    deg[a[i]]++; deg[b[i]]++;
  }
  ll ma = 0;
  ll arg = -1;
  rep(i,N) if(chmax(ma,deg[i])) arg = i;
  cout << ma << endl;
  map<Pl, ll> color;
  function<void(ll,ll,ll)> dfs = [&](ll u, ll p, ll c){
    ll now = 0;
    if(now==c) now++;
    for(auto v:g[u]){
      if(v==p) continue;
      color[{min(u,v),max(u,v)}] = now;
      dfs(v,u,now);
      now++;
      if(now==c) now++;
    }
  };
  dfs(0LL,-1LL,-1LL);
  rep(i,N-1){
    cout << color[{min(a[i],b[i]),max(a[i],b[i])}]+1 << endl;
  }
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  long long N;
  scanf("%lld",&N);
  std::vector<long long> a(N-1);
  std::vector<long long> b(N-1);
  for(int i = 0 ; i < N-1 ; i++){
    scanf("%lld",&a[i]);
    scanf("%lld",&b[i]);
  }
  solve(N, std::move(a), std::move(b));
  return 0;
}


Measured memory_bytes: 18560
import java.awt.geom.*;
import java.util.*;

import static java.lang.Math.*;
public class Main {
	final Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	Main(){
		new AOJ1212();
	}
	
	class AOJ1212{
		AOJ1212(){
			while(true){
				N=sc.nextInt();
				if(N<0)	break;
				solve();
			}
		}
		int N;
		final double EPS=1.0e-4;
		void solve(){
			Line2D[] mirrors = new Line2D[N];
			for(int i=0; i<N; ++i){
				String d = sc.next();
				int x=sc.nextInt(), y=sc.nextInt();
				mirrors[i]=new Line2D.Double(x, y, x+(d.equals("x")? 1: 0), y+(d.equals("y")? 1: 0));
			}
			Line2D[] walls = new Line2D[4];
			walls[0]=new Line2D.Double(0,0,8,0);
			walls[1]=new Line2D.Double(8,0,8,8);
			walls[2]=new Line2D.Double(8,8,0,8);
			walls[3]=new Line2D.Double(0,8,0,0);
			
			Point2D start = new Point2D.Double(0.75,0.25),
					ans=start;
			Line2D l=new Line2D.Double(0.75, 0.25, 0.75+100, 0.25+100);
			
			Point2D[] vv= {new Point2D.Double(100,100), new Point2D.Double(-100,100),
						new Point2D.Double(100,-100), new Point2D.Double(-100,-100)};
			
			int cnt=0,v=0;
			boolean fin=false;
			while(!fin){
				
				boolean bs = cnt>0 && l.ptSegDist(start)<EPS;
				++cnt;
				
				double dis = 100;
				Point2D p=null;
				int idx=-1;
				for(int i=0; i<N; ++i){
					if(l.intersectsLine(mirrors[i])){
						Point2D b = intersectionPoint(l, mirrors[i]);
						double a = b.distance(l.getP1());
						if(a < dis && a>EPS){
							dis = a;
							p=b;
							idx=i;
						}
					}
				}
				
//				System.out.println("P:"+p+" L:"+l.getP1()+","+l.getP2());
				
				if(p==null){
					if(bs)	break;
					for(int i=0; i<4; ++i){
						if(l.intersectsLine(walls[i])){
							Point2D tmp = intersectionPoint(l, walls[i]);
							if(tmp.distance(l.getP1()) > EPS){
								ans=tmp;
								fin=true;
								break;
							}
						}
					}
				}else{
					if(bs){
						double tmp = start.distance(l.getP1());
						if(tmp < dis)	break;
					}
					
					if(mirrors[idx].getX1()==mirrors[idx].getX2()){
						v = v^1;
					}else{
						v = v^2;
					}
					double px = p.getX()*100+EPS, py = p.getY()*100+EPS;
					p = new Point2D.Double((int)px/100.0, (int)py/100.0);
					l=new Line2D.Double(p, sum(p, vv[v]));
					
				}
			}
			
			System.out.println((int)(ans.getX()*100+EPS) +" "+ (int)(ans.getY()*100+EPS));
			
		}
		Point2D intersectionPoint(Line2D l1,Line2D l2){
			return intersectionPoint(l1.getP1(), l1.getP2(), l2.getP1(), l2.getP2());
		}
		Point2D intersectionPoint(Point2D a1,Point2D a2,Point2D b1,Point2D b2){
			Point2D a=diff(a2,a1),
					b=diff(b2,b1);
			return sum(a1, mul(cross(b, diff(b1,a1))/cross(b,a), a));
		}
		Point2D sum(Point2D p1,Point2D p2){
			return new Point2D.Double(p1.getX()+p2.getX(), p1.getY()+p2.getY());
		}
		Point2D diff(Point2D p1,Point2D p2){
			return new Point2D.Double(p1.getX()-p2.getX(), p1.getY()-p2.getY());
		}
		Point2D mul(double n,Point2D p1){
			return new Point2D.Double(p1.getX()*n, p1.getY()*n);
		}
		double cross(Point2D p1,Point2D p2){
			return p1.getX()*p2.getY() - p2.getX()*p1.getY();
		}
	}
}

Measured memory_bytes: 18592
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF 2e9
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

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

	vector<int>a(n),b(n+1,0);
	rep(i, 0, n)cin >> a[i];

	if (k > 500)k = 500;
	while (k)
	{
		rep(i, 0, n)
		{
			b[max(0,i - a[i])]++;
			b[min(n,i + a[i] + 1)]--;
		}
		rep(i,0,n)
		{
			b[i + 1] += b[i];
			a[i] = b[i];
			b[i] = 0;
		}
		k--;
	}
	rep(i, 0, n)cout << a[i] << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 4844
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


int main() {
	init();
	
	int N, X, Y; cin >> N >> X >> Y;
	Graph G(N);
	rep(i, 0, N - 1) {
		G[i].push_back(i + 1);
		G[i + 1].push_back(i);
	}
	G[X - 1].push_back(Y - 1);
	G[Y - 1].push_back(X - 1);
	map<int, int>mp;
	rep(i, 0, N) {
		priority_queue <pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>pq;
		vector<int>vec(N, INF);
		vec[i] = 0;
		pq.push(make_pair(0, i));
		while (!pq.empty()) {
			auto p = pq.top();pq.pop();
			int v = p.second;
			if (vec[v] < p.first)continue;
			for (auto to : G[v]) {
				if (chmin(vec[to], vec[v] + 1)) {
					pq.push(make_pair(vec[to], to));
				}
			}
		}
		rep(i, 0, N) {
			mp[vec[i]]++;
		}
	}
	rep(i, 1, N) {
		cout << mp[i] / 2 << "\n";
	}

	return 0;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	int count = 0;
	for (int i = a; i < b + 1; i++) {
		if (i % 10 != i / 10000)
			continue;
		if (i % 100 / 10 != i % 10000 / 1000)
			continue;
		count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 256
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

L =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(3)]


for a1 in range(101):
    b1 = L[0][0] - a1
    b2 = L[0][1] - a1
    b3 = L[0][2] - a1
    a2 = L[1][1] - b2
    a3 = L[2][2] - b3
    # print(a1, a2, a3, b1, b2, b3)
    # (2,1)(3,1),(3,2),(2,3)
    if (a2 + b1) == L[1][0] and (a3 + b1) == L[2][0] and (a3 + b2) == L[2][1] and (a2 + b3) == L[1][2]:
        print("Yes")
        exit()

print("No")

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

using namespace std;
typedef long long LL;

const int MAXN = 2E5 + 5;

LL n, q, type, x;
LL ans;

struct Node {
    int lson, rson;
    int l, r, mi, lazy;
} tr[MAXN * 8];

int root1, root2;

void update(int id) { tr[id].mi = min(tr[tr[id].lson].mi, tr[tr[id].rson].mi); }

void pushdown(int id) {
    if (tr[id].lazy != n) {
        tr[tr[id].lson].mi = min(tr[tr[id].lson].mi, tr[id].lazy);
        tr[tr[id].lson].lazy = min(tr[tr[id].lson].lazy, tr[id].lazy);
        tr[tr[id].rson].mi = min(tr[tr[id].rson].mi, tr[id].lazy);
        tr[tr[id].rson].lazy = min(tr[tr[id].rson].lazy, tr[id].lazy);
        tr[id].lazy = n;
    }
}

void build(int& id, int l, int r) {
    static int tot;
    id = ++tot;
    tr[id].l = l, tr[id].r = r;
    tr[id].lazy = n;
    if (l == r) {
        tr[id].mi = n;
        return;
    }
    int mid = l + r >> 1;
    build(tr[id].lson, l, mid);
    build(tr[id].rson, mid + 1, r);
    update(id);
}

void modify(int id, int l, int r, int val) {
    if (tr[id].mi < val) return;
    if (tr[id].l == l && tr[id].r == r) {
        tr[id].mi = min(tr[id].mi, val);
        tr[id].lazy = min(tr[id].lazy, val);
        return;
    }
    pushdown(id);
    int mid = tr[id].l + tr[id].r >> 1;
    if (r <= mid)
        modify(tr[id].lson, l, r, val);
    else if (l > mid)
        modify(tr[id].rson, l, r, val);
    else {
        modify(tr[id].lson, l, mid, val);
        modify(tr[id].rson, mid + 1, r, val);
    }
    update(id);
}

int query(int id, int x) {
    if (tr[id].l == x && tr[id].r == x) {
        return tr[id].mi;
    }
    pushdown(id);
    int mid = tr[id].l + tr[id].r >> 1;
    if (x <= mid)
        return query(tr[id].lson, x);
    else
        return query(tr[id].rson, x);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> q;
    ans = (n - 2) * (n - 2);
    build(root1, 1, n);
    build(root2, 1, n);
    for (int i = 1; i <= q; i++) {
        cin >> type >> x;
        if (type == 1) {
            int now = query(root1, x);

            ans -= now - 2;
            modify(root2, 2, now - 1, x);
        } else {
            int now = query(root2, x);
            ans -= now - 2;
            modify(root1, 2, now - 1, x);
        }
    }
    cout << ans;
    return 0;
}


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

using namespace std;

using ll = long long;

template<int MOD>
struct ModInt {
   using Mint = ModInt;
   int val;
   ModInt(ll __val = 0) { fix(__val % MOD + MOD); }
   Mint& fix(int __val) { val = __val; if (val >= MOD) val -= MOD; return *this; }
   explicit operator int() { return val; }
   Mint operator + (const Mint &mt) const { return Mint().fix(val + mt.val); }
   Mint operator - (const Mint &mt) const { return Mint().fix(val - mt.val + MOD); }
   Mint operator * (const Mint &mt) const { return Mint().fix(ll(val) * mt.val % MOD + MOD); }
   Mint& operator += (const Mint &mt) { return *this = *this + mt; }
   Mint& operator -= (const Mint &mt) { return *this = *this - mt; }
   Mint& operator *= (const Mint &mt) { return *this = *this * mt; }
   Mint pow(int y) const {
      Mint x = *this;
      Mint ans(1);
      for (; y > 0; y >>= 1, x *= x) {
         if (y & 1) ans *= x;
      }
      return ans;
   }
   Mint operator -() const { return Mint().fix(MOD - val); }
   Mint inv() const { return pow(MOD - 2); }
   Mint operator / (const Mint &mt) const { return *this * mt.inv(); }
   Mint& operator /= (const Mint &mt) const { return *this / mt; }
   friend ostream& operator<<(ostream& os, const Mint& mt) { return os << mt.val; }
};

using Mint = ModInt<998244353>;

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   int A, B, C, D;
   cin >> A >> B >> C >> D;
   vector<Mint> dp(D + 1);
   dp[B] = 1;
   for (int a = A; a < C; ++a) {
      vector<Mint> ndp(D + 1);
      vector<Mint> sum(D + 1);
      for (int b = B; b <= D; ++b) {
         ndp[b] += dp[b] * b;
         if (b < D) sum[b + 1] += dp[b] * a;
      }
      for (int b = B + 1; b <= D; ++b) {
         sum[b] += sum[b - 1] * a;
      }
      for (int b = B; b <= D; ++b) ndp[b] += sum[b];
      dp = ndp;
   }
   Mint ans = 0;
   Mint pwr = 1;
   for (int b = D; b >= B; --b) {
      ans += dp[b] * pwr;
      pwr *= C;
   }
   cout << ans << "\n";
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
#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 sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
   int n;cin>>n;
   vector<ll> a(n);
   rep(i,n) cin>>a[i];
   sort(a.begin(),a.end());
   ll res=1;
   rep(i,n){
       //cout<<res<<" "<<((1e+18)/a[i])<<endl;
       if(a[i]==0){
           cout<<0<<endl;
           return 0;
       }
       if(res>1000000000000000000/a[i]){
           cout<<-1<<endl;
           return 0;
       }
       res*=a[i];
   }
   cout<<res<<endl;
}


Measured memory_bytes: 4004
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 100000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
int main(){
  int n,m;
  std::cin >> n>>m;
  std::cout << (n+m)%24 << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
//#define int long long
#define D double
#define inf 123456789
#define mod 1000000007
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
#define rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; ++ i)
#define drep(i , b , a) for(int i = (a) , i##Limit = (b) ; i >= i##Limit ; -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define lb(x) (x)&(-(x))
#define ls k * 2
#define rs k * 2 + 1
#define maxn 200005
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
int n, m, a, b, fac[maxn], inv[maxn];
il int Sum(int x) {
	return Dec(qpow(2, x), 1);
}
il int C(int x, int y) {
	return Mul(fac[x], Mul(inv[y], inv[x - y]));
}
il int F(int x) {
	int ans1 = 1, ans2 = 1;
	rep(i, 1, x) ans1 = Mul(ans1, i);
	rep(i, n - x + 1, n) ans2 = Mul(ans2, i);
	ans2 = Mul(ans2, qpow(ans1, mod - 2));
	return ans2;
}
int main() {
	n = read(), a = read(), b = read();
	cout << Dec(Sum(n), Inc(F(a), F(b))) << endl;
	return 0;
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
		int N;
	cin >> N;
	vec(A);
	map<int, int> B;
	fx(N) {
		vecp(A);
		B[A[x]]++;
	}
	fx(N) {
		if (B[A[x]]>1) {
			ceN;
			return 0;
		}
	}
	ceY;;

    return 0;
}



Measured memory_bytes: 10356
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

ll uniformity[8*NUM],partial[8*NUM];
ll N = 1;

void init(ll first_N){
	while(N < first_N)N *= 2;
}

void add(ll left,ll right,ll value,ll node_id,ll node_left,ll node_right){

	if(right <= node_left || left >= node_right)return;
	else if(left <= node_left && right >= node_right){
		uniformity[node_id] += value;
	}else{
		partial[node_id] += (min(right,node_right)-max(left,node_left))*value;
		add(left,right,value,2*node_id+1,node_left,(node_left+node_right)/2);
		add(left,right,value,2*node_id+2,(node_left+node_right)/2,node_right);
	}
}

ll getSum(ll left,ll right,ll node_id,ll node_left,ll node_right){
	if(right <= node_left || left >= node_right)return 0;
	else if(left <= node_left && right >= node_right){
		return (node_right-node_left)*uniformity[node_id]+partial[node_id];

	}else{
		ll sum = (min(right,node_right)-max(left,node_left))*uniformity[node_id];

		sum += getSum(left,right,2*node_id+1,node_left,(node_left+node_right)/2);
		sum += getSum(left,right,2*node_id+2,(node_left+node_right)/2,node_right);
		return sum;
	}
}

int main(){

	ll first_N,Q,command,loc,left,right,value;
	scanf("%lld %lld",&first_N,&Q);

	init(first_N);

	for(ll i = 0; i <= 2*N-2; i++){
		uniformity[i] = 0;
		partial[i] = 0;
	}

	for(ll i = 0; i < Q; i++){
		scanf("%lld",&command);

		if(command == 0){
			scanf("%lld %lld %lld",&left,&right,&value);
			left--;
			add(left,right,value,0,0,N);
		}else{
			scanf("%lld",&loc);
			loc--;
			printf("%lld\n",getSum(loc,loc+1,0,0,N));
		}
	}

	return 0;
}



Measured memory_bytes: 7316
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	string s;
	int k;
	cin>>s>>k;
	string t;
	for(int i=0;i<s.size();i+=k) t += s[i];
	cout<<t<<endl;
}


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

int cal(int x) {
    static char s[10];
    sprintf(s, "%d", x);
    int ret = 0;
    for(int i = 0; s[i]; i++) {
        ret += s[i] ^ '0';
    }
    return ret;
}

int n, a, b;

int main() {
    scanf("%d%d%d", &n, &a, &b);
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        int tmp = cal(i);
        if(a <= tmp && tmp <= b) ans += i;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
// user: whzzt
// https://beta.atcoder.jp/contests/agc014/submissions/1729574

#include<bits/stdc++.h>
 
using namespace std;
 
const int N=200005;
int n,p[N],a,v;
 
int main(){
	scanf("%d",&n);
	for(int i=1,x;i<=n;i++)scanf("%d",&x),p[x]=i;
	for(int i=n-1;i;i--)if(a&&(p[v]<p[i+1])+(p[i+1]<p[i])+(p[i]<p[v])==2||!a&&p[i]>p[i+1])a++,v=i+1;
	printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 1024
module Queue' = struct
  type 'a t = {
    mutable front : int;
    mutable capa  : int;
    mutable index : int;
    mutable length : int;
    mutable elems : (string * int) array
  }

  let is_empty (t: (string * int) t) = t.length = 0

  let create ?(capacity=2) () =
    let c = log10 (float_of_int capacity) /. log10 2.
            |> ceil |> ( ** ) 2. |> int_of_float in
    { front = 0;
      capa  = c;
      index = 0;
      length = 0;
      elems = Array.make c ("",0)}

  let enq (t: (string * int) t) (a: string * int) =
    let (elems: (string * int) array) = t.elems in
    elems.(t.index) <- a;
    t.length <- t.length + 1;
    t.index <- (t.index + 1) lor t.capa |> (lxor) t.capa

  let deq (t: (string * int) t) =
    let (elems: (string * int) array) = t.elems in
    let (front: int) = t.front in
    let (res: string * int) = elems.(front) in
    t.front <- (t.front+1) lor t.capa |> (lxor) t.capa;
    t.length <- t.length - 1;
    res
end

let () =
  let open Queue' in
  let (n:int),(quantum:int) = Scanf.scanf "%d %d\n" (fun a b -> a,b) in
  let (q:(string * int) t) = create ~capacity:n () in
  for i=1 to n do
    enq q (Scanf.scanf "%s %d\n" (fun a b -> a,b));
  done;
  let (sum:int ref) = ref 0 in
  while not (is_empty q) do
    let (p:string),(t:int) = deq q in
    if t <= quantum then (sum := !sum+t; Printf.printf "%s %d\n" p !sum)
    else
      (enq q (p,t-quantum); sum := !sum+quantum)
  done

Measured memory_bytes: 11028
import java.util.Scanner;

public class Main {
	int H, W;
	
	// true is drop
	public boolean test(String me, String oth,
			int size, int start,
			char L, char R) {
		int left = -1;
		int right = size;
		
		for (int i=me.length()-1; i>=0; i--) {
			if (oth.charAt(i) == R) {
				left--;
				if (left < -1) {
					left = -1;
				}
			} else if (oth.charAt(i) == L) {
				right++;
				if (right > size) {
					right = size;
				}
			}
			if (me.charAt(i) == L) {
				left++;
			} else if (me.charAt(i) == R) {
				right--;
			}
			if (left+1 >= right) {
				return true;
			}
		}
		if (start <= left || start >= right) {
			return true;
		}
		return false;
	}
	
	public void solve() {
		Scanner in = new Scanner(System.in);
		H = in.nextInt();
		W = in.nextInt();

		int N = in.nextInt();
		int startY = in.nextInt()-1;
		int startX = in.nextInt()-1;
		
		String me = in.next();
		String oth = in.next();
		in.close();
		
		boolean isDropLR = test(me, oth, W, startX, 'L', 'R');
		boolean isDropUD = test(me, oth, H, startY, 'U', 'D');
		
		if (isDropLR || isDropUD) {
			System.out.println("NO");			
		} else {
			System.out.println("YES");			
		}
		
	}
	
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

}


Measured memory_bytes: 28588
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#define pb push_back
using namespace std;
typedef pair<int,int> pii;

int main(){
  int n,a,b;
  cin>>n>>a>>b;

  cout<<min(a,b)<<" "<<max(a+b-n,0)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
#define ll long long
inline char tc(void){
	static char fl[10000],*A=fl,*B=fl;
	return A==B&&(B=(A=fl)+fread(fl,1,10000,stdin),A==B)?EOF:*A++;
}
inline ll read(void){
	ll a=0;static char c;
	while((c=tc())<'0'||c>'9');
	while(c>='0'&&c<='9')a=a*10+c-'0',c=tc();
	return a;
}
struct Y{
	int id;ll sum;
	inline bool operator <(const Y&a)const{
		return sum<a.sum;
	}
}sum[200005];
int n,k,now;
ll t[200005],w[200005],ans;
inline void add(int x){
	while(x<=n)++t[x],x+=x&-x;
	return ;
}
inline ll sum1(int x){
	ll res=0;
	while(x)res+=t[x],x-=x&-x;
	return res;
}
int main(void){
	register int i;
	n=read(),k=read();
	for(i=1;i<=n;++i)
		sum[i].sum=read()-k+sum[i-1].sum,sum[i].id=i,ans+=sum[i].sum>=0;
	sort(sum+1,sum+n+1);
	for(i=1;i<=n;++i){
		if(i==1||sum[i].sum!=sum[i-1].sum)++now;w[sum[i].id]=now;
	}
	for(i=1;i<=n;++i)
		ans+=sum1(w[i]),add(w[i]);	
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 6400
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

const p = 10^9+7

function main()
	n = readline() |> parseInt
	x = readline() |> split |> parseMap
	a = zeros(Int,n+1,2)
	a[1,1] = 1
	a[1,2] = 1
	om = 3
	ans = 1
	for i in 2:n
		if x[i]<om
			ans = ans*((om+1)>>1)%p
		else
			om+=2
		end
	end
	for i in 1:om>>1
		ans = ans*i%p
	end
	println(ans)
end

main()

Measured memory_bytes: 118720
n_text = input()
n = int(n_text)

s_text = input()

if n % 2 != 0:
    print('No')
    exit()

half_n = int(n / 2)
half_b_text = s_text[0:half_n]
half_a_text = s_text[half_n:n]

# print(half_b_text)
# print(half_a_text)
if half_b_text == half_a_text:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#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;}

const int INF=1001001001001001001ll;

int N;
int A[55],B[55];

int dp[1<<12][51];


bool calc(int a,int b,int ans){
    if(a==b)return true;

    int k=-1;
    rep(i,50)if(ans>>i&1)k=i;
    if(k==-1)return false;

    if(k<12)return dp[ans][a]>>b&1;

    if(calc(a,b,ans^(1ll<<k)))return true;
    if(a>=k&&calc(a%k,b,ans^(1ll<<k)))return true;
    return false;
}

signed main(){
    rep(i,1<<12){
        if(i&1)continue;
        rep(j,51){
            dp[i][j]|=1ll<<j;

            if(i==0)continue;
            int k=0;
            rep(x,12)if(i>>x&1)k=x;
            dp[i][j]|=dp[i^(1<<k)][j];
            dp[i][j]|=dp[i^(1<<k)][j%k];
        }
    }

    cin>>N;
    rep(i,N)cin>>A[i];
    rep(i,N)cin>>B[i];


    int ans=(1ll<<50)-2;
    for(int i=49;i>0;i--){
        bool ok=true;
        ans^=(1ll<<i);
        rep(j,N)if(calc(A[j],B[j],ans)==0)ok=false;

        if(!ok)ans^=(1ll<<i);
    }

    rep(i,N)if(calc(A[i],B[i],ans)==0){
        cout<<-1<<endl;
        return 0;
    }

    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
using namespace std;

const int N=100005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,T y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,T y){if(x<y) x=y;}
inline void ch(int &x,int y){x+=y;if(x>=mod) x-=mod;}

int n,a[1000005];

int main(){
	scanf("%d",&n);
	int now=0,ans=1;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=2;i<=n;i++){
		if(a[i]==a[i-1]) continue;
		else if(a[i]>a[i-1]){
			if(now<=0){now=-1;continue;}
			ans++;now=0;
		}
		else{
			if(now>=0){now=1;continue;}
			ans++;now=0;
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
int main(void){
      int  A,X,N,i,L[10000],cou=1;
      scanf("%d %d",&N,&X);
      A=0;
      for(i=0;i<N;i++){
        scanf("%d",&L[i]);
        A+=L[i];
        if(A<=X){
          cou++;
        }
      }
      printf("%d",cou);

  return 0;
 }
      

Measured memory_bytes: 128
#include <bits/stdc++.h> 
using namespace std;
void solution(int n,int a[])
{
	float s=0;
	for(int i=0; i<n; i++)
	{
		s+=a[i];
	}
	float prom=(s/n);
	prom=roundf(prom);
	int p=static_cast<int>(prom);
	int cost=0;
	for(int i=0; i<n; i++)
	{
		cost+=pow(abs(p-a[i]),2);
	}
	cout<<cost<<endl;
}

int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n; i++)
	{
		cin>>a[i];
	}
	solution(n,a);
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int n;

int main() {
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    vector<int> h(n);
    REP(i,n){
        cin >> x[i] >> y[i] >> h[i];
    }
    int cx,cy,H=INT_MAX;
    REP(i,101){
        REP(j,101){
            cx = i;
            cy = j;
            bool flag = true;
            REP(k,n){
                int dx = abs(cx-x[k]);
                int dy = abs(cy-y[k]);
                if(h[k]!=0){
                    int Hi = h[k]+dx+dy;
                    H = Hi;
                }
            }
            REP(k,n){
                int dx = abs(cx-x[k]);
                int dy = abs(cy-y[k]);
                int Hi = h[k]+dx+dy;
                if(h[k]==0){
                    if(H>Hi){
                        flag = false;
                    }
                }else{
                    if(H!=Hi){
                        flag = false;
                    }
                }
            }
            if(flag){
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }
        }
    }
    //put(res);
    return 0;
}


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

tmp = h[0] - 1
for i in range(1,n):
    if tmp == h[i]:
        tmp = h[i]
    elif tmp < h[i]:
        tmp = h[i] - 1
    else:
        print('No')
        exit()
print("Yes")

Measured memory_bytes: 14252
use proconio::{input, fastout};
use std::*;

#[allow(unused_variables)]
#[fastout]
fn main() {
    input! {
        n: isize,
        s: String
    }

    let mut rc = 0;
    for i in s.chars() {
        if i == 'R' { rc += 1 }
    }

    let mut ans = 0;
    for i in s.chars() {
        if rc == 0 { break }
        if i == 'W' {
            ans += 1;
            rc -= 1;
        } else {
            rc -= 1;
        }
    }
    println!("{}", ans);

}


Measured memory_bytes: 2416
// Problem : B - Go to Jail
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ff         first
#define ss         second
#define endl       '\n'
#define pb         push_back
#define int        long long
#define vi         vector<int>
#define mii        map<int, int>
#define pii        pair<int, int>
#define all(x)     (x).begin(), (x).end()
#define fill(a,b)  memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define px(a)      for(auto x: a) cout<<x<<" "; cout<<'\n';
#define pxy(a,n)   rep(i,0,n) {px(a[i])};
const long long MOD=1e9+7,N=1e5+5;
int power(int x, unsigned int y)  
{  
    int res = 1;
    x = x % MOD;
    if (x == 0) return 0;
  
    while (y > 0)  
    { 
        if (y & 1)  
            res = (res*x) % MOD;
        y = y>>1;
        x = (x*x) % MOD;  
    }  
    return res;  
}

/*_________________________________________________________*/


bool solve()
{
	int n,ans=0;
	cin>>n;
	stack<int>s;
	bool ok=0;
	rep(i,0,n){
		int x,y;
		cin>>x>>y;
		if(x==y) s.push(x);
		else{
			while(!s.empty()) s.pop();
		}
		
		if(s.size()==3) ok=1;
	}
	return ok;
}
int32_t main()
{	
	std::ios::sync_with_stdio(false); 
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1; 
	//cin>>t;
	while(t--) 
	//solve();
	//cout<<solve()<<endl;
	cout<<(solve()?"Yes":"No")<<endl;
}

Measured memory_bytes: 3652