akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

// const ll MOD = 1e9 + 7;
const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll dp[2][512][512];
ll sum[512][512];
int main() {
    init();
    ll N, X;
    cin >> N >> X;
    dp[0][0][0] = 1;
    rep(i,N){
        ll pre = i % 2, next = (i + 1) % 2;

        fill(dp[next][0], dp[next][512], 0);
        fill(sum[0], sum[512], 0);
        // j:XORの値 k:何番目まで選んだか
        rep(j, 512) sum[j][0] = dp[pre][j][0];
        rep(j, 512) repe(k, 1, 512)(sum[j][k] += sum[j][k - 1] + dp[pre][j][k]) %= MOD;
        rep(now,X+1)rep(x, 512){
            (dp[next][now^x][now] += sum[x][now]) %= MOD;
        }
    }
    ll ans = 0;
    rep(i, X + 1)(ans += dp[N % 2][X][i]) %= MOD;
    cout << ans << endl;
}


Measured memory_bytes: 9356
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){

	int A,B,C;

	scanf("%d %d %d",&A,&B,&C);

	int ans = C,left = 0,right= C,mid = (left+right)/2;

	while(left <= right){

		if(mid*A+mid/7*B >= C){

			ans = mid;
			right = mid-1;

		}else{

			left = mid+1;
		}
		mid = (left+right)/2;
	}

	printf("%d\n",ans);

	return 0;
}



Measured memory_bytes: 3224
#include <stdio.h>

long long t[50][2500][51];

int
main(int argc, char *argv[])
{
  long long n, a, x[50], sum = 0;
  scanf("%lld %lld", &n, &a);
  for(int i = 0; i < n; i++){
    scanf("%lld", &x[i]);
    sum += x[i];
  }

  for(int i = 0; i < n; i++){
    t[i][0][0] = 1;
    for(int j = 1; j < n; j++){
      t[i][0][j] = 0;
    }
  }

  

  for(int i = 0; i < n; i++){
    t[i][0][0] = 1;
    for(long long s = 1; s <= sum; s++){
      t[i][s][0] = 0;
    }
  }

  for(long long s = 1; s <= sum; s++){
    if(s == x[0]) t[0][s][1] = 1;
    else t[0][s][1] = 0;
  }

  

  long long ans = 0;

  for(int i = 1; i < n; i++){
    for(long long s = 0; s <= sum; s++){
      for(int u = 1; u <= n; u++){
	if(x[i] <= s){
	  t[i][s][u] = t[i - 1][s - x[i]][u - 1] + t[i - 1][s][u];
	}
	else{
	  t[i][s][u] = t[i - 1][s][u];
	}
      }
    }
  }

  for(long long s = 1; s <= sum; s++){
    for(int u = 1; u <=n; u++){
      if(a * u == s) ans += t[n - 1][s][u];
    }
  }


  printf("%lld\n", ans);

 

  return 0;
}


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

using namespace std;

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	int i = 0;
	int j = 0; 
	int k = 0;
	int player = 0;
	while (true) {
		if (player == 0) {
			if (i == a.size()) {
				puts("A");
				return 0;
			}
			if (a[i] == 'b') {
				player = 1;
			} else  if (a[i] == 'c'){
				player = 2;			
			}
			i++;
		} else if (player == 1) {
			if (j == b.size()) {
				puts("B");
				return 0;
			}
		  if (b[j] == 'a') {
		  	player = 0;
		  } else if (b[j] == 'c') {
		  	player = 2;
		  }
		  j++;
		} else {
			if (k == c.size()) {
				puts("C");
				return 0;
			}
			if (c[k] == 'a') {
				player = 0;
			}	else if (c[k] == 'b') {
				player = 1;
			}
			k++;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a; } // a <= b
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }
//clang++ -std=c++11 -stdlib=libc++ 

const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};

mint choose(int n, int a) {
  mint x =1, y=1;
  rep(i,a) {
    y*=i+1;
    x*=n-i;
  }
  return x/y;
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  mint ans=2;
  ans = ans.pow(n);
  ans -= 1;
  ans -= choose(n,a);
  ans -= choose(n,b);

  cout << ans.x << 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 YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1000000007;
const long long INF = 1LL << 60;
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    int ans = pow(n,3);
    cout << ans <<endl;;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define uint unsigned int
#define MOD 1000000007
#define MAXN 5000
#define MAXH 4
#define MAXM 4
#define INF 1LL << 30
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;

int main(){
	fast_io();
	int n,W;
	cin >> n >> W;
	vector<ll> v[4];
	ll w,y;
	cin >> w >> y;
	v[0].pb(y);
	cu(i,1,n){
		int x,y;
		cin >> x >> y;
		v[x-w].pb(y);
	}
	cu(i,0,4)sort(v[i].rbegin(), v[i].rend());
	ll dp[4][101] = {};
	cu(i,0,4){
		fu(j,1,v[i].size()){
			dp[i][j] = v[i][j-1] + dp[i][j-1];
		}
	}
	ll ans = 0;
	fu(i,0,v[0].size()){
		fu(j,0,v[1].size()){
			fu(k,0,v[2].size()){
				fu(r,0,v[3].size()){
					if(w * i + (w+1) * j + (w+2) * k + (w+3) * r <= W){
						gmax(ans, dp[0][i] + dp[1][j] + dp[2][k] + dp[3][r]);			
					}
				}
			}
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	i64 x, y; scanf("%lld%lld", &x, &y);

	if(std::abs(x - y) <= 1) printf("Brown\n");
	else printf("Alice\n");
	return 0;
}


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

using namespace std;

int main(void){
  int N, K, sum = 0;
  int l[50];
  cin >> N >> K;
  for(int i = 0; i < N; i++){
    cin >> l[i];
  }
  sort(l, l + N, greater<int>());
  for(int i = 0; i < K; i++){
    sum += l[i];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
mod = 10**9+7
fact = [1]*(10**5+2)
for n in range(1,10**5+2):
    fact[n] = n*fact[n-1]%mod
def comb(n,k):
    return fact[n]*pow(fact[k],mod-2,mod)*pow(fact[n-k],mod-2,mod)%mod

N = int(input())
a = list(map(int,input().split()))
c = [-1]*N
for j in range(N+1):
    if c[a[j]-1] != -1:
        break
    c[a[j]-1] = j
i = c[a[j]-1]
j = N-j

for k in range(1,N+2):
    ans = comb(N+1,k)
    if k-1<=i+j:
        ans -= comb(i+j,k-1)
    print(ans%mod)

Measured memory_bytes: 17780
import math
chou_len, tan_len, nan_ji, nan_pun = map(int, input().split())
nan_ji_kaku = 30*nan_ji + nan_pun*30/60
nan_pun_kaku = 6*nan_pun

kaku = abs(nan_ji_kaku-nan_pun_kaku)

if kaku > 180:
  kaku = 360-kaku
if(kaku == 0):
    print(abs(chou_len-tan_len))
elif(kaku == 180):
  print(chou_len+tan_len)
else:
  kai = math.sqrt(chou_len*chou_len + tan_len*tan_len
                - 2 * chou_len*tan_len*math.cos(kaku*math.pi/180))
  print(kai)

Measured memory_bytes: 9528
#include<stdio.h>
int main(){
int a[11],i,j;
char b;
while(scanf("%c",&b)!=EOF){
if(b=='o'){
a[1]=1;
}
else if(b=='x'){
a[1]=2;
}
else{
a[1]=0;
}
for(i=2;i<10;i++){
scanf("%c",&b);
if(b=='o'){
a[i]=1;
}
else if(b=='x'){
a[i]=2;
}
else{
a[i]=0;
}
}
scanf("\n");
if((a[1]==a[4] && a[4]==a[7] && a[1]==1)||(a[2]==a[5] && a[5]==a[8] && a[2]==1)||(a[3]==a[6] && a[6]==a[9] && a[9]==1)||(a[1]==a[2] && a[2]==a[3] && a[3]==1)||(a[4]==a[5] && a[5]==a[6] && a[6]==1)||(a[7]==a[8] && a[8]==a[9] && a[9]==1)||(a[1]==a[5] && a[5]==a[9] && a[9]==1)||(a[3]==a[5] && a[5]==a[7] && a[3]==1)){
printf("o\n");
}
else if((a[1]==a[4] && a[4]==a[7] && a[1]==2)||(a[2]==a[5] && a[5]==a[8] && a[2]==2)||(a[3]==a[6] && a[6]==a[9] && a[9]==2)||(a[1]==a[2] && a[2]==a[3] && a[3]==2)||(a[4]==a[5] && a[5]==a[6] && a[6]==2)||(a[7]==a[8] && a[8]==a[9] && a[9]==2)||(a[1]==a[5] && a[5]==a[9] && a[9]==2)||(a[3]==a[5] && a[5]==a[7] && a[3]==2)){
printf("x\n");
}
else{
printf("d\n");
}
}
return 0;
}


Measured memory_bytes: 1924
import java.util.*;
public class Main {
	boolean [] isprime;
	int MAX = 1000000;
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		eratos();
		while(true){
			int n = sc.nextInt();
			int x = sc.nextInt();
			if((n | x) == 0) break;
			int [] data = new int[n];
			for(int i = 0; i < n; i++){
				data[i] = sc.nextInt();
			}
			
			boolean [] dp = new boolean[x+1];
			dp[0] = true;
			int max = -1;

			for(int j = 0; j <= x; j++){
				if(dp[j]){
					for(int i = 0; i < n; i++){
						if(j + data[i] > x) continue;
						dp[j + data[i]] = true;
						if(isprime[j + data[i]]){
							max = Math.max(max, j + data[i]);
						}
					}
					
				}
			}

			System.out.println(max == -1 ? "NA" : max);
		}
	}
	
	private void eratos() {
		isprime = new boolean[MAX + 1];
		Arrays.fill(isprime, true);
		
		for(int i = 2; i * i <= MAX; i++ ){
			if(isprime[i]){
				for(int j = i + i; j <= MAX; j += i){
					isprime[j] = false;
				}
			}
		}
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 16000
N, P = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

import collections
import math

c = collections.Counter()

for a in A:
    c[a % 2] += 1

ans = 0
if P == 0:
    ans1 = 0
    for i in range(0, c[1] + 1, 2):
        ans1 += math.factorial(c[1]) / math.factorial(i) / math.factorial(c[1] - i)

    for i in range(c[0] + 1):
        ans0 = math.factorial(c[0]) / math.factorial(i) / math.factorial(c[0] - i)
        ans += ans0 * ans1
else:
    ans1 = 0
    for i in range(1, c[1] + 1, 2):
        ans1 += math.factorial(c[1]) / math.factorial(i) / math.factorial(c[1] - i)

    for i in range(c[0] + 1):
        ans0 = math.factorial(c[0]) / math.factorial(i) / math.factorial(c[0] - i)
        ans += ans0 * ans1


print(int(ans))


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

int in() {int x; cin>>x; return x;}
string stin() {string s; cin>>s; return s;}
int n, m, q;
int a[55], b[55], c[55], d[55];
// rest: 数列の残り要素数
// v: 現在の数列
// last_element: 数列の最後の要素
int dfs(int rest, vector<int> v, int last_element = 0) {
  if(last_element) {
    // 最後の要素を数列を追加
    v.push_back(last_element);
  } else {
    // 再帰の最初の段階
    last_element = 1;
  }

  // 数列が完成したら点数をカウント
  if(rest == 0) {
    int ret = 0;
    REP(i, q) {
      if(v[b[i]] - v[a[i]] == c[i]) {
        ret += d[i];
      }
    }
    return ret;
  }

  // 残りの数列を定義
  int ans = 0;
  REPS(i, last_element, m+1) ans = max(ans, dfs(rest-1, v, i));
  return ans;
}
/***** MAIN *****/
signed main() {
  cin >> n >> m >> q;
  REP(i,q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    --a[i]; --b[i];
  }
  cout << dfs(n, vector<int>());
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 3604
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)






int main(){
    ll n;
    cin >> n;
    vector<pair<ll, ll>> l(n), r(n);
    REP(i, n){
        cin >> l[i].first >> r[i].first;
        l[i].second = r[i].second = i;
    }
    
    sort(l.begin(), l.end(), greater<pair<ll, ll>>());
    sort(r.begin(), r.end());
    
    vector<bool> used1(n), used2(n);
    ll p1 = 0, sum1 = 0, li1 = 0, ri1 = 0, p2 = 0, sum2 = 0, li2 = 0, ri2 = 0;
    REP(i, n){
        if(i % 2 == 0){
            while(used1[l[li1].second]) li1++;
            sum1 += max(l[li1].first - p1, 0LL);
            used1[l[li1].second] = true;
            p1 = max(p1, l[li1].first);
            
            while(used2[r[ri2].second]) ri2++;
            sum2 += max(p2 - r[ri2].first, 0LL);
            used2[r[ri2].second] = true;
            p2 = min(p2, r[ri2].first);
        }
        else{
            while(used1[r[ri1].second]) ri1++;
            sum1 += max(p1 - r[ri1].first, 0LL);
            used1[r[ri1].second] = true;
            p1 = min(p1, r[ri1].first);
            
            while(used2[l[li2].second]) li2++;
            sum2 += max(l[li2].first - p2, 0LL);
            used2[l[li2].second] = true;
            p2 = max(p2, l[li2].first);
        }
        // cerr << sum1 << " " << p1 << " " << sum2 << " " << p2 << endl;
    }
    
    cout << max(sum1 + abs(p1), sum2 + abs(p2)) << endl;
}

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

#define pi acos(-1);
#define nl cout<<"\n";
#define sp cout<<" ";

#define op() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

int main()
{
    op();
    long double r;
    cin>>r;
    ///cout<<fixed<<setprecision(20);
    cout<<2*r*pi;
    nl;
    return 0;
}



Measured memory_bytes: 3812
// cout << "Case #" << test << ": ";
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if(a % 2 || b % 2 || c % 2) {
        cout << 0 << endl;
        return 0;
    }
    for(int i = 0; i < 9999999; i++) {
        if((a + b) % 2 || (b + c) % 2 || (c + a) % 2) {
            cout << i << endl;
            return 0;
        }
        ll x = (b + c) / 2, y = (a + c) / 2, z = (a + b) / 2;
        a = x;
        b = y;
        c = z;
    }
    cout << -1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	map<int,int> u;
	for(int i = 0; i < n; i++){
		int x; cin >> x;
		u[x]++;
	}
	if(u.find(0) != u.end() && u[0] == n) return cout << "Yes" << endl, 0;
	if((n % 3) || (u.size() > 3)) return cout << "No" << endl, 0;
	vector<int> d;
	for(auto it : u) if(it.second % (n / 3)) return cout << "No" << endl, 0; else {
		for(int i = 0; i < it.second / (n / 3); i++) d.push_back(it.first);
	}
	if((d[0] ^ d[1] ^ d[2]) == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
int main()
{char a[100005],b[100005];
 bool flag=0;
 scanf("%s",a);
 int lena,k=0;
 lena=strlen(a);
 for(int i=lena-1;i>=0;i--)
 {if(a[i]=='b'){
 	b[k]='d';
 	k++;
 }
 else if(a[i]=='d'){
 	b[k]='b';
 	k++;
 }
 else if(a[i]=='p'){
 	b[k]='q';
 	k++;
 }
 else if(a[i]=='q'){
 	b[k]='p';
 	k++;
 }
 }
 for(int i=0;i<lena;i++)
 {if(a[i]!=b[i]){
 	cout<<"No";
 	flag=1;
 	break;
 }
 }
 if(flag==0)cout<<"Yes";
}


Measured memory_bytes: 384
a, b, c, x, y = map(int, input().split())
ans = min(a+b, c*2) * min(x, y)
if x > y:
  ans += min(a, c*2) * (x-y)
elif x < y:
  ans += min(b, c*2) * (y-x)
print(ans)

Measured memory_bytes: 3060
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int ans = max({a + b, a - b, a * b});
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
using graph = vector<vector<int>>;
typedef long long ll;

int gcd(int n, int m)
{
	int r;
	if (n > m) {
		int t = m;
		m = n;
		n = t;
	}
	while ((r = m % n) != 0) {
		m = n;
		n = r;
	}
	return n;
}

int main() {
	ll k,sum = 0;
	cin >> k;
	for (ll a = 1; a <= k; a++) {
		for (ll b = a; b <= k; b++) {
			for (ll c = b; c <= k; c++) {
				
				if (a == b && b == c) {
					sum = sum + gcd(a, gcd(b,c));
				}
				else if (a == b || b == c || c == a) {
					sum = sum + gcd(a, gcd(b, c)) + gcd(a, gcd(b, c)) + gcd(a, gcd(b, c));
				}
				else {
					sum = sum + gcd(a, gcd(b, c)) + gcd(a, gcd(b, c)) + gcd(a, gcd(b, c)) + gcd(a, gcd(b, c)) + gcd(a, gcd(b, c)) + gcd(a, gcd(b, c));
				}
			}
		}
	}
	cout << sum << endl;
	return 0;
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
using ll = long long;
using ld = long double;
using str = string;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<str>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

// Constant variables
const ld PI = (acos(-1));
const ll MOD = 1000000007;

// I/O Asynchronizing
struct __io_async{
    __io_async(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};

int main() {
    int n;
    cin >> n;
    int x = n / 1.08;
    // DBG(x);
    if((int)((x + 1) * 1.08) == n) x++;
    else if((int)((x - 1) * 1.08) == n) x--;
    else if((int)(x * 1.08) != n) x = -1;
    cout << (x < 0 ? ":(" : to_string(x)) << "\n";

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
					
public class my
{
	public static void Main()
	{
		string s;
		var p = new int[10,10];	//paper
		
		while( null != ( s = Console.ReadLine()) ) {
			
			
			var n = my.GetIntArray(',', s);
			
			my.DropInk(n[0], n[1], n[2], p);
		}
		
		
		int max = 0, cnt = 0;
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 10; j++) {
				max = Math.Max(p[i,j], max);
				if(p[i, j] == 0)	cnt++;
			}
		}
		
		Console.WriteLine(cnt);
		Console.WriteLine(max);
	}

	private static void DropInk(int x, int y, int size, int[,] p)
	{
		if(size >= 1) {
			p[x,y]++;
			
			if(x != 0) p[x-1, y]++;
			if(y != 0) p[x, y-1]++;
			if(x != 9) p[x+1, y]++;
			if(y != 9) p[x, y+1]++;
		}
		
		if(size >= 2) {
			if(x != 0 && y != 0) p[x-1, y-1]++;
			if(x != 0 && y != 9) p[x-1, y+1]++;
			if(x != 9 && y != 0) p[x+1, y-1]++;
			if(x != 9 && y != 9) p[x+1, y+1]++;
		}
		
		if(size >= 3) {
			if(x >= 2)	p[x-2, y]++;
			if(y >= 2)	p[x, y-2]++;
			if(x <= 7) 	p[x+2, y]++;
			if(y <= 7) 	p[x, y+2]++;
		}
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}

	private static int[] GetIntArray(int n)
	{
		var A = new int[n];
		var s = Console.ReadLine().Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}
	
	private static int[] GetIntArray(int n, string t)
	{
		var A = new int[n];
		var s = t.Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}

	private static int[] GetIntArray(char c)
	{
		return Array.ConvertAll(Console.ReadLine().Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(char c, string s)
	{
		return Array.ConvertAll(s.Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(string s)
	{
		return Array.ConvertAll(s.Split(' '), int.Parse);
	}
	
	private static double[] GetDoubleArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
	}
	
	public static string Reverse(string s)
	{
		var c = s.ToCharArray();
		Array.Reverse(c);
		
		return new String(c);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}

	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteVector(Vector v)
	{
		Console.WriteLine(string.Format("{0:f8} {1:f8}", v.X, v.Y));
	}
}

public struct Vector
{
	public double X,Y;
}

Measured memory_bytes: 8964
import math

# N = 4
# ARR = [10, 30, 40, 20]


N = int(input())
ARR = list(map(int, input().split()))

def calculate(n, arr):
    result = [math.inf for i in range(n)]

    result[0] = 0
    result[1] = abs(arr[1]-arr[0])


    for i in range(2,n):
        a1 = abs(arr[i] - arr[i-2]) + result[i-2]
        a2 = abs(arr[i] - arr[i-1]) + result[i-1]

        result[i] = min(a1,a2)


    print(result[-1])




calculate(N, ARR)


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

int main(){
  int n, x;
  cin >> n;
  map<int, int> mp;
  for ( int i = 0; i < n; i++){
    cin >> x;
    mp[x]++;
    if ( mp[x] >= 2){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;

  return 0;
}

Measured memory_bytes: 9600
N = int(input())
C = {}
for _ in range(N):
    s = "".join(sorted(list(input().strip())))
    if s not in C:
        C[s] = 0
    C[s] += 1
cnt = 0
for s in C:
    n = C[s]
    cnt += (n*(n-1))//2
print(cnt)

Measured memory_bytes: 62296
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios()                \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1LL << 60;
constexpr int Inf = 1e9;
inline int in()
{
	int x;
	cin >> x;
	return x;
}
template <typename T>
inline void out(const T &x) { cout << x << endl; }
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
	if (a < b)
		gcd(b, a);
	int r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}
void eratos(bool *isPrime, int max)
{
	fill(isPrime, isPrime + max, true);
	isPrime[0] = false;
	isPrime[1] = false;
	for (int i = 2; i <= max / i; ++i)
		if (isPrime[i])
			for (int j = 2; j <= max / i; ++j)
				isPrime[i * j] = false;
}
//
 
vector<int> divisor(int n)
{
	vector<int> ret;
	for (int i = 0; i * i <= n; i++)
	{
		ret.push_back(i);
		if (i * i != n)
			ret.push_back(i);
	}
	sort(ALL(ret));
	return ret;
}
 
char m[51][51];
int w, h;
 
void dfs(int x, int y, vector<vector<bool>> &cmap, char color, vector<vector<bool>> &checked)
{
	if (x >= w || y >= h || y < 0 || x < 0) return;
	if (checked[x][y]) return;
	checked[x][y] = true;
	if (m[x][y] != '.') return;
 
	cmap[x][y] = true;
	for (int di = 0; di < 4; di++)
	{
		dfs(x + dx[di], y + dy[di], cmap,color,checked);
	}
}
 
 
signed main()
{
	ios();
	int N,X;
	cin >> N >> X;
	int L[N];
	for (int i = 0; i < N; i++ ) {
		cin >> L[i];
	}
	int D = 0;
	for ( int i = 0; i < N ; i++) {
		D += L[i];
		if(D > X) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << N + 1 << endl;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef long long int64;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a > b) { a = b; return 1; } return 0; }
#include <chrono>

int n = 4;
int k = 8;
int MAX_N = 4;
vi a = { 1, 2, 4, 7 };

bool dfs(int i, int sum) {
	if (i == n) {
		cout << 1 << " " << i << " " << sum << endl;
		return sum == k;
	}
	// a[i]を使わない場合
	if (dfs(i + 1, sum)) {
		cout << 2 << " " << i << " " << sum << endl;
		return true;
	}
	// a[i]を使う場合
	if (dfs(i + 1, sum + a[i])) {
		cout << 3 << " " << i << " " << sum << endl;
		return true;
	}
	// a[i]を使う使わないに拘わらずkが作れないのでfalseを返す
	cout << 4 << " " << i << " " << sum << endl;
	return false;
}
void solve() {
	if (dfs(0, 0)) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int gcd(int a, int b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	cin >> N;
	long long int fbsum = 0;
	repk(i, 1, N + 1) {
		repk(j, 1, N + 1) {
			repk(k, 1, N + 1) {
				int l;
				l = gcd(i, j);
				fbsum += gcd(l, k);
			}
		}
	}
	cout << fbsum;
	return 0;
}


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

#define MAXSZ 100
typedef long long int llmtx[MAXSZ][MAXSZ];

int main(void){
  int n,m,l;
  llmtx mtA,mtB,mtC;
  
  cin >> n >> m >> l;
  for (int i=0; i<n; i++){
    for (int j=0; j<m; j++){
      cin >> mtA[i][j];
    }
  }
  for (int i=0; i<m; i++){
    for (int j=0; j<l; j++){
      cin >> mtB[i][j];
    }
  }
  for (int i=0; i<n; i++){
    for (int j=0; j<l; j++){
      mtC[i][j] = 0;
      for (int k=0; k<m; k++){
        mtC[i][j] += mtA[i][k]*mtB[k][j];
      }
    }
  }
  
  for (int i=0; i<n; i++){
    cout << mtC[i][0];
    for (int j=1; j<l; j++){
      cout << " " << mtC[i][j];
    } cout << endl;
  }
  return 0;
}


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

int n,b[1000010],Q[1000010],ans;
char s[1000010],t[1000010];

void work()
{
	scanf("%d\n%s\n%s",&n,s+1,t+1);
	if (strcmp(s+1,t+1)==0)  {printf("0");  return;}
	for (int i=n,j=n,last=n+1; i; i--)
		if (t[i]!=t[i-1])
			{
				j=min(j,i);
				while ((j)&&(s[j]!=t[i]))  j--;
				if (!j)  {printf("-1");  return;}
				b[j]=last-1,last=i;
			}
	for (int i=n,l=1,r=0,k=0; i; i--)
		if (b[i])
			{
				while ((l<=r)&&(Q[l]-k>b[i]))  l++;
				if (i!=b[i])  Q[++r]=i+(++k);
				ans=max(ans,r-l+1);
			}
	printf("%d",ans);
}

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


Measured memory_bytes: 9984
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) local n=dimension local m={default_val and {__index=function()return default_val end}}for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
----
local N = read.n()
local tbl = array(1, {10^9, {0}})
local function chmin(i, s)
    if tbl[i][1] > tbl[s][1] then
        local route = {table.unpack(tbl[s][2])}
        table.insert(route, i-s)
        tbl[i] = {tbl[s][1]+1, route}
    end
end
tbl[0] = {0, {}}
for i=0,N-1 do
    chmin(i+1, i)
    local j = 6
    while j <= N do
        chmin(i+j, i)
        j = j * 6
    end
    j = 9
    while j <= N do
        chmin(i+j, i)
        j = j * 9
    end
end
for i=0,N do
    --print(i, tbl[i][1], table.concat(tbl[i][2], ","))
end
print(tbl[N][1])

Measured memory_bytes: 158564
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//数値計算 個数以外はdouble
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//過半数：N/2.0で判定
//優先度付きキュー
//priority_queue<
//ll,
//vector<ll>
//> q;
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
#define PI 3.14159265358979323846264338327950L
using namespace std;


//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

ll RS(ll N, ll P, ll M) {
	if (P == 0) return 1;
	if (P % 2 == 0) {
		ll t = RS(N, P / 2, M);
		return t * t % M;
	}
	return N * RS(N, P - 1, M);
}

int main() {
	ll N; cin >> N;
	vector<unsigned long> A(N); 
	rep(i, N)cin >> A[i];

	unsigned long ans = 1;
	unsigned long num = pow(10, 18);

	rep(i, N) {
		if(A[i] == 0){
			cout << 0 << endl;
			return 0;
		}
	}

	rep(i, N) {
		if (ans <= num / A[i]) {
			ans *= A[i];
			//cout << ans << endl;
		}
		else {
			cout << -1 << endl;
			return 0;
		}

		if (ans > num) {
			cout << -1 << endl;
			return 0;
		}
	}

	cout << setprecision(20) << ans << endl;
}

Measured memory_bytes: 12060
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
using namespace std;
int N;
long res;
void fnc(long long taget, int state) {
	if (taget > N) {
		return;
	}
	if (state == 0b111) {
		++res;
	}
	fnc(taget * 10 + 7, state | 0b001);
	fnc(taget * 10 + 5, state | 0b010);
	fnc(taget * 10 + 3, state | 0b100);
}

int main() {
	cin >> N;
	fnc(0, 0b000);

	cout << res << endl;
}

Measured memory_bytes: 256
class Factorial:
    def __init__(self,n,mod):
        self.f=[1]
        for i in range(1,n+1):
            self.f.append(self.f[-1]*i%mod)
        self.i=[pow(self.f[-1],mod-2,mod)]
        for i in range(1,n+1)[::-1]:
            self.i.append(self.i[-1]*i%mod)
        self.i.reverse()
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.i[i]
    def comb(self,n,k):
        return self.f[n]*self.i[n-k]%mod*self.i[k]%mod
mod=10**9+7
h,w,a,b=map(int,input().split())
f=Factorial(h+w,mod)
ans=0
for i in range(b,w):
    ans=(ans+f.comb(h-a-1+i,i)*f.comb(a-1+w-i-1,w-i-1))%mod
print(ans)

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 A, Va; cin >> A >> Va;
    i64 B, Vb; cin >> B >> Vb;
    i64 T; cin >> T;
    if (Va <= Vb) cout << "NO" << endl;
    else {
        if (abs(Va - Vb) * T >= abs(A - B)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3572
import math
n = int(input())

def balance_fact(n):
  rn = int(math.sqrt(n))
  m = 1
  k = 0
  for i in range(rn):
    j = rn-i
    if n%j == 0:
      m = n//j
      k = j
      break
  return (m, k)  
    
m, k = balance_fact(n)
print(m+k-2)


  

Measured memory_bytes: 3060
k = int(input())

a = [[str(i) for i in range(1,10)]]
c = 9

if k <= 12 :
    print(k)
else :
    for i in range(10) :
        b = []
        for s in a[i] :
            if s[-1] == '0' :
                b.append(s+'0')
                b.append(s+'1')
            elif s[-1] == '9' :
                b.append(s+'8')
                b.append(s+'9')
            else :
                b.append(s+str(int(s[-1])-1))
                b.append(s+str(int(s[-1])))
                b.append(s+str(int(s[-1])+1))

            if c + len(b) > k :
                print(b[k-c-len(b)-1])
                break
    
        if c + len(b) > k :
            break
    
        a.append(b)
        c += len(b)


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

using namespace std;

typedef long long ll;

#define INF 1e10

int main(){
	ll n, w; cin >> n >> w;
	ll dp[2][111111];
	for(int i = 0; i <= 100000; i++) dp[1][i]=INF;
	dp[1][0]=0;
	ll ww, v;
	for(int i = 0; i < n; i++){
		cin >> ww >> v;
		for(int j = 0; j <= 100000; j++){
			if(j<v)dp[i%2][j]=dp[(i+1)%2][j];
			else dp[i%2][j]=min(dp[(i+1)%2][j],ww+dp[(i+1)%2][j-v]);
		}
	}
	for(int i = 100000; i >= 0; i--){
		if(dp[(n-1)%2][i]<=w){
			cout<<i;
			return 0;
		}
	}
}


Measured memory_bytes: 1792
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func strSprit(str string) []string {
	cols := strings.Split(str, " ")
	return cols
}

func parseInt(str string) int {
	n, _ := strconv.Atoi(str)
	return n
}

func intSprit(str string) []int {
	strs := strSprit(str)
	cols := make([]int, len(strs))
	for i, v := range strs {
		cols[i] = parseInt(v)
	}
	return cols
}

func bitCount(n uint) int {

	x := uint64(n)

	const m = 1<<64 - 1
	const m0 = 0x5555555555555555
	const m1 = 0x3333333333333333
	const m2 = 0x0f0f0f0f0f0f0f0f

	x = x>>1&(m0&m) + x&(m0&m)
	x = x>>2&(m1&m) + x&(m1&m)
	x = (x>>4 + x) & (m2 & m)
	x += x >> 8
	x += x >> 16
	x += x >> 32

	return int(x) & (1<<7 - 1)
}

func bitExist(n, i int) bool {
	return ((n >> uint(i)) & 1) == 1
}

func setBit(d, n int) int {
	t := 1 << uint(n)
	return d | t
}

func intAbs(n int) int {
	return int(math.Abs(float64(n)))
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
	line := nextLine()

	spl := intSprit(line)

	H := spl[0]
	W := spl[1]

	s := intSprit(nextLine())

	h := s[0]
	w := s[1]

	sum := H * W

	diff := H*w + W*h - h*w

	fmt.Println(sum - diff)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int n,x;
cin>>n>>x;
int a;
int ans=0;
int s=0;
for(int i=0;i<n;i++)
{
cin>>a;
s+=a;
if(s<=x)
{
ans++;
}
}
cout<<ans+1<<endl;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
    long long l[128] = {2, 1};
    int n;
    int i;

    scanf("%d", &n);
    for (i = 2; i <= n; ++i){ l[i] = l[i - 1] + l[i - 2]; }
    printf("%lld\n", l[n]);

    return 0;
}


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

int main() {
  char C;
  cin>>C;
  if(C=='a'||C=='e'||C=='i'||C=='u'||C=='o'){
    cout<<"vowel"<<endl;
  }
  else{
    cout<<"consonant"<<endl;
  }
}


Measured memory_bytes: 3584
#include <iostream>
#include <vector>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int building[4][3][10] = { 0 };
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int b, f, r, v; cin >> b >> f >> r >> v;
		int& room = building[b - 1][f - 1][r - 1];
		room += v;
		if (room < 0) room = 0;
		if (room > 9) room = 9;
	}
	for (int b = 0; b < 4; b++) {
		for (int f = 0; f < 3; f++) {
			for (int r = 0; r < 10; r++) {
				cout << " " << building[b][f][r];
			}
			cout << endl;
		}
		if (b != 3) cout << "####################" << endl;
	}
}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	string w;

	cin >> w;

	int a[26] = {};
	for(auto x : w)
		a[x-'a']++;

	bool check = true;
	for(auto x : a)
		if(x %2)
			check = false;

	if(check)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000000
#define mod 1000000007

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	ll N;
	cin>>N;
	ll ans=1;
	ll i=1;
	while(i>=0){
		if(i>=N){
			cout<<ans<<endl;
			return 0;
		}
		ans++;
		i+=ans;
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    char s;
    int i;
    int sum = 0;
    for(i=0;i<3;i++){
        scanf("%c",&s);
        if(s == 'o'){
            sum +=100;
        }
    }
    printf("%d",sum+700);
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    
    bool b=false;
    for(int i=0;i<=n;i++){
        if(n-i*4>=0 && (n-i*4)%7==0)
            b=true;
    }

    if(b) cout<<"Yes";
    else cout<<"No";

    return 0;
}

Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine()); //トレーニング回数
        long power=1;
        for (int i=1; i <= N; i++)
        {
            power *= i;
            power %=  (long)1e9 + 7;
        }
        Console.WriteLine(power);
    }
}

Measured memory_bytes: 11092
#import<bits/stdc++.h>
#define int long long
using namespace std;int n;main(){cin>>n;int a[222222];for(int i=0;i<n;i++){cin>>a[i];}int ia[222222];for(int i=0;i<n;i++){ia[i+1]=a[i]+ia[i];}int x=0,y=2,ans=LLONG_MAX;for(int i=2;i<n-1;i++){while(ia[x+1]<ia[i]-ia[x+1])x++;while(ia[y+1]-ia[i]<ia[n]-ia[y+1])y++;for(int j=0;j<2;j++){for(int k=0;k<2;k++){ans=min({ans,abs(max({ia[x+j],ia[i]-ia[x+j],ia[y+k]-ia[i],ia[n]-ia[y+k]})-min({ia[x+j],ia[i]-ia[x+j],ia[y+k]-ia[i],ia[n]-ia[y+k]}))});}}}cout<<ans<<endl;}

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

int main()
{
  string S;
  cin >> S;
  vector<string> A = {"KIH", "B", "R"};
  queue<string> Q;
  Q.push("");
  Q.push("A");
  for (int i = 0; i < A.size(); i++)
  {
    int64_t sq = Q.size();
    for (size_t j = 0; j < sq; j++)
    {
      string qf = Q.front();
      Q.pop();
      string nx = qf.append(A.at(i));
      Q.emplace(nx);
      Q.emplace(nx.append("A"));
    }
  }
  while (!Q.empty())
  {
    if (S == Q.front())
    {
      cout << "YES" << endl;
      return 0;
    }
    Q.pop();
  }
  cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] arg) {
		Scanner scan = new Scanner(System.in);
		int ah = scan.nextInt();
		int aa = scan.nextInt();
		int bh = scan.nextInt();
		int ba = scan.nextInt();
		boolean flag = true;
		while(true){
		  bh -= aa;
		  if(bh <= 0){
			  flag = true;
			  break;
		  }
		  ah -= ba;
		  if(ah <= 0){
			  flag = false;
			  break;
		  }
		  		};
		if(flag == true){
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


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

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

  int count = 0;
  for(int i=0; i<n; i++) {
    int l, r;
    cin >> l;
    cin >> r;
    count += r - l + 1;
  }

  cout << count << endl;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	int a,b,h,m;cin>>a>>b>>h>>m;
	m=h*60+m;
	double t1=2*M_PI/60*m,t2=2*M_PI/720*m;
	double x1=cos(t1)*b,y1=sin(t1)*b;
	double x2=cos(t2)*a,y2=sin(t2)*a;
	printf("%.12lf\n",hypot(x2-x1,y2-y1));
}

Measured memory_bytes: 4128
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
long long  mod = 1000000007;
int main()
{
	char S[200000];
	int N, A, B, C, D;
	int flag = 0;
	scanf("%d%d%d%d%d%s", &N, &A, &B, &C, &D, S);
	for (int i = A - 1; i < max(C, D) - 1; i++) {
		if (S[i] == '#') {
			if (S[i + 1] == '#') {
				printf("No");
				return 0;
			}
		}
	}
	if (C > D) {
		for (int i = B - 2; i < D - 1; i++) {
			if (i == N - 1) break;
			if (D - B <= 1) {
				printf("No");
				return 0;
			}
			if (S[i] == '.' && S[i + 1] == '.' && S[i + 2] == '.') {
				printf("Yes");
				return 0;
			}
		}
	}
	else {
		printf("Yes");
		return 0;
	}
	printf("No");
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace  std;
#define f(i,n) 		for(i=0;i<n;i++)
#define fr(i,n,a) 	for(i=n;i>=a;i--)
#define fa(i,a,n) 	for(i=a;i<n;i++)
#define deb(x)		cout<<#x<<" "<<x<<endl;
#define deb2(x,y)	cout<<#x<<","<<#y<<" "<<x<<","<<y<<endl;
#define buf(x)		cout<<"Check"<<x<<endl;
#define ll			long long int 
#define ft			first
#define s			second
#define pb			push_back
#define mp			make_pair
#define d			double
#define all(v)		v.begin(),v.end()	
#define et(v)		for(auto itr:v)
inline void p(int x[],int n)	{	int i;f(i,n)cout<<x[i]<<" ";cout<<endl; }
void solve()
{  	
	ll N,K,i,ans=0,cnt=0;
	cin>>N;
	string st;
	cin>>st;
	f(i,N)
	{
		if(st[i]=='W')
			++cnt;
	}
	fa(i,(N-cnt),N)
	{
		if(st[i]=='R')
			++ans;
	}
	cout<<ans;
	
	
}
int main()
{	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t=1;
	//cin>>t;
	while(t--)
	{
		solve();
		cout<<endl;
		
	}
	return 0;
}
		


Measured memory_bytes: 3768