akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>

using namespace std;

const int N = 100;

int num[N];

void insertSort(int num[], int n) {
	for (int i=0; i<n; ++i) {
		int j, ns = num[i];
		for (j=i-1; j>=0 && ns<num[j]; --j) num[j + 1] = num[j];
		num[j + 1] = ns;
		for (j=0; j<n; ++j) {
			if (j) printf (" ");
			printf ("%d", num[j]);
		}
		printf ("\n");
	}
}

int main() {
	int n;
	while (scanf("%d", &n) != EOF) {
		for (int i=0; i<n; ++i) scanf ("%d", &num[i]);
		insertSort(num, n);
	}
	return 0;
}

Measured memory_bytes: 0
s,a,b=[set(map(int,input().split()))for j in[0]*3];c=1;N=M=0;k=x=max(a)
while k:A=k in a;B=k in b;N+=A;M+=B;c*=[M*N-x+k,N,M,1][A*2+B];c%=10**9+7;k-=1
print(c)


Measured memory_bytes: 41580
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <climits>
#include <math.h>
#include <memory.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
ll ans = 0LL;
int i_index;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};
string board[64];
int main(){
    int x; cin >> x;
    int ans = 0;
    //b
    rrep(i, 1, 1001){
        //p
        rrep(p, 2, 1001){
            int b = pow(i, p);
            if(b <= x){
                ans = max(ans, b);
            }
            else{
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N,M; cin >> N >> M;
  ll a[N],b[N],c[M],d[M]; 
  rep(i,0,N) cin >> a[i] >> b[i];
  rep(i,0,M) cin >> c[i] >> d[i];
  
  rep(i,0,N) {
    ll ans =INF;
    int num;
    rep(j,0,M) {
      ans = min(ans,abs(a[i]-c[j])+abs(b[i]-d[j]));
    }
    rep(j,0,M) {
      if(ans == abs(a[i]-c[j])+abs(b[i]-d[j])) {
        num = j; break;
      }
    }
    cout << num + 1 << endl;
  }
}

Measured memory_bytes: 3588
#include<stdio.h>
int main()
{
  int n ;
  scanf("%d",&n);
  if(n % 10 == 3) printf("bon\n");
  else if(n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) printf("pon\n");
  else printf("hon\n");
}  

Measured memory_bytes: 1660
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
#define MAX 10000000

int b[110];
struct edge{int from, to, cost;};

int solve(edge a[10010], int n, int nn){
	b[0] = 0;
	while(1){
		int update = 0;
		for(int i = 0;i < nn;i++){
			if(b[a[i].from] != MAX && b[a[i].to] > b[a[i].from] + a[i].cost){
				b[a[i].to] = b[a[i].from] + a[i].cost;
				update = 1;
			}
		}
		if(update == 0)break;
	}
	return 0;
}

int main(){
	int n, nn = 0;
	edge a[10010];
	fill(b, b+110, MAX);
	cin >> n;
	for(int i = 0;i < n;i++){
		int u, k, c, d;
		cin >> u >> k;
		for(int j = 0;j < k;j++){
			cin >> c >> d;
			a[nn].from = u;
			a[nn].to = c;
			a[nn++].cost = d;
		}
	}
	
	solve(a, n, nn);
	for(int i = 0;i < n;i++){
		cout << i << " " << b[i] << endl;
	}
	
	return 0;
}
/*
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
*/

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

using namespace std;

static const int INF = 1e9 + 7;

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

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int a, b, c;
	cin >> a >> b >> c;
	int d = a % b;
	set<int> nums;
	int k = d;
	do {
		nums.insert(k);
		if (k == c) {
			cout << "YES\n";
			return;
		}
		k += d;
		k %= b;
	} while (!nums.count(k));
	cout << "NO\n";
}

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


Measured memory_bytes: 512
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;


struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

struct Edge {
	int a;
	int b;
	ld len;
	ld cost;
};

double len_sum = 0, cost_sum = 0;
bool check(int N,ld ratio, vector<Edge>&es) {
	sort(es.begin(), es.end(), [&](
		const Edge&l, const Edge&r) {
		return l.cost - l.len*ratio>
			r.cost - r.len*ratio;
	});
	UnionFind uf(N);
	double len_use = 0;
	double cost_use = 0;
	for (int i = 0; i < es.size(); ++i) {
		if (uf.root(es[i].a) != uf.root(es[i].b)) {
			len_use += es[i].len;
			cost_use += es[i].cost;
			uf.unionSet(es[i].a, es[i].b);
		}
	}
	return (cost_sum - cost_use) / (len_sum - len_use) > ratio;
}
int main() {
	int N, M; cin >> N >> M;
	vector<Edge>es;
	for (int i = 0; i < M; ++i) {
		int a, b;ld c, d; cin >> a >> b >> c >> d;
		es.push_back(Edge{ a,b,c,d });
		len_sum += c;
		cost_sum += d;
	}
	if (N == M + 1)cout << 0 << endl;
	else {
		ld amin = -7;
		ld amax = 7;
		int k = 50;
		while (k--) {
			ld amid = (amin + amax) / 2;
			if (check(N, powl(10, amid), es)) {
				amin = amid;
			}
			else {
				amax = amid;
			}
		}
		cout <<fixed<<setprecision(10)<< powl(10, amin) << endl;
	}
	return 0;
}

Measured memory_bytes: 3976
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int group(int i)
{
    if (i == 2)
        return 2;
    if (i == 11 || i == 4 || i == 6 || i == 9)
        return 1;
    return 0;
};

void solveSingleCase(int caseNo)
{
    int x, y;
    cin >> x >> y;
    cout << (group(x) == group(y) ? "Yes" : "No") << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

const long long MOD = 1000000007;
long long N;
long long a[100000] = {0};

int main() {
  cin >> N;
  long long ans = 1;
  rep(i, N) {
    long long A;
    cin >> A;
    long long temp;
    if(A == 0) {
      temp = 3 - a[A];
    } else {
      temp = a[A-1] - a[A];
    }
    ans =  ans * temp % MOD;
    a[A]++;
  }
  if(ans <= 0) cout << 0 << endl;
  else cout << ans << endl;
  return 0;
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int n; cin >> n;
  vector<int> w(n);
  rep(i,n) cin >> w[i];

  int sum = 0;
  rep(i,n) sum+=w[i];
  
  int ans = INF;
  int s1 = sum,s2 = 0;
  rep(i,n){    
    s1-=w[i];
    s2+=w[i];
    ans = min(ans,abs(s1-s2));
  }

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


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n; cin >> n;
   int all = 0;
   vector<int> A;
   rep(i,n){
      int a; cin >> a;
      all ^= a;
      A.push_back(a);
   }
   rep(i,n){
      cout << (all ^ A[i]) << " ";
   }
}

Measured memory_bytes: 4256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

int main(){
    int a, b;
    cin >> a >> b;
    cout << ((a * b % 2 == 0) ? "Even" : "Odd") << endl;
    return 0;
}


Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/
#include<bits/stdc++.h>
// #include <iostream>

using namespace std;

int main()
{
    string s;
    cin>>s;
    char r = 'R';
    int ans = 0;
    for(auto i :s)
    {
        if(i==r&&i=='R')
        ans++;
        else if(ans==0&&i=='R')
        ans++;
        r = i;
    
    }cout<<ans;

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(int i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
	ll n,a,b;
	cin>>n>>a>>b;
	ll z = a+b;
	ll c = n/z;
	ll ans = c*a;
	ans += min(n%z,a);
	cout<<ans<<Endl;
	return 0;
}


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

const long long int MOD = 1000000007;

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

    vector<vector<long long int>> dp(100001, vector<long long int>(13));
    // dp[n][ ] = # of possible n letters
    // dp[ ][r] =                         with % 13 = r
    dp[0][0] = 1;

    for(int i=0; i<s.length(); i++){// i-th letter of s
        /**********************************************/
        for(int j=0; j<10; j++){
            // do something when s[i] == '?' or j
            if(s[i] != '?' && j != s[i] - '0') continue;// need char -> int
            for(int k=0; k<13; k++){
                dp[i + 1][(k * 10 + j) % 13] += dp[i][k];// **...**k -> **...**kj
            }
        }
        /*********************************************/

        for (int l=0; l<13; l++){
            dp[i + 1][l] %= MOD;
        }
    }

    cout << dp[s.length()][5] << endl;
    return 0;
}

Measured memory_bytes: 13696
#include<iostream>
#include<utility>
#include<vector>

using namespace std;

int main(){

	int N,temp,a2,counta=0;


	cin >>N;
	//vector < pair <int ,bool >> M(N);
	int M[100001];
	bool can[100001]={0},ca1=1;;

	for(int i=1; i<=N; i++){

		cin >>a2;



		M[i]=a2;

		temp=M[1];


	}

//	for(int i=1; i<=N; i++)cout <<"aa" << i <<" " <<M[i]<<endl;

	while(1){

		if(temp==2){

			cout <<counta+1 <<endl;
			return 0;
		}

		if(can[temp]!=1){

			can[temp] =1;
			temp=M[temp];
			counta++	;
			
		}
		else{
			 cout <<-1<<endl;
			 return 0;

		}


		

	}



}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int N;
vector<double> x;
vector<double> y;

int main() {
    cout << fixed << setprecision(10);
    cin >> N;
    x.resize(N);
    y.resize(N);
    REP(i, N) {
        cin >> x[i];
        cin >> y[i];
    }

    int M = 1;
    FOR(i, 1, N + 1) {
        M *= i;
    }

    double sum = 0;
    REP(i, N) {
        FOR(j, i + 1, N) {
            sum += sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2)) * (M / N) * 2;
        }
    }
    cout << sum / M;

    return 0;
}

Measured memory_bytes: 256
#define ONLINE_JUDGE
#include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>
#include <cmath>
#include <iterator>
#include <map>
#include <set>
#ifndef ONLINE_JUDGE
#include <prettyprint/prettyprint.hpp>
#endif

#define FOR(i, n) for(int i = 0; i < n; ++i)
#define TEST int T; std::cin >> T; while(T--)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using vll = std::vector<ll>;
using vull = std::vector<ull>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	ifstream fin("in.txt");
	ofstream fout("out.txt");
	auto cinbuf = cin.rdbuf(fin.rdbuf());    // save and redirect
	auto coutbuf = cout.rdbuf(fout.rdbuf()); // save and redirect
#endif	
	int n;
	cin >> n;

	vector<int> costs(n), heights(n);

	for(auto& e : heights) {
		cin >> e;
	}

	costs[n - 1] = 0;
	if(n - 2 >= 0) {
		costs[n - 2] = abs(heights[n - 1] - heights[n - 2]);
	}

	for(int i = n - 3; i >= 0; --i) {
		costs[i] = min(costs[i + 1] + abs(heights[i] - heights[i + 1]),
					   costs[i + 2] + abs(heights[i] - heights[i + 2]));
	}

	cout << costs[0] << endl;
#ifndef ONLINE_JUDGE
	cin.rdbuf(cinbuf);    // restore
	cout.rdbuf(coutbuf); // restore
#endif	
}


Measured memory_bytes: 1024
def main():
  N=int(input())
  N_100=N//100
  N_10=(N-N_100*100)//10
  N_1=(N-N_100*100)-N_10*10
  if(N_1==3):
    print('bon')
  elif((N_1==0) or (N_1==1) or(N_1==6) or (N_1==8)):
    print('pon')
  else:
    print('hon')
  
if __name__ == '__main__':
    main()

Measured memory_bytes: 61664
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
ll facctorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

ll vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
    }
    else { // 発見できなかったとき
        return 0;
    }
}

int main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    
    vector<ll> a, b, c;
    
    ll ans = 0;
    rep(i, n){
        b.clear();
        if(vector_finder(a, s[i])){
            continue;
        }else{
            a.push_back(s[i]);
        }
        For(j, i+1, n){
            c.clear();
            if(vector_finder(b, s[j])){
                continue;
            }else{
                b.push_back(s[j]);
            }
            For(k, j+1, n){
                if(vector_finder(c, s[k])){
                    continue;
                } else {
//                    cout << s[i] << s[j] << s[k] << endl;
                    c.push_back(s[k]);
                    ans ++;
                }
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  int N;
  N = S.size();
  
  if (S.at(N-1) == 's') {
    cout << S << "es" << endl;
  }
  else
    cout << S << "s" << endl;
}

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

int main(){
  int N;
  int M;

  cin >> N >> M;

  int count = 0;
  for(int i = 1;i <= N; i++){
    for(int j = 1; j <= M; j++){
      count++;
    }
  }

  int max_patern = 0;
  max_patern = ((N+M) * (N+M-1)) / 2;

  int patern = 0;
  patern = max_patern - count;
  
  cout << patern << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;
 
 
 class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();	
        String[] a = new String[N];
        for (int i=0 ; i<N; i++) {
            a[i] = sc.next();
        }
        Arrays.sort(a);
        int ans=1;
        for(int i=0;i<N-1;i++) {
        	if(!a[i].equals(a[i+1]))ans++;
        }
    	
    	
    	System.out.println(ans);
    	
        		
    }
}

Measured memory_bytes: 69860
words = lambda t : list(map(t, input().split()))
n = int(input())
xs = words(int)

s_xs = sorted(xs)
ans = False
if s_xs == xs:
    ans = True
else:
    for i in range(n-1):
        for j in range(i,n):
            f_xs = xs.copy()
            tmp = f_xs[i]
            f_xs[i] = f_xs[j]
            f_xs[j] = tmp
            if s_xs == f_xs:
                ans = True
                break
        if ans == True:
            break
if ans == True:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3064
from collections import Counter

n=int(input())
a=list(map(int,input().split()))

min_v=min(a)
max_v=max(a)

c=Counter(a)

ans=0
for i in range(min_v,max_v+1):
  t_ans=c[i-1]+c[i]+c[i+1]
  ans=max(ans,t_ans)

print(ans)

Measured memory_bytes: 14564
#include <stdio.h>

int main () {
  int n,res=0;
  int perm[21];
  scanf("%d", &n);

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

  for(int i=0; i< (n-2) ; i++)
  {
    if( (perm[i]<perm[i+1]) && (perm[i+1]<perm[i+2])  )
    {
      res++;
    }
    else if( (perm[i+2]<perm[i+1]) && (perm[i+1]<perm[i]) )
      res++;
  }
  printf("%d\n", res);



  return 0;
}


Measured memory_bytes: 128
def resolve():
    s = int(input())
    # s = (10**9 * y3 - x3 * 1)
    x2, y2 = 10 ** 9, 1
    y3 = -(-s // 10 ** 9)
    x3 = y3 * 10 ** 9 - s
    print(0, 0, x2, y2, x3, y3)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 2940
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
    int a1,a2,a3;
    cin>>a1>>a2>>a3;
    int x1=abs(a2-a1)+abs(a3-a2);
    int x2=abs(a3-a1)+abs(a2-a3);
    int x3=abs(a1-a2)+abs(a3-a1);
    int x4=abs(a3-a2)+abs(a1-a3);
    int x5=abs(a1-a3)+abs(a2-a1);
    int x6=abs(a2-a3)+abs(a1-a2);
    int ans=101;
    ans=min(ans,x1);
    ans=min(ans,x2);
    ans=min(ans,x3);
    ans=min(ans,x4);
    ans=min(ans,x5);
    ans=min(ans,x6);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int r;cin>>r;
  cout<<r*r<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

int main()
{
    int D, N;
    cin >> D >> N;
    if(N == 100){
        if(D== 0){
            cout << 101 << endl;
        }
        else if(D == 1){
            cout << 10100 << endl;
        }
        else{
            cout << N * 10000 + 10000 << endl;
        }
    }
    else if (D == 0)
    {
        cout << N << endl;
    }
    else if (D == 1)
    {
        cout << N * 100 << endl;
    }
    else
    {
        cout << N * 10000 << endl;
    }
}


Measured memory_bytes: 256
// C.

#include <iostream>
#include <vector>

using namespace std;

typedef long long LL;

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }

int main(int argc, char *argv[])
{
	int n;
	cin >> n;
	LL ans = 1, t;
	for (int i = 0; i < n; ++i) {
		cin >> t;
		LL g = gcd(ans, t);
		ans = (ans / g) * t;
	}
	cout << ans << endl;
	return 0;
}


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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 2e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////

const int N = 1e6 + 5;

int DP[N], PS[N];

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));

	int n, sum; cin >> n;
	DP[0] = DP[1] = 1;
	sum = DP[0] + DP[1];
	for (int i = 2; i < n; i++) {
		DP[i] = (sum - DP[i - 2] + MOD) % MOD;
		sum = (sum + DP[i]) % MOD;
	}
	int ans = 1LL * sum * (n - 1) % MOD;
	for (int i = 1; i + 1 <= n; i++) ans = (ans + 1LL * DP[i - 1] * (1LL * (n - 1) * (n - 1) % MOD) % MOD) % MOD;
	cout << ans + 1 << endl;

	return 0;
}


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


void solve(long long N, long long K, long long R, long long S, long long P, std::string T){
    const array<ll, 3> score{R, S, P};
    const string names = "spr";
    vector<array<ll, 3>> dp(N); // rsp
    for(ll i = N - 1; i >= 0; --i){
        REP(j, 3){
            dp.at(i).at(j) = score.at(j) * (T.at(i) == names.at(j));
        }
        if(i + K < N){
            REP(j, 3){
                dp.at(i).at(j) += max(dp.at(i + K).at((j + 1) % 3), dp.at(i + K).at((j + 2) % 3));
            }
        }

    }
    ll ans = 0;
    REP(i, K){ ans += *max_element(dp.at(i).begin(), dp.at(i).end()); }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long R;
    scanf("%lld",&R);
    long long S;
    scanf("%lld",&S);
    long long P;
    scanf("%lld",&P);
    std::string T;
    std::cin >> T;
    solve(N, K, R, S, P, T);
    return 0;
}


Measured memory_bytes: 2816
// Tazoe

#include <iostream>
using namespace std;

int main()
{
while(true){
	int y1, m1, d1, y2, m2, d2;
	cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
if(y1<0||m1<0||d1<0||y2<0||m2<0||d2<0)  break;
	int sum = 0;
	for(int i=y1; i<y2; i++){
		sum += 365;

		if(i%400==0||(i%100!=0&&i%4==0)){
			sum++;
		}
	}

	const int M[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

	for(int i=1; i<m2; i++){
		sum += M[i-1];

		if(i==2&&(y2%400==0||(y2%100!=0&&y2%4==0))){
			sum++;
		}
	}
	sum += d2;

	for(int i=1; i<m1; i++){
		sum -= M[i-1];

		if(i==2&&(y1%400==0||(y1%100!=0&&y1%4==0))){
			sum--;
		}
	}
	sum -= d1;

	cout << sum << '\n';
}
	return 0;
}

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

int main(){
    int H;
    while(cin >> H, H != 0){
        vector<vector<int>> cell(H,vector<int>(5,0));
        rep(i,H)rep(k,5) cin >> cell[i][k];
        int score = 0;
        while(1){
            int s = 0;
            for(int h = H-1;h >= 0; h--){
                int right = 0;
                for(int left = 0; left < 3; left++){
                    while(cell[h][left] == cell[h][right] && right < 5) right++;

                    if(right - left > 2){
                        s += (right - left) * cell[h][left];

                        while(left < right){
                            cell[h][left] = 0;
                            left++;
                        }
                        break;
                    }
                    if(left == right) right++;
                }
            }
            
            if(s == 0) break;
            score += s;

            for(int h = H - 1; h > 0; h--){
                for(int w = 0; w < 5; w++){
                    int hei = h;
                    while(cell[hei][w] == 0 && hei > 0) hei--;

                    for(int k = h; hei >= 0; hei--, k--){
                        if(k == hei) break;
                        swap(cell[k][w], cell[hei][w]);
                    }
                }
            }
            
        }

        cout << score << endl;
    }
}



Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int (i) = 0; i < (n);++i)
using namespace std;
typedef long long ll;

int main(){
    int X,Y;
    cin >> X >> Y;
    string str[70];
    bool can = false;
    rep(i,X) cin >> str[i];
    int dx[4] = {1,-1,0,0};
    int dy[4] = {0,0,1,-1};
    
    rep(i,X){
        rep(j,Y){
            if (str[i][j]=='#'){
                can = false;
                //cout << i << j << "hakken" << endl;
                rep(k,4){
                int x = i + dx[k];
                int y = j + dy[k];
                if (x<X && y<Y && x>=0 && y>=0 && str[x][y] == '#'){
                    can = true;
                    break;
                        }
                if (k == 3 && !can){
                    can = false;
                    cout << "No" << endl;
                    return 0;
                        }
                    }
                }
            }
        }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 19;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = ' ';
}

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


	int N = getint();
	int a[20001];
	rep(i, N) a[getint()] = i;
	rep1(i, N) putint(i * 30000 + a[i]);
	rep1(i, N) putint((N - i + 1) * 30000);

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 1152
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author Node2
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String str = in.readLine();
        
     
        
        String[] sp = str.split(" ");
        int[] a = new int[sp.length];
        for(int i=0;i<sp.length;i++){
            a[i] = Integer.parseInt(sp[i]);
        }
        
        int fivecount = 2;
        int sevencount = 1;
        
        for(int i=0;i<3;i++){
            if(a[i] == 5){
                fivecount--;
            }
            if(a[i] == 7){
                sevencount--;
            }
        }
        
        if(fivecount == 0 && sevencount == 0){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 8020
#include<stdio.h>
#include<string.h>
int main(){
  char s[300];
  scanf("%s",s);
  int len=strlen(s);
  int i,c;
  if(len%2==1)len-=1;
  while(len>0){
    len-=2;
    c=0;
    for(i=0;i<len/2;i++){
      if(s[i]==s[(len/2)+i]){
        c++;
      }
    }
      if(c==len/2)break;
  }
  printf("%d\n",len);
  return 0;
}

Measured memory_bytes: 128
n = int(input())
cnt = 0
#7ドルのループ
for i in range(int((n+7-1)/7)+1):
    #4ドルのループ
    for j in range(int((n+4-1)/4)+1):
        if i*7 + j*4 == n:
            cnt += 1
if cnt != 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include<cstdio>
#include<cstring>
using namespace std;
int a,b,c,k,ans;
int main()
{
	scanf("%d%d%d%d",&a,&b,&c,&k);
	if(k>=a) 
	{
		ans+=a;
		k-=a;
	}
	else
	{
		printf("%d\n",k);
		return 0;
	}
	if(k>=b) k-=b,ans-=k;
	printf("%d\n",ans);
}

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

int main(){
  using ll= long long int;
  ll Ns,Nc;
  cin >> Ns >> Nc;
  
  ll diff= Nc- 2*Ns;
  if(diff >= 0){
    cout << Ns+ diff/4 << endl;
  }
  else{
    cout << Nc/2 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   int a,b,t;
   cin>>a>>b>>t;
   int use_t=a,B=0,s=1;
   while(use_t<=t){
     B = s*b;
     ++s;
     use_t += a;
   }
   cout<<B<<endl;
   // cout << "Hello world!" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
 
using namespace std;
 
int main(){
  int A,B;
  string S,T,U;
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  if(U==S) A -=1;
  else B -=1;
  cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
  int a,b;
  double C;
  scanf("%d %d %lf",&a,&b,&C);
  C=M_PI/180*C;
  printf("%lf\n",0.5*a*b*sin(C));
  printf("%lf\n",a+b+sqrt(a*a+b*b-2*a*b*cos(C)));
  printf("%lf\n",b*sin(C));
  return 0;
}


Measured memory_bytes: 2036
use std::io::Read;

fn main() {
    let (a, b, c) = {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        let a: usize = iter.next().unwrap().parse().unwrap();
        let b: usize = iter.next().unwrap().parse().unwrap();
        let c: usize = iter.next().unwrap().parse().unwrap();
        (a, b, c)
    };
    if a+b == c || a+c == b || b+c == a {
        print!("Yes");
    } else {
        print!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
typedef tree<string,null_type,less<string>,rb_tree_tag,tree_order_statistics_node_update> indexed_set2;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

int main()
{    
    ll k;
    cin>>k;
    if(k % 2 == 0){
        cout<<-1<<endl;
        return 0;
    }
    ll val = 7;
    ll ct = 1;
    unordered_map<ll,ll> mp;
    mp[val] = 1;

    while(1){
        if(val % k == 0){
            cout<<ct<<endl;
            return 0;
        }
        val = (val*10 + 7) % k;
        if(mp.count(val)){
            cout<<-1<<endl;
            return 0;
        }
        else {
            mp[val] = 1;
        }
        ct++;
    }
    return 0;
}

Measured memory_bytes: 42696
from collections import defaultdict


n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for i in range(n):
    d[a[i]] += 1

b = sorted(list(set(a)))[::-1]
newa = []
for i in range(len(b)):
    if d[b[i]] >= 2:
        newa.append((b[i], d[b[i]]))

area = 0
for i in range(len(newa)):
    if newa[i][1] >= 4:
        area = newa[i][0] ** 2
        break
    elif newa[i][1] >= 2:
        for j in range(i + 1, len(newa)):
            area = newa[i][0] * newa[j][0]
            break
        break
print(area)


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

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

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const double eps = 1e-9;
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ")
{ if (!v.size()) puts(""); rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

#define equals(a, b) (fabs(a - b) < EPS)

struct Point {
  double x, y;

  Point() {}
  Point(double x, double y) :x(x), y(y){}

  Point operator+(Point p) { return Point(this->x + p.x, this->y + p.y); }
  Point operator-(Point p) { return Point(this->x - p.x, this->y - p.y); }
  Point operator*(double k){ return Point(this->x * k, this->y * k); }
  Point operator/(double k){ return Point(this->x / k, this->y / k); }

  double norm() { return x * x + y * y; }
  double abs()  { return sqrt(norm()); }
};

struct Circle {
  double r;
  Point c;
  Circle() {}
  Circle(Point c, double r) :c(c), r(r){}
  Circle(double x, double y, double r) :c(Point(x, y)), r(r){}
};

double norm(Point a) {
  return a.x * a.x + a.y * a.y;
}

double abs(Point a) {
  return sqrt(norm(a));
}

static const int ICC_SEPARATE = 0;
static const int ICC_CIRCUMSCRIBE = 1;
static const int ICC_INTERSECT = 1;
static const int ICC_INSCRIBE = 1;
static const int ICC_CONTAIN = 2;

int intersectCC(Circle c1, Circle c2){
  int f = 1;
  if(c1.r < c2.r) { f *= -1; swap(c1, c2); }

  double d = abs(c1.c - c2.c);
  double r = c1.r + c2.r;

  if(equals(d, r)) return ICC_CIRCUMSCRIBE;
  if(d > r) return ICC_SEPARATE;
  if(equals(d + c2.r, c1.r)) return ICC_INSCRIBE;
  if(d + c2.r < c1.r) return ICC_CONTAIN * f;
  return ICC_INTERSECT;
}

signed main() {
  int n = in();
  while (n--) {
    Circle c1, c2;
    double x, y, r;
    cin >> x >> y >> r;
    c1 = Circle(x, y, r);

    cin >> x >> y >> r;
    c2 = Circle(x, y, r);

    cout << intersectCC(c1, c2) << endl;
  }
}

Measured memory_bytes: 3196
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>
 
// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std
 
Jehian Norman Saviero;
 
// MACROS TYPE
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
 
// MACROS FOR PRINT
#define nl printf("\n")
 
// MACROS FOR ATTRIBUTE
#define fi first
#define se second
 
// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) for (int _qwe = sizeof(x)/sizeof(x[0]); _qwe; ) x[--_qwe] = (y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))
 
// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scd(x) scanf("%lf", &x)
#define scld(x) scanf("%Lf", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

int main() {
	ll N;
	scll(N);
	if (N & 1) {
		printf("0\n");
		return 0;
	}
	N >>= 1L;
	ll ans = 0;
	while (N) {
		ans += (N / 5L);
		N /= 5L;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
    int n,x,ans,count, i, j, k;
    count = 0;
    while(cin >> n >> x){
        if(n == 0 && x == 0) break;
        for(i = 1; i <= n; i++){
            for(j = 1; j <= n; j++){
                for(k = 1; k <= n; k++){
                    if(i == j == k) continue;
                    else if(i == j || i == k || j == k) continue;    
                    else if(i > j || i > k || j > k) continue;
                    ans = i + j + k;
                    if(ans == x) count++;
                }
            }
        }
        cout << count << endl;
        count = 0;
    }
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s;
    cin>>s;
    int v=0;
    for(int i=0;i<s.size();i++)
        if(s[i]=='1')
            v++;
    cout<<v<<endl;
    // insert code here...
    //td::cout << "Hello, World!\n";
    return 0;
}


Measured memory_bytes: 256
import collections

def gcd(u,v):
	if v:
		return gcd(v, u % v)
	else:
		return u

n = int(raw_input())
elems = map(int , raw_input().split(' '))
dpp = [ None ] * len(elems)
dps = [ None ] * len(elems)
dpp[0] = elems[0]
for i in range(1,len(elems)): 
	dpp[i] = gcd(elems[i], dpp[i-1])
dps[len(elems) -1]  = elems[-1]
for i in range(len(elems) - 2, -1, -1): 
	dps[i] = gcd(elems[i], dps[i+1])
r = 0
for i in range(len(elems)):
	u,v = dpp[i-1] if i-1 >= 0 else -1, dps[i+1] if i+1 < len(elems) else -1
	r  = max(r, gcd(u,v) if u != -1 and v != -1 else max(u,v))
print r



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

int main()
{
    long long a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    long long ans=max(x,y)*2*c*1LL;
    ans=min(ans,a*x+b*y*1LL);
    ans=min(ans,min(x,y)*2*c*1LL+((y>x)?(y-x)*b:(x-y)*a));
    cout<<ans;
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
#define mp(x,y) make_pair(x,y)
const int maxn=2e5+5;
int n,r1,r2,ecnt;
int ans[maxn],siz[maxn],ban[maxn*4];
int head[maxn],cnt;
struct node{
    int v,id,nxt;
}E[maxn*4];
void insert(int u,int v,int id){
    E[++cnt]=(node){v,id,head[u]};
    head[u]=cnt;
}

void dfs(int u,int fa=0){
    for(int i=head[u];i;i=E[i].nxt){
        int v=E[i].v;
        if(v==fa) continue;
        dfs(v,u);
        siz[u]++;
    }
}
void sol(int u){
    for(int &i=head[u];i;i=E[i].nxt){
        int v=E[i].v,id=E[i].id;
        if(ban[id]) continue;
        ban[id]=1;
        if(v==u-n) ans[v]=-1;
        else if(v==u+n) ans[u]=1;
        sol(v);
    }
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int x;
        scanf("%d",&x);
        if(x==-1) r1=i;
        else{
            insert(x,i,++ecnt);
            insert(i,x,ecnt);
        }
    }
    for(int i=1;i<=n;i++){
        int x;
        scanf("%d",&x);
        if(x==-1) r2=i+n;
        else{
            insert(x+n,i+n,++ecnt);
            insert(i+n,x+n,ecnt);
        }
    }
    dfs(r1);
    dfs(r2);
    for(int i=1;i<=n;i++){
        if((siz[i]&1)!=(siz[i+n]&1)) return puts("IMPOSSIBLE"),0;
        if(!(siz[i]&1)){
            insert(i,i+n,++ecnt);
            insert(i+n,i,ecnt);
        }
    }
    insert(r1,2*n+1,++ecnt),insert(2*n+1,r1,ecnt);
    insert(r2,2*n+1,++ecnt),insert(2*n+1,r2,ecnt);
    sol(2*n+1);
    puts("POSSIBLE");
    for(int i=1;i<=n;i++)
        printf("%d ",ans[i]);
}

Measured memory_bytes: 24192
import re
import itertools
N = int(input())
S = input()
R = S.count('R')
G = S.count('G')
B = S.count('B')
#R = [m.start() for m in re.finditer('R', S)]
#G = [m.start() for m in re.finditer('G', S)]
#B = [m.start() for m in re.finditer('B', S)]
ans = 0
for i in range(N-2):
  for j in range(1, N-1):
    if i + 2*j >=N:
      break
    else:
      if not(S[i] == S[i + 2*j] or S[i + j] == S[i + 2*j] or S[i] == S[i + j]):
        ans += 1
print(R*G*B - ans)

Measured memory_bytes: 9932
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#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 reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    long double A, B;
    cin>>A>>B;
    cout<<(ll)(A*B)<<endl;
    return 0;
}


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

namespace contest_Csharp
{
    class Program
    {


        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            //var vals = Console.ReadLine().Split(' ')
            //    .Select(x => int.Parse(x)).ToList();

            var S = Console.ReadLine();
            var ans = new StringBuilder();
            var prev = "";
            var n = S.Count();
            for (int i = 0; i < n; i++)
            {
                if (S[i]=='?')
                {
                    ans.Append( "D");
                }
                else
                {
                    ans.Append(S[i]);
                }
            }




            Console.WriteLine(ans.ToString());
            Console.Out.Flush();

        }



    }

}


Measured memory_bytes: 27740