akhauriyash/Code-Regression huggingface dataset:
x=int(input())
for n in range(1,int(x**0.5)+1):
    if x%n==0:
        for a in range(int(x**0.5)+1):
            if 5*a**4-10*a**3*n+10*a**2*n**2-5*a*n**3+n**4==x//n:
                print(str(a)+" "+str(a-n))
                break
            a=-a
            if 5*a**4-10*a**3*n+10*a**2*n**2-5*a*n**3+n**4==x//n:
                print(str(a)+" "+str(a-n))
                break
        else:
            continue
        break

Measured memory_bytes: 9460
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int h, w;
	cin >> h >> w;

	char str[100][101], frame[102][102];

	for (int i = 0; i < h; i++)
	{
		cin >> str[i];
	}



	for (int i = 0; i < h + 2; i++)
	{
		for (int j = 0; j < w + 2; j++)
		{
			frame[i][j] = '#';
		}
	}

	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			frame[i + 1][j + 1] = str[i][j];
		}
	}

	for (int i = 0; i < h + 2; i++)
	{
		for (int j = 0; j < w + 2; j++)
		{
			cout << frame[i][j];
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int ERAST_MAX = 55555;

vector<bool> erast(ERAST_MAX,true);

void erasttenesu(){
    erast[1]=false;
    erast[2]=true;
    for(int i=2;i<=ERAST_MAX;i++){
     if(erast[i]==true){
         for(int j=2;j*i<=ERAST_MAX;j++){
             erast[i*j]=false;
         }
     }
    }
}



int main() {
    erasttenesu();

    int n;
    cin>>n;
    vector<int> ans;
    int sum=2;
    ans.push_back(2);
    n--;
    for(int i=3;i<ERAST_MAX;i++){
        if(erast[i]==true){
           if(i%5==1) {
               ans.push_back(i);
               n--;
               if (n == 0)break;
           }
             }

        }

    

    rep(i,ans.size()){
        cout<<ans[i]<<" ";
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 256
cake_list = []


N, M = [int(i) for i in input().split()]

for _ in range(N):
    cake_list.append([int(i) for i in input().split()])

pattern_list = [(1, 1, 1),
                (1, 1, -1),
                (1, -1, 1),
                (-1, 1, 1),
                (1, -1, -1),
                (-1, -1, 1),
                (-1, 1, -1),
                (-1, -1, -1)]

total = []

def eval_cake(cake, pattern):
    point = 0
    for i in range(3):
        point += cake[i] * pattern[i]

    return point
        
for pat in pattern_list:
    cake_list.sort(key=lambda x:eval_cake(x, pat))
    
    eaten_cake_list = cake_list[:M]
    
    total.append(abs(sum([i[0] for i in eaten_cake_list])) + abs(sum([i[1] for i in eaten_cake_list])) + abs(sum([i[2] for i in eaten_cake_list])))

print(max(total))

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


int A, B;

void solve()
{
    cin >> A >> B;
    A = (A + 11) % 13;
    B = (B + 11) % 13;
    if(A < B) cout << "Bob" << endl;
    else if(A > B) cout << "Alice" << endl;
    else cout << "Draw" << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

void solve() {
  ll n;
  cin >> n;
  auto pm = prime_factor(n);
  ll ans = 0;
  for (auto p : pm) {
    ll sum = 0;
    for (int i = 1; i <= p.second; i++) {
      sum += i;
      if (p.second < sum) break;
      ans++;
      dump(p, sum, ans);
    }
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 3656
function read_line()
    map(x->parse(Int64, x), split(readline()))
end
function solve()
    n,k = read_line()

    p = [i for i in 1:n]

    res = n

    function find(x)
        if x != p[x]
            p[x] = find(p[x])
        end
        p[x]
    end

    function union(x, y)
        x = find(x)
        y = find(y)
        if x != y
            p[x] = y
            true
        else
            false
        end
    end

    for i in 1:k
        u,v,_ = read_line()
        if union(u, v)
            res -= 1
        end
    end

    println(res)
end
solve()


Measured memory_bytes: 168100
n, k = map(int,input().split())
s = input()

A = []
if s[0] == "0":
    A.append(0)
else:
    A.append(0)
    A.append(0)

key = int(s[0])
for i in range(n):
    if int(s[i]) == key :
        A[-1] += 1
    else:
        A.append(1)
        key = (key+1) % 2

if len(A) % 2 == 0:
    A.append(0) 

#print(A)

la = len(A)

le = -1
ri = k*2
ans = sum(A[:ri])
mans = ans
while ri < la:
    minus = A[le] if le >= 0 else 0
    plus = A[ri+1] if ri+1 <= la-1 else 0
    ans = ans - minus - A[le+1] + A[ri] + plus 
    mans = max(mans, ans)
    #print(A[le+2:ri+2],mans)
    le += 2
    ri += 2

A = [A[-(i+1)] for i in range(la)]
#print(A)

le = -1
ri = k*2
ans = sum(A[:ri])
mans = max(mans, ans)
while ri < la:
    minus = A[le] if le >= 0 else 0
    plus = A[ri+1] if ri+1 <= la-1 else 0
    ans = ans - minus - A[le+1] + A[ri] + plus 
    mans = max(mans, ans)
    #print(A[le+2:ri+2],mans)
    le += 2
    ri += 2

print(mans)

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

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

    int N;
    cin >> N;
    vector<int> A(N, INT_MAX);
    for (int i = 0; i < N - 1; ++i) {
        int B;
        cin >> B;
        A.at(i) = min(A.at(i), B);
        A.at(i + 1) = B;
    }
    int sum = 0;
    for (auto &x : A) {
        sum += x;
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b;
	cin >> a >> b;
	cout << a - b + 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
int memo[100005], arr[100005], vis[100005];
int min(int a, int b)
{
    return a<b ? a : b;
}
int dp(int n, int k)
{
    if(vis[n]==1)
        return memo[n];
    vis[n]=1;
    int mn = 1000000000;
    for(int i=n-k; i<n; i++)
        mn = min(mn, dp(i, k) + fabs(arr[n]-arr[i]));
    return memo[n] = mn;
}
int main()
{
    memset(memo, 0, sizeof(memo));
    memset(arr, 0, sizeof(arr));
    memset(vis, 0, sizeof(vis));
    int n, k;   scanf("%d %d", &n, &k);
    for(int i=0; i<n; i++)
        scanf("%d", &arr[i]);
    for(int i=0; i<k; i++)
    {
        memo[i] = fabs(arr[i]-arr[0]);
        vis[i]=1;
    }
    printf("%d\n", dp(n-1, k));
    return 0;
}

Measured memory_bytes: 6016
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 500010;
char s[N];
int n,a[N],ans;
int main(){
	//freopen("in.txt","r",stdin);
	n = 0;
	char ch = getchar();
	while (ch >= '0' && ch <= '9'){
		a[n ++] = ch - '0';
		ch = getchar();
	}
	reverse(a,a+n);
	a[n] = 0;
	bool pd = false;
	int pos = n;
	for(int i=n-1;i>=0;i--){
		if(a[i]<a[i+1]){
			if(pd){
				a[0]++;
				for(int j=0;j<pos;j++) 
					if(a[j]>=10){
						a[j+1]++;
						a[j]-=10;
					} else break;
				ans++;
				a[pos]=0;
				pos--;
				//pd=false;
				if(i==pos){
					pd = false;
					pos++;
				} 
				i++;
				
			} else{
				pos = i;
				pd = true;
			}
		
			
		} else {
			if(a[i]>0) pd = true;
			if(a[i]!=a[i+1]) pos = i;
		}
	}
	ans++;
	printf("%d\n",ans);
	return 0;
}
/*
7204647845201772120166980358816078279571541735614841625060678056933503
31
*/

Measured memory_bytes: 2176
#include<iostream>

using namespace std;
char table[310][310];
char tableT[310][310];

int main(void){
  int N;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> table[i];
    for(int j=0;j<N;j++){
      tableT[j][i]=table[i][j];
    }
  }
  int ans=0;
  for(int k=0;k<N;k++){
    bool symflag=true;
    for(int i=0;i<N;i++){
      int ikp=i+k;
      ikp = ikp>=N ? ikp-N : ikp;
      for(int j=0;j<N;j++){
        int jkn= j>=k ? j-k : j-k+N;
        symflag &= (table[i][j]==tableT[ikp][jkn]);
      }
    }
    if(symflag){
      ans+=N;
      //cout << k << endl;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

unsigned long long n, ans = 1;
vector<unsigned long long> t, a, h, s;

int main() {
	cin >> n;
	t.resize(n);
	a.resize(n);
	h.resize(n);
	Counting count(n, 1000000007);
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	unsigned long long cons = t[0], lid = 0, lmax = t[0], rmax = 0;
	for (int i = 1; i < n; i++) {
		if (cons != t[i]) {
			if(i - lid - 1 > 0)
				s.push_back(count.power(cons, i - lid - 1));
			cons = t[i];
			lid = i;
			lmax = t[i];
		}
	}
	cons = a[n - 1];
	rmax = a[n - 1];
	unsigned long long rid = n - 1;
	for (int i = n - 1; i >= 0; i--) {
		if (cons != a[i]) {
			if(rid - i - 1 > 0)
				s.push_back(count.power(cons, rid - i - 1));
			cons = a[i];
			rid = i;
			rmax = a[i];
		}
	}
	if (rid < lid || rmax != lmax) {
		cout << 0 << endl;
	//	cin >> n;
		return 0;
	}
	if(rid > lid + 1)
		s.push_back(count.power(lmax, rid - lid - 1));

	for (int i = 0; i < s.size(); i++) {
	//	cout << s[i] << endl;
		ans = (ans*s[i]) % 1000000007;
	}
	cout << ans << endl;
	cin >> n;
	return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef long double ld;
#define A 1000000007
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define M 4000
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,greater<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define bs binary_search
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

int main() 
{
    FAST;
    ll x=500000004ll,n=0;
    cin>>n;
    ve<ll> a(n);
    ll sum1=0,sum2=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum1=(a[i]+sum1)%A;
        sum2=(sum2+((a[i]*a[i])%A))%A;
    }
    sum1=(sum1*sum1)%A;
    sum1=(sum1-sum2+A)%A;
    sum1=(sum1*x)%A;
    cout<<sum1;
    subt;
    return 0;
}

Measured memory_bytes: 4776
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
	}

	void solve() {
		vector<int> a {
			1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
			1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
		};
		int K;
		cin >> K;
		cout << a[K-1] << endl;
	}
};

int main() {
	Solver().solve();
	return 0;
}


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++) 
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = INF + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 50 + 7;

int n;
pt a[N];

bool read () {
	if (scanf("%d", &n) != 1)
		return false;
	forn(i, n)
		scanf("%d%d", &a[i].x, &a[i].y);
	return true;
}

void solve() {
	map<pt, int> cnt;
	forn(i, n) forn(j, i){
		pt tmp(a[i].x - a[j].x, a[i].y - a[j].y);
		if (tmp.x < 0 || (tmp.x == 0 && tmp.y < 0))
			tmp.x = -tmp.x, tmp.y = -tmp.y;
		++cnt[tmp];
	}
	int ans = 0;
	for (auto it : cnt)
		ans = max(ans, it.y);
	printf("%d\n", n - ans);
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	
	int tt = clock();
	
#endif
	
	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef _DEBUG
	while(read()) {	
#else
	if (read()){
#endif
		solve();
		
#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}

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

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

	const long long MOD = 1000000000 + 7;
	map<int, long long> mp;
	for( int n = 1; n <= N; n++ ) {
		int nn = n;
		for( int i = 2; i * i <= nn; i++ ) {
			while( nn % i == 0 ) {
				mp[i]++;
				mp[i] %= MOD;
				nn /= i;
			}
		}
		if( nn != 1 ) {
			mp[nn]++;
			mp[nn] %= MOD;
		}
	}
	long long ans = 1;
	for( auto it = mp.begin(); it != mp.end(); it++ ) {
		ans *= it->second + 1;
		ans %= MOD;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = a; i < n; i++)
#define Repr(i, n, a) for (int i = n; i >= a; i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int sum = 0;
    rep(i, n) if (a[i] > 0) sum += a[i];
    vector<int> v1(n + 1), v2(n + 1);
    v1[0] = 0, v2[0] = 0;
    rep(i, n) v1[i + 1] = v1[i] + min(0LL, a[i]), v2[i + 1] = v2[i] + max(0LL, a[i]);
    int ans = 0;
    for (int i = 0; i + k <= n; i++)
        ans = max(ans, sum + max(v1[i + k] - v1[i], -(v2[i + k] - v2[i])));
    cout << ans << endl;
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

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

int main(){
    int a, b;
    cin >> a >> b;
    int ans = -INF;
    ans = max({ans, a+b, a-b, a*b});
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3548
import sys
input = sys.stdin.readline

n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n-2):
    if (p[i] < p[i+1] and p[i+1] < p[i+2]) or (p[i+2] < p[i+1] and p[i+1] < p[i]):
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

/*
10^100 = (10 ^ 5)^20
10^5 mod n

 */

int main()
{
    string S,T;
    cin>>S;
    int L = S.length();
    int C[L];

    for(int i = 0;i<L;i++)
    {
        C[i] = 0;
    }
    
    for(int i = 0;i<L;i++)
    {
        if(S[i] == 'R')
        {
            
            int j = i + 1;
            while(true)
            {
                if(S[j] =='L')
                {
                    C[j-1] += (j - i + 1)/2;
                    C[j] +=(j-i) - (j-i+1)/2;
                    i = j;
                    break;
                }
                j++;
            }
        }
    }

    for(int i = L -1;i > 0;i--)
    {
        if(S[i] == 'L')
        {
            
            int j = i - 1;
            while(true)
            {
                if(S[j] =='R')
                {
                    C[j+1] += (i -j  + 1)/2;
                    C[j] +=(i - j) - (i-j+1)/2;
                    i = j;
                    break;
                }
                j--;
            }
        }
    }

    for(int i = 0;i<L;i++)
    {
        cout<<C[i]<<endl;;
    }
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int X = sc.nextInt();
    
    int answer = 0;
    for(int a = 0; a<=A; a++){
      for(int b = 0; b<=B; b++){
        int c = (X - a*500 - b*100)/50;
        if(c >= 0 && c <= C){
          answer++;
        }
      }
    }
    
    System.out.println(answer);
    }
}


Measured memory_bytes: 21844
using System;
using static System.Console;
using static System.Convert;

class Program
{
    static void Main(string[] args)
    {
        var input = ReadLine().Split(' ');
        var startA = ToInt32(input[0]);
        var endA = ToInt32(input[1]);
        var startB = ToInt32(input[2]);
        var endB = ToInt32(input[3]);
        var min = Math.Min(endA, endB);
        var max = Math.Max(startA, startB);

        if (endA <= startB || endB <= startA) WriteLine(0);
        else WriteLine(min - max);
    }
}



Measured memory_bytes: 13268
n=int(input())

arr=[]
for i in range(n):
    a,b = list(input().split())
    arr.append([a,int(b),i])
arr=sorted(arr, key=lambda x: x[1], reverse=True)
arr=sorted(arr, key=lambda x: x[0])
#print(arr)
for i in arr:
    print(i[2]+1)

Measured memory_bytes: 3060
/* Author: Dhruv Rastogi */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int> 
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

void solve(){  
	double denom=0;
	int n;
	cin>>n;
	rep(i,0,n){
		int x;
		cin>>x;
		denom+=1.0/x;
	}
	cout<<fixed<<setprecision(12)<<1/denom<<endl;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(A: int, V: int, B: int, W: int, T: int):
    
    d_dif = abs(A-B)
    if d_dif==0:
        print(YES)
        return
    v_dif = V - W
    if v_dif <=0:
        print(NO)
        return
    t = d_dif/v_dif
    if t <= T:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    V = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    solve(A, V, B, W, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 61784
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//コピペするとこ



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


int main()
{
  ll n, p ;
  cin >> n >> p ;
  ll ans = 1 ;
  if(n>=50){
    cout << 1 <<endl ;
    return 0 ;
  }
  if(p==1){
    cout << 1 <<endl ;
    return 0 ;
  }
  if(n==1){
    cout << p <<endl ;
    return 0 ;
  }
  else{
    for(ll i=1;i*i<=p;i++){
      if(p%i==0){
        ll hoge = 1 ;
        for(ll j=0;j<n;j++){
          hoge *= i ;
          if(hoge>p){
            cout << ans <<endl ;
            return 0 ;
          }
        }

        if(p%hoge==0){
          ans = i ;
        }
      }
    }
  }
  cout << ans <<endl ;

  return 0 ;
}

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

int main(void){
    int h, w;
    char a[9][9];
    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> a[i];
    
    bool t[9][9];
    for (int i = 0; i < h * w; i++) {
        if (a[i / w][i % w] == '#') t[i / w][i % w] = true;
        else t[i / w][i % w] = false;
    }
    for (int i = 0; i < h; i++) t[i][w] = false;
    for (int i = 0; i < w; i++) t[h][i] = false;
    
    int k = 0;
    while (k != h * w - 1) {
        if (t[k / w + 1][k % w] && !t[k / w][k % w + 1]) {
            t[k / w][k % w] = false;
            k += w;
        }
        else if (!t[k / w + 1][k % w] && t[k / w][k % w + 1]) {
            t[k / w][k % w] = false;
            k += 1;
        }
        else {
            cout << "Impossible" << endl;
            return 0;
        }
    }
    
    for (int i = 0; i < h * w - 1; i++) {
        if (t[i / w][i % w]) {
            cout << "Impossible" << endl;
            return 0;
        }
    }
    
    cout << "Possible" << endl;
    return 0;
    
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String arg[]){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		ArrayList<Integer>adj[]=new ArrayList[m];
		for(int i=0;i<m;i++)
			adj[i]=new ArrayList<>();
		for(int i=0;i<m;i++){
			int c=sc.nextInt();
			for(int j=0;j<c;j++)
				adj[i].add(sc.nextInt());
		}
		int cnt=0;
		ArrayList<Integer> stat=new ArrayList<>();
		for(int i=0;i<m;i++)
			stat.add(sc.nextInt());
		//System.out.println(stat);
		ArrayList<Integer> curr=new ArrayList<>();
		for(int i=0;i<(1<<n);i++){
			for(int j=0;j<n;j++)
				curr.add((i>>j)&1);
		//	System.out.println(curr);
			boolean v=true;
			for(int l=0;l<m;l++){
				int cc=0;
				for(Integer k:adj[l])
					cc+=curr.get(k-1);
				
				if(cc%2!=stat.get(l))
					v=false;
			}
			//System.out.println(cc);
			if(v)
				cnt++;
			//System.out.println(cnt);
			curr.clear();
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23764
//AUTHOR: *Akash Shrivastva*
//Birla Institute of Technology,Mesra,India
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define M 1000000007
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll vector< pair <ll,ll> >
#define F first
#define S second
#define PII pair <ll,ll>
double ans=0;
void calc(ll a[],ll n,pll v)
{
	ll i,d;
	for (i=0;i<n-1;i++)
	{
		d=(double)(pow(v[a[i]].F-v[a[i+1]].F,2)+pow(v[a[i]].S-v[a[i+1]].S,2));
		ans+=sqrt(d);
	}
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
   
    ll n;cin>>n;
    ll a[n],i;
    pll v;
    for (i=0;i<n;i++)
    {
    	ll x,y;cin>>x>>y;
    	v.pb(mp(x,y));
    }
    for (i=0;i<n;i++)
    	a[i]=i;
    do
    {
    	calc(a,n,v);
    }
    while (next_permutation(a,a+n));
    ll f=1;
    for (i=1;i<=n;i++)	f=f*i;
    ans/=(double)f;
	printf("%0.10lf\n",ans);
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long[] Num = new long[N];
		long[] Den = new long[N];
		
		for(int i=0;i<N;i++){
			long d = 1;
			long n = 0;
			
			int idx = -1;
			for(int j=0;j<A[i].Length;j++){
				if(A[i][j] == '.') idx = j;
			}
			
			if(idx == -1){
				d = 1;
				n = long.Parse(A[i]);
			} else {
				d = 1;
				for(int j=idx+1;j<A[i].Length;j++) d *= 10;
				
				n = 0;
				for(int j=0;j<A[i].Length;j++){
					if(A[i][j] == '.') continue;
					n *= 10;
					n += (long)(A[i][j] - '0');
				}
			}
			
			Num[i] = n;
			Den[i] = d;
		}
		
		int[] two = new int[N];
		int[] five = new int[N];
		
		for(int i=0;i<N;i++){
			while(Num[i] % 2 == 0){
				two[i]++;
				Num[i] /= 2;
			}
			while(Num[i] % 5 == 0){
				five[i]++;
				Num[i] /= 5;
			}
			while(Den[i] % 2 == 0){
				two[i]--;
				Den[i] /= 2;
			}
			while(Den[i] % 5 == 0){
				five[i]--;
				Den[i] /= 5;
			}
		}
		
		int ofs = 64;
		int M = 64 * 2;
		int[][] cnt = new int[M][];
		for(int i=0;i<M;i++){
			cnt[i] = new int[M];
		}
		
		for(int i=0;i<N;i++){
			if(Den[i] != 1) continue;
			cnt[two[i] + ofs][five[i] + ofs]++;
		}
		
		var acc = new Acc2();
		acc.Init(cnt);
		
		long ans = 0;
		
		for(int i=0;i<N;i++){
			if(Den[i] != 1) continue;
			
			int n2 = two[i] * -1;
			int n5 = five[i] * -1;
			
			long c = acc.cal(n5 + ofs, n2 + ofs, M, M);
			ans += c;
		}
		
		long diag = 0;
		for(int i=0;i<N;i++){
			if(Den[i] == 1 && two[i] >= 0 && five[i] >= 0) diag++;
		}
		
		ans -= diag;
		ans /= 2;
		Console.WriteLine(ans);
		
		
		
	}
	int N;
	String[] A;
	public Sol(){
		N = ri();
		A = new String[N];
		for(int i=0;i<N;i++) A[i] = rs();

	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


class Acc2{
	public int H,W;
	public int[][] acc;
	public int cal(int x1,int y1,int x2,int y2){
		//return num of land [x1,x2)*[y1,y2); left-inclusive / right-noninclusive;
		if(x2 < x1 || y2 < y1) return 0;
		return acc[y2][x2] - acc[y2][x1] - acc[y1][x2] + acc[y1][x1];
	}
	public void Init(int[][] M){
		H = M.Length;
		W = M[0].Length;
		acc = new int[H+1][];
		for(int i=0;i<=H;i++){
			acc[i] = new int[W+1];
			if(i == 0) continue;
			for(int j=1;j<=W;j++){
				acc[i][j] = M[i-1][j-1];
			}
		}
		
		for(int i=1;i<=H;i++){
			for(int j=1;j<=W;j++){
				acc[i][j] += acc[i][j-1];
			}
		}
		for(int j=1;j<=W;j++){
			for(int i=1;i<=H;i++){
				acc[i][j] += acc[i-1][j];
			}
		}
	}
}

Measured memory_bytes: 44596
#!/usr/bin/env python

import sys
#from sympy import isprime

class bigint:
    def __init__(self,n,mod=10**9+7):
        self.n = n % mod
        self.mod = mod
        return
    #
    def __str__(self):
        return str(self.n)
    #
    def __add__(self,other):
        assert self.mod==other.mod, "modulos of the two not match"
        return bigint(self.n+other.n,self.mod)
    #
    def __iadd__(self,other):
        assert self.mod==other.mod, "modulos of the two not match"
        self.n = (self.n + other.n) % self.mod
        return self
    #
    def __sub__(self,other):
        assert self.mod==other.mod, "modulos of the two not match"
        return bigint(self.n-other.n,self.mod)
    #
    def __isub__(self,other):
        assert self.mod==other.mod, "modulos of the two not match"
        self.n = (self.n - other.n) % self.mod
        return self
    #
    def __mul__(self,other):
        assert self.mod==other.mod, "modulos of the two not match"
        return bigint(self.n*other.n,self.mod)
    #
    def __imul__(self,other):
        assert self.mod==other.mod, "modulos of the two not match"
        self.n = ( self.n * other.n ) % self.mod
        return self
    #
    def __pow__(self,other):
        assert type(other)==int, "power should be integer"
        #
        if other<0: return self ** ( other % ( self.mod-1 ) )
        elif other==0: return bigint(1,self.mod)
        elif other==1: return self
        elif other%2==0:
            tmp= self ** (other//2)
            return bigint( ( tmp.n**2 ) % self.mod,self.mod )
        else:
            tmp= self ** (other//2)
            return bigint( ( tmp.n**2 * self.n ) % self.mod,self.mod )
    #
    def __truediv__(self,other):
        assert self.mod==other.mod, "modulos of the two not match"
        return self * ( other ** (other.mod-2) )
    #
    def __itruediv__(self,other):
        assert self.mod==other.mod, "modulos of the two not match"
        self*= ( other ** (other.mod-2) )
        return self
    #
    def copy(self):
        return bigint(self.n,self.mod)
#
#::::::::::::::::::::::::::::::::::::::::::::::::::
n,a,b,c = [ int(x) for x in sys.stdin.readline().split() ]
h= bigint(100) ** (-1)
pa= bigint(a) * h
pb= bigint(b) * h
cc= ( bigint(100-c) * h ) ** (-1)
# power of n
cn= cc**(n+1)
an= pa**n * cn * bigint(n)
bn= pb**n * cn * bigint(n)
# for A
pam= bn
pac= pa * cc
# for B
pbm= an
pbc= pb * cc
# permutation
mbar = n
perm= [ bigint(1) ]
for m in range(1,n):
    mbar-= 1
    perm.append( perm[m-1]*bigint(mbar) )
perm.reverse()
nfact= perm[0]
#
ret= bigint(0)
ncm= bigint(1)
for m in range(n):
    if m>0:
        ncm*= bigint(n+m)
        pam*= pac
        pbm*= pbc
    #
    ret+= ncm*(pbm+pam)*perm[m]
#
print( ret/nfact )


Measured memory_bytes: 23540
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

ll L,K;
ll dp[200][101];

int main(){
    cin >> L >> K;

    ll ans = 0;

    for(ll i = 0;i * 2 + 1 <= L;i++) {
        ll n = i * 2 + 1;
        REP(j,n + 1) {
            REP(k,L + 1) {
                dp[j][k] = 0;
            }
        }
        dp[0][0] = 1;

        REP(j,n) {
            REP(k,L) {
                if(k + 1 <= L) {
                    dp[j + 1][k + 1] += dp[j][k];
                }
                if(j % 2 == 0 && k + K <= L) {
                    dp[j + 1][k + K] += dp[j][k];
                }
            } 
        }
        REP(k,L + 1) {
            ans += dp[n][k];
        }
    }
    cout << ans << endl;
}




Measured memory_bytes: 3200
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 100 * 1000 + 47;
const int MOD = 1000 * 1000 * 1000 + 7;

int n;
bool check(const string& s, char ch, int k)
{
	FOR(i, 0, n - k - 1)
	{
		if (s[i] != ch)
		{
			return false;
		}
	}

	return true;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios::sync_with_stdio(false); cin.tie(0);
	string s;
	cin >> s;
	string t = s;
	n = SZ(s);
	int ans = INF;
	if (check(s, s[0], -1))
	{
		ans = 0;
	}

	FOR(ch, 0, 26)
	{
		s = t;
		int steps = 0;
		FOR(k, 0, n)
		{
			FOR(i, 0, n - k - 1)
			{
				if (s[i] == ch + 'a' || s[i + 1] == ch + 'a')
				{
					s[i] = ch + 'a';
				}
			}

			if (check(s, ch + 'a', k))
			{
				ans = min(k + 1, ans);
				break;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP2_5_D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            int[] line = new int[n];
            for (int i = 0 ; i < n ; i++) { line[i] = i + 1; }
            var sb = new StringBuilder();
            foreach (var item in GetPermutation(line, line.Count()))
            {
                sb.AppendLine(String.Join(" ",item.Select(x => x.ToString()).ToArray()));
            }
            Console.Write(sb.ToString());
        }

        /// <summary>
        /// 配列の順列を列挙する
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="items">配列</param>
        /// <param name="r">取得数</param>
        /// <returns>配列の組み合わせの列挙</returns>
        public static IEnumerable<IEnumerable<T>> GetPermutation<T>(IEnumerable<T> items, int r)
        {
            if (r == 0)
            {
                yield return Enumerable.Empty<T>();
            }
            else
            {
                foreach (var x in items)
                {
                    var xs = items.Where(y => !y.Equals(x));
                    foreach (var c in GetPermutation(xs, r - 1)) yield return Concat(x, c);
                }
            }
        }

        public static IEnumerable<T> Concat<T>(T first, IEnumerable<T> items)
        {
            yield return first;
            foreach (var i in items) yield return i;
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int a,b,c;
	cin >> a >> b >> c;
	if((a+b+c)>=22){
		cout << "bust\n";
	}else{
		cout << "win\n";
	}
	return 0;
}

Measured memory_bytes: 256
list1 = []
for i in range(1, 11):
    list1.append(input())

for x in range(1, 11):
    for y in range(0, 9):
        if list1[y] < list1[y+1]:
            temp = list1[y]
            list1[y] = list1[y+1]
            list1[y+1] = temp

print(list1[0])
print(list1[1])
print(list1[2])




Measured memory_bytes: 4656
#include "iostream"
#include "vector"
#include "iomanip"
#include "algorithm"
#include "vector"
#include "cmath"

typedef struct {
	int num;
	bool open;
}Bingo;

int main() {
	std::vector<std::vector<Bingo>> a(3, std::vector<Bingo>(3));
	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < 3; ++j) {
			std::cin >> a[i][j].num;
			a[i][j].open = false;
		}

	int n;
	std::cin >> n;

	std::vector<int> b(n);
	for (int i = 0; i < n; ++i) {
		std::cin >> b[i];
		for (int j = 0; j < 3; ++j)
			for (int k = 0; k < 3; ++k)
				if (a[j][k].num == b[i])
					a[j][k].open = true;
	}

	bool ans = false;
	for (int i = 0; i < 3; ++i) {
		if (a[i][0].open && a[i][1].open && a[i][2].open)
			ans = true;
		if (a[0][i].open && a[1][i].open && a[2][i].open)
			ans = true;
	}
	if (a[0][0].open && a[1][1].open && a[2][2].open)
		ans = true;
	if (a[0][2].open && a[1][1].open && a[2][0].open)
		ans = true;

	if (ans)
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  
  int n, a[110], i, j;

  scanf("%d", &n);

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

    scanf("%d", &a[i]);

  }

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

    printf("%d", a[n - 1 - i]);

    if(i < n - 1){

      printf(" ");

    }

  }

  printf("\n");

  
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
template<typename T>
void print_to(std::ostream &os,const char *,const char *tail,const T &fst){
  os<<fst<<tail;
}
template<typename Fst,typename... Rst>
void print_to(std::ostream &os,const char *del,const char *tail,const Fst &fst,const Rst &... rst){
  os<<fst<<del;
  print_to(os,del,tail,rst...);
}
template<typename Iter>
void print_to_(std::ostream &os,const char *del,const char *tail,Iter bgn,Iter end){
  for(Iter it=bgn;it!=end;){
    os<<*it;
    if(++it!=end)os<<del;
    else os<<tail;
  }
}
template<typename Fst,typename... Rst>
void println(const Fst &fst,const Rst &... rst){
  print_to(std::cout,"\n","\n",fst,rst...);
}
template<typename Fst,typename... Rst>
void print(const Fst &fst,const Rst &... rst){
  print_to(std::cout," ","\n",fst,rst...);
}
template<typename Iter>
void println_(Iter bgn,Iter end){
  print_to_(std::cout," ","\n",bgn,end);
}
using namespace std;
const ll MOD=(ll)1e9+7;
//const ll inf=(ll)1e14;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
int n,m,h,w;
string s;
ll mae[100001];
ll ato[100001];

ll inverse(ll a){
  ll now=MOD-2;
  ll res=1;
  while(now!=0){
    if(now&1)res=(res%MOD)*(a%MOD)%MOD;
    now>>=1;
    a=(a%MOD)*(a%MOD)%MOD;
  }
  return res;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  ll a,b;
  cin>>h>>w>>a>>b;
  ll now=1;
  ll left=b-1;
  //cerr<<1<<endl;
  for(int i=0;i<h-a;i++){
    mae[i]=now;
    //cerr<<11<<endl;
    left++;
    //cerr<<12<<endl;
    now=((now%MOD)*(left%MOD))%MOD;
    //cerr<<13<<endl;
    now=((now%MOD)*(inverse(i+1)%MOD))%MOD;
    //cerr<<14<<endl;
  }
  //cerr<<2<<endl;
  now=1;
  left=w-b-1;
  for(int i=0;i<h;i++){
    if(h-i-1<h-a){ato[h-i-1]=now;}
    left++;
    now=((now%MOD)*(left%MOD))%MOD;
    now=((now%MOD)*(inverse(i+1)%MOD))%MOD;
    //print(now);
  }
  //cerr<<3<<endl;
  //println_(mae,mae+h-a);
  //println_(ato,ato+h-a);
  ll ans=0;
  for(int i=0;i<h-a;i++){
    ans+=((mae[i]%MOD)*(ato[i]%MOD))%MOD;
    ans+=MOD;
    ans%=MOD;
  }
  print(ans);
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}






Measured memory_bytes: 1664
N,Y = map(int,input().split())
for i in range(min(N+1,Y//10000 + 1)):
    for j in range(N+1-i):
        if 10000 * i + 5000 * j + 1000 * (N-i-j) == Y:
            print(i,j,N-i-j)
            exit(0)
print(-1,-1,-1)
        
        

Measured memory_bytes: 9116
#include<bits/stdc++.h>
using namespace std;
#define int long long
main(){
    string a,b;
    cin>>a>>b;
    int pos=0;
    int ans=0;
    for(int i=0;b[i];++i){
        pos=a.find(b[i],pos);
        if(pos==string::npos){
            pos=a.find(b[i],0);
            if(pos==string::npos){
                puts("-1");
                return 0;
            }
            ans++;
        }
        pos++;
    }
    cout<<ans*(a.length())+pos<<endl;
}


Measured memory_bytes: 640
#define f first
#define s second
#define loop(a,b) for(int i=a;i<b;i++)
#define vi vector<int>
#define vvi vector<vi>
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define ll long long
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define loop2(a,b) for(int j=a;j<b;j++)
#define str_in cin.ignore(numeric_limits<streamsize>::max(), '\n')
#define sz(a) int(a.size())

//#define all(c)\
c.begin(),c.end()
#define tr(container,it)\
for(__typeof(container.begin()) it=container.begin();it!=container.end();it++)
#include<bits/stdc++.h>

using namespace std;

const int mod = 1e+9 + 7;

int dif(int a, int b) {
	if (a >= b) return(a-b);
	else return(b-a);
}
int min(int a, int b) {
	if (a <= b) return(a);
	else return(b);
}
int dp[1000001],N,h[1000000];

void solve() {
	cin >> N;
	loop(0, N) {
		cin >> h[i];
	}
	dp[0] = 0; dp[1] = dif(h[0], h[1]);
	loop(2, N) {
		dp[i] = min(dp[i - 1] + dif(h[i], h[i - 1]), dp[i - 2] + dif(h[i], h[i - 2]));
	}
	cout << dp[N - 1] << '\n';
//	loop(0,N) cout << dp[i] << ' ';
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int t = 1;
//	cin >> t;
	while (t--) solve();
	return 0;
}

Measured memory_bytes: 4736
class Main:
    def __init__(self):
        self.N = int(input())

    def dfs(self, ret, cur, f1, f2, f3):
        if self.N < cur:
            return ret

        ret += 1 if f1 and f2 and f3 else 0

        ret = self.dfs(ret, cur * 10 + 7, True, f2, f3)
        ret = self.dfs(ret, cur * 10 + 5, f1, True, f3)
        ret = self.dfs(ret, cur * 10 + 3, f1, f2, True)

        return ret

    @staticmethod
    def main():
        main = Main()
        print(main.dfs(0, 0, False, False, False))


Main.main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000050
#define ll long long
#define MOD 1000000007
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()

unordered_map<int,unordered_set<int> >mp;
int arr[MAX], mx;
vector<int>divis[MAX];

void sieve(int n)
{
    for(int i = 1; i <= n; i++)
    {
        for(int j = i; j <= n; j += i)
        {
            divis[j].push_back(i);
        }
    }
}

int main()
{
    int n, v;
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &v);
        arr[i] = v;
        mx = max(mx, v);
        mp[v].insert(i);
    }
    sieve(mx);
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        bool fnd = 0;
        for(int v : divis[arr[i]])
        {
            if(mp.find(v) != mp.end())
            {
                if(mp[v].size() > 1 || (mp[v].count(i) != 1)) fnd = 1;
            }
            if(fnd) break;
        }
        if(fnd == 0) ans++;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 148364
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner scan = new Scanner(System.in);
		String w, t, end = "END_OF_TEXT";
		int ans = 0;
		
		w = scan.next();
		while (true) {
			t = scan.next(); if (t.equals(end)) break;
			if (t.equalsIgnoreCase(w)) ans++;
		}
		
		// 出力
		System.out.println(ans);
	}
}



Measured memory_bytes: 26300