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

using namespace std;

int main()
{
    int dh[4] = {1,0,-1,0};
    int dw[4] = {0,1,0,-1};
    int H,W;
    cin >> H >> W;
    vector<vector<char>>c(H,vector<char>(W,' '));
    int bcount = 0;
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            cin >> c[i][j];
            if(c[i][j] == '#') bcount++;
        }
    }
    vector<vector<int>>dist(H,vector<int>(W,-1));
    dist[0][0] = 0;
    queue<pair<int,int>>que;
    que.push(pair(0,0));
    while(!que.empty())
    {
        pair<int,int>p = que.front();
        que.pop();
        for(int i = 0; i < 4; i++)
        {
            pair<int,int>np = pair(p.first + dh[i], p.second + dw[i]);
            if((np.first >= H)||(np.first < 0)||(np.second >= W)||(np.second < 0)) continue;
            if(dist[np.first][np.second] != -1) continue;
            if(c[np.first][np.second] == '#') continue;
            dist[np.first][np.second] = dist[p.first][p.second] + 1;
            que.push(np);
        }
    }
    if(dist[H-1][W-1] == -1) 
    {
        cout << -1 << endl;
        return 0;
    }
    cout << H*W - (dist[H-1][W-1] + 1) - bcount << endl;
    return 0;
}

Measured memory_bytes: 3624
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
#define fir first
#define sec second
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, s, k, ans, sum, a[1000000], d[10000];
bool f;
struct Edge { LL to, cost; };
vector<Edge>vec[10000];
string str;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
void DIUX(LL s) {
	for (int i = 0; i < 10000; i++)
		d[i] = INF;
	d[s] = 0;
	priority_queue<Pll, vector<Pll>, greater<Pll>> pq;
	pq.push(make_pair(d[s], s)); // (cost,頂点番号) 
	while (!pq.empty()) {
		Pll pp;
		pp = pq.top();
		LL cos = pp.first, vv = pp.second;
		pq.pop();
		if (d[vv] < pp.first)continue;
		for (int i = 0; i < vec[vv].size(); i++) {
			if (vec[vv][i].cost + d[vv] < d[vec[vv][i].to]) {
				d[vec[vv][i].to] = vec[vv][i].cost + d[vv];
				pq.push(make_pair(d[vec[vv][i].to], vec[vv][i].to));
			}
		}
	}
}

int main() {
	cin >> n;
	rep(i,n)
		rep(j, n) {
		LL x;
		cin >> x;
		vec[i].push_back(Edge{ j,x });
		ans += x;
	}
	rep(i, n) {
		DIUX(i);
		rep(j, n) {
			if (vec[i][j].cost != d[j])
				f = 1;
		}
	}
	if (f){
		cout << -1 << endl;
		return 0;
	}
	else {
		rep(i, n)
			rep(j, n) {
			bool F = 0;
			rep(k, n) 
				if (k != i&&k != j)
					if (vec[i][j].cost == vec[i][k].cost + vec[j][k].cost)
						F = 1;
				if (F)ans -= vec[i][j].cost;
		}
	}
		cout << ans/2 << endl;
	return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int W, H, N;
    cin >> W >> H >> N;
    vector<vector<int>> v( H, vector<int>( W ) );
    for( int i = 0; i < N; ++i )
    {
        int x, y, a;
        cin >> x >> y >> a;
        if( a == 1 )
        {
            for( int j = 0; j < H; ++j )
            {
                for( int k = 0; k < x; ++k )
                {
                    v[ j ][ k ] = 1;
                }
            }
        }
        if( a == 2 )
        {
            for( int j = 0; j < H; ++j )
            {
                for( int k = x; k < W; ++k )
                {
                    v[ j ][ k ] = 1;
                }
            }
        }
        if( a == 3 )
        {
            for( int j = 0; j < y; ++j )
            {
                for( int k = 0; k < W; ++k )
                {
                    v[ j ][ k ] = 1;
                }
            }
        }
        if( a == 4 )
        {
            for( int j = y; j < H; ++j )
            {
                for( int k = 0; k < W; ++k )
                {
                    v[ j ][ k ] = 1;
                }
            }
        }
    }
    int cnt{};
    REP( i, H )
    {
        REP( j, W )
        {
            cnt += !v[ i ][ j ];
        }
    }
    cout << cnt << endl;
    return 0;
}

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


int main(){
    int x, y, z, tmp;

    cin >> x >> y >> z;
    
    tmp = x;
    x = y;
    y = tmp;

    tmp = x;
    x = z;
    z = tmp;

    printf("%d %d %d\n", x, y, z);

    return 0;

}

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

Measured memory_bytes: 1164
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define srep(i) for(int i = 0; i < s.size(); i++)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
const int MOD = 1000000009;

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

int main() {
    int N, X[105], minv = INF;
    cin >> N;
    rep(i, N) cin >> X[i];

    for(int i = 0; i < 100; i++) {
        int sum = 0;
        for(int j = 0; j < N; j++) {
            sum += pow(X[j] - i, 2.0);
        }
        minv = min(minv, sum);
    }
    cout << minv << endl;
}

Measured memory_bytes: 256
class Acc2D:
    def __init__(self, a):
        h, w = len(a), len(a[0])
        self.acc2D = self._build(h, w, a)

    def _build(self, h, w, a):
        ret = [[0] * (w + 1) for _ in range(h + 1)]
        for r in range(h):
            for c in range(w):
                ret[r + 1][c + 1] = ret[r][c + 1] + ret[r + 1][c] - \
                    ret[r][c] + a[r][c]
        return ret

    def get(self, r1, r2, c1, c2):
        # [r1,r2), [c1,c2) : 0-indexed
        acc2D = self.acc2D
        return acc2D[r2][c2] - acc2D[r1][c2] - acc2D[r2][c1] + acc2D[r1][c1]


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())

    G = [[0] * 101 for _ in range(101)]
    # G[p2][p5]

    data = []
    for _ in range(N):

        *a, = input().rstrip().split('.')

        lena = 0
        p2, p5 = 0, 0
        if len(a) > 1:
            a[1] = a[1].rstrip('0')
            lena = len(a[1])
            a[0] = a[0] + a[1]
            p2 = p5 = -lena

        c = int(a[0])
        if c:
            while c % 2 == 0:
                c //= 2
                p2 += 1
            while c % 5 == 0:
                c //= 5
                p5 += 1

        p2 += 40
        p5 += 40
        G[p2][p5] += 1
        data.append((p2, p5))

    acc2d = Acc2D(a=G)

    ans = 0
    for p2, p5 in data:
        ans += acc2d.get(80 - p2, -1, 80 - p5, -1)
        if p2 >= 40 and p5 >= 40:
            ans -= 1
    ans //= 2
    print(ans)


if __name__ == '__main__':
    main()

# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 85648
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<limits>
#include<stack>
#include<array>
#include<stdio.h>
#include<cstring>

using namespace std;

typedef unsigned long long ll;
typedef pair<int,int> ii;
typedef vector<pair<int,int> > vii;
typedef vector<vii> vvii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;

int INF = 1000000009; //std::numeric_limits<int>::max();
ll LLINF = 1e15;
int NINF = std::numeric_limits<int>::min();
int MOD = 1e9+7;

int col[] = {1,0,-1,0,1,1,-1,-1};
int row[] = {0,1,0,-1,1,-1,1,-1};

//knight moves
int cc[] = {1,2,2,1,-1,-1,-2,-2};
int rr[] = {-2,-1,1,2,-2,2,1,-1};


int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //ios::sync_with_stdio(0);
    //cin.tie(0);

    int n;
    cin >> n;

    vll cumsum(n+1,0);
    vll slimes(n+1);

    cumsum[0] = 0;

    for(int i = 1 ; i <= n ; ++i)
        {
            cin >> slimes[i];
            cumsum[i] = cumsum[i-1]+slimes[i];
        }

    vvll dp(401,vll(401,0));

    for(int j = 2; j <= n ; ++j)
    {
        for(int i = 1; i <= n-j+1 ; ++i)
        {
            int clmn = i+j-1;

            ll rangeDiff = cumsum[clmn]-cumsum[i-1];

            dp[i][clmn] = 1e18;
            for(int k = i ; k < clmn; ++k)
            dp[i][clmn] = min(dp[i][clmn], rangeDiff + dp[i][k] + dp[k+1][clmn]);
        }
    }

    /*for(int i = 0 ; i <n ; ++i)
    {
        for(int j = 0 ; j < n ; ++j)
            cout << dp[i][j] << "   ";
        cout << endl;
    }*/


    cout << dp[1][n];

    return 0;
}


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

int main(){
    int K,A,B;
    cin >> K >> A >> B;
    int C = A / K,D = B / K;
    if (C != D || (A % K == 0 || B % K == 0)){
        cout << "OK" << endl;
    }
    else {
        cout << "NG" << endl;
    }
}

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

typedef long long ll;
const int N = 2000005;
const ll MOD = 1e9+7;

string s;
int x,y;
bool pud[N],plr[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	cin>>s;
	
	
	cin>>x>>y;
	
	if(s.size())reverse(s.begin(),s.end());
	while(!s.empty() && s[(int)s.size()-1] == 'F'){
		x--;
		s.pop_back();
	}
	
	if(s.size())reverse(s.begin(),s.end());
	vector<int> ud,lr;
	s += 'T';
	x = abs(x);
	y = abs(y);
	bool dr = true;
	int n = s.size();
	int cnt = 0;
	for(int i=1;i<n;i++){
		if(s[i] == 'T'){
			if(dr){
				ud.push_back(cnt);
			}else{
				lr.push_back(cnt);
			}
			cnt = 0;
			dr ^= 1;
		}
		else{
			cnt++;
		}
	}
	/*
	for(int x:ud){
		cout<<x<<" ";
	}cout<<endl;
	for(int x:lr){
		cout<<x<<" ";
	}
	cout<<endl;
	*/
	
	int lst = 0;
	pud[0] = 1;
	for(int xx:ud){
		for(int i=lst;i>=0;i--){
			if(pud[i])pud[i+xx] = true;
		}
		lst += xx;
	}
	int hano = (lst-y);
	if(hano %2 != 0 || hano < 0){
		cout<<"No"<<endl;
		return 0;
	}
	if(!pud[hano/2]){
		cout<<"No"<<endl;;
		return 0;
	}
	lst  = 0;
	plr[0] = 1;
	for(int xx:lr){
		for(int i=lst;i>=0;i--){
			if(plr[i])plr[i+xx] = true;
		}
		lst += xx;
	}
	hano = (lst-x);
	if(hano %2 != 0 || hano < 0){
		cout<<"No"<<endl;
		return 0;
	}
	if(!plr[hano/2]){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

ll myceil(ll a, ll b) {
    if(a % b == 0) return a / b;
    return (a + (b - a%b)) / b;
}

int main() {
    int N; cin >> N;
    ll ansT = 0, ansA = 0;
    ll t, a;
    cin >> t >> a;
    ansT = t, ansA = a;
    rep(i, N - 1) {
        cin >> t >> a;
        ll add = max(myceil(ansT, t), myceil(ansA, a));
        ansT = add * t;
        ansA = add * a;
    }
    cout << ansT + ansA << endl;
}


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

bool cmp(int a, int b)
{ 
    return a > b;
}

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

    int a[200000+5]={0};

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

    sort(a+1, a+200000+1, cmp);
    int count = 0;

    for (int i=k+1; i<=200000; i++) count += a[i];

    cout << count << endl; 
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
// #define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pii a, pii b)//true for a before b
{
	if(a.S < b.S)
		return 1;
	if(a.S > b.S)
		return 0;
	if(a.F <= b.F)
		return 1;
	return 0;
}

const int N = (2e5) + 9;
const int M = (672*672) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 900;

pll a[N];

void solve()
{
	int n, i;
	ll sum = 0;
	cin >> n;
	fo(i,1,n+1)
		cin >> a[i].S >> a[i].F;
	sort(a+1,a+n+1);
	fo(i,1,n+1)
	{
		sum += a[i].S;
		if(sum > a[i].F)
		{
			cout << "No\n";
			return;
		}
	}
	cout << "Yes\n";
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	// io_file;
	// srand(clock());

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(15);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n;
  cin >> n;
  int64 sum = 0;
  vector<int64> xs(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
    sum += xs[i];
  }

  int min_arg = -1;
  int64 min_value = INT64_MAX;
  for (int i = 0; i < n; i++) {
    if (abs(sum - xs[i] * n) < min_value) {
      min_arg = i;
      min_value = abs(sum - xs[i] * n);
    }
  }
  cout << min_arg << endl;
}

Measured memory_bytes: 256
import unittest
import functools


class TestD(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(4, 1, 3), 7)

    def test_2(self):
        self.assertEqual(think(1000000000, 141421, 173205), 34076506)


def solve():
    n, a, b = read()
    result = think(n, a, b)
    write(result)


def read():
    return read_int(3)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(n, a, b):
    mode = 10 ** 9 + 7

    result = pow(2, n, mode) - 1
    if result < 0:
        result += mode
    result -= combi(n, a, mode)
    if result < 0:
        result += mode
    result -= combi(n, b, mode)
    if result < 0:
        result += mode
    return result


def write(result):
    print(result)


def combi(n, a, mode):
    numer = functools.reduce(lambda x, y: (x * y) % mode, range(n, n - a, -1))
    denom = functools.reduce(lambda x, y: (x * y) % mode, range(1, a + 1))
    return (numer * pow(denom, mode - 2, mode)) % mode


def fact(n, mode=None):
    result = 1
    for i in range(1, n + 1):
        result *= i
        if mode:
            result %= mode
    return result


if __name__ == '__main__':
    # unittest.main()
    solve()

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

const int MAXN=1e6+5;
int fail1[MAXN],fail2[MAXN];//the max length in 0~i that prefix==suffix
//indicate the place to go when mismatching
void FF(string& pattern,int fail[]){
   fail[0]=0;
   for(int i=1;i<pattern.size();i++){
      fail[i]=fail[i-1];
      while(fail[i]>0&&pattern[fail[i]]!=pattern[i])
         fail[i]=fail[fail[i]-1];
      if(pattern[fail[i]]==pattern[i]) fail[i]++;
   }
}



int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	int n=s.size();
	FF(s,fail1);
	reverse(s.begin(),s.end());
	FF(s,fail2);
	if(fail1[n-1]==n-1){
		cout<<n<<endl<<1<<endl;
	}
	else if(fail1[n-1]==0||n%(n-fail1[n-1])!=0){
		cout<<1<<endl<<1<<endl;
	}
	else{
		int cnt=0;
		for(int i=0;i<n-1;i++){
			int j=n-i-2;
			if((i==0||fail1[i]==0||(i+1)%(i+1-fail1[i])!=0)&&(j==0||fail2[j]==0||(j+1)%(j+1-fail2[j])!=0))
				cnt++;
		}
		cout<<2<<endl<<cnt<<endl;
	}
}


Measured memory_bytes: 6940
#include <iostream>
#include <fstream>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <iterator>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=1e5+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,m,d;
    cin>>n>>m>>d;
    ld q=(n-d)*2;
    if(!d){
        q=n;
    }
    ld z=1.0/n/n;
    cout<<fixed<<setprecision(6)<<z*q*(m-1);
    return 0;
}


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

int main(){

    int n, k;
    cin >> n >> k;
    double ans = 0;
    for(int i = 1; i <= n; i++){
        int I = i;
        double tmp = 1;
        while(I < k){
            I *= 2;
            tmp *= 0.5;
        }
        ans += tmp;
    }
    printf("%.9f\n", ans / n);
    return 0;
}


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

#define watch(x) cout << (#x) << " = " << x << endl;
#define mkp make_pair
#define mkt make_tuple
#define pb push_back
#define ll long long
#define ld long double

using namespace std;

int h, w;
long long dp[1010][1010];
char c[1010][1010];
const int MOD = 1e9 + 7;

int main(){
	scanf("%d%d", &h, &w);

	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			scanf(" %c", &c[i][j]);
		}
	}

	dp[0][0] = 1;
	for(int i = 1; i < h; i++) if(c[i][0] != '#') dp[i][0] = dp[i - 1][0];
	for(int i = 1; i < w; i++) if(c[0][i] != '#') dp[0][i] = dp[0][i - 1];

	for(int i = 1; i < h; i++){
		for(int j = 1; j < w; j++){
			if(c[i][j] != '#') dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			dp[i][j] %= MOD;
		}
	}

	cout << dp[h - 1][w - 1];

	return 0;
}

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

int main() {

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

	int ans = 10000;
	for (int i = 0; i < S.size() - T.size() + 1; i++) {
		int cnt = 0;
		for (int j = 0; j < T.size(); j++){
			if (S[i + j] != T[j]) cnt++;
		}
		ans = min(ans, cnt);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
using namespace std;

int main() {

    int x, y;
    cin >> x >> y;

    cout << x + y / 2 << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD=1000000007;

int main() {
  int N;
  cin>>N;
  bool error=false;
  int64_t ans=0;
  vector<int64_t> S(N+1);
  vector<int64_t> T(N+1);
  for(int i=0;i<=N;i++)cin>>S.at(i);
  T.at(N)=S.at(N);
  for(int i=N-1;i>0;i--) T.at(i)=T.at(i+1)+S.at(i);
  T.at(0)=1;
  for(int i=1;i<=N;i++){
    T.at(i)=min(T.at(i),2*T.at(i-1)-2*S.at(i-1));
    if(T.at(i)<1) error=true;
  }
  if(error||T.at(N)<S.at(N)) cout<<-1;
  else{
    for(int i=0;i<=N;i++){
      ans+=T.at(i);
    }
    cout<<ans<<endl;
  }
 
}



Measured memory_bytes: 4832
import static java.util.Arrays.deepToString;

import java.util.Arrays;
import java.util.Calendar;
import java.util.Scanner;

import javax.swing.plaf.basic.BasicComboBoxUI.ComboBoxLayoutManager;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		for (;sc.hasNext();) {
			int y1 = sc.nextInt();
			int m1 = sc.nextInt();
			int d1 = sc.nextInt();
			int y2 = sc.nextInt();
			int m2 = sc.nextInt();
			int d2 = sc.nextInt();
			if (y1 == -1) break;
			
			Calendar cal1 = Calendar.getInstance();
			cal1.set(y1, m1 - 1, d1, 0, 0, 0);
			
			Calendar cal2 = Calendar.getInstance();
			cal2.set(y2, m2 - 1, d2, 0, 0, 0);
			long dd = (cal2.getTime().getTime() - cal1.getTime().getTime()) / (1000 * 60 * 60 * 24);
			System.out.println(dd);
		}
	}
}

Measured memory_bytes: 20120
import sys

ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nms = lambda: map(str, sys.stdin.readline().split())
nl = lambda: list(nm())

n = ni()
l = [nl() for i in range(n)]
dp = [[-1, -1, -1] for i in range(n + 1)]
dp[0] = [0, 0, 0]
dp[1] = [l[0][0], l[0][1], l[0][2]]

for i in range(1, n + 1):
    dp[i][0] = max(dp[i-1][1] + l[i-1][0], dp[i-1][2] + l[i-1][0])
    dp[i][1] = max(dp[i-1][2] + l[i-1][1], dp[i-1][0] + l[i-1][1])
    dp[i][2] = max(dp[i-1][0] + l[i-1][2], dp[i-1][1] + l[i-1][2])
print(max(dp[n]))


Measured memory_bytes: 47336
#Toll Gates
N,M,X = map(int,input().split())
A = list(map(int,input().split()))
judge = 1
k = 0
n1 = 0; n2 = 0

for i in range(N+1):
    if i == A[k] and judge == 1:
        n1 += 1
        if k != M-1:
            k += 1
    if i == A[k] and judge == 2:
        n2 += 1
        if k != M-1:
            k += 1
    if i == X:
        judge = 2
print(min(n1,n2))

Measured memory_bytes: 3064
#template
def inputlist(): return [int(k) for k in input().split()]
#template
N = int(input())
A = inputlist()
dic = {}
li = [int(i) for i in range(1,N+1)]
for i in range(N):
    dic[A[i]] = i+1
lia = []
for i in range(1,N+1):
    lia.append(dic[i])
print(*lia)

Measured memory_bytes: 24668
#include <stdio.h>

int main (void){

int ai,i,n,min,max;

long sum;


sum=0;

min=1000000;

max=-1000000;

scanf("%d",&n);

for(i=1;i<=n;i++){

scanf("%d",&ai);

sum+=ai;


if(max<ai){max=ai;}


if(min>ai){min=ai;}


}


printf("%d %d %lld\n",min,max,sum);


return 0;


}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std ; 
#define ll long long
#define flp(i ,a ,b) for(int  i = a ; i<b ; i++)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define blp(i, a , b) for(int  i = a ; i>=b ; i--)
#define lol 1000000007

ll a[101] , b[101] ; 
ll c[102][100002]   ; 

ll dp(ll n , ll w )
{	if(c[n][w]!=-1)
	{	
		
		return c[n][w] ; 
	}

	if(n==0 || w==0)
	{
		c[n][w] = 0 ; 
		
		return c[n][w] ;
	}

	if(b[n-1]>w)
	{
			c[n][w]=dp(n-1 , w);
	}
	else
	{	
		c[n][w] =  max(a[n-1] + dp(n-1 , w-b[n-1]), dp(n-1 , w));
	}
	return c[n][w] ; 
}

int main()
{	ios ; 
	ll n , w ; 
	cin>>n>>w; 
	memset(c , -1 ,  sizeof c) ; 
	flp(i,0,n)
	{
		cin>>b[i]>>a[i] ; 
	}
	cout<<dp(n, w)<<"\n";


}


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

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

long long MOD = 1000000000 + 7;

bool comparex(pii x, pii y){
  return x.first < y.first;
}
bool comparey(pii x, pii y){
  return x.second < y.second;
}

int main(){
  cout << setprecision(10);
  int N;
  cin >> N;
  vector<pii> A(N), B(N);
  for(int i = 0; i < N; i++){
    int x,y;
    cin >> x >> y;
    A.at(i) = make_pair(x,y);
  }
  for(int i = 0; i < N; i++){
    int x,y;
    cin >> x >> y;
    B.at(i) = make_pair(x,y);
  }

  sort(A.rbegin(), A.rend(), comparey);
  sort(B.begin(), B.end(), comparex);

  cerr << A[0].first << " " << A[0].second << endl;

  map<int, int> m;
  int ans = 0;
  for(int i = 0; i < N; i++){
    int b_x = B.at(i).first;
    int b_y = B.at(i).second;
    bool flg = false;
    for(int j = 0; j < N; j++){
      if(m.count(j) == 0){
        int a_x = A.at(j).first;
        int a_y = A.at(j).second;
        if(a_x < b_x && a_y < b_y){
          ans++;
          m[j] = 1;
          flg = true;
          break;
        }
      }
    }
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define maxc 100005
#define maxn 105
using namespace std;

int dp[maxc] = {};
int n, W;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> W;
    for(int i = 0; i < n; i++) {
        int w, v; cin >> w >> v;
        for(int j = W; j >= w; j--) {
            dp[j] = max(dp[j], dp[j - w] + v);
        }
    }
    cout << dp[W] << '\n';
    return 0;
}


Measured memory_bytes: 4372
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))


int s[11];
int n = 0;
int ans = 0;

void dfs(int i, int sum, int now) {
	if (i == n - 1) {
		ans += sum + now;
	}
	else {
		dfs(i + 1, sum + now, s[i + 1]);
		dfs(i + 1, sum, now * 10 + s[i + 1]);
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string str; cin >> str;
	n = str.size();
	rep(i, str.size()) {
		s[i] = str.at(i) - '0';
	}
	dfs(0, 0, s[0]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/perl

my ($n) = map { $_ - 0 } split(/\s+/,<STDIN>);
my $s = <STDIN>;

my $cnt = 0;
my $prev = '';
for(my $i=0;$i<$n;$i++){
  my $c = substr($s,$i,1);
  $cnt += 1 if $c ne $prev;
  $prev = $c;
}
print "$cnt\n";



Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n;
    cin>>n;
    vector<LP> as(n);
    rep(i, n) {
        ll a;
        cin>>a;
        as[i].fi = a; as[i].se = i;
    }
    sort(rng(as));
    reverse(rng(as));
    vvl dp(n, vl(n, -INF));
    dp[0][n - 1] = 0;
    rep(i, n) rep(j, i + 1) {
        ll l = j, r = n - i + j - 1;
        if (l + 1 < n) chmax(dp[l + 1][r], dp[l][r] + as[i].fi * abs(as[i].se - l));
        if (r - 1 >= 0) chmax(dp[l][r - 1], dp[l][r] + as[i].fi * abs(as[i].se - r));
    }
    ll ans = 0;
    rep(i, n) rep(j, n) chmax(ans, dp[i][j]);
    cout<<ans<<endl;
}

Measured memory_bytes: 34616
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int w, h, k;
int memo[1 << 12][4][50][50];
int mask;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
char field[64][64];

bool check(int ny, int nx)
{
	return (0 <= ny && ny < h && 0 <= nx && nx < w);
}

int getMax(int bit, int left, int ty, int tx)
{
	if (memo[bit][left][ty][tx] != -1) return (memo[bit][left][ty][tx]);
	
	if (ty == h - 1 && tx == w - 1 && left == 0){
		return (0);
	}
	
	int px = tx, py = ty;
	bool same = false;
	for (int i = 0; i < 2 * k; i++){
		px += -dx[(bit >> (2 * i)) & 3];
		py += -dy[(bit >> (2 * i)) & 3];
		if (px == tx && py == ty){
			same = true;
			break;
		}
	}
	
	int ret = 0;
	
	if (!same && field[ty][tx] != '.') ret += field[ty][tx] - '0';
	
	int val = -999999;
	for (int i = 0; i < 4; i++){
		if (left == 0 && i >= 2) break;
		int nx = tx + dx[i], ny = ty + dy[i];
		if (check(ny, nx) && field[ny][nx] != '#'){
			val = max(val, getMax(((bit << 2) | i) & mask, left - (i >= 2), ny, nx) + ret);
		}
	}
	
	return (memo[bit][left][ty][tx] = val);
}

int main()
{
	scanf("%d %d %d", &h, &w, &k);
	
	mask = (1 << (4 * k)) - 1;
	
	for (int i = 0; i < h; i++){
		scanf("%s", field[i]);
	}
	
	memset(memo, -1, sizeof(memo));
	
	int res = getMax(0, k, 0, 0);
	
	printf("%d\n", res < 0 ? 0 : res);
	
	return (0);
}

Measured memory_bytes: 161048
#include<bits/stdc++.h>
#define MAX 1e9
using namespace std;

typedef long long ll;

void
chmin(int *arrdp, int cost, int index)
{
  if(cost < arrdp[index]){
    arrdp[index] = cost;
  }
  return;
}

int
main(void)
{

  int n; cin >> n;
  int k; cin >> k;
  int arrh[100010];for(int i = 0; i < n; ++i)cin >> arrh[i];
  int arrdp[100010];for(int i = 0; i < n; ++i)arrdp[i] = MAX;
  arrdp[0] = 0;

  for(int i = 1; i < n; ++i){
    for(int j = 1; j <= k && i - j >= 0; ++j){
      chmin(arrdp, arrdp[i - j] + abs(arrh[i - j] - arrh[i]), i);
    }
  }

  cout << arrdp[n - 1] << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
 
#define MOD 1000000007
 
int main() {
    int n = 0;
    long long ans = 1;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) {
        ans = (ans * i) % MOD;
    }
    printf("%lld\n", ans);
 
    return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }

int main()
{
	int n, m;
	ll k;
	cin >> n >> m >> k;
	vector<ll> a(n + 1, 0), b(m + 1, 0);
	rep(i, 0, n)cin >> a[i + 1], a[i + 1] += a[i];
	rep(i, 0, m)cin >> b[i + 1], b[i + 1] += b[i];
	int ans = 0;
	rep(i, 0, n + 1) {
		ll time = a[i];
		if (a[i] > k)continue;
		ans = max(ans, i + (int)(lower_bound(all(b), k - time + 1) - b.begin() - 1));
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
 
#define oo 1e9
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO ios_base::sync_with_stdio(false); cin.tie(0)
#define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa))
#define cntbit(xxxx) __builtin_popcount(xxxx)
#define getbit(xxxx,aaaa) ((xxxx>>(aaaa-1))&1)
#define _cos(xxxx) cos(xxxx*acos(-1)/180)
#define _sin(xxxx) sin(xxxx*acos(-1)/180)
#define _tan(xxxx) tan(xxxx*acos(-1)/180)
#define PE cout<<fixed
 
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,long long> plll;
 
const ld pi=acos(-1);
const ll mod=1e9+7;

ll fact[500009],f[500009],n,m,a,b,i,res,j;

ll GTN(ll x,ll y) {
    if (y==0) {
        return 1;
    }
    else {
        ll tmp=GTN(x,y/2);
        if (y%2==0) {
            return (tmp*tmp)%mod;
        }
        else {
            return (((tmp*tmp)%mod)*x)%mod;
        }
    }
}

ll calc(ll x,ll y) {
    return (fact[x]*GTN(((fact[y]*fact[x-y])%mod),mod-2))%mod;
}

int main() {
    IO;
    cin>>n>>m>>a>>b;
    fact[0]=1;
    for (i=1;i<=200000;i++) {
        fact[i]=(fact[i-1]*i)%mod;
    }
    for (i=b+1;i<=m;i++) {
        f[i]=calc(n-a-1+i-1,i-1);
    }
    for (i=b+1;i<=m;i++) {
        res=(res+f[i]*calc(a-1+m-i,m-i))%mod;
    }
    /*
    for (i=1;i<=n;i++) {
        for (j=1;j<=m;j++) {
            cout<<calc(i-1+j-1,j-1)<<' ';
        }
        cout<<'\n';
    }
    */
    cout<<res<<'\n';
}
    

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

#define ull unsigned long long
#define ll long long


int main(){
    string s;
    cin >> s;

    int count=0, ans=0;
    for(int i=0; i<(int)s.length(); ++i){
        count=0;
        if(s[i]=='A' || s[i]=='G' || s[i]=='C' || s[i] =='T'){
            int j=i;
            while(j<(int)s.length()){
                if(s[j]=='A' || s[j]=='G' || s[j]=='C' || s[j] =='T'){
                    count++;
                    j++;
                }
                else
                    break;
            }
            ans = max(ans, count);
        }
    }
    cout << ans;
}

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

int main(){
    using namespace std;
    unsigned long M;
    cin >> M;
    unsigned long dig{~0UL}, sm{~0UL};
    for(unsigned long i{0}, d, c; i < M; ++i){
        cin >> d >> c;
        dig += c;
        sm += d * c;
    }
    cout << dig + sm / 9 << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin>>s;
  vector<string>de={"dream", "dreamer", "erase","eraser"};
  int idx=s.length();
  bool flag=1;
  while(idx!=0)
  {
    if(idx>=5&&(s.substr(idx-5,5)==de[0]||s.substr(idx-5,5)==de[2])){idx-=5;continue;}
    if(idx>=6&&s.substr(idx-6,6)==de[3]){idx-=6;continue;}
    if(idx>=7&&s.substr(idx-7,7)==de[1]){idx-=7;continue;}
    flag=0;
    break;
  }
  if(flag)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;


  return 0;

}


Measured memory_bytes: 512
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

    int r;
    cin >> r;

    cout << 3 * r * r << endl;

    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] joshi = new int[N-1];
		int[] buka_cnt = new int[N] ;
		for(int i = 0;i<N-1;i++) {
			joshi[i] = sc.nextInt();
		}
		for(int i = N-2;i>=0;i--) {
			buka_cnt[joshi[i]-1]++;
		}
		for(int j :buka_cnt) {
			System.out.println(j);
		}
	}

}

Measured memory_bytes: 62816
//JSD
#include<iostream>
#include<vector>
#include<set>
using namespace std;
int main(){
	string s; set<char > st;
	cin>>s;
	for(int i=0;i<s.length();i++) st.insert(s[i]);
	if(st.size()==2) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

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

    vector<int> v(100010, 0);
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        v[a]++;
        v[a + 1]++;
        if (a != 0) {
            v[a - 1]++;
        }
    }

    sort(v.begin(), v.end(), greater<int>());
    cout << v[0] << endl;

    return 0;
}


Measured memory_bytes: 768
eval"K,*X,j=#{`tr -! ,`}l=1
x,y,*s=X.map &:abs
d=x+y
x,y=y,x if f=x<y
K%2<d%2&&p(-1)+exit
d!=K&&(l+=[~-d/K,1].max
l+=1&d-K*l
v=K>(t=K*l-d>>1)?0:t-t=K
a=K-t
2.upto(l){s<<(u=f ?-t:a)<<a-t-u
a+=q=[x+v-a,K].min
t-=K-q})
p l,*s.map{_1.*X[j^=1]<=>0.1}+X"

Measured memory_bytes: 29824
#include<stdio.h>
int main(void){
	int n,m,s,w=0;
	unsigned int cnt=0;
	short a[100000];
	scanf("%d%d",&n,&m);
	for(int i=0;i<n-1;i++){
		scanf("%d",&s);
		a[i]=s;
	}
	for(int i=0;i<m;i++){
		scanf("%d",&s);
		for(int j=0;j<s;j++){
			cnt+=a[w++];
		}
		for(int j=0;j>s;j--){
			cnt+=a[--w];
		}
		cnt%=100000;
	}
	
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 908
#include <bits/stdc++.h>
#define pb push_back
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
#define INF 3000000000000001 // 3e15
#define ll_max 9000000000000000000
#define PI 3.14159265358979323846L
#define fill(a, n, x) for(int i = 0; i < n; i++) a[i] = x;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define db(args...) {string _ss = #args; replace(_ss.begin(), _ss.end(), ',' , ' '); stringstream ___s(_ss) ; debug(___s, args);}
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
ll mod = 1000000007;
const ll N = 1000001;
const ll M = 1;

struct point
{
    ll x, y;
};

void debug(stringstream &s) {}
template <typename T, typename... Args>
void debug(stringstream &s, T a, Args... args)
{
    string word;
    s >> word;
    cerr << word << " = " << a << endl;
    debug(s, args...);
}

ll gcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = gcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

vector<ll> p;
void SoE(ll n)
{
    bool Primes[n + 1];
    Primes[0] = Primes[1] = 0;
    for(ll i = 2; i < n + 1; i++)
        Primes[i] = 1;
    for(ll i = 2; i * i <= n; i++)
    {
       if(Primes[i] == 1)
       {
           for(ll j = i; i * j <= n; j++)
           {
               Primes[i * j] = 0;
           }
       }
    }
    for(ll i = 2; i < n + 1; i++)
    {
        if(Primes[i])
        {
            p.push_back(i);
        }
    }
}

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    int test = 0;
    while(_--)
    {
        test++;
        ll n, m, x, y, ans = INF, k;
        cin >> n;
        cout << !n << "\n";
    }
    return 0;
}


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

int main() {
    int a, b, c, d;

    cin >> a >> b >> c >> d;

    int tmp = 0;

    if (a < b) {
        tmp += a;
    }
    else {
        tmp += b;
    }

    if (c < d) {
        tmp += c;
    }
    else {
        tmp += d;
    }

    cout << tmp << endl;

    return 0;
}

Measured memory_bytes: 256
import Data.List
import Data.Array.IArray

solve :: [Int] -> Int
solve a = dp!(n,0)
  where
    n = length a
    aa = listArray (1,n) a :: Array Int Int
    k = ((1,0),(n,1))
    dp = listArray k $ map f (range k) :: Array (Int,Int) Int
    f (1,0) = aa!1
    f (1,1) = aa!1 * (-1)
    f (i,0) = max (dp!(i-1,0) + (aa!i)) (dp!(i-1,1) - (aa!i))
    f (i,1) = max (dp!(i-1,0) - (aa!i)) (dp!(i-1,1) + (aa!i))

main :: IO ()
main = do
    _ <- getLine
    a <- map read . words <$> getLine :: IO [Int]
    print $ solve a

Measured memory_bytes: 92540
<?php
// Here your code !
# $ans = ($a+$b)/($c-$d)
$n = intval(trim(fgets(STDIN)));
$a = explode(' ',trim(fgets(STDIN)));
sort($a);

$ans = 0.0;
$array = range(1, $n);
foreach ($array as $i) {
    $cd = @$a[$i] - $a[$i-1];

    if ($i == $n-1) {
        $ab = $a[$n-3] + $a[$n-4];
    } elseif ($i == $n-2) {
        $ab = $a[$n-1] + $a[$n-4];
    } else {
        $ab = $a[$n-1] + $a[$n-2];
    }
    $ans=max($ans, $ab/$cd);

}
echo $ans . "\n";

exit(0);

Measured memory_bytes: 15724
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
bool isPrime(int n){
    rep(i, 2, sqrt(n) + 1){
        if(i > 3){
            i++;
        }
        if(!(n % i)){
            return false;
        }
    }
    return true;
}
main(){
    INCANT;
    int q, l, r, tmp, res = 0;
    string s;
    int v[111111] = {};
    for(int i = 3; i < 111111; i += 2){
        v[i] = v[i - 2];
        if(isPrime(i) && isPrime(i / 2 + 1)){
            v[i]++;
        }
    }
    in(q);
    tmp = 111111 - q;
    while(q--){
        in(l, r);
        print(v[r] - v[max(0LL, l - 2)]);
    }
    while(tmp--){
        res++;
    }
}


Measured memory_bytes: 1536
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//



int main() {
	int N;
	cin >> N;
	
	int rem = N;
	Vec< int > ans;
	while (rem) {
		int lb = 0, ub = 10000;
		while (ub - lb > 1) {
			int med = (ub + lb) / 2;
			if (rem <= med * (med + 1) / 2) ub = med;
			else lb = med;
		}
		ans.push_back(ub);
		rem -= ub;
	}
	reverse(allof(ans));
	for (int x : ans) cout << x << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//


Measured memory_bytes: 384