akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
using P = pair<int,int>;

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    ll N; cin >> N;
    vector<pair<ll, int>> fs;   // ある値の素因数分解を行うときは、vectorの中にpairというデータ型を定義して、それぞれの底およびべき指数を格納する
    for(ll i=2; i*i<=N; i++){   // 1は素数ではないので、素因数分解を行うときは2からループを始める
        int x = 0;
        while(N%i==0){
            ++x;
            N /= i;
        }
        fs.push_back(make_pair(i,x));
    }
    // 素因数分解をするためのループ回数を少なくするために、エラトステネスのふるいを用いているが、
    // もし素因数分解ができなかった場合を含めるために、最後に素因数分解できたか判定して
    // できていない場合は素因数分解の結果を格納する配列に追加する
    if(N != 1) fs.push_back(make_pair(N, 1));


    int ans = 0;
    for(auto f: fs){
        int x = f.second;
        int b = 1;
        while(x >= b){
            x -= b;
            ++b;
            ++ans;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 19768
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int q = sc.nextInt();
		long[][] alpha = new long[26][s.length()];
		Segment[] seg = new Segment[26];
		for (int i = 0; i < n; i++) alpha[s.charAt(i)-'a'][i]++;
		for (int i = 0; i < 26; i++) seg[i] = new Segment(alpha[i]);
		int t,b,c,l,r,count;
		char[] S = s.toCharArray();
		for (int i = 0; i < q; i++) {
			t = sc.nextInt();
			if(t==1) {
				b = sc.nextInt()-1;
				c = sc.next().charAt(0)-'a';
				if(S[b]-'a'!=c) {
					seg[S[b]-'a'].update(b, 0);
					seg[c].update(b, 1);
					S[b] = (char)(c+'a');
				}
			}else if(t==2) {
				l = sc.nextInt()-1;
				r = sc.nextInt();
				count = 0;
				for (int j = 0; j < 26; j++) {
					if(seg[j].query(l,r)>0) {
						count++;
					}
				}
				System.out.println(count);
			}
		}
		sc.close();
	}
	public static class Segment {
		int n; long[] dat; int e = 0;
		public Segment(long[] a){
			n = 1;
			while(n < a.length) n *= 2;
			dat = new long[2*n-1];
			for (int i = 0; i < n; i++) dat[i+n-1] = (i<a.length)?a[i]:e;
			for (int i = n-2; i >= 0; i--) dat[i] = dat[2*i+1] + dat[2*i+2];
		}
		public void update(int k, long a){
			k += n-1;
			long b = dat[k];
			dat[k] = a;
			while(k>0) {
				k = (k-1)/2;
				dat[k] += a-b;
			}
		}
		private long query(int a, int b, int k, int l, int r) {
			if(r<=a||b<=l) return 0;
			if(a<=l&&r<=b) return dat[k];
			else {
				long vl = query(a,b,2*k+1,l,(l+r)/2);
				long vr = query(a,b,2*k+2,(l+r)/2,r);
				return vl+vr;
			}
		}
		public long query(int a, int b) {
			return query(a,b,0,0,n);
		}
	}
}

Measured memory_bytes: 443504
#include <bits/stdc++.h>
#define ll long long int
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll x = 1000000000000000000;
    ll res = 1LL;
    bool y = false;
    bool z = false;
    while(n--)
    {
        ll a;
        cin >> a;
        if (a == 0)
            y = true;
        if (res == 0)
        {
            y = true;
            break;
        }
        if (x / res >= a)
            res = res * a;
        else 
            z = true;
    }
    if (y == true)
        cout << 0;
    else if (z == true)
        cout << -1;
    else
        cout << res;
    return 0;
}
// Instead of com

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main()
{
    int n,i,j;
    string x,y,z;
    cin>>n;
    cin>>x>>y;
    for(i=0,j=0;i<n+n,j<n;i=i+2,j++){
        z[i]=x[j];
    }
    for(i=1,j=0;i<n+n,j<n;i=i+2,j++){
        z[i]=y[j];
    }
    for(i=0;i<n+n;i++)
    cout<<z[i];
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>

int N;
std::vector<int> A;
std::vector<std::vector<std::pair<int, int>>> xy;
int max_num_honest = 0;

bool Judge(int bit_assumed) {
  // extract each person(i)'s testifications in the bit_assumed
  for (int i = 0; i < N; ++i) {
    if (!((bit_assumed>>i) & 1)) continue;
    for (int j = 0; j < A[i]; j++) {
      int x = xy[i][j].first;
      int y = xy[i][j].second;
      if (((bit_assumed>>x) & 1) ^ y) {
        return false;
      }
    }
  }
  return true;
}

int HonestCounter(int bit_assumed) {
  int counter = 0;
  for(int i = 0; i < N; ++i) {
    if ((bit_assumed>>i) & 1) {
      counter++;
    }
  }
  return counter;
}

int main() {
  std::cin >> N;
  xy.reserve(N);
  A.reserve(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> A[i];
    xy[i].reserve(A[i]);
    for (int j = 0; j < A[i]; ++j) {
      std::cin >> xy[i][j].first >> xy[i][j].second;
      --xy[i][j].first;
    }
  }

  for (int bit_assumed = 0; bit_assumed < (1<<N); ++bit_assumed) {
    if (!Judge(bit_assumed)) {
      continue;
    }
    max_num_honest = std::max(max_num_honest, HonestCounter(bit_assumed));
  }
  std::cout << max_num_honest << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n,l[200],ans=0;
  cin>>n;
  for(int i=0;i<n*2;i++){
  cin>>l[i];
  }
  sort(l,l+2*n);
  for(int i=0;i<n;i++){
  ans+=l[2*i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import math
N = int(input())
counts = [0] * N
for x in range(1, N, 1):
    if x**2>N:
        break
    for y in range(1, N, 1):
        if y**2 > N:
            break
        for z in range(1, N, 1):
            if z**2 > N:
                break
            i = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)
            # print(x,y,z,i)
            if i <= N:
                counts[i - 1] += 1
for k in counts:
    print(k)

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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, d; cin >> n >> d;
    ll ans = 0;
    rep(i, n) {
        ll x, y; cin >> x >> y;
        if(d*d >= x*x + y*y) ans++;
    }
    cout << ans << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3624
/*
      author  : nishi5451
      created : 14.08.2020 17:35:05
*/

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


int main(){
    map<string,int> mp;
    int n,m;
    cin >> n;
    rep(i,n){
        string s;
        cin >> s;
        mp[s]++;
    }
    cin >> m;
    rep(i,m){
        string s;
        cin >> s;
        mp[s]--;
    }
    int ans = 0;
    string key;
    for(auto a : mp){
        if(a.second > ans){
            key = a.first;
            ans = a.second;
        }
    }
    if(ans == 0){
        cout << 0 << endl;
    }
    else cout << ans << endl;
   
    return 0;
}

Measured memory_bytes: 3636
n = int(input())
xy = []
ans = []

for i in range(n):
    xin,yin = map(int,input().split())
    xy.append([xin,yin])

if n==1:
    print(1)
    exit(0)

xy.sort(key=lambda x:x[1])
xy.sort(key=lambda x:x[0])

for i in range(n):
    for j in range(n):
        if( i==j ):
            continue
        t = (xy[i][0]-xy[j][0],xy[i][1]-xy[j][1])
        ans.append(t)

res = [ans.count(e) for e in set(ans)]
print(n-max(res))

Measured memory_bytes: 3444
fun main(args:Array<String>): Unit {
    val (x, y) = readLine()!!.trim().split(' ').map(String::toInt)
    println(x + y - gcd(x, y) + 1)
}
fun gcd(a: Int, b: Int): Int {
    return when(b){
        0 -> a
        else -> gcd(b, a % b)
    }
}


Measured memory_bytes: 26736
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n,j,i=0,k=0;
    cin >> n >> j;
    
    int a[100000] = {};
    while(i<n){
        cin >> a[i];
        i++;
    }
    sort(a,a+n);
    
    vector<pair<int,int>> A(j);
    i=0;
    while(i<j){
        cin >> A[i].second >> A[i].first;
        i++;
    }
    sort(A.begin(),A.end(),greater<pair<int,int>>());
    i=0;
    while(i<j)
    {
        int b = A[i].second;
        while(b > 0){
            if(a[k]<A[i].first){
                a[k] = A[i].first;
                k++;
                b--;
                if(k>=n){
                    goto out;
                }
            }else{
                break;
            }
        }
        i++;
    }
out:
    long long ans = 0;
    i=0;
    while (i<n){
        ans += a[i];
        i++;
    }
    cout << ans<< endl;
    
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() cin.tie(0), ios::sync_with_stdio(false)

int X, A, B, N, now;

int main()
{
    cin >> X >> A >> B >> N;
    now = X;
    for (int i = 0; i < N; i++)
    {
        int up = 0;
        string s;
        cin >> s;
        if (s == "nobiro")
            up = A;
        else if (s == "tidime")
            up = B;
        else
            now = 0;

        if (now + up < 0)
            now = 0;
        else
            now += up;
    }

    cout << now << endl;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

template<typename T>
class CumulativeSum{
public:
  Int n;
  vector<T> sum;
  vector<T> A;
  Int added;
  CumulativeSum():n(-1),added(0){}
  CumulativeSum(Int n):n(n), sum(n+1), A(n+1),added(0){}
  CumulativeSum(const vector<T> &B):n(B.size()), sum(n+1), A(n+1),added(0){
    for(Int i=1;i<=n;i++) sum[i] = sum[i-1] + B[i-1];
  }

  void apply(){
    for(Int i=1;i<=n;i++) A[i] = A[i] + A[i-1];
    for(Int i=1;i<=n;i++) A[i] = A[i] + A[i-1];
    for(Int i=1;i<=n;i++) sum[i] = sum[i] + A[i-1];
    added = 0; A.clear(); A.resize(n+1);
  }

  //[l, r)にxを加算
  void add(Int l, Int r, T x){
    added = 1;
    assert(l <= r && 0 <= l && r <= n);
    A[l] = A[l] + x;
    A[r] = A[r] - x;
  }

  //[l, r)の和を得る
  T get(Int l,Int r){
    assert(l<=r && 0<=l && r<=n);
    if(added) apply();
    return sum[r] - sum[l];
  }
};


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s;
  cin>>s;
  Int cnt = 0;
  Int ans = 0;
  Int n = s.size();
  for(Int i=0;i<n;i++){
    cnt += s[i] == 'B';
    if(s[i] == 'W') ans += cnt;
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

struct Vector2 {
    double x;
    double y;

    Vector2()
    : x(0.0)
    , y(0.0)
    {}

    Vector2(double _x, double _y) 
    : x(_x)
    , y(_y)
    {}

    double Length() const {
        return sqrt(x * x + y * y);
    }

    Vector2 Normalize() const {
        const double length = Length();
        Vector2 norm(x / length, y / length);
        return norm;
    }
    
    Vector2 operator+(const Vector2& vec) const {
        Vector2 v;
        v.x = x + vec.x;
        v.y = y + vec.y;
        return v;
    }

    Vector2 operator-(const Vector2& vec) const {
        Vector2 v;
        v.x = x - vec.x;
        v.y = y - vec.y;
        return v;
    }

    Vector2 operator*(const double d) const {
        Vector2 v;
        v.x = x * d;
        v.y = y * d;
        return v;
    }
};

double Dot(const Vector2& l, const Vector2& r) {
    return l.x * r.x + l.y * r.y;
}

int main() {
    int p0X, p0Y, p1X, p1Y;
    cin >> p0X >> p0Y >> p1X >> p1Y;

    int q;

    cin >> q;

    const Vector2 p0(p0X, p0Y);
    const Vector2 p1(p1X, p1Y);

    const Vector2 p0p1 = p1 - p0;
    
    while(q--) {
        int ptx, pty;
        cin >> ptx >> pty;

        const Vector2 pt(ptx, pty);
        const Vector2 p0pt = pt - p0;

        const Vector2 ans = p0 + p0p1 * (Dot(p0p1, p0pt) / (p0p1.Length() * p0p1.Length()));
        cout << fixed << setprecision(10) << ans.x << " " << ans.y << endl;
    }

    return 0;
}

Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  
  //vector<int> A(N);
  vector<int> B(N-1);
  //vector<int> C(N);
  
  
  for(int i=0;i<N-1;i++){
    cin >> B.at(i);
  }
  
  int ans = B.at(0);
  
  if(N!=2){
    for(int i=1;i<N-1;i++){
      if(B.at(i-1) >= B.at(i)){
        ans = ans + B.at(i);
      }
      else{
        ans = ans + B.at(i-1);
      }
    }
  }
  
  ans = ans + B.at(N-2);
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
int main(){
	int a,b;
	a=b=0;
	for(int i=0;i<3;i++){
		int k;
		scanf("%d",&k);
		if(k==5) a++;
		if(k==7) b++;
	}
	if(a==2 && b==1) printf("YES\n");
	else printf("NO\n");
}

Measured memory_bytes: 128
//O(N^2)
#include<cstdio>
#define ll long long
const int N=2005,mo=1e9+7;
int n,k,i,j,f[N][N];
void add(int &x,int k){x=(x+k)%mo;}
int main(){
	scanf("%d%d",&n,&k);f[n+1][0]=1;
	for (i=n+1;i>=3;i--){
		for (j=n+1-i;j>=0;j--){
			add(f[i-1][j+1],f[i][j]);
			add(f[i][j],f[i][j+1]);
			add(f[i-1][j],f[i][j]);
		}
	}
	int ans=f[2][n-k]; 
	for (i=n-k-1;i>=1;i--) ans=2ll*ans%mo;
	printf("%d",ans);
}

Measured memory_bytes: 15232
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>

#include <climits>
#include <cmath>
#include <cstring>

#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	int a,b;
	cin >> a >> b;

	string str = "";
	string str2 = "";
	for(int i=0 ; i<b ; i++)
		str += a+'0';
	for(int i=0 ; i<a ; i++)
		str2 += b+'0';

	if(str < str2)
		cout << str;
	else
		cout << str2;

	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++)
using ll = long long;
const ll M = 1e9 + 7;

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

  int ans = 0;
  rep(i,s.size()) {
    if (s[i] == '2') ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3580
//----------ACCIDENTAL COMPETITIVE PROGRAMMER---------------------

#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair


const LL MOD = (1e9) + 7 ;
const LD EPS = 0.0000001 ;

const int N = 55;
const int K = 150;
LL cache[N][N][K];
bool vis[N][N][K];
LL arr[N];

LL solve(int l, int r, int k)
{
	if (k == 0)
		return 0;
	if (l == r)
		return max(0LL, arr[l]);
	if (vis[l][r][k])
		return cache[l][r][k];
	LL &ans = cache[l][r][k];
	vis[l][r][k] = true;
	if (arr[l] >= 0){
		ans = max (ans, arr[l] + solve(l + 1, r, k - 1));
	} else {
		if (k >= 2)
			ans = max(ans, solve(l + 1, r, k - 2));
		
		ans = max(ans, arr[l] + solve(l + 1, r, k - 1));
	}

	if (arr[r] >= 0){
		ans = max (ans, arr[r] + solve(l, r - 1, k - 1));
	} else {
		if (k >= 2)
			ans = max(ans, solve(l , r - 1, k - 2));
	
		ans = max(ans, arr[r] + solve(l , r - 1, k - 1));
	}
//	cout << l << " " << r << " " << k << endl;
	return ans;
}

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

    int n, k; cin >> n >> k;
    for (int i = 1; i <= n; i++)
    	cin >> arr[i];
    cout << max(0LL, solve(1, n, k));

	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ld long double
#define vi vector<vector<ll> >
using namespace std;
const int MOD=1000000007;
const int MOD2=15000007;
const ll MAX=9187201950435737471;
const int N=100005;
const int INF=1e17;
const long double PI=acos(-1);

double A[200005];

void solve(int T){
    int n,k;
    double res,ex=0;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
    }
    for(int i=0;i<k;i++)
    {
        ex+=(A[i]*(A[i]+1)/2)*(1/A[i]);
    }
    res=ex;
    for(int i=k;i<n;i++)
    {
        ex-=(A[i-k]*(A[i-k]+1)/2)*(1/A[i-k]);
        ex+=(A[i]*(A[i]+1)/2)*(1/A[i]);
        res=max(res,ex);
    }
    cout<<fixed<<setprecision(12)<<res<<endl;
}

int main() {
    fastio
    int T=1;
    //cin>>T;
    for(int i=1;i<=T;i++){
        solve(i);
        //if(i<T)cout<<"\n";
    }
    return 0;
}





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

int main(){
    int n,l;
    cin >> n >> l;
    int sum = 0;
    int a,b = 10000;
    for (int i = 1;i <= n;i++){
        a = l + i - 1;
        sum += a;
        if (abs(a) < abs(b)){
            b = a;
        }
    }
    cout << sum - b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char ch[5];

int main(){
	cin>>ch;int fg=0;
	for(int i=0;i<3;++i){
		if(ch[i]-'0'==7){
			puts("Yes");fg=1;
			break;
		}
	}
	if(!fg)puts("No");
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int n;cin>>n;
  n%=1000;
  if(n){
    cout<<(1000-n)<<endl;
  }else{
    cout<<0<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3636
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        w:i64,h:i64,x:i64,y:i64,
    }
    if x * 2 == w && y * 2 == h {
        println!("{} {}", (w * h) as f64 / 2.0, 1);
    } else {
        println!("{} {}", (w * h) as f64 / 2.0, 0);
    }
}


Measured memory_bytes: 2128
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <type_traits>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define all(n) std::begin(n), std::end(n)
#define rall(n) std::rbegin(n), std::rend(n)
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;


void init() {
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
}

void calc() {

	Int X, Y, A, B, C; std::cin >> X >> Y >> A >> B >> C;
	std::vector<Int> p(A), q(B);
	rep(i, A)std::cin >> p[i];
	rep(i, B)std::cin >> q[i];
	std::sort(rall(p)), std::sort(rall(q));
	std::vector<Int> container;
	rep(i, X)container.push_back(p[i]);
	rep(i, Y)container.push_back(q[i]);
	rep(i, C) {
		Int r; std::cin >> r;
		container.push_back(r);
	}
	std::sort(rall(container));
	Int ans = 0;
	rep(i, X + Y) {
		ans += container[i];
	}

	std::cout << ans;


}


int main() {

	init();
	calc();

	return 0;
}

Measured memory_bytes: 7664
import sys

import numpy as np
from numba import njit, i8


def input():
    return sys.stdin.readline().strip()


def convert(S):
    i, *d = S.split(".")
    i = int(i) * 1_000_000_000
    if d:
        return i + int(d[0].ljust(9, "0"))
    else:
        return i


def div_cnt(n, d):
    res = 0
    while n % d == 0:
        res += 1
        n //= d
    return res


@njit(i8(i8[:, :]), cache=True)
def solve(table):
    ans = 0
    for i in range(19):
        for j in range(19):
            cur = table[i][j]
            if cur == 0:
                continue
            for k in range(18 - i, 19):
                for l in range(18 - j, 19):
                    if k == i and j == l:
                        ans += cur * (cur - 1)
                    else:
                        ans += cur * table[k][l]
    return ans


N = int(input())
A = list(convert(input()) for _ in range(N))
divs = [(div_cnt(a, 2), div_cnt(a, 5)) for a in A]

table = np.zeros((19, 19), np.int64)
for t, f in divs:
    table[min(t, 18)][min(f, 18)] += 1
print(solve(table) // 2)


Measured memory_bytes: 130892
#include <bits/stdc++.h>
using namespace std;
int n,m,a[101][101],row[101],col[101];
string str;
int main() {
    cin>>n>>m;
    for (int i=0; i<n; i++) {
        cin>>str;
        for (int j=0; j<m; j++) a[i][j]=(str[j]=='.');
    }
    for (int i=0; i<n; i++) {
        int x=0;
        for (int j=0; j<m; j++) {
            if (a[i][j]==0) x=1;
        }
        if (!x) row[i]=1;
    }
    for (int i=0; i<m; i++) {
        int x=0;
        for (int j=0; j<n; j++) {
            if (a[j][i]==0) x=1;
        }
        if (!x) col[i]=1;
    }
    for (int i=0; i<n; i++) {
        if (row[i]) continue;
        for (int j=0; j<m; j++) {
            if (col[j]) continue;
            if (a[i][j]) cout<<'.';
            else cout<<'#';
        }
        cout<<'\n';
    }
}

Measured memory_bytes: 3660
using System;
using System.Collections.Generic;
using System.Linq;

namespace AOJ
{
  class Program
  {
    public static void Main(string[] args)
    {
      var n = int.Parse(Console.ReadLine());
      var debt = 100000;
      foreach (var i in Enumerable.Range(0, n))
      {
        var tmp = (double)debt * 1.05;
        if (tmp % 1000 != 0)
          debt = (int)((tmp / 1000) + 1) * 1000;
        else
          debt = (int)tmp;
      }
      Console.WriteLine(debt);
    }
  }
}

Measured memory_bytes: 5808
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

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

    ll a[n];
    rep(i, 0, n){
        cin >> a[i];
    }

    ll ans = 0;
    ll count = 1;
    rep(i, 0, n){
        if(a[i] == count){
            count++;
        }else{
            ans++;
        }
    }

    if(count == 1){
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
}


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

int nParticipant , nSport ;

pair < int , int > numbest[310] ;
int del[310] ;

int a[310][310] ;

int main(){
    #define NAME "A"
    //freopen( NAME".inp" , "r" , stdin ) ; freopen( NAME".out" , "w" , stdout ) ;

    scanf( "%d %d" , &nParticipant , &nSport ) ;

    for( int i = 1 ; i <= nParticipant ; ++ i ){
        for( int j = 1 ; j <= nSport ; ++ j ) {
            scanf( "%d" , &a[i][j] ) ; if( j == 1 ) numbest[ a[i][j] ].first ++ ;
        }
    }

    int ans = 0 ;

    for( int i = 1 ; i <= nSport ; ++ i ) numbest[i].second = i , ans = max( ans , numbest[i].first ) ;

    for( int i = 1 ; i < nSport ; ++ i ){
        sort( numbest + 1 , numbest + nSport + 1 ) ;
        del[ numbest[nSport].second ] = 1 ;
        memset( numbest , 0 , sizeof(numbest) ) ;
        for( int idPar = 1 ; idPar <= nParticipant ; ++ idPar ){
            for( int j = 1 ; j <= nSport ; ++ j ) {
                if( del[ a[idPar][j] ] ) continue ;
                numbest[ a[idPar][j] ].first ++ ;
                break ;
            }
        }
        int res = 0 ;
        for( int j = 1 ; j <= nSport ; ++ j ){
            numbest[j].second = j ;
            res = max( res , numbest[j].first ) ;
        }
        ans = min( ans , res ) ;
    }

    printf( "%d" , ans ) ;

    return 0 ;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,j,k) for(int i = (int)(j);i <= (int)(k);i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define fix cout<<fixed<<setprecision(20);
const int maxn=(int)1e6+5;
typedef pair<int,int> pii;
#define X first
#define Y second
pii p[maxn];
signed main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    rep(i,1,n){cin>>p[i].X;p[i].Y=i;}
    sort(p+1,p+1+n,greater<pii>());
    multiset<int> st;
    st.insert(0);st.insert(0);st.insert(n+1),st.insert(n+1);
    int ans=0;
    rep(j,1,n){
        
        int i=p[j].Y;
        auto it=st.lower_bound(i);
        int yi=*it;
        int zi=*(++it);it--;
        int xi=*(--it);
        int wi=*(--it);
        ans+=((xi-wi)*(yi-i)+(zi-yi)*(i-xi))*p[j].X;//debug(ans);
        st.insert(i);
    }
    cout<<ans<<endl;
}
/* 
core
1. decreasing add to set
2. wi  xi  i  yi  zi   (xi-wi)*(yi-i)+(zi-yi)*(i-xi)
eg
3
2 3 1
2*2+1
2*()
 */

Measured memory_bytes: 6528
#include <stdio.h>

int main() {

	int N;
	scanf("%d",&N);

	int i,j;

	for(i=0;i<=25;i++){
		for(j=0;j<=14;j++){
			if((4*i)+(7*j)==N){
			printf("Yes\n");
			return 0;
			}
		}
	}

	printf("No\n");


	return 0;
}

Measured memory_bytes: 128
import numpy as np


def solve(stdin):
    A, B, C, D, E, F = stdin
    conc = -1
    ans = (1, 2)
    for na in range(F // (100 * A) + 1):
        for nb in range(F // (100 * B) + 1):
            if na == nb == 0:
                continue
            G = F - na * 100 * A - nb * 100 * B
            for nc in range(G // C + 1):
                for nd in range(G // D + 1):
                    W = na * 100 * A + nb * 100 * B + nc * C + nd * D
                    if 0 < W <= F and nc * C + nd * D <= E * (na * A + nb * B):
                        conc2 = 100 * (nc * C + nd * D) / W
                        if conc < conc2 <= 100 * E / (100 + E):
                            ans = (W, nc * C + nd * D)
                            conc = conc2
    return ans


def main():
    stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=' ')
    print(*solve(stdin))


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()


Measured memory_bytes: 27288
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define sz(v) (ll)v.size()
using namespace std;

ll MOD=1e9+7;
ll g,h,l;
const ll N=100005;

ll add(ll a,ll b); ll mul(ll a,ll b); ll binpo(ll a,ll b);

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll a,b;
    cin>>a>>b;
    if(max(a,b)>9){
        cout<<-1;
    }
    else{
        cout<<a*b;
    }
}

ll add(ll a,ll b)
{
    return (a%MOD+b%MOD)%MOD ;
}
ll mul(ll a,ll b)
{
    return (a* 1ll *b)%MOD ;
}
ll binpo(ll a,ll b)
{
    int ans = 1 ;
    while(b)
    {
        if( b % 2 != 0)
        {
            ans = mul(ans,a);
        }
        a = mul(a,a);
        b = b/2;
    }
    return ans;
}

Measured memory_bytes: 256
n,x,y=map(int,input().split())
ans=[0]*(n-1)
for i in range(1,n):
    for j in range(i+1,n+1):
        a=min(j-i,abs(j-y)+1+abs(x-i),abs(y-i)+1+abs(x-j))-1
        ans[a]+=1
for i in range(len(ans)):
    print(ans[i])


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

int main() {
  int n;
  cin>>n;
  int a[n];
  bool ok=true;
  REP(i,n){
    cin>>a[i];
    if (a[i]%2==0)
    {
      /* code */
      if (a[i]%3==0)
      {
        /* code */
        ok=true;
      }
      else if (a[i]%5==0)
      {
        /* code */
        ok=true;
      }
      else
      {
        ok=false;
        break;
      }
      
      
      
    }
    
  }
  if (ok)
  {
    /* code */
    cout<<"APPROVED"<<endl;

  }
  else
  {
    cout<<"DENIED"<<endl;
  }
  
  
  
}


Measured memory_bytes: 256
import java.lang.Math.max
import java.lang.Math.min
import java.util.*

fun main(args: Array<String>) {
    val s = Scanner(System.`in`)
    val a = s.nextInt()
    val b = s.nextInt()
    val c = s.nextInt()

    val min = min(a, min(b, c))
    val max = max(a, max(b, c))
    val ret = if (min == c || max == c) "No" else "Yes"
    
    println(ret)
}

Measured memory_bytes: 31136
#include <iostream>
#include <vector>
#include <numeric>
#include <math.h>
#include <algorithm>

using namespace std;

const long long int MAX_N = 100000;

int main(int argc, char const *argv[]) {
  long long int n;
  vector<long long int> a(MAX_N,0);
  cin >> n;
  a.resize(n+1);
  a[0] = 0;
  for (size_t i = 1; i <= n; i++) cin >> a[i];

  long long int sum = 0;
  for (size_t i = 1; i <= n; i++) {
    sum += abs(a[i]-a[i-1]);
  }
  sum += abs(a[n]-a[0]);
  for (size_t i = 1; i <= n; i++) {
    long long int ans = sum;
    if (i != n) {
      ans -= (abs(a[i]-a[i-1])+abs(a[i+1]-a[i]));
      ans += abs(a[i+1]-a[i-1]);
    }
    else {
      ans -= (abs(a[i]-a[i-1])+abs(a[i]-a[0]));
      ans += abs(a[i-1]-a[0]);
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 2032
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <set>

using namespace std;

int a[10];
string vs[10];
bool selected[10];
set<int> res;
bool no[10];
int lleft[10];

void comb(int num){
  if(num==5){
    // ツづつソツづァツづーツ湘」ツづ可つキツづゥツつゥ
    for(int s = 0; s < (1<<5); s++){
      int mask=0;
      for(int i = 0; i < 5; i++){
	if((s>>i)&1){
	  for(int j = 0; j < 5; j++){
	    if(vs[a[i]][j]=='1')
	      mask|=(1<<(j*5+i));
	  }
	}
	else{
	  // ツ逆ツ古シツつォ
	  for(int j = 0; j < 5; j++){
	    if(vs[a[i]][4-j]=='1')
	      mask|=(1<<(j*5+i));
	  }
	}
      }
      int tail=0;
      for(int i = 0; i < 10; i++){
	if(!selected[i])
	  lleft[tail++]=i;
      }
      memset(no,0,sizeof(no));
      bool bad=false;
      // ツづ個つアツづィツづ個要ツ素ツづーツマツッツチツつキツづゥツ渉氾板づ可置ツつ「ツづつ「ツつュ
      for(int i = 0; i < 5; i++){
	bool ok=false;
	for(int j = 0; j < tail; j++){
	  if(no[j])continue;
	  bool isMatch=true;
	  // matchツつキツづゥツつゥツ陳イツづ猟づゥ
	  // ツ債カツつゥツづァ
	  for(int k = 0; k < 5; k++){
	    if(!((vs[lleft[j]][k]-'0')^((mask>>(i*5+k))&1))){
	      // no
	      isMatch=false;
	      break;
	    }
	  }
	  if(!isMatch){
	    isMatch=true;
	    for(int k = 0; k < 5; k++){
	      if(!((vs[lleft[j]][4-k]-'0')^((mask>>(i*5+k))&1))){
		// no
		isMatch=false;
		break;
	      }
	    }
	    if(isMatch){
	      no[j]=true;
	      ok=true;
	      break;
	    }
	  }
	  else{
	    no[j]=true;
	    ok=true;
	    break;
	  }
	}
	// ツづ敖づつつゥツづァツづ按つ「
	if(!ok){
	  bad=true;
	  break;
	}
      }
      if(!bad){
	res.insert(mask);
      }
    }
  }
  else{
    for(int i = 0; i < 10; i++){
      if(selected[i])continue;
      a[num]=i;
      selected[i]=true;
      comb(num+1);
      selected[i]=false;
    }
  }
}

int main(){

  memset(selected,0,sizeof(selected));
  while(cin>>vs[0]&&vs[0]!="END"){
    for(int i = 1; i < 10; i++)
      cin>>vs[i];
    comb(0);
    cout<<res.size()/8<<endl;
    res.clear();
  }
  
  
  return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" ";
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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


const string YES = "Yes";
const string NO = "No";

void func(std::string S){

    if(S[2]==S[3] && S[4]==S[5])cout<<"Yes"<<endl;
    else cout<<NO<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    std::string S;
    std::cin >> S;
    func(S);
    return 0;
}


Measured memory_bytes: 256
fn main() {
    let (n, h) : (usize, i32) = readln();
    let mut v : Vec<(i32, i32)> = readlns(n);
    let normal = v.iter().map(|k| k.0).max().unwrap();
    let mut answer = 0;
    v.sort_by_key(|x| -(x.1));
    let mut h = h;
    for &(_, b) in &v {
        if b <= normal {
            break
        }
        h -= b;
        answer += 1;
        if h <= 0 {
            break
        }
    }
    if h > 0 {
        answer += (h + normal - 1) / normal;
    }
    println!("{}", answer);
}

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::HashSet;

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n { vs.push(readln()); }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(String, bool, f32, f64, isize, i8, i16, i32, i64, usize, u8, u16, u32, u64);
impl<T> FromLn for Vec<T> where T: FromLn {
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);


Measured memory_bytes: 4352
#pragma GCC optimize("Ofast")
#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;


/*
                     Keep trying ..!!!!
                     The journey is more important
*/

#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define umapii unordered_map < int , int >
#define umapll unordered_map<ll,ll>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define ll long long
#define pi pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vs vector<string>
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pi>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define FOR(i,a,b) for(int i = a;i <= b; i++)

// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";

const ll mod = 1000000007;
ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}


const int inf = 1e9 + 7;
int main(){
    ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int a , b , c;
    cin >> a >> b >> c;
    if(a + b + c >= 22) cout << "bust\n";
    else cout << "win\n";

}

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

int main(){
    
    int a, b, c;
    
    cin >> a >> b >> c;
    
    if (a < b && a < c){
        if (b < c){
            cout << a <<" "<< b <<" "<< c << endl;
        } else{
            cout << a <<" "<< c <<" "<< b << endl;
        }
    } else if (b < a && b < c){
        if (a < c){
            cout << b <<" "<< a <<" "<< c << endl;
        } else{
            cout << b <<" "<< c <<" "<< a << endl;
        }
    } else{
        if(a < b){
            cout << c <<" "<< a <<" "<< b << endl;
        } else{
            cout << c <<" "<< b <<" "<< a << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3108
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//ABC165D
//ABC165C
//ABC165B

int main(void) {
  long long x, n, k, i=0, cou=0;
  double tmp=100;
  scanf(" %lld", &x);
  while(x>tmp){
    tmp=floor(tmp*101/100);
    i++;
  }
  printf("%lld", i);
}


Measured memory_bytes: 1736
#include <iostream>
#include <vector>
using namespace std;
const int nmax=100005;
vector<int> v[nmax];
int viz[nmax],sg[nmax];
int n,i,a,b;
void dfs(int x)
{
    viz[x]=1;
    for(int i=0;i<v[x].size();i++)
        if(!viz[v[x][i]])
    {
        dfs(v[x][i]);
        sg[x]^=(sg[v[x][i]]+1);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin>>n;
    for(i=1;i<=n-1;i++)
    {
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(1);
    if(sg[1]) cout<<"Alice";
    else cout<<"Bob";
    return 0;
}

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


int main(){
  int n, ame1[100] = {0}, ame2[100] = {0};
  int ans=0;

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


  int cnt = 0;
  for(int i=0; i<n; ++i){
    int work = 0;
    for(int k=0; k<n; ++k){
      if(k < cnt){
	work += ame1[k];
      }else if(k == cnt){
	work += ame1[k] + ame2[k];
      }else{
	work += ame2[k];
      }
    }
    ans = max(ans, work);
    ++cnt;
  }

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


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

using ll=long long;



void solve(){
    string s;
    cin>>s;
    bool flag=false;
    for(auto e:s){
        if(e=='C'){
            flag=true;
        }
        if(e=='F'&&flag){
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;
}

signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int x, y, z;
  cin >> x >> y >> z;
  cout << (x - z) / (y + z) << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3540
from collections import deque
import heapq
n,k = map(int,input().split())
v = deque(list(map(int,input().split())))

ans = 0
for i in range(min(n,k)+1):
    for j in range(min(n,k)-i+1):
        l = [0]
        r = [0]
        mm = [0]
        for p in range(i):
            if v[p] > 0:
                l.append(v[p])
            else:
                heapq.heappush(mm,v[p])
        for o in range(j):
            if v[-o-1] > 0:
                r.append(v[-o-1])
            else:
                heapq.heappush(mm,v[-o-1])
        for m in range(min(k-i-j,len(mm))):
            heapq.heappop(mm)
        # print(i,j,ans,l,r)
        ans = max(ans,sum(l)+sum(r)+sum(mm))
print(ans)
# while k and v:
#     heapq.heappush(l,deque.popleft(v))
#     k-=1
# ans = sum(l)+sum(r)
# while l:
#     print(ans)
#     deque.appendleft(v,heapq.heappop(l))
#     ans = max(ans,sum(l)+sum(r))
#     heapq.heappush(r,deque.pop(v))
#     ans = max(ans,sum(l)+sum(r))
# print(ans)

Measured memory_bytes: 76552
w, h, n = map(int, raw_input().split())
a = []
for i in range(n):
    a.append(map(int, raw_input().split()))

minx = 0
miny = 0
maxx = w
maxy = h

for i in range(n):
    if a[i][2] == 1:
        minx = max(minx, a[i][0])
    elif a[i][2] == 2:
        maxx = min(maxx, a[i][0])
    elif a[i][2] == 3:
        miny = max(miny, a[i][1])
    elif a[i][2] == 4:
        maxy = min(maxy, a[i][1])

if maxy <= miny or maxx <= minx:
    print 0
else:
    print (maxy - miny) * (maxx - minx)

Measured memory_bytes: 2696
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
	int n;
	int t[100000], x[100000], y[100000];
	int T, D;
	bool flag;

	cin >> n;

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

	for (int i = 0; i < n; i++) {
		if (i == 0) {
			T = t[0];
			D = x[0] + y[0];
			if (D <= T && (T % 2) == (D % 2))flag = true;
			else {
				cout << "No" << "\n";
				flag = false;
				break;
			}
		}
		else {
			T = t[i] - t[i - 1];
			D = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
			if (D <= T && (T % 2) == (D % 2))flag = true;
			else {
				cout << "No" << "\n";
				flag = false;
				break;
			}
		}
	}

	if (flag == true)cout << "Yes" << "\n";

    return 0;
}



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

//wierd debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << "\n" ; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
//end of weird debugging stuff
using ll = long long;
using ld = long double;
using vi = vector<int>;
using ii = pair<int,int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
 
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define fo(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define foe(i,x) for(auto& i: x)
#define ar array
#define pb push_back
#define vt vector

template<class T> bool umin(T& a,const T& b){return b<a?a=b,1:0;}
template<class T> bool umax(T& a,const T& b){return b>a?a=b,1:0;}

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
	cin >> x;
}
void read(double& d) {
	string t;
	read(t);
	d=stod(t);
}
void read(long double& d) {
	string t;
	read(t);
	d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
	read(h);
	read(t...);
}
template<class A> void read(vt<A>& x) {
	foe(a, x)
		read(a);
}

// no change 
const ll MOD = 1e9+7;  
int n,r;

void Titan(){
	read(n,r);
	cout << (n<10 ? r+((100 * (10-n))): r);
	
}

int main() {
	FASTER;
	int T = 1;
	//cin >> T;		//cmt if one test case
    fo(T)Titan();
}


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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;

void run_case()
{
    char c;
    cin >> c;
    if (c >= 'A' && c <= 'Z')
        cout << 'A' << "\n";
    else
        cout << 'a' << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3572
ans = [0]*4
for i in range(int(input())):
    S = input()
    if S == "AC":
        ans[0] += 1
    elif S == "WA":
        ans[1] += 1
    elif S == "TLE":
        ans[2] += 1
    else:
        ans[3] += 1
print("AC x {}\nWA x {}\nTLE x {}\nRE x {}".format(*ans))


Measured memory_bytes: 9184
#include <stdio.h>
int main( ){
  int N,i,P,K;
  scanf("%d",&N);

  for(i=0; i < N; i++){
    scanf("%d %d",&P,&K);
    if(P%K == 0){
      printf("%d\n",K);}
    else
      {  printf("%d\n",P%K);}
  }
  return 0;
}

Measured memory_bytes: 596