akhauriyash/Code-Regression huggingface dataset:
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
vector<llint>ryu(vector<llint>a){
	llint n=a.size(),i,ans=0;
	vector<llint>ret(n+1);
	stack<pair<int,int>>sta;
	sta.push(mp(n-1,mod));
	for(i=n-2;i>=0;i--){
		if(a[i]<=a[i+1]){
			int over=0;
			llint g=a[i];
			while(g*4<=a[i+1]){g*=4;over++;}
			if(over>0){sta.push(mp(i,over));}
		}else{
			int less=0;
			llint g=a[i+1];
			while(a[i]>g){g*=4;less++;}
			while(less--){
				ans+=sta.top().fir-i;
				sta.top().sec--;
				if(sta.top().sec<=0){sta.pop();}
			}
		}
		ret[i]=ans*2;
	}
	return ret;
}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	//留年じゃ～ん
	llint i,n,ans=big;cin>>n;
	vector<llint>in(n);
	for(i=0;i<n;i++){cin>>in[i];}
	auto aaa=ryu(in);
	REV(in);
	auto bbb=ryu(in);
	for(i=0;i<n;i++){mineq(ans,aaa[i]+bbb[n-i]+i);}
	cout<<ans<<endl;
	return 0;
}


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

template <int MOD_>
struct modnum {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");
 
private:
	using ll = long long;
 
	int v;
 
	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}
 
public:
 
	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }
 
	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }
 
	modnum inv() const {
		modnum res;
		res.v = minv(v, MOD);
		return res;
	}
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
 
	modnum operator- () const {
		return neg();
	}
	modnum operator+ () const {
		return modnum(*this);
	}
 
	modnum& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	modnum& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= o.inv();
	}
 
	friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
	friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
};
using num = modnum<int(1e9) + 7>;

const int MAXN = 310;
int N;
int M;
vector<pair<int, int>> conds[MAXN];

num dp[MAXN][MAXN][MAXN];

int countInside(int r, int g, int b, int l) {
	return (l <= r) + (l <= g) + (l <= b);
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int l, r, x; cin >> l >> r >> x;
		conds[r].emplace_back(l, x);
	}

	num ans = 0;
	dp[0][0][0] = 1;
	for (int r = 0; r <= N; r++) {
		for (int g = 0; g <= N; g++) {
			for (int b = 0; b <= N; b++) {
				if (!int(dp[r][g][b])) continue;
				int i = max({r, g, b});

				for (auto c : conds[i]) {
					if (countInside(r, g, b, c.first) != c.second) {
						goto invalid;
					}
				}

				if (i == N) {
					ans += dp[r][g][b];
				} else {
					dp[i+1][g][b] += dp[r][g][b];
					dp[r][i+1][b] += dp[r][g][b];
					dp[r][g][i+1] += dp[r][g][b];
				}
invalid:;
			}
		}
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 116608
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <chrono>
#include <random>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    string s; cin >> s;
    auto srev = s;
    REVERSE(srev);
    REP(i, srev.size()) {
        char c;
        if (s[i] == 'b') c = 'd';
        if (s[i] == 'd') c = 'b';
        if (s[i] == 'p') c = 'q';
        if (s[i] == 'q') c = 'p';
        s[i] = c;
    }
    cout << (s == srev ? "Yes" : "No") << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define int long long int
#define mkp make_pair
#define maxN 100005
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
using namespace std;
void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
}
 set<pair<int,int>> primeset;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primeset.insert(mkp(p,1));
}
int32_t main()
{
fastio;
int a;in a;int b;in b;
int c=a-2*b;
if(c>0) out c;
else out 0;
    return 0;
}


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

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            int H, W, h, w;
            {
                string[] s = Console.ReadLine().Split(' ');
                H = int.Parse(s[0]);
                W = int.Parse(s[1]);
            }
            {
                string[] s = Console.ReadLine().Split(' ');
                h = int.Parse(s[0]);
                w = int.Parse(s[1]);
            }
            Console.WriteLine("{0}", (H-h) * (W-w));
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    ll t,i,j,n,m,l=0,r;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        if(i%3==0 || i%5==0)
        {
            l+=0;
        }
        else
        {
            l+=i;
        }
    }
    cout<<l<<"\n";
    return 0;
}



Measured memory_bytes: 3624
w, h, n = map(int, input().split(' '))
x_mi = 0
x_ma = w
y_mi = 0
y_ma = h
for _ in range(n):
    x, y, a = map(int, input().split(' '))
    if a == 1:
        if x_mi < x:
            x_mi = x
    if a == 2:
        if x_ma > x:
            x_ma = x
    if a == 3:
        if y_mi < y:
            y_mi = y
    if a == 4:
        if y_ma > y:
            y_ma = y
if y_ma - y_mi <=0 or x_ma - x_mi <= 0:
    print(0)
else:
    print((x_ma - x_mi)*(y_ma - y_mi))

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

using namespace std;

using ll = long long;

int h, w;
int maze[100][100];
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

void Dfs(int x, int y, int n) {
    for (int d = 0; d < 4; ++d) {
        int nx = x + dx[d], ny = y + dy[d];
        if (nx < 0 || ny < 0 || w <= nx || h <= ny)
            continue;
        if (maze[ny][nx] == -2) continue;
        if (maze[ny][nx] == -1 || n + 1 < maze[ny][nx]) {
            maze[ny][nx] = n + 1;
            Dfs(nx, ny, n + 1);
        }
    }
}

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

    cin >> h >> w;
    int cnt = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            char c; cin >> c;
            if (c == '.') {
                maze[i][j] = -1;
                ++cnt;
            }
            else maze[i][j] = -2;

        }
    }

    maze[0][0] = 1;
    Dfs(0, 0, 1);
    if (maze[h - 1][w - 1] == -1) cout << "-1\n";
    else cout << cnt - maze[h - 1][w - 1] << '\n';

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define all(v) (v).begin(),(v).end()
#define sz(v) (v).size()
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
bool desc_sort(const int & lhs,const int & rhs)
{
    return lhs>rhs;
}
bool desc_pii_sort(const pii & lhs , const pii & rhs)
{
    return lhs>rhs;
}
bool second_sort(const pii & lhs , const pii & rhs)
{
    pii a,b;
    a.F = lhs.S;
    a.S = lhs.F;
    b.F = rhs.S;
    b.S = rhs.F;
    return a<b;
}
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v : V) os << v << " ";
    return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
#else
    #define trace(...)
#endif


// #define int long long
#define modd 1e0



inline ll fast_expo(ll base,ll power,ll modulo=modd){
    base%=modulo;
    if (base<0LL) base+=modulo;
    ll x=base,cnt=power,ans=1LL;
    while(cnt){
        if (cnt&1LL) ans=(ans*x)%modulo;
        x=(x*x)%modulo;
        cnt>>=1LL;
    }
    // int tmp=ans;
    return ans;
}
inline ll inv(ll base,ll modulo=modd){
    return fast_expo(base,modulo-2LL,modulo);
}
#define dd long double
const dd pi = acos(-1.0);
signed main()
{
    #ifdef _SUBLIME
    ifstream cin("input.txt");
    ofstream cout("output.txt");
    #endif
    fio;
    dd sw = 2.0*pi;
    sw = sw/60.0;
    dd lw = sw/12.0;
    sw = sw - lw;
    dd a,b,h,m;
    cin>>a>>b>>h>>m;
    m = 60.0*h + m;
    dd ang = m * sw;
    a = a*a + b*b - 2.0*a*b*cos(ang);
    a = sqrt(a);
    cout<<fixed<<setprecision(15)<<a<<endl;
    return 0;
}

Measured memory_bytes: 4184
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n;
		int s;
		int count;
		while(scan.hasNext()){
			n = scan.nextInt();
			s = scan.nextInt();
			if(n == 0 && s == 0){
				break;
			}
			count = 0;
			for(int i = 0;i <= 9;i++){
				if(i > s){
					break;
				}
				count += sumInteger(i,s-i,n-1);
			}
			System.out.println(count);
		}
	}
	public static int sumInteger(int min,int lest,int depth){
		int count = 0;
		if(lest == 0 && depth == 0){
			return 1;
		}else if(min > lest || depth <= 0 || lest <= 0){
			return 0;
		}
		if(b(lest,depth)){
			return 0;
		}
		while(min <= lest){
			min+=1;
			count += sumInteger(min,lest-min,depth-1);
		}
		return count;
	}
	public static boolean b(int lest,int depth){
		boolean judge = false;
		int sum = 0;
		int j = 9;
		for(int i = 0;i < depth;i++){
			sum += j;
			j -= 1;
		}
		return (sum < lest)?true:false;
	}
}

Measured memory_bytes: 19820
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 3000050;
using namespace std;
typedef long long ll;
int a[maxn];
int b[maxn];
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i]>>b[i];
    sort(a,a+n);
    sort(b,b+n);
    ll ans;
    if(n%2){
    	ans=b[n/2]-a[n/2]+1;
	}
	else {
		ans=(b[n/2]+b[n/2-1])-(a[n/2]+a[n/2-1])+1;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 5216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vp;
typedef set<ll> si;
typedef map<string, ll> msi;
#define REP(i,a,b) \
for(ll i=ll(a);i<=ll(b);i++)
#define DEP(i,a,b) \
for(ll i=ll(a);i>=ll(b);i--)
#define TR(c, it) \
for (auto it = (c).begin(); it != (c).end(); it++)
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  
  int T;
  T=1;
  while(T--)
  {
      ll n,i,j,k,l,m;
      char c;
      cin>>n>>k;
      ll a[n];
      REP(i,0,n-1)cin>>a[i];
      string s;
      sort(a,a+n);
      ll sum=0;
      REP(i,0,k-1)sum+=a[i];
      cout<<sum;
  }
  return 0;
}

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

void solve();

int main() {

   solve();

   return 0;
}

void solve() {

   int a,b;

   cin >>a >>b;

   if (a == b) {

      cout << "a == b" << endl; 

   }
   else if (a > b) {

      cout << "a > b" << endl;

   }
   else {

      cout << "a < b" << endl;

   }

}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
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 int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

const int MAX = 2000010;

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

void COMinit() // 二項係数を求める時は前処理として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() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    COMinit();
    int r1, r2, c1, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    ll ans = COM(r1 + c1, r1);
    ans = (ans - COM(r1 + c2 + 1, r1) + MOD) % MOD;
    ans = (ans - COM(r2 + c1 + 1, r2 + 1) + MOD) % MOD;
    (ans += COM(r2 + c2 + 2, r2 + 1)) %= MOD;
    cout << ans << endl;
}

Measured memory_bytes: 47104
S = list(input())

#check

#真ん中がR
if S[1] == 'R':
    if S[0] == S[2]:
        if S[0] == 'R':
            print(3)
        else:
            print(1)
    else:
        print(2)

#真ん中がS
if S[1] == 'S':
    if S[0] == S[2]:
        if S[0] == 'R':
            print(1)
        else:
            print(0)
    else:
        print(1)


Measured memory_bytes: 8984
#[macro_export]
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,{$t :tt =>$f :expr } ) =>{$f (read_value !($iter ,$t ) ) } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .unwrap () } ;}
#[macro_export]
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,mut $var :ident :$t :tt $($r :tt ) *) =>{let mut $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,mut $var :ident $($r :tt ) *) =>{input_inner !{$iter ,mut $var :usize $($r ) *} } ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,$var :ident $($r :tt ) *) =>{input_inner !{$iter ,$var :usize $($r ) *} } ;}
#[macro_export]
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;(iter =$iter :ident ,$($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut $iter =s .split_whitespace () ;input_inner !{$iter ,$($r ) *} } ;($($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
fn main() {
    #[allow(unused_imports)]
    use std::io::Write as _;
    let __out = std::io::stdout();
    #[allow(unused_mut, unused_variables)]
    let mut __out = std::io::BufWriter::new(__out.lock());
    #[allow(unused_macros)]
    macro_rules !print {($($arg :tt ) *) =>(::std ::write !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules !println {($($arg :tt ) *) =>(::std ::writeln !(__out ,$($arg ) *) .unwrap () ) }
    #[allow(unused_macros)]
    macro_rules! echo {
        ($iter :expr ) => {
            echo!($iter, "\n")
        };
        ($iter :expr ,$sep :expr ) => {
            let mut iter = $iter;
            if let Some(item) = iter.next() {
                print!("{}", item);
            }
            for item in iter {
                print!("{}{}", $sep, item);
            }
            println!();
        };
    }
    input!(n, a: [usize; n]);
    let mut s = 0;
    for &a in a.iter() {
        s ^= a;
    }
    let b: Vec<_> = a.iter().map(|a| a ^ s).collect();
    echo!(b.iter(), " ");
}


Measured memory_bytes: 7896
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i<i##_len; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main(){
    int n; cin >> n;
    for(int i = 1;; ++i){
        if(i * i > n){
            cout << (i-1) * (i-1) << "\n";
            return 0;
        }
    }
}


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

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long

#define MAX 10000

//-----????¨????-----

//?????????????????±
struct Node {
	int key;
	Node *left, *right, *parent;
};


//-----?????°??£?¨?-----

Node *root, *NIL;

//-----??¢??°??£?¨?-----
//?????????????????????????????¨????????¨???????°????
Node* treeMinimum(Node *x) {
	while(x->left!=NIL)x=x->left;
	return x;
}

//?????????????????????????????¨???????????§?????????????????????????´¢
Node* find(Node* u, int k) {
	//??¨?????????or??????????????????????????§???????????????
	while (u != NIL && k != u->key) {
		if(k< u->key)u=u->left;
		else         u=u->right;
	}
	return u;
}

//?¬??????????????´¢ ???
Node* treeSuccessor(Node *x) {
	//??????????????????????????????????????????????????????
	if(x->right!=NIL)return treeMinimum(x->right);

	//?????????????????????????????´???
	Node* y=x->parent;
	//???????????????????±??????????????????????????????§??????????????????
	while (y != NIL && x == y->right) {
		x=y;
		y=y->parent;
	}
	return y;
}

void treeDelete(Node *z) {
	Node *y;//????????????????±?
	Node *x;//y??????

	//??????????????????????±???????
	if (z->left == NIL || z->right == NIL) y=z;
	else y = treeSuccessor(z);
}

void insert(int k) {

	//?????°??£?¨?
	Node *y = NIL;   //????????¨????????????????????????
	Node *x = root;  //??¢?´¢??????????????????
	Node *z;       //?????\????????????

				   //z??????????¨????
	z = (Node*)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	//?????????????????????????????§???????????????????????¢????????¨???????????????
	while (x != NIL) {
		y = x;
		if (z->key < x->key) {
			x = x->left;
		}
		else {
			x = x->right;
		}
	}
	//???????¢????
	z->parent = y;

	//???????????????????¢?????????????
	if (y == NIL) {
		root = z;
	}
	else {
		if (z->key < y->key) y->left = z;
		else                 y->right = z;
	}
}

//???????????????
void inorder(Node *u) {
	if (u == NIL) return;
	inorder(u->left);
	cout << " " << u->key;
	inorder(u->right);
}

//???????????????
void preorder(Node *u) {
	if (u == NIL)return;
	cout << " " << u->key;
	preorder(u->left);
	preorder(u->right);
}

//???????????¢??°
int main() {
	int n, x;
	string com;

	//??\???
	cin >> n;
	REP(i, n) {
		cin >> com;
		if (com == "insert") {
			cin >> x;
			insert(x);
		}
		else if (com == "print") {
			inorder(root);
			cout << endl;
			preorder(root);
			cout << endl;
		}
		else if (com == "find") {
			cin>>x;
			Node *t=find(root,x);
			if(t!=NIL)cout<<"yes"<<endl;
			else      cout<<"no"<<endl;
		}
	}
	cin>>n;
	return 0;
}

Measured memory_bytes: 21860
x,n=map(int,input().split())
if(n==0):
    print(x)
else:
    ar=list(map(int,input().split()))
    if x not in ar:
        print(x)
    else:           #4 5 6 7 10  {8:2;9:3}
        ar.sort()
        di={}
        for i in range(ar[0]-1,ar[n-1]+2):
            if(i not in ar):
                di[i]=abs(x-i)
        #print(di)
        ans=(2**31)
        for i in di.keys():
            if(di[i]<ans):
                k=i
                ans=di[i]
        print(k)

Measured memory_bytes: 9180
import sys
import copy


N, M = map(int, input().split())

V = []
E = []

for i in range(N):
    V.append(set())

seen = []
seen = [False] * N

count = 0
def dfs(node):
    global V
    global seen

    #注目ノードは訪問済みか?
    if seen[node]==True:
        return
    
    seen[node]=True

    for next_node in V[node]:
        dfs(next_node)
    return

for i in range(M):
    *l,  = map(int, input().split())
    V[l[0]-1].add(l[1]-1)
    V[l[1]-1].add(l[0]-1)
    E.append([l[0]-1, l[1]-1])



E_copy = copy.deepcopy(E)
V_copy = copy.deepcopy(V)
seen_copy = copy.deepcopy(seen)


for i in range(M):
    e = [E[i][0], E[i][1]]
    
    V[e[0]].remove(e[1])
    V[e[1]].remove(e[0])
    
    dfs(0)
    if (False in seen):
        count = count + 1
    seen = [False] * N
    V = copy.deepcopy(V_copy)
   
print(count)




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

typedef long long ll;
const ll MOD = 1e9+7;

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

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

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

    int n;
    cin >> n;
    vector<ll> t(n);
    for(int i=0;i<n;i++) cin >> t[i];
    ll ans = t[0];
    for(int i=1;i<n;i++){
        ans = lcm(ans,t[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long ,long long>pll;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
ll lcm(ll a, ll b) {return ((a*b)/gcd(a,b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

long long modpow(long long n, long long k, long long mod)
{
if (k == 0) return 1;
long long r = modpow(n * n % mod, k >> 1, mod);
if (k & 1) r = r * n % mod;
return r;
}

void solve(){
     ll n,w;cin >> n >> w;
     vector<ll>wi(n),v(n);
     for(int i = 0;i<n;i++)
        cin >> wi[i] >> v[i];
        ll dp[n+1][w+1];
        memset(dp,0,sizeof(dp));
     for(ll i = 0;i<n;i++){
        for(ll j = 0;j<=w;j++){
            if(j>=wi[i])
                dp[i+1][j] = max(dp[i][j],dp[i][j-wi[i]]+v[i]);
            else
                dp[i+1][j] = dp[i][j];
        }
     }
     cout << dp[n][w];
}

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


Measured memory_bytes: 82476
str1=[0 for i in range(10**6)]
str1[0]=1
str1[1]=1
for i in range(2,(10**6)):
    if str1[i]==0:
        for j in range(2,(10**6)):
            if i*j>=len(str1):
                break
            else:
                str1[i*j]=1
            
while 1 :
    try:
        x=int(input())
        count=0
        for i in range(1,x+1):
            if str1[i]==0:
                count+=1
        print(count)
        
    except EOFError:
        break

Measured memory_bytes: 15144
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
using ll = long long;
const int INF = 1e9 + 5;

void print_vector2(vector<vector<ll> >v){
    for(ll i=0;i<v.size();i++){
        for(ll j=0;j< v[i].size();j++){
            cout<<v[i][j]<<" ";
        }cout<<"\n";
    }
}

void print_vector1(vector<ll> v){
    for(ll i=0; i<v.size();i++){
        cout<<v[i]<<" ";
    }cout<<"\n";
}

ll gcd(ll a, ll b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;
    if (a == b)
        return a;
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

int main(){
    double r;
    cin>>r;
    cout<<2*r*22/7;
}


Measured memory_bytes: 3752
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

#ifdef MUTABLE
int mod;
#else
template<int mod>
#endif
struct ModInt {
  int val;
  ModInt inv() const{
    int tmp,a=val,b=mod,x=1,y=0;
    while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
    return ModInt(x);
  }
  ModInt():val(0){}
  ModInt(ll x){if((val=x%mod)<0)val+=mod;}
  ModInt pow(ll t){ModInt res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
  ModInt& operator+=(const ModInt& x){if((val+=x.val)>=mod)val-=mod;return *this;}
  ModInt& operator-=(const ModInt& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
  ModInt& operator*=(const ModInt& x){val=(ll)val*x.val%mod; return *this;}
  ModInt& operator/=(const ModInt& x){return *this*=x.inv();}
  bool operator==(const ModInt& x) const{return val==x.val;}
  bool operator!=(const ModInt& x) const{return val!=x.val;}
  bool operator<(const ModInt& x) const{return val<x.val;}
  bool operator<=(const ModInt& x) const{return val<=x.val;}
  bool operator>(const ModInt& x) const{return val>x.val;}
  bool operator>=(const ModInt& x) const{return val>=x.val;}
  ModInt operator+(const ModInt& x) const{return ModInt(*this)+=x;}
  ModInt operator-(const ModInt& x) const{return ModInt(*this)-=x;}
  ModInt operator*(const ModInt& x) const{return ModInt(*this)*=x;}
  ModInt operator/(const ModInt& x) const{return ModInt(*this)/=x;}
  static int get_mod() { return mod; }
};

#ifndef MUTABLE
using modint = ModInt<1000000007>;
#endif

modint dp[100001][13];

int main() {
  string s; cin >> s;
  int n = s.size();
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) { 
    if (s[i] == '?') {
      for (int k = 0; k < 10; ++k) {
        for (int j = 0; j < 13; ++j) {
          dp[i+1][(j*10+k)%13] += dp[i][j];
        }
      }
    }
    else {
      int d = s[i]-'0';
      for (int j = 0; j < 13; ++j) {
        dp[i+1][(j*10+d)%13] += dp[i][j];
      }
    }
  }
  cout << dp[n][5].val << endl;
}



Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define int long long
typedef pair<int,int>pii;
typedef vector<int> vi;
typedef vector<vi> vii;
const int mxN=2e5+5,MOD=1e9+7;
//did u check when n=1?
//is mxN correct?
int n,k;
vii mult(vii a,vii b){
    vii c(n,vi(n));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                c[i][j]=(c[i][j]+(a[i][k]*b[k][j])%MOD)%MOD;
            }
        }
    }
    return c;
}
vii exp(vii a,int b){
    if(b==1)return a;
    if(b&1)return mult(a,exp(a,b-1));
    vii t=exp(a,b/2);
    return mult(t,t);
}
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>k;
    vii M(n,vi(n));
    vi V(n,1);
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>M[i][j];
        }
    }
    M=exp(M,k);
    vi ans(n);
    for(int i=0;i<n;i++){
        for(int k=0;k<n;k++){
            ans[i]=(ans[i]+(M[i][k]*V[k])%MOD)%MOD;
        }
    }
    int res=0LL;
    for(int i=0;i<n;i++)res=(res+ans[i])%MOD;
    cout<<res%MOD;

    

}

Measured memory_bytes: 2944
from collections import deque

if __name__ == '__main__':
    x = [(int)(x) if x.isdigit() else x for x in input().split()]
    
    y = deque()

    for tmp in x:
        if tmp == '+':
            a = y.pop()
            b = y.pop()
            y.append(a+b)
        elif tmp == '-':
            a = y.pop()
            b = y.pop()
            y.append(b-a)
        elif tmp == '*':
            a = y.pop()
            b = y.pop()
            y.append(a*b)
        elif tmp == '/':
            a = y.pop()
            b = y.pop()
            y.append(b//a)
        else:
            y.append(tmp)

    print(y.pop())

Measured memory_bytes: 8084
def f(p):
    t = 0
    for v in data:
        w, a, b = v
        if a <= p < b:
            t += w
    else:
        if t <= 150:
            return True
        else:
            return

while True:
    n = int(raw_input())
    if n == 0: break
    data = [map(int, raw_input().split()) for i in range(n)]
    for p in sorted([v[1] for v in data]):
        if not f(p):
            print 'NG'
            break
    else:
        print 'OK'

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

#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(int i=1; i<= (int)n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,r,l) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<char,int> pci;
typedef tuple<int, int, int> tiii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

const ll INF = LONG_LONG_MAX;
const double PI = atan(1)*4;
const int MAXN = 1e3+20;
const double EPS= 1e-10;
const ll MOD = 1e9+7;
int h,w;
string pt[MAXN];
ll dp[MAXN][MAXN];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<< setprecision(2)<< fixed;
    cin>> h>> w;
    string s;
    forn(i,h){
        cin>> pt[i+1];
    }
    queue<ii> q;
    q.push(ii(1,1));
    dp[1][1]=1;
    while(!q.empty()){
        int x = q.front().fi;
        int y = q.front().se;
        q.pop();
        if(x+1<=h && pt[x+1][y-1]=='.'){
            if(dp[x+1][y]==0) q.push(ii(x+1,y));
            dp[x+1][y]+= dp[x][y]%MOD;
        }
        if(y+1<=w && pt[x][y]=='.'){
            if(dp[x][y+1]==0) q.push(ii(x,y+1));
            dp[x][y+1]+= dp[x][y]%MOD;

        }
    }
//    cout<<el;
//    for1(i,h){
//        for1(j,w){
//            cout<< dp[i][j]<< " ";
//        }
//        cout<<el;
//    }
//    cout<<el;
    cout<< dp[h][w]%MOD<<el;
}



Measured memory_bytes: 9344
def remove_duplicate(s):
    out=s[0]
    for i in range(1,len(s)):
        if s[i]!=out[-1]:
            out+=s[i]
    return len(out)
n = int(input())
# A= [int(c) for c in input().strip().split(' ')]
s = input().strip()
print(remove_duplicate(s))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int a[100];
priority_queue<double,vector<double>,greater<double> > que;
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        que.push(a[i]);
    }
    double res=0;
    while(que.size()>=2){
        double x=que.top();que.pop();
        double y=que.top();que.pop();
        que.push((x+y)/2);
    }
    printf("%.10f\n",que.top());
    return 0;
}

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

ave_down = sum(x) // n #切り捨て平均値
ave_up = -(-sum(x) // n) #切り上げ平均値

distance1 = []
distance2 = []

for i in range(n):
  distance1.append(( ave_down - x[i] ) ** 2)

for i in range(n):
  distance2.append(( ave_up - x[i] ) ** 2)

if sum(distance1) <= sum(distance2):
  print(sum(distance1))
else:
  print(sum(distance2))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int a[3];
int main()
{
	int n;
	long long R, G, B, N;
    long long count = 0;
    cin >> R >> G >> B >> N;
 
    for(long long i = 0; i <= N; i++)
	{
      for(long long j = 0; j <= N-i; j++)
	  {
        if((N >= ((R*i)+(G*j))) && ((N - ((R*i)+(G*j))) % B == 0)) 
			count++;
      }
    }
 
    cout << count << endl;
	return 0;
}


Measured memory_bytes: 3588
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

void main()
{
    long A, B;
    scan(A, B);
    long n = A + B;
    writeln((n / 2) + (n & 1));
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int k = scan.nextInt();
		int s = scan.nextInt();
		int count = 0;
		for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				if(x + y <= s && x + y + k >= s) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
}

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

using namespace std;

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

    vector<char> c(n);
    int red=0;
    for(int i=0; i<n; i++){
        cin >> c[i];
        if(c[i]=='R'){
            red++;
        }
    }

    int white=0;
    for(int i=0; i<red;i++){
        if(c[i]=='W'){
            white++;
        }
    }

    cout << white << endl;

}

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

int main() {
  int N;
  cin >> N;
  vector<int> d;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    d.push_back(a);
  }
  
  sort(d.begin(), d.end());
  int ans = 1;
  
  for (auto it = d.begin(); it < d.end()-1; it++) {
    if (*it < *(it+1)) {ans++;}
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	string s;
	ll a = 0;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		a += s[i] - '0';
	}
	a = atoi(s.c_str()) % a;
	if (a == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
int x[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",x+i);
	long long ret=1;
	int at=0;
	for(int i=0;i<a;i++){
		while(at<a&&x[i]<i*2+1-at*2){
			ret=(ret*(i+1-at))%mod;
			at++;
		}
	}
	while(at<a){
		ret=(ret*(a-at))%mod;
		at++; 
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;


int main() {
    int n;
    cin >> n;
    int temp;
    vector <int> h;
    vector <int> s;
    bool ans = true;
    for (int i = 0; i < n; i++) {
        cin >> temp;
        h.push_back(temp);
        if (i > 1) {
            if (temp - h[i - 1] < 0 && h[i - 1] - h[i - 2] < 0) {
                ans = false;
            }
        }
        if (i > 0) {
            if (temp - h[i - 1] < -1) {
                ans = false;
            }
            s.push_back(temp - h[i - 1]);
        }
    }

    int wa = 0;
    for (int i = 0; i < n - 1; i++) {
        if (s[i] < 0) {
            wa += s[i];
        }
        if (s[i] > 0) {
            wa = 0;
        }
        if (wa < -1) {
            ans = false;
        }
    }

    if (ans) {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
inline int read(){
	char c=getchar();int x=0,f=1;
	while(c<'0'||c>'9'){ if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+c-'0',c=getchar();
	return x*f;
}
int n,c[200100],b[200100],tail,f[200100],sum[200100];
int main(){
	n=read();
	for(int i=1;i<=n;++i){
		c[i]=read();
		if(c[i]!=c[i-1]) b[++tail]=c[i];
	}
	f[0]=1;
	for(int i=1;i<=tail;++i){
		(f[i]+=(sum[b[i]]+f[i-1])%mod)%=mod;
	//	cout<<i<<' '<<f[i]<<' '<<sum[b[i]]<<endl;
		sum[b[i]]=(sum[b[i]]+f[i-1])%mod;
	}
	printf("%d\n",f[tail]);
	return 0;
}


Measured memory_bytes: 3328
using System;
using System.Linq;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            // 要素数が1なら自明
            if (N == 1)
            {
                Console.WriteLine("Yes");
                return;
            }

            long[] H = Console.ReadLine().Split().Select(i => Convert.ToInt64(i)).ToArray();
            long[] dp = new long[N];
            Array.Copy(H, dp, N);

            // 先頭だけ確認
            dp[0]--;
            if (dp[0] > dp[1])
            {
                Console.WriteLine("No");
                return;
            }

            // 全走査
            for (var i = 1; i < N - 1; i++)
            {
                // 下げれるなら下げる
                if (dp[i - 1] < dp[i])
                {
                    dp[i]--;
                }
                if (dp[i] > dp[i + 1])
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 30044
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
	int n, l;
	cin >> n >> l;
	vector<string> s(n);
	for (int i = 0; i < n; i++) cin >> s[i];
	sort(s.begin(), s.end());

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define repeat_from_reverse(i, m, n) for( int i = (n) - 1; (i) >= (m); --(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t t=0; t<v.size(); ++t){cout << " " << #v << "[" << t << "]=" << v[t];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

// ユニオンファインドツリー
struct uf_tree {
    vector<int> parent;
    int internal_size;
    uf_tree(int size_) : parent(size_, -1), internal_size(size_) {}
    void unite(int x, int y) {
        if ((x = find(x)) != (y = find(y))) {
            if (parent[y] < parent[x]) swap(x, y);
            parent[x] += parent[y];
            parent[y] = x;
            internal_size--;
        }
    }
    bool is_same(int x, int y) { return find(x) == find(y); }
    int find(int x) { return parent[x] < 0 ? x : parent[x] = find(parent[x]); }
    int size(int x) { return -parent[find(x)]; }
    int size() { return internal_size; }
};

int main(void) {
    int n, k, l; cin >> n >> k >> l;
    uf_tree road(n), train(n);
    
    repeat(i, k) {
        int p, q; cin >> p >> q; --p; --q;
        road.unite(p, q);
    }
    repeat(i, l) {
        int r, s; cin >> r >> s; --r; --s;
        train.unite(r, s);
    }
   
    vector<lint> ps(n);
    repeat(i, n) {
        lint rp = road.find(i);
        lint tp = train.find(i);
        ps[i] = rp * (1e7) + tp;
    }
    sort(ps.begin(), ps.end());
    
    repeat(i, n) {
        lint rp = road.find(i);
        lint tp = train.find(i);
        lint key = rp * (1e7) + tp;
        auto lb = lower_bound(ps.begin(), ps.end(), key);
        auto ub = upper_bound(ps.begin(), ps.end(), key);
        cout << distance(lb, ub) << " ";
    }
    return 0;
}
            
    

Measured memory_bytes: 3840
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	n := nextInt()
	vv := make([]int, 0, n)

	for i := 0; i < n; i++ {
		vv = append(vv, nextInt())
	}

	sort.Sort(sort.Reverse(sort.IntSlice(vv)))

	m := vv[0]

	var sum int
	for _, item := range vv[1:] {
		sum += item
	}

	if m < sum {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include <stdio.h>
int main()
{
  int data[101],n,i;
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    scanf("%d",&data[i]);
  }
  
  for(i=n-1;i>-1;i--){
     
    if(i!=n-1){printf(" ");}
    printf("%d",data[i]); 
  }
  
  
  printf("\n");
  
  return 0;
}

Measured memory_bytes: 600
//投票数を動かして比に合わせる→1時間はまった
//比を動かして投票数に合わせる→簡単！, 投票数…あり得る組み合わせの内、和が最小のものを貪欲に推定すればよい
//今までの投票数がx, yのとき、比がa : bになった。このとき投票数は(考えられるものの最小だと）いくつ？
//x <= an, y <= bnをともに満たす自然数nのうち最小のものを取ると、an, bnになっていると考えてよい。

#include <iostream>
#define int long long
using namespace std;

int n;
int t[1000], a[1000];

signed main() {
	int i;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> t[i] >> a[i];
	
	int x = t[0];
	int y = a[0];
	for (i = 1; i < n; i++) {
		int bai = max((x + t[i] - 1) / t[i], (y + a[i] - 1) / a[i]);
		x = t[i] * bai;
		y = a[i] * bai;
	}
	cout << x + y << endl;
	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;

const int N = 5e3 + 20;

int n, k, p[N], c[N];
bool vis[N];

void reset()
{
    for(int i = 1; i <= n; i++) vis[i] = false;
}

long long go(int node)
{
    node = p[node];
    int moves = k;

    reset();
    long long cycle_sum = 0;
    vector <long long> v;
    while(not vis[node])
    {
        vis[node] = true;
        cycle_sum += c[node];
        v.push_back(cycle_sum);
        node = p[node];
    }

    long long ans = LLONG_MIN;
    for(int i = 0; i < min(moves, (int)v.size()); i++) ans = max(ans, v[i]);
    if(moves > v.size())
    {
        long long sum = ((moves - 1) / v.size()) * cycle_sum;
        for(int i = 0; i <= (moves - 1) % v.size(); i++) ans = max(ans, sum + v[i]);
    }
    return ans;
}

int main()
{
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; i++) scanf("%d", &p[i]);
    for(int i = 1; i <= n; i++) scanf("%d", &c[i]);

    long long ans = LLONG_MIN;
    for(int i = 1; i <= n; i++) ans = max(ans, go(i));
    printf("%lld", ans);
}

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

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    double s = x / a;
    double tantheta = (b - x / a / a) / a * 2;
    if(s < a * b / 2) tantheta = b * b / 2 / s;
    double ans = abs(atan(tantheta)) * 180 / 3.1415926;
    printf("%.10f\n", ans);
}


Measured memory_bytes: 256