akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>

using namespace std;

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		(1000000)
#define Rep(i,n) for(int i = 0; i < (n); i++ )

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define	show(x)	 copy( (x).begin(), (x).end(), ostream_iterator<int>(cout, ",") );	// container<int>を全て表示

using namespace std;

typedef long long ll;

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

ll kaijo( ll N )
{
	// 階乗
	if( N == 0 ) return 1;
	return N * kaijo(N - 1);
}

map<ll, ll> prime_factor(ll N)
{
	// 素因数分解
	map<ll, ll> ret;
	for( ll i = 2; i * i <= N; i++ ){
		while( N % i == 0 ){
			ret[i]++;
			N /= i;
		}
	}
	if(N != 1) ret[N] = 1;
	return ret;
}

ll gcd( ll a, ll b )
{
	// a >= b
	if( b > a ) swap(a, b);
	if( b == 0 ) return a;
	return gcd( a % b, b );
}

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

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

class UnionFind
{
public:
	vector<int> parent;
	vector<int> rank;

	UnionFind(int n)
	{
		Rep(i, n){
			parent.push_back(i);
			rank.push_back(1);
		}
	}
	int root(int x)
	{
		if( parent[x] != x ) parent[x] = root(parent[x]);
		return parent[x];
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if( rx == ry ) return;
		if( rank[rx] > rank[ry] ){
			parent[ry] = rx;
			rank[rx] += rank[ry];
		}
		if( rank[rx] <= rank[ry] ){
			parent[rx] = ry;
			rank[ry] += rank[rx];
		}
	}
};

int main()
{
	string ans = "";
	ll N = 0;

	cin >> N;
	ans = (N > 999) ? "ABD" : "ABC";
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007

int main() {
  int N;
  cin >>N;
  set<int> s;
  rep(i,N){
    int a;
    cin >> a;
    if(s.count(a)) s.erase(a);
    else s.insert(a);
  }

  cout << s.size() << endl;
  
}


Measured memory_bytes: 4864
N,A,B,C,D = map(int, input().split())

S = input()

if '##' in S[A-1:C] or '##' in S[B-1:D]:
    print('No')
elif D < C and not '...' in S[B-2:D+1]:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3572
#include<cstdio>
#include<queue>
using namespace std;
const char N_MAX = 105;
bool matrix[N_MAX][N_MAX];
char n;
char length = 0;
queue<char> que;
struct Node{
    char state;//0:undiscovered 1:active 2:end
    char path;
};
Node V[N_MAX];
char next(char num, char found){
    for(char i=found;i<n;i++){
        if(matrix[num][i]&&V[i].state==0){
            return i;
        }
    }
    return -1;
}
void buildMatrix(){
	for(char i=0; i<n;i++){
		int degree, index;
		scanf("%u%u", &index, &degree);
		for(char j=0; j<degree; j++){
			int temp;
			scanf("%d", &temp);
			matrix[index-1][temp-1] = true;
		}
	}
}

void bfs() {
    que.push(0);
    V[0].path = length = 0;
    V[0].state = 1;
    while(!que.empty()) {
        char active = que.front();
        char nex = next(active, 0);
        while(nex != -1) {
            que.push(nex);
            V[nex].path = V[active].path+1;
            V[nex].state = 1;
            nex = next(active, nex + 1);
        }
        V[active].state = 2;
        que.pop();
    }
}

int main(){
    scanf("%d", &n);
    for(char i=1;i<n;i++){
        V[i].path=-1;
    }
    buildMatrix();
    bfs();
    for(char i =0;i<n;i++){
        printf("%d %d\n", i+1, V[i].path);
    }
    return 0;
}



Measured memory_bytes: 2732
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define xmod 100000007
using namespace std;

int n,a[100005],m,dp[100005];
int main (){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for (int i=1;i<=n;i++){
		cin >> a[i];
	}
	for (int i=2;i<=n;i++){
		dp[i]=1e9;
		for (int j=max(1,i-m);j<i;j++){
			dp[i]=min(dp[j]+abs(a[j]-a[i]),dp[i]);
		}
	}
	cout << dp[n] << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>

using namespace std;

long N;

void solve()
{
	int res;
	for (res = 1; res * res <= N; res++);
	res--;
	cout << res * res << endl;
}


int main()
{
	cin >> N;
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
const ll MOD = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	string s;
	cin >> s;
	int r = 0, b = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '0')
			r++;
		else
			b++;
	}
	cout << min(r, b) * 2;
}

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

#define en '\n'
using ll = long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vec<vec<T>>;
#define REP(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(hoge) hoge.begin(), hoge.end()

int main(void) {
    int n, m;
    while(cin >> n >> m) {
        if(n == 0 and m == 0)
            break;

        vec<int> s(n);
        REP(i, n) {
            cin >> s[i];
        }
        auto check = [&](int x) -> bool {
            int con = 0;
            int L = 1;
            if(x + L < s[0])
                return true;
            while(x + L <= s[n - 1]) {
                auto it = lower_bound(all(s), L);
                int cost = 1;
                if(x + L > *it and cost < x - abs(L - *it))
                    cost = x - abs(L - *it);
                if(it != s.begin()) {
                    it--;
                    if(cost < x - abs(L - *it))
                        cost = x - abs(L - *it);
                }
                L += cost;
                con++;
            }
            return con + 1 >= m;
        };

        int l = 0;
        int r = 1000001;
        while(l + 1 < r) {
            int m = l + r >> 1;
            if(check(m))
                l = m;
            else
                r = m;
        }
        if(l + 1 <= s[0] or check(l) == false)
            cout << -1 << en;
        else
            cout << l << en;
    }
    return 0;
}


Measured memory_bytes: 3468
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = (1ll<<31)-1;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int nx[4] = {0,-1,0,1};
int ny[4] = {1,0,-1,0};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w,b = 0;
    cin >> h >> w;
    vector<string> grid(h);
    rep(i,h) cin >> grid[i];
    rep(i,h){
        rep(j,w){
            if (grid[i][j] == '#') b++;
        }
    }
    queue<P> q;
    vector<vector<int>> d(h,vector<int>(w,-1));
    d[0][0] = 0;
    q.push(P(0,0));
    while(!q.empty()){
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        int xn,yn;
        rep(i,4){
            xn = x + nx[i];
            yn = y + ny[i];
            if (xn >= 0 && xn < h && yn >= 0 && yn < w && d[xn][yn] == -1 && grid[xn][yn] == '.'){
                d[xn][yn] = d[x][y]+1;
                q.push(P(xn,yn));
            }
        }
    }
    if (d[h-1][w-1] == -1) PRINT(-1);
    else PRINT(h*w-b-d[h-1][w-1]-1);
}


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

using namespace std;
 
//#define int long long
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=0;i<=n;i++)


ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
 
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(){
    ios_base::sync_with_stdio(false);
    ll X;
    cin >> X;
    if(X>=30){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


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

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T, class Compare = less<>>
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template <class T, class Compare = greater<>>
using MinHeap = priority_queue<T, vector<T>, Compare>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline istream& operator>>(istream &is, vector<T> &vec) {
    for (auto &e: vec) {
        is >> e;
    }
    return is;
}

inline void output() { cout << "\n"; }
template <class Head, class... Tail>
inline void output(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << " ";
    }
    output(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        os << e << delim[&e == &vec.back()];
    }
    return os;
}

template <class T>
inline vector<T> makeVector(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeVector(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeVector<T>(initValue, args...))>(sz, makeVector<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

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

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

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(intmax_t, a, b, c);

    const intmax_t tmp = c - a - b;
    const intmax_t k = tmp * tmp;

    output(tmp >= 0 && 4_jd * a * b < k ? "Yes" : "No");

    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 reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define forin(x,n) for(auto& (x) : n)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define inf 1000000000
#define llinf 1000000000000000
#define MAX 1000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;
typedef pair<int,pint> P;

int main(){
    int n;
    cin>>n;
    vll a(n);
    rep(i,n)cin>>a[i];

    ll nummin=inf;
    ll sum=0;
    int counter=0;
    int check=0;
    rep(i,n){
        if(a[i]==0)check++;
        if(a[i]<0)counter++;
        nummin=min(nummin,abs(a[i]));
        sum+=abs(a[i]);
    }
    if(check>1 || counter%2==0)cout<<sum<<endl;
    else cout<<sum-nummin*2<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  int a;
  
  for(int i; i < 3; i++){
    if (S[i] == 'o'){
      a++;
    }
  }
  cout << 700 + (a*100) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<math.h>
#include<iomanip>

using namespace std;

int main() {
	double a =0, ave, s = 0;
	int n, i;
	int box[1000] = {};
	while(1){
	cin >> n;
	if (n == 0) { break; }
	for (i = 0; i < n; i++) {
		cin >> box[i];
	}
	for (i = 0; i < n; i++) {
		a += box[i];
	}
	ave = a / n;
	for (i = 0; i < n; i++) {
		s += (box[i] - ave) * (box[i] - ave);
	}
	
	cout << fixed << setprecision(6)<<sqrt(s/n) << endl;
	a = 0;
	s = 0;
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 3256
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
int n;
int ar[100005];
lint sum[100005];
bool check(int K){
  while(K<n-1){
    lint tot=sum[K+1];
    if(tot*2>=ar[K+1]) ++K;
    else return false;
  }
  return true;
}
int main(){
  cin>>n;
  REP(i,n) cin>>ar[i];
  sort(ar,ar+n);
  REP(i,n) sum[i+1]=sum[i]+ar[i];

  int lb=-1,ub=n-1;
  while(ub-lb>1){
    int md=(lb+ub)>>1;
    if(check(md)) ub=md;
    else lb=md;
  }
  int res=n-ub;
  cout<<res<<endl;
  return 0;
}





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

int main() {
	int n;
	cin >> n;
	long long int s[n];
	for(int i=0;i<n;i++){
		cin >> s[i];
	}
	int count = 0;
	bool even = true;
	
	for(int j=0;j<50;j++){
		for(int i=0;i<n;i++){
			if(s[i]%2==0){
				s[i] = s[i] / 2;
			}
			else{
				even = false;
				break;
			}
			if(even == false) break;
			if(i==n-1) count++;
		}
	}
	
	cout << count << endl;
	return 0;
}

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

long long int con(long long int i){
    long long int x=(i*(i-1))/2;
    return x;
}
int main(){
    long long int N; cin>>N;
    vector<long long int> A(N,0);
    vector<long long int> B(N+1,0);
    for(long long int i=0;i<N;i++){   //入力とカウント＋＋
        cin>>A[i];
        B[A[i]]++;
    }
    long long int ans=0;
    for(long long int i=0;i<N+1;i++){
        ans=ans+con(B[i]);   //元の答え
    }

    for(long long int i=0;i<N;i++){
        cout<<ans-con(B[A[i]])+con(B[A[i]]-1)<<endl;
    }

    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;

int main(){
  int x;
  cin>>x;
  if(x==0)cout<<1;
  else cout<<0;

}


Measured memory_bytes: 3628
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
typedef pair<double,double> P;
int main(){
  map<string,int> data;
  string s;
  int cnt=0,t=0,m=0;
  string ans[2];
  while(cin>>s){
    data[s]++;
    if(data[s]>t){
      t=data[s];
      ans[0]=s;
    }
    if(s.size()>m){
      m=s.size();
      ans[1]=s;
    }
  }
  cout<<ans[0]<<" "<<ans[1]<<endl;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, sx, sy, tx, ty);
  rep(i, sy, ty) {
    cout << 'U';
  }
  rep(i, sx, tx) {
    cout << 'R';
  }
  rep(i, sy, ty) {
    cout << 'D';
  }
  rep(i, sx, tx + 1) {
    cout << 'L';
  }
  rep(i, sy, ty + 1) {
    cout << 'U';
  }
  rep(i, sx, tx + 1) {
    cout << 'R';
  }
  cout << "DR";
  rep(i, sy, ty + 1) {
    cout << 'D';
  }
  rep(i, sx, tx + 1) {
    cout << 'L';
  }
  cout << 'U' << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<ll> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  bool ans = true;
  for (int i = N-1; i >= 1; i--) {
    if (H[i] >= H[i-1]) {
      continue;
    }
    if (H[i-1] - H[i] == 1) {
      H[i-1]--;
      continue;
    }
    if (H[i-1] - H[i] >= 2) {
      ans = false;
      break;
    }
  }
  if (ans) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

typedef long long int LL;
typedef unsigned long long uLL;
typedef pair< int,int > ii;
typedef pair< int,ii > iii;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 100005;
const int MOD = 1e9+7;
const double EPS = 1e-6;
const double PI = acos(-1.0);

int main( int argc, char const *argv[] ) {
    int n , a , b;
    cin >> n >> a >> b;
    bool f = false;
    if( a > b ) {
        bool f = true;
        swap( a , b );
    }
    int al = 0 , bo = 0;
    while( true ) {
        if( a+1 <= n && a+1 != b ) {
            a++;
        }
        else if( a-1 >= 1 ) {
            a--;
        }
        else {
            bo = 1;
            break;
        }
        if( b-1 >= 1 && b-1 != a ) {
            b--;
        }
        else if( b+1 <= n && b+1 != a ) {
            b++;
        }
        else {
            al = 1;
            break;
        }
    }
    if( f ) swap( al , bo );
    cout << ( al == 1 ? "Alice" : "Borys" )  << endl;
    return 0;
}



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

int main()
{
    int x, y;
    cin >> x >> y;

    cout << x + y / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Measured memory_bytes: 147732
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main(){
	double a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << fixed;
	cout << setprecision(8);
	cout << sqrt(pow(a-c, 2) + pow(b-d, 2)) << endl;
	
}


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

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

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

  return 0;

}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
using P = pair <int, int>;
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; }
ll gcd(ll a,ll b) {return  b ? gcd(b,a%b) : a;}
const long long INF = 1LL << 60;
const int mod = 1000000007;
const double PI = acos(-1.0);
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

int h,w;
bool seen[51][51];
char fi[51][51];
void dfs(int x,int y){
     seen[x][y]=true;
     
          rep(i,4){
               int nx = x+dx[i];
               int ny = y+dy[i];
               if(nx<0||nx>=h||ny<0||ny>=w)continue;
               if(fi[nx][ny]=='#')continue;
               if(seen[nx][ny])continue;
               dfs(nx,ny);
          }
}

int main () {
     cin >> h >> w;
     rep(i,h){
          rep(j,w){
               cin >> fi[i][j];
          }
     }
     memset(seen,false,sizeof(seen));
     dfs(0,0);
     if(!seen[h-1][w-1]) {
          cout << -1 <<endl;
          return 0;
     }
     using pint = pair<int,int>;
     queue<pint>que;
     que.push({0,0});
     int dist[51][51];
     memset(dist,-1,sizeof(dist));
     dist[0][0]=0;
     while(!que.empty()){
          int a = que.front().first;
          int b = que.front().second;
          if(a==h-1&&b==w-1) break;
          que.pop();
          rep(i,4){
               int nx = a+dx[i];
               int ny = b+dy[i];
               if(nx<0||nx>=h||ny<0||ny>=w)continue;
               if(fi[nx][ny]=='#')continue;
               if(dist[nx][ny]!=-1)continue;
               dist[nx][ny]=dist[a][b]+1;
               que.push({nx,ny});
          }
     }
     int kei = dist[h-1][w-1] +1;
     int black = 0;
     rep(i,h){
          rep(j,w){
               if(fi[i][j]=='#') black++;
          }
     }
     int ans = w*h-kei-black;
     cout << ans <<endl;
}

Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <unordered_set>
#include <complex>
#include <unordered_map>
#include <bitset>
#include <ctime>
#include <cassert>

#define sz(a) (int)((a).size())

using namespace std;

typedef long long ll;
typedef long double ld;

int solve()
{
    ios::sync_with_stdio(0);
    ll n;
    if (!(cin >> n))
    {
        return 1;
    }
    ll m;
    cin >> m;
    if (n > m)
    {
        swap(n, m);
    }
    if (m == 1)
    {
        cout << 1 << endl;
        return 0;
    }
    if (n == 1)
    {
        cout << max(0LL, m - 2) << endl;
        return 0;
    }
    ll ans = max((m - 2), 0LL) * max((n - 2), 0LL);
    cout << ans << endl;    
    return 0;
}

int32_t main()
{
    int T = 1;
    #ifdef ONPC
        freopen("in.txt", "r", stdin);
    #endif
    for (int i = 1;; i++)
    //cin >> T; for (int i = 0; i < T; i++)
    {
        #ifdef ONPC
            cout << "Test #" << i << ":\n";
        #endif
        if (solve())
            break;
        #ifdef ONPC
            cerr << "_______________________________________________" << endl;
        #endif
    }
    #ifdef ONPC
        cerr << endl << "finished in " << clock() * 1000LL / CLOCKS_PER_SEC << " ms" << endl;
    #endif
    return 0;
}


Measured memory_bytes: 256
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;

fn main() {
    input! {
        ss: String,
    }

    let mut s = String::new();
    s += "hi";
    let mut v = vec![];
    v.push(s.clone());

    for i in 0..10 {
        s += "hi";
        v.push(s.clone());
    }

    for e in v {
        if e == ss {
            println!("Yes");
            return;
        }
    }

    println!("No");
}


Measured memory_bytes: 4352
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define f first 
# define s second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

# define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
# define debug cerr<<"ERROR"<<endl
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

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

const int dx[]={1,0,-1,0,-1,-1,1,1};
const int dy[]={0,1,0,-1,-1,1,-1,1}; 
const int inf=1e9,mod=1e9+7,N=2e5+5;

int f(int x){
	return x*x;
}

void solve(){
	int n;
	cin>>n;
	vector<int>x(n),y(n),v;
	rep(i,n)cin>>x[i]>>y[i];
	forn(i,n)v.pb(i);
	int cnt=0;
	double ans=0;
	do{	
		cnt++;
		rep(i,n-1){
			ans+=sqrt(f(x[v[i]-1]-x[v[i+1]-1])+f(y[v[i]-1]-y[v[i+1]-1]));
		}
	}
	while(next_permutation(all(v)));
	double res=ans/cnt;
	printf("%.12f",res);
}

int main(){
 	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)solve();
}

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

int main() {
  int X,Y;
  cin >> X >> Y;
  
  if (Y%2 == 0 && Y >= 2*X && Y <= 4*X) {
   cout << "Yes" << endl; 
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n >= 30) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 35632
# I used the below code as a reference.
# https://atcoder.jp/contests/abc075/submissions/10369947
class UnionFind():
    def __init__(self, N):
        self._root = [-1 for _ in range(N)]

    def find(self, x):
        if self._root[x] < 0: return x
        self._root[x] = self.find(self._root[x])
        return self._root[x]

    def unite(self, x, y):
        gx = self.find(x)
        gy = self.find(y)
        if gx == gy: return False
        if self._root[gx] > self._root[gy]:
            gx, gy = gy, gx
        self._root[gx] += self._root[gy]
        self._root[gy] = gx
        return True

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -(self._root[self.find(x)])

    def roots(self):
        return [i for i in self._root if i < 0]

n, m = map(int, input().split())
nodes = []
for _ in range(m):
    a, b = map(int, input().split())
    nodes.append((a, b))

cnt = 0
for i in range(m):
    uf = UnionFind(n)
    for j in range(m):
        if i != j:
            uf.unite(nodes[j][0]-1, nodes[j][1]-1)
    cnt += (len(uf.roots()) != 1)
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  int count = 0;
  cin >> a >> b >> c;
  for (int i = a; i <= b; i++) {
    if (c % i == 0)
      count++;
  }
  cout << count << endl;
  return 0;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  int n;
  cin>>n;
  vector<int> t(n),v(n);
  for(int i=0;i<n;i++) cin>>t[i],t[i]*=2;
  for(int i=0;i<n;i++) cin>>v[i],v[i]*=2;
  vector<vector<int> > dp(222,vector<int>(2,-1));
  dp[0][0]=0;
  int cur=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<t[i];j++){
      bool f=cur%2;
      for(int k=0;k<222;k++) dp[k][!f]=-1;
      for(int k=0;k<=v[i];k++){
	if(dp[k][f]<0) continue;
	dp[k][!f]=max(dp[k][!f],dp[k][f]+k+k);
	if(k+1<=v[i])
	  dp[k+1][!f]=max(dp[k+1][!f],dp[k][f]+k+(k+1));
	if(k-1>=0)
	  dp[k-1][!f]=max(dp[k-1][!f],dp[k][f]+k+(k-1));
      }
      cur++;
    }
  }
  //assert(sum==cur);
  cout<<fixed<<setprecision(12)<<(double)dp[0][cur%2]/8.0<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <climits>

using namespace std;

int main() {
    int H,W,h,w;
    cin >> H >> W >> h >> w;
    cout << W*H - (h*W+w*H - h*w) << endl;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Union Find tree
//-------------------------------------------------
class UnionFind
{
private:
    ::std::vector<int> par;
    ::std::vector<int> rank;
    ::std::vector<int> diff;
public:
    UnionFind(int n):par(n), rank(n), diff(n){
        for(int i=0; i<n; i++){
            par[i] = i;
            rank[i] = 0;
            diff[i] = 0;
        }
    }
    int root(int x){
        if (par[x]==x) return x;
        int rx = root(par[x]);
        diff[x] += diff[par[x]];
        return par[x] = rx;
    }
    int weight(int x){
        root(x);
        return diff[x];
    }
    bool same(int x, int y){
        return root(x)==root(y);
    }
    void unite(int x, int y, int w){
        int rx = root(x);
        int ry = root(y);
        if (rx==ry) return;
        if (rank[rx]>rank[ry]){
            w+=weight(x)-weight(y);
            diff[ry] = w;
            par[ry] = rx;
        }else{
            w+=weight(y)-weight(x);
            diff[rx] = w;
            par[rx] = ry;
            if (rx==ry) rank[ry]++;
        }
    }
};

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    UnionFind uf(n);
    rep(i,m){
        int l,r,d; cin>>l>>r>>d; l--; r--;
        if (uf.same(l,r)){
            if (uf.weight(l)-uf.weight(r)!=d){
                cout<<"No\n";
                return 0;
            }
        }else{
            uf.unite(l,r,d);
        }
    }
    cout<<"Yes\n";
    return 0;
}


Measured memory_bytes: 1408
from math import sin,cos,pi
a,b,h,m = map(int, input().split())

print(((a*cos(h*pi/6+m*pi/(360))-b*cos(m*pi/30))**2 + (a*sin(h*pi/6+m*pi/(360))-b*sin(m*pi/30))**2)**(1/2))

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

using namespace std;
inline void
prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
//printf("%.12lf\n",mid);
int mod;

int mymod(int num){
  if (num< 0){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
int main ()
{
  prep ();
  int a, p;
  cin >> a >> p;
  a *= 3;
  cout << (a+p)/2;
  return 0;
}
// in dp problems think: up until here, intervals, or "what if there's 1, 2, 3..."
// in math problems write out equations
// also in math problems to change multiplication/division to addition/subtraction use logs, add/subtract something to make the multiplication easier (like if it's 3*f(x)+2, change it to 3*(f(x)+1)-1)
// if printint pow function, put an (int) or (long long) next to it
// if checked everything check for bugs (like sorting wrong way or not putting a break in a loop)
// if n is 10^7 try brute force if the operations are simple
// if can't do dp do brute force/greedy
// to save time don't copy maps/vectors into variables if it already exists
// only use long long if need to
// if wrong on decimal problem, check if program rounds or if you can round to a certain amt of decimals
// if decimals too, if can subtract instead of divide
// in grid traversal problems check if doing sideways or not
// if TLE try to take away loop
// in recursion looking math problems look at things from the point of view of both sides (the start and the end sections of the recursion)
// think about how many possible answers there are to the problem
// if it makes it easier use +1 indexing
// think twice when writing things down that you're going to use later


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  int l[n];
  for (int i = 0; i < n; ++i) scanf("%d", &l[i]);

  sort(l, l + n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int ab = l[i] + l[j];
      int right = lower_bound(l, l + n, ab) - l;
      int left = j + 1;
      ans += max(0, right - left);
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
int a,b;


scanf("%d",&a);


scanf("%d",&b);


if(a<b){


printf("a < b\n");


}


else if(a>b){


printf("a > b\n");


}


else{


printf("a == b\n");


}





return 0;


}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define all(x) x.begin(),x.end()
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL);
#define N

int main(){
	FIO;
    ll n,m; cin >> n >> m;
    vector<ll> a(m);
    ll sum = 0;
    for(ll &i : a) cin >> i, sum += i;
    if(n < sum) cout << -1 << endl;
    else cout << n-sum << endl;
	return 0;
}

Measured memory_bytes: 3664
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
import std.container.dlist;


alias M = Tuple!(long, "x", long, "h");

void main()
{
    auto nda = readln.split.to!(long[]);
    auto N = nda[0];
    auto D = nda[1];
    auto A = nda[2];
    M[] MS;
    foreach (_; 0..N) {
        auto xh = readln.split.to!(long[]);
        MS ~= M(xh[0], xh[1]);
    }
    sort!"a.x < b.x"(MS);

    auto deq = DList!M();
    long d, x;
    foreach (m; MS) {
        while (!deq.empty && deq.front.x < m.x) {
            d -= deq.front.h;
            deq.removeFront();
        }
        auto h = m.h - d;
        if (h <= 0) continue;
        auto y = (h + A - 1) / A;
        x += y;
        d += A*y;
        deq.insertBack(M(m.x + D*2, A*y));
    }
    writeln(x);
}

Measured memory_bytes: 8828
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


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

#define IMIN INT_MIN;
#define IMAX INT_MAX;

int maxelem(vector<int> src) {
	int dst = src[0];
	rep(i, src.size()) {
		dst = (dst > src[i]) ? dst : src[i];
	}
	return dst;
}

int secondelem(vector<int> src) {
	int dst = src[0];
	int dst2 = src[0];
	rep(i, src.size()) {
		if (dst < src[i]) {
			dst2 = dst;
			dst = src[i];
		}
		else if (dst2 < src[i]) {
			dst2 = src[i];
		}
	}
	return dst2;
}

vector<int> count(vector<int> a) {
	int ma = maxelem(a);
	vector<int> count(ma+1, 0);
	rep(i, a.size()) {
		count[a[i]]++;
	}
	return count;
}

int find(vector<int> a, int b) {
	rep(i, a.size()) {
		if (a[i] == b) return i;
	}
	return -1;
}

int main(){
	int n;
	cin >> n;
	vector<int> o, e;
	int mo, me;
	int mno, mne;
	int mno2, mne2;
	int x;
	rep(i, n) {
		cin >> x;
		if (i%2 == 0) o.push_back(x);
		else e.push_back(x);
	}

	int ans;
	vector<int> counto = count(o);
	vector<int> counte = count(e);
	mno = maxelem(counto);
	mne = maxelem(counte);
	mo = find(counto, mno);
	me = find(counte, mne);
	mno2 = secondelem(counto);
	mne2 = secondelem(counte);

	if (mo != me) ans = n - mno - mne;
	else if (mno2 >= mne2) ans = n - mno2 - mne;
	else ans = n - mno - mne2;

	cout << ans;

	return 0;
}



Measured memory_bytes: 1976
import sys
import math
import collections
import bisect
import itertools
import decimal
import copy
import heapq

# import numpy as np

# sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
flush = lambda: sys.stdout.flush()


# ===CODE===
def main():
    n = ni()

    dp = [[0 for _ in range(4)] for __ in range(n + 1)]
    dp[0][0] = 1

    for i in range(n):
        dp[i + 1][0] += dp[i][0] * 8
        dp[i + 1][1] += dp[i][0] + dp[i][1] * 9
        dp[i + 1][2] += dp[i][0] + dp[i][2] * 9
        dp[i + 1][3] += dp[i][1] + dp[i][2] + dp[i][3] * 10

        for j in range(4):
            dp[i + 1][j] %= MOD
    print(dp[n][3] % MOD)


if __name__ == '__main__':
    main()


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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

vector<vector<PLL>> G;

int32 w, h;

void add_edge(int32 y1, int32 x1, int32 d1, int32 y2, int32 x2, int32 d2, int32 v=0){
	G[y1*w+x1+d1*h*w].push_back(PLL(v, y2*w+x2+d2*h*w));
}

int32 dx[4] = {0, 1, 0, -1};
int32 dy[4] = {1, 0, -1, 0};

int main(void){
	auto in = [&](int32 y, int32 x){
		return 0<=y&&y<h&&0<=x&&x<w;
	};
	while(cin >> w >> h && w+h){
		vector<vector<int32>> s(h, vector<int32>(w));
		G.clear();
		G.resize(w*h*8);
		int32 c[4] = {};
		REP(i, h) REP(j, w) cin >> s[i][j];
		REP(i, 4) cin >> c[i];
		REP(i, h){
			REP(j, w){
				REP(k, 4){
					REP(l, 4){
						int32 cost = (s[i][j] == (4-l)%4 ? 0 : c[(4-l)%4]);
						if(in(i+dy[(k+l)%4], j+dx[(k+l)%4])){
							add_edge(i, j, k, i+dy[(k+l)%4], j+dx[(k+l)%4], (k+l)%4, cost);
						}
					}
				}
			}
		}
		vector<int64> d(w*h*8, INF_LL);
		priority_queue<PLL, vector<PLL>, greater<PLL>> pq;
		d[h*w] = 0;
		pq.push(PLL(0, h*w));
		while(pq.size()){
			int32 v, dd;
			tie(dd, v) = pq.top(); pq.pop();
			if(dd > d[v]) continue;
			REP(i, G[v].size()){
				if(d[G[v][i].sc] > d[v]+G[v][i].fs){
					d[G[v][i].sc] = d[v]+G[v][i].fs;
					pq.push(PLL(d[G[v][i].sc], G[v][i].sc));
				}
			}
		}
		cout << min({d[h*w-1], d[2*h*w-1], d[3*h*w-1], d[4*h*w-1]}) << endl;
	}
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;
int main()
{
  char b;
  cin>>b;
  switch(b){
    case 'A':
    cout<<'T'<<endl;
    break;

    case 'T':
    cout<<'A'<<endl;
    break;

    case 'G':
    cout<<'C'<<endl;
    break;

    case 'C':
    cout<<'G'<<endl;
    break;
  }
  return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

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

        final int A = sc.nextInt();
        final int B = sc.nextInt();

        System.out.println(lcm(A, B));
    }

    private static long lcm(final long a, final long b) {
        return a / gcd(a, b) * b;
    }

    private static long gcd(final long a, final long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }
}


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

int main(){
    int n,m;
    cin >> n >> m;
    int a[m];
    rep(i,m){
        scanf("%d",&a[i]);
    }
    int sum=0;
    rep(i,m){
        sum+=a[i];
    }
    if(n-sum>=0){
        cout << n-sum;
    }else{
        cout << "-1";
    }
    return 0;
}

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

long aps(long a, long d, long n) {
  return n * (2 * a + (n - 1) * d) / 2;
}

int main() {
  int N;
  cin >> N;
  long ans = 0;
  for (int i = 1; i <= N; i++) {
    ans += aps(1, 1, i);
  }
  for (int i = 0; i < N - 1; i++) {
    int u, v;
    cin >> u >> v;
    if (u > v) swap(u, v);
    ans -= (long) u * (N - v + 1);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3584
#include <iostream>
#include<iomanip>
using namespace std;
#define ll long long

int main(){
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    cout <<  std::setprecision(10);
    double area = W*H/2.0;
    if(W == x*2 && H == y*2){
        cout << std::setprecision(10) << area << " 1";
    }else{
        cout << std::setprecision(10) << area << " 0";
    }
    return EXIT_SUCCESS;
}

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

int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  int i;
  for(i=0;i<n;i++){
    cin >> s.at(i);
  }
  sort(s.begin(),s.end());
  
  int k=1;
  for(i=1;i<n;i++){
    if(s.at(i)!=s.at(i-1)){
      k++;
    }
  }
  
  cout << k << endl;
}

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

using namespace std;

#define int long long

void solve() {
    int n, m;
    cin >> n >> m;
    vector <int> g[n];
    int h[n];
    for (int i = 0; i < n; ++i) cin >> h[i];
    for (int i = 0; i < m; ++i) {
        int v, u;
        cin >> v >> u;
        --v;
        --u;
        g[v].push_back(u);
        g[u].push_back(v);
    }
    int cnt = 0;
    for (int i =0; i < n; ++i) {
        bool ch = 0;
        for (int j = 0; j < g[i].size(); ++j) {
            if (h[g[i][j]] >= h[i]) {
                ch = 1;
                break;
            }
        }
        if (!ch) ++cnt;
    }
    cout << cnt;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 10240
#include <bits/stdc++.h>
#define se second.first
#define th second.second
#define fi first
using namespace std;
int main(){

  for(int t,p,r;cin>>t>>p>>r,t;){
    int wa[50][10]={};
    pair<int,pair<int,int> > sc[50]={};
    for(int i=0;i<t;i++) sc[i].th=i+1;
    for(int i=0;i<r;i++){
      string s;
      int t0,p0,time;
      cin>>t0>>p0>>time>>s;
      if(s[0]=='W') wa[t0-1][p0-1]++;
      else{
        sc[t0-1].fi++;
        sc[t0-1].se+=time+wa[t0-1][p0-1]*1200;
      }
    }
    for(int i=10;i!=-1;i--){
      vector <pair<int,int> > b;
      for(int j=0;j<t;j++) if(i==sc[j].fi) b.push_back(make_pair(sc[j].se,sc[j].th));
      sort(b.begin(),b.end());
      for(int j=0;j<(int)b.size();j++) cout<<b[j].second<<" "<<i<<" "<<b[j].fi<<endl;
    }
  }
  return 0;

}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define MAX 200005
#define MOD 1000000007
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define vi vector<ll>
#define ii pair<ll,ll>
#define vii vector<ii>
#define si set<ll>
#define mp map<ll,ll>
#define mpi map<ii,ll>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#include <unordered_map> 
#define ump unordered_map<ll,ll>
#define F first
#define S second
int main()
{
    fast
    ll ans=0;
    ll n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        ll x;
        cin>>x;
        if(i%2==1 && x%2==1)
        {
            ans++;
        }
    }
    cout<<ans<<endl;
    
}

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

def solve(h,w,s):
    for i in range(1,h):
        for j in range(1,w):
            if s[i][j] == "#" and \
               s[i+1][j] != "#" and \
               s[i-1][j] != "#" and \
               s[i][j+1] != "#" and \
               s[i][j-1] != "#":
                return "No"
    return "Yes"



def main():
    H,W = map(int,input().split())
    s = ['.'*55]*55
    for i in range(H):
        s[i] = input() + '.'*(55-W)
    print(solve(H,W,s))
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 9152