akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/


signed main() {
	int x, y;
	cin >> x >> y;
	rep(i, 10000000) {
		int xx = i, yy = i * 2;
		if (y < yy)continue;
		int two = y - yy;
		if (xx + two * 2 == x) {
			cout << comb(two + i, two) << endl; return 0;
		}
	}
	cout << 0 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n; cin >> n;
    VL a(n); cin >> a;

    VL x(n, 0), y(n, 0);
    FOR(i, 1, n) {
        if (i % 2) {
            x[i - 1]++, x[i]--;
            y[i - 1]--, y[i]++;
        }
        else {
            x[i - 1]--, x[i]++;
            y[i - 1]++, y[i]--;
        }
    }
    SORT(a), SORT(x), SORT(y);

    ll X = 0, Y = 0;
    FOR(i, 0, n) {
        X += a[i] * x[i];
        Y += a[i] * y[i];
    }

    cout << max(X, Y) << "\n";
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
#define all(a) a.begin(),a.end()
using namespace std;
string s,t;
string tt;
int ans=10000;
int main(void){
	cin>>s>>t;
	for(int i=0;i+t.size()-1<=s.size()-1;i++){
		int cnt=0;
//		cout<<i<<':';
		REP(j,t.size()){
			if(t[j]!=s[i+j]){
				cnt++;
//				cout<<j<<' ';
			}
		}
//		cout<<' '<<cnt<<endl;
		ans=min(ans,cnt);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3640
N, K = [x for x in input().split()]
D = [x for x in input().split()]

M = N
while True:
  N_ = 0
  for i,n in enumerate(N):
    if n in D:
      N_ += (int(n) + 1) * 10 ** (len(N) - 1 - i)
      break
    else:
      N_ += int(n) * 10 ** (len(N) - 1 - i)
  else:
    break
  N = str(N_)
          
print(N)

Measured memory_bytes: 3060
module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.List
import           Data.Array
import           Data.Char
import           Data.Bits
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

parseInt = fst . fromJust . BS.readInt
readInt = parseInt <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine

main = do
  [a, b] <- replicateM 2 readInt
  print $ 6 - a - b


Measured memory_bytes: 380
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main (void) {
  long long N;
  cin >> N;
  
  long long dist;
  
  long long root = floor(sqrt(N));
  
  long long elem1, elem2;
  for (int i = root; i >= 1; i--) {
    if (N % i == 0) {
      elem1 = N / i;
      elem2 = i;
      break;
    }
  }
  dist += (elem1-1) + (elem2-1);
  
  cout << dist << endl;
  return 0;
}

Measured memory_bytes: 764
N = int(input())
A = list(map(int,input().split()))
A.sort()
mod = 10**9 + 7
if N%2 == 0:
    for i in range(N):
        if A[i] != 1+(i//2)*2:
            print(0)
            break
    else:
        print(pow(2,N//2,mod))
else:
    if A[0] == 0:
        for i in range(1,N):
            if A[i] != ((i+1)//2)*2:
                print(0)
                break
        else:
            print(pow(2,N//2,mod))

Measured memory_bytes: 20392
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#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 For(i, a, b)    for(int i = (a); (i) < (int)(b) ; (i)++)
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    ll h; cin >> h;
    ll cnt = 1, ans = 0;
    while(h > 0){
        h /= 2;
        ans += cnt;
        cnt *= 2;
    }

    cout << ans << endl;

return 0;
}


Measured memory_bytes: 3608
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int bit = 0;
        for (int i=0; i<N; i++) {
            bit |= sc.nextInt();
        }
        System.out.println(Integer.numberOfTrailingZeros(bit));
    }
}

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

using namespace std;

int main()
{
	double A, B, H, M;
	cin >> A >> B >> H >> M;

	double shortDegree = 30.0 * H + 0.5 * M;
	double longDegree = 6.0 * M;

	double degree = abs(shortDegree - longDegree);
	double rad = min(degree, 360.0 - degree) * M_PI / 180.0;

	double dist = sqrt((A * A + B * B) - 2.0 * A * B * cos(rad));

	printf("%.15f\n", dist);

	return 0;
}


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

int main(){

    string s;
    cin>>s;
    if(s=="SUN") cout<<7<<endl;
    if(s=="MON") cout<<6<<endl;
    if(s=="TUE") cout<<5<<endl;
    if(s=="WED") cout<<4<<endl;
    if(s=="THU") cout<<3<<endl;
    if(s=="FRI") cout<<2<<endl;
    if(s=="SAT") cout<<1<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

class modint {
  public:
    using ll = long long;
    ll num;
    static const ll MOD = 1e9+7;
    static vector<modint> factorial;

    modint(): num(0) {};
    modint(ll n_): num((n_ + MOD) % MOD) {}
    modint(const modint &r): num(r.num) {}
    operator ll() const { return (num+MOD)%MOD; }
    friend istream& operator>>(istream& is, modint &r){
        ll num_;
        is >> num_;
        r = num_;
        return is;
    }
    modint operator+(const modint &r) const { return modint(num + r.num); }
    modint operator-(const modint &r) const { return modint(num - r.num); }
    modint operator*(const modint &r) const { return modint(num * r.num); }

    template<typename T>
    modint operator^(const T &r) const {
        if(r == 0) return 1;
        return (((*this)*(*this)) ^ (r/2)) * modint(r&1 ? num : 1);
    }
    modint operator/(const modint &r) const { return num * (r^(MOD-2)); }

    modint operator+=(const modint &r) { return *this = *this + r; }
    modint operator-=(const modint &r) { return *this = *this - r; }
    modint operator*=(const modint &r) { return *this = *this * r; }
    modint operator/=(const modint &r) { return *this = *this / r; }

    template<typename T>
    modint operator^=(const T &r) { return *this = *this ^ r; }

    static modint pow(const modint x, ll r) {
        return x^r;
    }

    static modint fact(int n){
        if((int)factorial.size() <= n) factorial.resize(n+1);
        if(factorial[n]) return factorial[n];
        if(n == 0) return 1;
        return factorial[n] = modint(n) * fact(n-1);
    }

    static modint C(ll n,ll r){
        return n >= r ? fact(n)/(fact(n-r)*fact(r)) : modint(0);
    }
};
vector<modint> modint::factorial;
#define fact(n) modint::fact(n)
#define C(n,r) modint::C(n,r)
#define H(a,b) C(a+b, a)


int main(void){
    string s;
    cin >> s;
    int n = s.size();
    using M = modint;
    M res = 0;
    ll num1 = 0;
    rep(i,n){
        if (s[i] == '1') {
            res += M::pow(2,num1) * M::pow(3,n-1-i);
            num1++;
        }
    }
    res += M::pow(2, num1);
    cout << res << endl;
    return 0;
}


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

int main()
{
    int A, B;

    cin >> A >> B;

    if (A <= 8 && B <= 8)
    {
        cout << "Yay!";
    }
    else
    {
        cout << ":(";
    }

    return 0;
}

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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }
UINT luin() { UINT x; scanf("%llu", &x); return x;}


int main(){
    int a, b, c;
    double fa, fb, fc;
    char S[128], sa[128], sb[128], sc[128];
    // int N = in();
    // int K = in();
    // scanf("%s", S);

    scanf("%s", S);



    printf(S[1] == 'B' ? "ARC" : "ABC");

    return 0;
}







Measured memory_bytes: 3752
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product#accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
def run():
    mod = 1000000007
    N, *AB = map(int, read().split())
    A_B = []
    INF = float('inf')
    zerozero = 0
    for i in range(N):
        a = AB[2*i]
        b = AB[2*i+1]
        if a== 0 and b == 0:
            zerozero += 1
        elif b == 0:
            A_B.append((INF, 0))
        elif a == 0:
            A_B.append((0, INF))
        else:
            tmp = math.gcd(a,b)
            if a / b > 0 :v = 1
            else: v = -1
            A_B.append((abs(a//tmp), v * abs(b//tmp)))

    comb_dict = defaultdict(lambda:[0,0])

    for ai, bi in A_B:
        if ai == INF:
            comb_dict[0][1] += 1
        elif bi == INF:
            comb_dict[0][0] += 1
        elif bi < 0:
            comb_dict[(ai,bi)][0] += 1
        else:
            comb_dict[(bi, -ai)][1] += 1

    ret = 1
    for _, val_list in comb_dict.items():
        a,b = val_list
        if a == 0 or b == 0:
            ret *= pow(2, max(a,b), mod)
        else:
            ret *= pow(2, a, mod) + pow(2, b, mod) - 1
        ret %= mod
    ret += zerozero-1
    print(ret%mod)



if __name__ == "__main__":
    run()

Measured memory_bytes: 107792
#include<stdio.h>

int main(void){
   int n,m,i,count;
   double sum;
   scanf("%d %d",&n,&m);
   int votes[n-1];
   sum=0;
   for(i=0;i<n;i++){
      scanf("%d",&votes[i]);
      sum+=votes[i];
   }
   count=0;
   sum/=4*m;
   for(i=0;i<n;i++){
      if(votes[i]>=sum){
         count++;
      }
   }
   if(count>=m){
      printf("Yes\n");
   } else {
      printf("No\n");
   }

   return 0;
}


Measured memory_bytes: 1588
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

long long f(long long x, long long y){
    string s = to_string(x);
    string t = to_string(y);

    return max(s.size(), t.size());
}

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

    long long minv = 100;
    for(long long a = 1; a <= sqrt(n); a++){
        if(n % a == 0){
            long long b = n/a;
            minv = min(minv, f(a, b));
        }
    }

    cout << minv << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

struct Job
{
	int a;
	int b;
};
Job jobs[100010];
int n, m;
std::set<int> availNums;

bool compare(const Job &a, const Job &b)
{
	if (a.b == b.b)
	{
		a.a > b.a;
	}
	return a.b > b.b;
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1 ; i <= m ; i++)
		availNums.insert(i);
		
	for (int i = 0 ; i < n ; i++)
		scanf("%d%d", &(jobs[i].a), &(jobs[i].b));
		
	sort(jobs, jobs + n, compare);
	
	long long ans = 0;
	std::set<int>::iterator iJob;
	for (int i = 0 ; i < n ; i++)
	{
		iJob = availNums.lower_bound(jobs[i].a);
		
		if (iJob != availNums.end())
		{
			ans = ans + jobs[i].b;
			availNums.erase(*iJob);
		}
	}
	
	printf("%lld\n", ans);
	
		
	return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int64_t H, W;
  cin >> H >> W;
  if (H == 1 || W == 1) {
    cout << 1 << endl;
    return 0;
  }

  int64_t res = (int64_t) H * W;
  if (res % 2 == 0) {
    cout << res / 2 << endl;
  } else {
    cout << res / 2 + 1<< endl;
  }


  return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)


int32_t main()
{
	fastio;
	int t, i, j, k, n, m, q;
	int x, y, l, r;
	cin >> n;
	map <string,int> mp;
	string s;
	for(i=0;i<n;i++){
		cin >> s;
		sort(all(s));
		mp[s]++; 
	}
	int ans = 0;
	for(auto &x:mp){
		ans += (x.second*(x.second-1))/2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11264
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))

ans=0
for i in range(2**n):
#  bit=format(i,'011b')
#  bit=list(reversed(format(i,'b')))
#  bit=bin(i)
#  print(bit)
  #ある電球
  num=0
  for j in range(m):
    #ある電球に接続されている各スイッチ
    cnt=0
    for k in range(1,l[j][0]+1):
#      print(l[j][k])
#      if bit[l[j][k]]==1:
#      if (i>>k)&1:
#      print(i,l[j][k])
      if (i>>l[j][k]-1)&1:
        cnt+=1
#    print(i,j,cnt)
    if cnt%2==p[j]:
      num+=1
  if num==m:
    ans+=1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;

const long double PI = acos(-1);

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

ld a,b,x;
cin >> a >> b >> x;

ld h = x/(a*a);

if(b >= 2 * h) {
    cout << fixed << setprecision(10) << (180/PI)*atan((a*b*b) / (2*x)) << endl;
}
else {
    cout << fixed << setprecision(10) << (180/PI)*atan((2*b*a*a-2*x)/(a*a*a)) << endl;
}

return 0;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

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

    double range = 2 * D + 1;

    int ans = ceil(N / range);

    cout << ans << endl;

    return 0;
}


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

int main(){
	string str;
	cin >> str;
  
  if(str[0]==str[1]&&str[1]==str[2]){
  	
    	cout << "No" << endl;
    
  }else{
  	cout << "Yes" << endl;
  }


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
    int n;
    char s[100];
    char p = 'P', w = 'W', g = 'G', y = 'Y';
    int c[4] = {};
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> s[i];
        if(s[i] == p){
            c[0] = 1;
        }
        else if(s[i] == w){
            c[1] = 1;
        }
        else if(s[i] == g){
            c[2] = 1;
        }
        else if(s[i] == y){
            c[3] = 1;
        }
    }
    int ans = 0;
    for(int i = 0; i < 4; i++){
        ans += c[i];
    }
    if(ans == 3){
        cout << "Three" << '\n';
    }else if(ans == 4){
        cout << "Four\n";
    }

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int N=2e5+1;
int n,a[N];
long long A=-1;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	a[0]=-1;
	for(int i=1;i<=n;i++)
		if(a[i]>a[i-1]+1)
		{
			cout<<-1;
			return 0;
		}
		else if(a[i]==a[i-1]+1)
			A++;
		else
			A+=a[i];
	cout<<A;
	return 0;
}

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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

lli n;
string s;
vll ans;
vll sna;

int main(){
  cin >> n;
  cin >> s;
  ans = sna = vll(n);
  for(lli i = 1;i < n;i++){
    if(s[i-1] == 'W') ans[i] = ans[i-1]+1;
    else ans[i] = ans[i-1];
  }
  for(lli i = n-2;i >= 0;i--){
    if(s[i+1] == 'E') sna[i] = sna[i+1]+1;
    else sna[i] = sna[i+1];
  }
  for(lli i = 0;i < n;i++){
    ans[i] += sna[i];
  }
  cout << *min_element(ans.begin(),ans.end()) << endl;

}


Measured memory_bytes: 5380
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#define lli long long int
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 57;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;

void solve()
{
    lli n, k;
    cin>>n>>k;
    lli a[n];
    lli ans = 0;
    for(int i = 0; i < n; i ++){
        cin>>a[i];
        if(a[i] >= k)
            ans ++;
    }
    cout<<ans;
    return ;
}
/*
7
6 7 4 1 2 11 6
5
1 2 10 4 5
*/

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

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


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std ;
template< class T > inl T read() {
	T x = 0 ; int f = 1 ; char k = getchar() ;
	for( ; k > '9' || k < '0'; k = getchar() ) if( k == '-' ) f = -1 ;
	for( ; k >= '0' && k <= '9'; k = getchar() ) x = x * 10 + k - '0' ;
	return x * f ;
}
template< class T > inl T read( T &x ) { return x = read<T>() ; }
int _num, _buf[20];
template< class T > il print( T x ) {
   	if( x == 0 ) return putchar( '0' ) ,void() ;
	if( x < 0 ) putchar( '-' ), x = -x ;
	while( x ) _buf[++_num] = x % 10, x /= 10 ;
	while( _num ) putchar( _buf[_num--] + '0' ) ;
}
ll mul( ll a, ll b, ll mod ) { long double c = 1. ; return ( a * b - (ll)( c * a * b / mod ) * mod ) % mod ; }
it qpow( int x, int m, int mod ) {
	int res = 1, bas = x ;
	while(m) {
		if( m & 1 ) res = ( 1ll * res * bas ) % mod ;
		bas = ( 1ll * bas * bas ) % mod, m >>= 1 ;
	}
	return res ;
}
const int N = 1e5 + 5 ;
int n, q, val[N], cnt[N];
ll sum;
int main() {
//	freopen( ".in", "r", stdin ) ;
//	freopen( ".out", "w", stdout ) ;
	n = read<int>() ;
	for( ri i = 1; i <= n; ++i ) {
		val[i] = read<int>() ;
		cnt[val[i]] += 1, sum += val[i] ;
	}
	q = read<int>() ;
	for( ri i = 1; i <= q; ++i ) {
		int x = read<int>(), y = read<int>() ;
		sum += cnt[x] * ( y - x ) ;
		cnt[y] += cnt[x], cnt[x] = 0 ;
		print( sum ), puts( "" ) ;
	}
	cerr << 1. * clock() / CLOCKS_PER_SEC << "\n" ;
	return 0;
}

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

#include <cmath>
#include <iomanip>

void _126() {
    int n, k;
    cin >> n >> k;

    double probability = 0.0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; ; ++j) {
            if (i * pow(2, j) >= k) {
                probability += (pow(0.5, j)) / n;
                break;
            }
        }
    }
    cout << fixed << setprecision(12);
    cout << probability << endl;
}

void _127() {
    int n, m, limit_l, limit_r, l, r;
    cin >> n >> m;
    limit_l = 1;
    limit_r = n;
    for (int i = 0; i < m; ++i) {
        cin >> l >> r;
        if (l > limit_l) {
            limit_l = l;
        }
        if (r < limit_r) {
            limit_r = r;
        }
    }
    int count = max(limit_r - limit_l + 1, 0);
    cout << count << endl;
}

void _128() {
    int n, m;
    cin >> n >> m;

    int k[10], s[10][10];
    for (int i = 0; i < m; ++i) {
        cin >> k[i];
        for (int j = 0; j < k[i]; ++j) {
            cin >> s[i][j];
        }
    }
    int p[10];
    for (int i = 0; i < m; ++i) 
        cin >> p[i];

    int count = 0;
    bool off_flag = false;
    int sw_count = 0;
    for (int i = 0; i < pow(2, n); ++i) {
        off_flag = false;
        for (int j = 0; j < m; ++j) {
            sw_count = 0;
            for (int l = 0; l < k[j]; ++l) {
                if (((i >> (s[j][l] - 1)) & 1) == 1) {
                    sw_count++;
                }
            }
            if (sw_count % 2 != p[j]) {
                // cout << "off " << sw_count <<  endl;
                off_flag = true;
                break;
            }
        }
        if (!off_flag) {
            count++;
        }
    }
    cout << count << endl;
}

void _129() {
    int n, m;
    cin >> n >> m;
    int a[200000];
    bool    failure = false;
    for (int i = 0; i < m; ++i) {
        cin >> a[i];
        if (i > 0 && a[i] == a[i - 1] + 1){
            failure = true;
        }
    }
    if (failure) {
        cout << 0 << endl;
        return;
    }


    long long count = 1;

    long long count_m1 = 1;
    long long count_m2 = 1;
    int j = 0;
    if (a[j] == 1) {
        count_m1 = 0;
        ++j;
    }
    for (int i = 2; i <= n; ++i) {
        if (i == a[j]) {
            count = 0;
            ++j;
        } else {
            count  = count_m1 + count_m2;
        }
        count_m2 = count_m1;
        count_m1 = count;

        count %= 1000000007;
        count_m1 %= 1000000007;
        count_m2 %= 1000000007;
        // if (i % 100 == 0)
            // cout << count << endl;
    }
    cout << count << endl;
}

int main()
{
    _129();
    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL =LONG_LONG_MAX;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    int n;cin>>n;vLL a(3*n);cin>>a;
    sort(all(a));
    
    ll ans = 0;
    rep(i,n){
        ans += a[3*n-2-2*i];
    }
    
    cout<<ans<<endl;

    
    return 0;
}








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

int main()
{
  int a,b;
  cin >> a >> b;
  if(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}


Measured memory_bytes: 3560
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define inf 0x3f3f3f3f3f3f3f3fll
using namespace std;
typedef long long ll;
#define int ll

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int N, m, X[1005], Y[1005], mx = 0, isodd = -1, d[35];
char dirs[35], dir;

signed main(){
	getint(N);
	for(register int i = 1; i <= N; i++){
		getint(X[i]), getint(Y[i]), mx = max(mx, abs(X[i]) + abs(Y[i]));
		if(isodd == -1) isodd = (X[i] ^ Y[i]) & 1;
		else if(isodd != ((X[i] ^ Y[i]) & 1)) return puts("-1"), 0;
	}
	for(m = d[1] = 1; (1LL << m) <= mx; m++) d[m + 1] = 1 << m;
	if(!isodd) d[++m] = 1;
	sort(d + 1, d + m + 1), dirs[m] = '\0', printf("%d\n", m);
	for(register int i = 1; i <= m; i++) printf("%d ", d[i]); puts("");
	for(register int k = 1; k <= N; k++){
		register ll x = 0, y = 0;
		for(register int i = m; i; i--){
			register ll mn = inf, cur, nx, ny;
			if((cur = llabs(x + d[i] - X[k]) + llabs(y - Y[k])) < mn) mn = cur, dir = 'R', nx = x + d[i], ny = y;
			if((cur = llabs(x - d[i] - X[k]) + llabs(y - Y[k])) < mn) mn = cur, dir = 'L', nx = x - d[i], ny = y;
			if((cur = llabs(x - X[k]) + llabs(y + d[i] - Y[k])) < mn) mn = cur, dir = 'U', nx = x, ny = y + d[i];
			if((cur = llabs(x - X[k]) + llabs(y - d[i] - Y[k])) < mn) mn = cur, dir = 'D', nx = x, ny = y - d[i];
			dirs[i - 1] = dir, x = nx, y = ny;
		}
		puts(dirs);
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define pi 3.14159265358979323846
#define ll long long
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int a = s.size();
  rep(i, 0, a){
    rep(j, 1, n + 1){
      s[i]++;
      if(s[i] == '['){
        s[i] = 'A';
      }
    }
    cout << s[i];
  }
  cout << "\n";
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <algorithm>

using namespace std;

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

  int t[n+1], x[n+1], y[n+1];
  t[0] = 0;
  x[0] = 0;
  y[0] = 0;
  for (int i = 1; i < n+1; i++) {
    scanf("%d %d %d", t + i, x + i, y + i);
  }

  for (int i = 1; i < n+1; i++) {
    if ((x[i] - x[i-1]) + (y[i] - y[i-1]) > (t[i] - t[i-1]) || abs((x[i] - x[i-1]) + (y[i] - y[i-1]) - (t[i] - t[i-1])) % 2 != 0) {
      printf("No\n");

      return 0;
    }
  }

  printf("Yes\n");

  return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  double n;
  cin >> n;
  vector< double > x(n), y(n);
  REP(i, n){
    cin >> x[i] >> y[i];
  }
  vector<vector<double > > d(n, vector<double >((int)n, 0.0));
  REP(i, n){
    REP(j, n){
      d[i][j] = sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
    }
  }
  double ans = 0;
  REP(i, n){
    REP(j, n){
      ans  += d[i][j];
    }
  }
  
  cout<<setprecision(12) << ans/n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        int n;
        string s;
        Int(n);
        cin>>s;

        int w=0,res=0;

        for(int i=0;s[i];++i){
            if(s[i]=='R')++w;
        }     

        for(int i=w;i<sz(s);++i){
            if(s[i]=='R')++res;
        }
        printf("%d\n", res);

        //printf("Case %d: ",++te);
    }
    return 0;
}






Measured memory_bytes: 3844
x_1, y_1, x_2, y_2 = gets.split(" ").map(&:to_i)
 
x_mount = x_2 - x_1
y_mount = y_2 - y_1
 
if x_mount > 0 && y_mount > 0 
  x_3, y_3 = x_2 - y_mount.abs, y_2 + x_mount.abs
  x_4, y_4 = x_1 - y_mount.abs, y_1 + x_mount.abs
 
elsif x_mount < 0 && y_mount < 0
  x_3, y_3 = x_2 + y_mount.abs, y_2 - x_mount.abs
  x_4, y_4 = x_1 + y_mount.abs, y_1 - x_mount.abs
 
elsif x_mount < 0 && y_mount > 0
  x_3, y_3 = x_2 - y_mount.abs, y_2 - x_mount.abs
  x_4, y_4 = x_1 - y_mount.abs, y_1 - x_mount.abs
 
elsif  x_mount > 0 && y_mount < 0
  x_3, y_3 = x_2 + y_mount.abs, y_2 + x_mount.abs
  x_4, y_4 = x_1 + y_mount.abs, y_1 + x_mount.abs
 
elsif y_mount == 0 && x_1 < x_2
  x_3, y_3 = x_2, y_2 + x_mount.abs
  x_4, y_4 = x_1, y_1 + x_mount.abs

elsif y_mount == 0 && x_1 > x_2
  x_3, y_3 = x_2, y_2 - x_mount.abs
  x_4, y_4 = x_1, y_1 - x_mount.abs

elsif x_mount == 0 && y_1 < y_2
  x_3, y_3 = x_2 - y_mount.abs, y_2
  x_4, y_4 = x_1 - y_mount.abs, y_1

elsif x_mount == 0 && y_1 > y_2
  x_3, y_3 = x_2 + y_mount.abs, y_2
  x_4, y_4 = x_1 + y_mount.abs, y_1
end
 
puts "#{x_3} #{y_3} #{x_4} #{y_4}"

Measured memory_bytes: 14124
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<int, int>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

#include <functional>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k, c;
    cin, n, k, c;
    string s;
    cin, s;
    int lst1 = -1, lst2 = -1;
    vector<int> nxt1(n, -1), nxt2(n, -1);
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == 'o') {
            nxt1[i] = lst1;
            nxt2[i] = lst2;
            lst2 = i;
        }
        if (i + c < n && s[i + c] == 'o') {
            lst1 = i + c;
        }
    }

    vector<int> used(n, -1);
    function<int(int)> solve = [&](int pos) {
        if (pos >= n || pos < 0) {
            return 0;
        }
        if (used[pos] != -1) {
            return used[pos];
        }
        return used[pos] = solve(nxt1[pos]) + 1;
    };
    REP(i, 0, n) {
        if (s[i] == 'o') {
            solve(i);
            dump(i, used[i]);
        }
    }
    int pos = 0;
    while (s[pos] == 'x') {
        pos++;
    }
    int cnt = 0;
    while (pos != -1) {
        int x = nxt2[pos];
        if (x != -1) {
            if (used[x] + cnt < k) {
                print(pos + 1);
            }
        } else {
            if (cnt < k) {
                print(pos + 1);
            }
        }
        cnt++;
        pos = nxt1[pos];
    }
    return 0;
}


Measured memory_bytes: 10388
import java.io.*;
import java.util.*;

public class Main {
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    out.println((n - 2) * 180);
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public int[] nextIntArray(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLongArray(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
}

class Algorithm {
  private static void swap(Object[] list, int a, int b) {
    Object tmp = list[a];
    list[a] = list[b];
    list[b] = tmp;
  }
  
  public static <T extends Comparable<? super T>> boolean nextPermutation(T[] ts) {
    int rightMostAscendingOrderIndex = ts.length - 2;
    while (rightMostAscendingOrderIndex >= 0 &&
        ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostAscendingOrderIndex + 1]) >= 0) {
      rightMostAscendingOrderIndex--;
    }
    if (rightMostAscendingOrderIndex < 0) {
      return false;
    }
    
    int rightMostGreatorIndex = ts.length - 1;
    while (ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostGreatorIndex]) >= 0) {
      rightMostGreatorIndex--;
    }
    
    swap(ts, rightMostAscendingOrderIndex, rightMostGreatorIndex);
    for (int i = 0; i < (ts.length - rightMostAscendingOrderIndex - 1) / 2; i++) {
      swap(ts, rightMostAscendingOrderIndex + 1 + i, ts.length - 1 - i);
    }
    return true;
  }
}



Measured memory_bytes: 20692
A,B,C,D,E,F = map(int,input().split(' '))
ans = [0,0]
r = 0
for i in range(F//A+1):
    for j in range(F//B+1):
        if (i == 0 and j == 0) or  100*(A*i+B*j) > F:
            break
        for k in range(F//C+1):
            for l in range(F//D+1):
                tmp = 100*A*i+100*B*j+C*k+D*l
                r_tmp = 100*(C*k+D*l)/tmp
                if tmp > F:
                    break
                if r <= r_tmp and 100*(C*k+D*l)/(100*(A*i+B*j)) <=E:
                    r = r_tmp
                    ans = [tmp,C*k+D*l]
print(ans[0],ans[1])

Measured memory_bytes: 42476
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		WriteLine(Solve());
		Out.Flush();
	}
	struct Answer : IComparable<Answer>
	{
		public long Depth, Leaf;
		public Answer(long d, long l) { Depth = d; Leaf = l; }
		public int CompareTo(Answer answer) { var x = Depth.CompareTo(answer.Depth); return x == 0 ? Leaf.CompareTo(answer.Leaf) : x; }
		public override string ToString() => $"{Depth} {Leaf}";
	}
	List<int>[] g;
	Answer Solve()
	{
		var N = F;
		g = new List<int>[N];
		for (var i = 0; i < N; i++) g[i] = new List<int>();
		for (var i = 0; i < N - 1; i++)
		{
			var I = G;
			g[I[0] - 1].Add(I[1] - 1);
			g[I[1] - 1].Add(I[0] - 1);
		}
		var x = Visit(-1, 0);
		var y = Visit(-1, x.Item2);
		var p = new int[N];
		AsRoot(x.Item2, -1, p);
		var c = y.Item2;
		for (var i = 0; i < y.Item1 / 2; i++) c = p[c];
		Answer ans;
		if (y.Item1 % 2 == 0)
		{
			ans = Check(c);
			foreach (var d in g[c])
			{
				var t = Check(c, d);
				if (ans.CompareTo(t) > 0) ans = t;
			}
		}
		else ans = Check(c, p[c]);
		return ans;
	}
	long[] Unite(IEnumerable<long[]> z)
	{
		var ans = new long[z.Max(x => x.Length) + 1];
		ans[0] = z.Count();
		for (var i = 0; i < ans.Length - 1; i++)
		{
			ans[i + 1] = 0;
			foreach (var t in z) if (i < t.Length) ans[i + 1] = Max(ans[i + 1], t[i]);
		}
		return ans;
	}
	long[] Unite(int v, int p)
	{
		var sub = new List<long[]>();
		foreach (var e in g[v]) if (e != p) sub.Add(Unite(e, v));
		if (sub.Count == 0) return new []{ 1L };
		return Unite(sub);
	}
	Answer Check(int v)
	{
		var ans = new Answer(0, 0);
		var tmp = Unite(v, -1);
		var p = 1L;
		foreach (var x in tmp) p *= x;
		return new Answer(tmp.Length, p);
	}
	Answer Check(int u, int v)
	{
		var a = Unite(u, v);
		var b = Unite(v, u);
		var c = Unite(new[] { a, b });
		var p = 1L;
		foreach (var x in c) p *= x;
		return new Answer(c.Length - 1, p);
	}
	void AsRoot(int v, int p, int[] par)
	{
		par[v] = p;
		foreach (var e in g[v]) if (e != p) AsRoot(e, v, par);
	}
	Tuple<int, int> Visit(int p, int v)
	{
		var r = new Tuple<int, int>(0, v);
		foreach (var e in g[v])
			if (e != p)
			{
				var t = Visit(v, e);
				if (r.Item1 < t.Item1 + 1) r = new Tuple<int, int>(t.Item1 + 1, t.Item2);
			}
		return r;
	}
}


Measured memory_bytes: 13652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;
const int MOD = 1000000007;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}


int main() {
    int n,k,q; cin >> n >> k >> q;
    vector<int> v;v.assign(n,k-q);
    for(int i = 0;i < q;i++){
        int x; cin >> x;x--;
        v[x]++;
    }
    for(int i = 0;i < n;i++){
        if(v[i] > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) cin >> d.at(i);
  int count = 0, high = 0, current = 100000000000, note = 0;
  for (int i = 0; i < N; i++) {
    high = 0;
    for (int j = 0; j < N; j++) {
      if (d.at(j) > high) {
        high = d.at(j);
        note = j;
      }
    }
    d.at(note) = 0;
    if (high < current) {
      count++;
      current = high;
    }
  }
  cout << count;
}


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

using namespace std;
int main(){
    int n, sum = 0;
    cin >> n;
    int b[n - 1];
    for(int i = 0; i < n - 1; i++){
        cin >> b[i];
    }
    sum += b[0];
    for(int i = 0; i < n - 2; i++){
        sum += min(b[i], b[i + 1]);
    }
    sum += b[n - 2];
    cout << sum << endl;
}


Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N = I()
    A = LI()
    print("YES" if len(list(set(A)))==len(A) else "NO")


main()



Measured memory_bytes: 49040
#include <cstdio>
#include <cmath>
int n;
double x[1005], y[1005], X, Y, d, e;
double dist(double a, double b) {
	return a*a + b*b;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lf%lf", &x[i], &y[i]);
		X += x[i]; Y += y[i];
	}
	X /= n; Y /= n;
	double P = 0.1;
	for (int i = 0; i < 30000; i++) {
		int f = 0;
		d = dist(X - x[0], Y - y[0]);
		for (int j = 1; j < n; j++) {
			e = dist(X - x[j], Y - y[j]);
			if (d < e) { d = e; f = j; }
		}
		X += (x[f] - X)*P;
		Y += (y[f] - Y)*P;
		P *= 0.999;
	}
	printf("%.12lf", sqrt(d));
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1LL << 60;

int main(void){
    int n;
    cin >> n;
    int a[n][3];
    REP(i,n)REP(j,3) cin>>a[i][j];
    ll dp[n+1][3]={0};
    REP(i,n){
        REP(j,3){
            REP(k,3){
                if(j==k) continue;
                chmax(dp[i+1][k],dp[i][j]+a[i][k]);
            }
        }
    }
    ll ans=0;
    REP(i,3) chmax(ans,dp[n][i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6964