akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define REP(i, a) for (ll i(0), _##i(a); i < _##i; ++i)
#define FOR(i, a, b) for (ll i(a), _##i(b); i <= _##i; ++i)

#ifdef LOCAL
#define _NTH_ARG(_1, _2, _3, _4, _5, _6, N, ...) N
#define _FE_1(_CALL, x) _CALL(x)
#define _FE_2(_CALL, x, ...) _CALL(x) _FE_1(_CALL, __VA_ARGS__)
#define _FE_3(_CALL, x, ...) _CALL(x) _FE_2(_CALL, __VA_ARGS__)
#define _FE_4(_CALL, x, ...) _CALL(x) _FE_3(_CALL, __VA_ARGS__)
#define _FE_5(_CALL, x, ...) _CALL(x) _FE_4(_CALL, __VA_ARGS__)
#define _FE_6(_CALL, x, ...) _CALL(x) _FE_5(_CALL, __VA_ARGS__)
#define FOR_EACH_MACRO(MACRO, ...)                                             \
  _NTH_ARG(__VA_ARGS__, _FE_6, _FE_5, _FE_4, _FE_3, _FE_2, _FE_1)              \
  (MACRO, __VA_ARGS__)
#define watch(x) cerr << "\033[1;32m" #x " = \033[1;34m" << (x) << "\033[0m; ";
#define debug(...)                                                             \
  cerr << "\033[2;31mLine " << __LINE__ << ": \033[0;m";                       \
  FOR_EACH_MACRO(watch, __VA_ARGS__)                                           \
  cerr << endl
#else
#define debug(...)
#endif

using namespace std;

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << '{' << p.first << ", " << p.second << '}';
}

template <class T, class = decltype(begin(declval<T>())),
          class = enable_if_t<!is_same<T, string>::value>>
ostream &operator<<(ostream &os, const T &c) {
  os << '[';
  for (auto it = begin(c); it != end(c); ++it)
    os << (it == begin(c) ? "" : ", ") << *it;
  return os << ']';
}
using ll = long long;

void solve() {
  int n;
  cin >> n;
  int pa = 0, pb = 0, pc = 0;
  REP(i, n){
    int a, b, c;
    cin >> a >> b >> c;
    int ca = a + max(pb, pc);
    int cb = b + max(pa, pc);
    int cc = c + max(pa, pb);
    pa = ca, pb = cb, pc = cc;
  }
  cout << max({pa, pb, pc}) << "\n";
}

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

  int T = 1;
  // cin >> T;
  while (T--) {
    solve();
  }
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
#define repM1(i, n) for(ll i = (ll)(n - 1); i > 0; 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; }

int main()
{
	cout << fixed << setprecision(18);

	ll a, b;
	cin >> a >> b;

	cout << a * b << endl;

	return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

char c[MAXN];
char c1[MAXN];

void solve(){
	int n;
	scanf("%s", &c[0]);
	n = strlen(c);
	int n1 = 0;
	REP(i, 0, n){
		if (c[i] != 'x'){
			c1[n1++] = c[i];
		}
	}
	if (n1 == 0){
		printf("0\n");
		return;
	}
	REP(i, 0, n1){
		if (c1[i] != c1[n1 - 1 - i]){
			printf("-1\n");
			return;
		}
	}
	int l1 = (n1 - 1) / 2, r1 = n1 / 2, l, r;
	int tmp = 0;
	REP(i, 0, n){
		if (c[i] != 'x'){
			if (tmp == l1){
				l = i;
			}
			if (tmp == r1){
				r = i;
			}
			tmp++;
		}
	}
	int ans = 0;
	for(int a = l, b = r; a >= 0 || b < n; ){
		if (a < 0){
			ans++;
			b++;
		} else if (b >= n){
			ans++;
			a--;
		} else {
			if (c[a] == c[b]){
				a--;
				b++;
			} else if (c[a] == 'x'){
				ans++;
				a--;
			} else {
				ans++;
				b++;
			}
		}
	}
	printf("%d\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>

using ll = long long;

int main()
{
  ll K, S;
  std::cin >> K >> S;

  ll cnt = 0LL;
  for (ll x = 0; x <= K; x++) {
    for (ll y = 0; y <= K; y++) {
      ll z = S - x - y;
      if (z >= 0 && z <= K) cnt++;
    }
  }

  std::cout << cnt << std::endl;
  return 0;
}


Measured memory_bytes: 256
H,W=map(int,input().split())
lines=[]
for i in range(H):
    lines.append(input().strip())

chars=dict()
for line in lines:
    for c in line:
        if c not in chars:
            chars[c]=0
        chars[c]+=1

def judge(H,W,chars):
    #両方奇数
    if H%2+W%2==2:
        ones=1
        twos=H//2 + W//2
    #両方偶数
    elif H%2+W%2==0:
        ones=0
        twos=0
    elif H%2==1:
        ones=0
        twos=W//2
    else:
        ones=0
        twos=H//2
    for c in chars:
        if ones<0 or twos<0:
            return False
        chars[c]%=4
        if chars[c]==0:
            continue
        if chars[c]==2:
            twos-=1
        elif chars[c]==3:
            twos-=1
            ones-=1
        else:
            ones-=1
    if ones<0 or twos<0:
        return False
    return True

if judge(H,W,chars):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38768
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
#define impossible cout<<"IMPOSSIBLE"<<endl;
#define error(s) throw runtime_error(s)
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=3e18;
const int32_t LOG=21;
const int MOD=MOD2;

int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      { 
           int n;
           cin>>n;
           int a[n],b[n];
           rep(i,0,n)cin>>a[i]>>b[i];
           sort(a,a+n);
           sort(b,b+n);
           if(n&1)
           {
                 int min1=a[n/2];
                 int max1=b[n/2];
                 int ans=max1-min1+1;
                 cout<<ans<<endl;
           }
           else
           {
                 int min1=a[n/2]+a[(n-1)/2];
                 int max1=b[n/2]+b[(n-1)/2];
                 cout<<max1-min1+1<<endl;
           }
           
      } 
      return 0;                         
}

/*
 TIPS:
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/

Measured memory_bytes: 6788
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> t(n);
    vector<int> x(n);
    vector<int> y(n);

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

    for(int i=0;i<n;i++){        
        if(t[i]%2==0){
            if(!((x[i]+y[i])%2==0 && 0<=x[i]&& x[i]<=t[i] && 0<=y[i]&& y[i]<=t[i] && 0<=x[i]+y[i] && x[i]+y[i] <= t[i])==true){
                cout << "No" << endl;
                return 0;
            }
        }
        else{
            if(!((x[i]+y[i])%2==1 && 0<=x[i]&& x[i]<=t[i] && 0<=y[i]&& y[i]<=t[i] && 0<=x[i]+y[i] && x[i]+y[i] <= t[i])==true){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

}

Measured memory_bytes: 1408
/*
Author: Hrujul Thumar
*/
#include <bits/stdc++.h>
#define int         long long
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define whilet()    int t; scanf("%d",&t); while(t--)
#define vp          vector<pair<int,int>,int>
#define pb          push_back
#define mii         map<int,int>
#define pii         pair<int,int>
#define msi         map<string,int>
#define psi         pair<string,int>
#define mpi         map<pair<int,int>,int>
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define ef          else if
#define MOD         1000000007
#define endl        '\n'
#define fastio       ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define pi          3.141592653589793238
const long long MAX_SIZE = 1000000000;
using namespace std;

signed main()
{
    fastio
    double d,t,s;
    cin>>d>>t>>s;
    if(t>=(d/s))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


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

ll solve() {
    ll N;
    cin >> N;
    vector<string> S(N);
    vector<ll> T(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> S[i] >> T[i];
    }
    string X;
    cin >> X;
    int j = -1;
    for ( int i = 0; i < N; i++ ) {
        if ( X == S[i] ) {
            j = i;
            break;
        }
    }
    ll ans = 0;
    for ( int i = j+1; i < N; i++ ) {
        ans += T[i];
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
N = int(input())
X = list(map(int, input().split()))
X_sorted = sorted(X)
median_upper = X_sorted[N//2]
median_lower = X_sorted[N//2 - 1]

for x in X:
	if x < median_upper:
		print(median_upper)
	elif x > median_lower:
		print(median_lower)
	else:
		print(median_lower)


Measured memory_bytes: 25556
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, N = MAP()
P = LIST()

P.sort()
# print(P)

# for p in P:
#     if 
i = 0
while 1:
    left = X - i
    if left not in P:
        print(left)
        exit()
    right = X + i
    if right not in P:
        print(right)
        exit()
    i += 1


Measured memory_bytes: 10044
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#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 rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

int main(){
	int n;
	while(cin >> n, n){
		char s[100];
		sprintf(s, "%o", n);
		char *p = s;
		while(*p){
			cout << "01235789"[*p-'0'];
			p++;
		}
		cout << endl;
	}

	return 0;
}

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

int main() {
    string s,t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if (s<t) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
from sys import stdin
from collections import deque

n, m = map(int, raw_input().strip().split())
inp = stdin.readlines()

g = [[] for i in xrange(n + 1)]

for line in inp:
    x, y, z = map(int, line.strip().split())
    g[x].append(y)
    g[y].append(x)

vis = [0] * (n + 1)

def bfs(root):
    global vis
    
    vis[root] = 1
    q = deque([root])
    while q:
        u = q.popleft()
        for v in g[u]:
            if not vis[v]:
                vis[v] = 1
                q.append(v)
    
ans = 0
for u in xrange(1, n + 1):
    if vis[u] == 0:
        bfs(u)
        ans += 1

print ans

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

int main()
{
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  sort(v.begin(), v.end());
  long long res = 0;
  for (int x = 0; x < n; x++) {
    for (int y = x+1; y < n; y++) {
      int a = v.at(x);
      int b = v.at(y);
      int mini = max(a - b, b - a);
      int maxi = a + b;
      auto fd = upper_bound(v.begin()+y+1, v.end(), mini);
      auto bk = lower_bound(v.begin()+y+1, v.end(), maxi);
      res += bk - fd;
    }
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
A, B = map(int, input().split())

exp_two = [2 ** i for i in range(1, 51)]

# 0から数えて1が何個入るかを計算する前準備
A += 1
B += 1

ans1 = 0
for i in range(50):
    # 周期の回数　×　1の出てくる数
    num = ((A - 1) // exp_two[i]) * (exp_two[i] // 2)
    amari = max(0, ((A - 1) % exp_two[i]) - (exp_two[i] // 2))
    cnt = num + amari
    # 1の数が奇数個の時その桁の値を加える
    if cnt % 2:
        ans1 += 1 << i

ans2 = 0
for i in range(50):
    # 周期の回数　×　1の出てくる数
    num = (B // exp_two[i]) * (exp_two[i] // 2)
    amari = max(0, (B % exp_two[i]) - (exp_two[i] // 2))
    cnt = num + amari
    if cnt % 2:
        ans2 += 1 << i

print(ans1 ^ ans2)


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

int main(){
  int n,i;
  double sum,now,now2;
  cin >> n;

  sum = 0;
  now = 0;
  now2= 0;

  double *a = new double[n];

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

  for(i=0;i<n;i++){
    now = (double)1/a[i];
    now2 = now2+now;
  }

  sum = (double)1/now2;

  cout << sum << "\n";


  delete[] a;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
volatile int n;

int f(int a,int b){
	if (a<b){
		if (a+b<=n){
			if (a%3==0){
				return 3;
			}else{
				return a%3;
			}
		}else{
			if ((n-b+1)%3==0){
				return 3;
			}else{
				return (n-b+1)%3;
			}
		}
	}else{
		if (a+b<=n){
			if (b%3==0){
				return 3;
			}else{
				return b%3;
			}
		}else{
			if ((n-a+1)%3==0){
				return 3;
			}else{
				return (n-a+1)%3;
			}
		}
	}
}

int main(void){
	scanf("%d",&n);
	
	int k;
	scanf("%d",&k);
	
	int a;
	int b;
	int i,x,y;
	for (i=0;i<k;i++){
		scanf("%d %d",&a,&b);
		printf("%d\n",f(a,b));
	}
	return 0;
}

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

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    int ans = 0;
    rep(is, 1<<h) rep(js, 1<<w) {
        int cnt = 0;
        rep(i, h) rep(j, w) {
            if (is>>i&1) continue;
            if (js>>j&1) continue;
            if (s[i][j] == '#') cnt++;
        }
        if (cnt == k) ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int h,w;
char maze[2020][2020];
int row[2020][2020],col[2020][2020];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int i,j,p,k;
    memset(row,0,sizeof(row));
    memset(col,0,sizeof(col));
    cin>>h>>w;
    for(i=0;i<h;i++)
        cin>>maze[i];
    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j=k+1)
        {
            for(k=j;k<w;k++)
                if(maze[i][k]=='#')
                    break;
            for(p=j;p<k;p++)
                row[i][p]=k-j;
        }
    }
    for(i=0;i<w;i++)
    {
        for(j=0;j<h;j=k+1)
        {
            for(k=j;k<h;k++)
                if(maze[k][i]=='#')
                    break;
            for(p=j;p<k;p++)
                col[p][i]=k-j;
        }
    }
    int ans=0;
    for(i=0;i<h;i++)
        for(j=0;j<w;j++)
            ans=max(ans,row[i][j]+col[i][j]);
    cout<<ans-(ans>0)<<endl;
    return 0;
}


Measured memory_bytes: 36096
#include <bits/stdc++.h>
 using namespace std;
 using pii = pair<int, int>;
 using ll = long long;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 1000000007;
 const ll INFL = (1LL << 60);
 const int INFI = (1 << 30);

 int main() {
   int N; cin >> N;
   map<int, int> ans;

   rep(i, 1, 100) {
     rep(j, 1, 100) {
       rep(k, 1, 100) {
         int n;
         n =  i * i + j * j + k * k + i * j + j * k + k * i;
         ans[n]++;
       }
     }
   }

   rep(i, 1, N + 1) {
     cout << ans[i] << endl;
   }
 }


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

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

using namespace std;

int dist[15];

int main(){
  int n, m;
  while(cin >> n >> m and n + m){
    REP(i, n){
      int d, p;
      cin >> d >> p;
      dist[p] += d;
    }
    REP(i, 15){
      if(dist[14-i] <= m) { m -= dist[14-i]; dist[14-i] = 0; }
      else if(dist[14-i] > 0) { dist[14-i] -= m; m = 0; }
      if(m <= 0) break;
    }
    int res = 0;
    REP(i, 15) res += i * dist[i];
    cout << res << endl;
    memset(dist, 0, sizeof(dist));
  }
  return 0;
}

Measured memory_bytes: 3060
n = int(input())
s = str(input())
v_s = s.split()
v_s = [float(str) for str in v_s]
v_s.sort()

idx = 0
while idx < n-1:
  v0 = v_s.pop(0)
  v1 = v_s.pop(0)
  v_s.insert(0, (v0 + v1)/2.0)
  idx += 1

print(v_s.pop(0))

Measured memory_bytes: 38256
#include<iostream>
using namespace std;
string s;
int p,cnt,m,a,ans;
int t[10];

int size;
int u[10];

int solve(){
  if(s[p]=='('){
    p++;
    int lc=solve();
    p++;
    int rc=solve();
    p++;
    int res;
    if(u[cnt]==0)res=lc|rc;
    if(u[cnt]==1)res=lc&rc;
    if(u[cnt]==2)res=lc^rc;
    cnt++;
    return res;
  }else{
    int num=s[p]-'0';
    p++;
    return t[num];
  }
}
int calc(){
  p=cnt=0;
  return solve();
}

void rec(int x){
  if(x==size){
    if(calc()==15)ans++;
  }else{
    for(int i=0;i<3;i++){
      u[x]=i;
      rec(x+1);
    }
  }
}
int main(){
  while(1){
    getline(cin,s);
    if(s=="END")break;
    cin>>m;
    for(int i=1;i<=m;i++){
      t[i]=0;
      for(int j=0;j<4;j++){
        cin>>a;
        t[i]=t[i]*2+a;
      }
    }
    ans=size=0;
    for(int i=0;i<(int)s.size();i++)if(s[i]=='(')size++;
    rec(0);
    cout<<ans<<endl;
    getline(cin,s);
  }
  return 0;
}

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

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        return gcd(b, a);
    }

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

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

    ll sum=0;
    ll g;

    for(int i=1;i<=n;i++){
        for (int j = 1; j <= n; j++){
            for(int k=1;k<=n;k++){
                g = gcd(i, j);
                sum += gcd(g, k);
            }
        }

    }

    cout << sum << endl;
    return 0;
}

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

int main() {
	long long a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;
    if (abs(a - b) <= (v - w) * t) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 3540
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    d = defaultdict(int)
    s = input()
    for e in s:
        d[e] += 1
    for _ in range(n-1):
        c = defaultdict(int)
        s = input()
        for e in s:
            c[e] += 1
        for k in d:
            d[k] = min(d[k], c[k])
    a = []
    for k in d:
        if d[k]:
            a.append(k * d[k])
    a.sort()
    print(''.join(a))
    
    

        
    
t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

7
3 1
4 1
5 9
2 6
5 3
5 8
9 7 5

"""


Measured memory_bytes: 9408
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
ans = 0

def distance(a, b):
    dist = 0
    for i in range(D):
        dist += (a[i] - b[i]) ** 2

    dist = dist ** 0.5

    return dist

for i in range (N):
    a = X[i]
    B = X[:i] + X[i+1:]

    for b in B:
        d = distance(a, b)
        if d == d // 1:
            ans += 1

print(ans // 2)


Measured memory_bytes: 3064
bingo = list()
for i in range(3):
    bingo.append(list(map(int, input().split())))
N = int(input())

for i in range(N):
    b = int(input())
    for x in bingo:
        if x[0] == b:
            x[0] = True
        elif x[1] == b:
            x[1] = True
        elif x[2] == b:
            x[2] = True

        if x[0] == True and x[1] == True and x[2] == True:
            print("Yes")
            exit()

if bingo[0][0] == True and bingo[1][0] == True and bingo[2][0] == True:
    print("Yes")
    exit()
if bingo[0][1] == True and bingo[1][1] == True and bingo[2][1] == True:
    print("Yes")
    exit()
if bingo[0][2] == True and bingo[1][2] == True and bingo[2][2] == True:
    print("Yes")
    exit()

if bingo[0][0] == True and bingo[1][1] == True and bingo[2][2] == True:
    print("Yes")
    exit()
if bingo[0][2] == True and bingo[1][1] == True and bingo[2][0] == True:
    print("Yes")
    exit()

print("No")

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		//int N = in.nextInt();
		int K = in.nextInt();
		int a = (int)Math.sqrt(K);
		
		System.out.println(a*a);
		
		
		in.close();
	}
}


Measured memory_bytes: 21844
///Bismillahir Rahmanir Rahim
///Hello_World_Its_Rakib_Alam_Bappi
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
///ascii for  A=65   and   a=97
#define		int 	long long
#define 		pb 	push_back
#define 		mp 	make_pair
#define 		pi 	2*acos(0.0)
#define 		loopi 	for(int i = 0 ; i <t ; i++)
#define 		loopj 	for(int j = 0 ; j < n ; j++)
#define 		backj 	for(int j = n-1 ; j >=0 ; j--)
#define 		vect 	vector<int>
#define 		vec_it 	vector<int>::iterator vi
#define 		mapp 	map<int,int>m
#define 		pairr 	pair<int,int>p
#define 		sett	set<int>s
#define 		set_it 	set<int>::iterator si
#define 		yes 	cout<<"YES"<<endl
#define 		no 	cout<<"NO"<<endl
#define 		xx 	first
#define 		xy 	second
main()
{
    /// freopen ("in.txt" , "r",  stdin) ;
    string st;
    double n,k,t,temp=0,cnt=0,x,y=0,sum=0;
    cin>>n;
    sum=2*pi*n;
    printf("%lf",sum);
    
}

Measured memory_bytes: 3808
#include <iostream>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int c1=0,c2=0;
    if(a==5)c1++;
    if(b==5)c1++;
    if(c==5)c1++;
    if(a==7)c2++;
    if(b==7)c2++;
    if(c==7)c2++;
    if(c1==2&&c2==1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

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

void Qsort(int arr[], int low, int high){
    if (high <= low) return;
    int i = low;
    int j = high + 1;
    int key = arr[low];
    while (true)
    {
        /*从左向右找比key大的值*/
        while (arr[++i] < key)
        {
            if (i == high){
                break;
            }
        }
        /*从右向左找比key小的值*/
        while (arr[--j] > key)
        {
            if (j == low){
                break;
            }
        }
        if (i >= j) break;
        /*交换i,j对应的值*/
        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }
    /*中枢值与j对应值交换*/
    int temp = arr[low];
    arr[low] = arr[j];
    arr[j] = temp;
    Qsort(arr, low, j - 1);
    Qsort(arr, j + 1, high);
}
 

int main() {
  int n,k;
  cin >> n >> k;
  int h[n];
  for(int i = 0;i < n;i++){
    cin >> h[i];
  }
  
  Qsort(h,0,sizeof(h)/sizeof(h[0])-1);
  long ans = 0;
  for(int i = 0;i < n-k;i++){
    ans+=h[i];
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = 0;
vl flag, color; vll path; ll start = 0;
//***********//
int main() {
	cin >> N;
	vl A(N);
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	vll dp(N + 1, vl(3, 0));
	for (i = 0; i < N + 1; i++) {
		for (j = 0; j < 3; j++) {
			dp[i][j] = INF * (-1);
		}
	}
	dp[0][0] = 0;
	dp[0][1] = 0;
	dp[0][2] = 0;
	dp[0][1] = 0;
	dp[0][2] = 0;
	dp[1][2] = 0;
	dp[1][0] = A[0];
	dp[2][1] = A[1];
	if (N != 2) dp[3][2] = A[2];
	for (i = 2; i < N; i++) {
		dp[i + 1][0] = max(dp[i + 1][0], dp[i - 1][0] + A[i]);
		dp[i + 1][1] = max(dp[i + 1][1], dp[i - 1][1] + A[i]);
		dp[i + 1][1] = max(dp[i + 1][1], dp[i - 2][0] + A[i]);
		if (N % 2 == 1 && i > 2) {
			dp[i + 1][2] = max(dp[i + 1][2], dp[i - 1][2] + A[i]);
			dp[i + 1][2] = max(dp[i + 1][2], dp[i - 2][1] + A[i]);
			dp[i + 1][2] = max(dp[i + 1][2], dp[i - 3][0] + A[i]);
		}
	}
	if (N % 2 == 1) {
		cout << max(max(dp[N - 2][0], dp[N - 1][1]), dp[N][2]);
	}
	else {
		cout << max(dp[N - 1][0], dp[N][1]);
	}
}


Measured memory_bytes: 15664
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int N;
  ll a[300001];
  ll b[300001];
  int cnt(0);
  cin>>N;
  for (int i(1);i<=N;i++)cin>>b[i];
  // for (int i(N/2+1);i<=N;i++){
  //   a[i]=b[i];
  //   if (a[i]==1)cnt+=1;
  // }
  for (int i(N);i>0;i--){
    // a[i] is needed
    int sum(0);
    for (int j(i*2);j<=N;j+=i){
      sum+=a[j];
    }
    // cout <<sum << " " <<  b[i] << endl;
    if (sum%2==b[i]) a[i]=0;
    else {
      a[i]=1;
      cnt+=1;
    }
  }

  cout << cnt << endl;
  for (int i(1);i<=N;i++){
    if (a[i]==1){
      cout << i << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 5632
find'::Eq a=>a->[] a->Int
find' x [] = 0
find' x (y:ys) =
  if y == x
    then 0
    else 1 + find' x ys
split::Char->String->[] String
split x [] = []
split x ys = take n ys : (split x $drop (n+1) ys)
  where
    n = find' x ys
toInt::String->Int
toInt = read
gcd'::Int->Int->Int
gcd' x 0 = x
gcd' 0 y = y
gcd' x y
  | x < y = gcd' x $mod y x
  | otherwise = gcd' (mod x y) y
main = do
  a <- getLine
  let b:c:_ = map toInt $split ' ' a
  print $gcd b c


Measured memory_bytes: 3636
N, M = map(int, input().split())
path = dict()
for i in range(1, N+1):
  path[i] = []
for _ in range(M):
  a, b = map(int, input().split())
  path[b].append(a)
#print(path)
step = [-1] * (N+1)
step[1] = 0
for i in range(2, N+1):
  if len(path[i]) == 0: continue
  for p in path[i]:
    if step[p] == -1: continue
    if step[i] == -1:
      step[i] = step[p] + 1
    else:
      step[i] = min(step[i], step[p] + 1)
#print(step)
if step[N] == 2:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Measured memory_bytes: 47584
// abc134c: Exception Handling
#include <stdio.h>

#define rep(i,s,e) for(int i=s;i<e;i++)
#define in(n) scanf("%d",n)
#define outi(d) printf("%d\n",d)

int main(){
  int n;in(&n);
  int m1[2]={-1,-1},m2[2]={-1,-1}; // 0:index,1:value
  rep(i,0,n){
    int a;in(&a);
    if(m1[0]<0 || (m1[0]>=0 && m1[1]<a)){
      m1[0] = i; m1[1] = a;
    }else if(m2[0]<0 || (m2[0]>=0 && m2[1]<a)){
      m2[0] = i; m2[1] = a;
    }
  }
  rep(i,0,n) outi(i==m1[0]? m2[1]: m1[1]);
  return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll dx[4] = {0, 0, 1, -1};
ll dy[4] = {1, -1, 0, 0};

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    ll n;
    cin >> n;
    ll a[n*3];
    rep(i, n*3) cin >> a[i];
    sort(a, a+3*n);
    ll ans = 0;
    for(ll i=1;i<2*n;i+=2){
        ans += a[3*n-i-1];
    }
    cout<<ans<<endl;

}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int a, b;
  cin >> a >> b;
  long long A=0, B=0;
  for(int i=0;i<b;i++)
  {
    A = 10 * A + a;
  }
  for(int i=0;i<a;i++)
  {
    B = 10 * B + b;
  }
  if(b >= a)
    cout << A << endl;
  else
    cout << B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    vector<vector<pair<int,int>>> Tes(N);
    rep(n,0,N){
        int a; cin>>a;
        rep(i,0,a){
            int x,y; cin>>x>>y;
            Tes.at(n).emplace_back(x,y);
        }
    }


    int ans=0;
    rep(i,0,1<<N){
        bitset<15> b(i);

        bool escape=false;
        rep(n,0,N){
            if(b.test(n)){
                for(auto t:Tes.at(n)){
                    if(b.test(t.first-1)!=t.second){
                        escape=true;
                        break;
                    }
                }
            }
            if(escape) break;
        }
        if(!escape) ans=max(ans,(int)b.count());
    }

    cout<<ans<<endl;
}

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

int main(){
 	vector<int> A(3);
  	cin >> A.at(0) >> A.at(1) >> A.at(2);
  	sort(A.begin(),A.end());
  	cout << abs(A.at(1) - A.at(0)) + abs(A.at(2) - A.at(1)) << endl;
}

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

int main()
{
    int n;
    long long int sum=0;
    scanf("%d",&n);

    for(int i=1; i<=n; i++)
    {
        if(i%3 != 0)
            if(i%5 != 0)
                if(i%15 != 0)
                    sum+=i;
    }
    printf("%lld\n",sum);

    return 0;
}


Measured memory_bytes: 3832
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

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

template<typename T,typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v){ t = v; }

template<typename T,typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<LL> a(n);
    REP(i, n) cin >> a[i];
    REP(i, n) a[i] *= 2;

    LL y = 0;
    REP(i, n)
    {
        y = a[i] - y;
    }
    LL x = y / 2;
    REP(i, n)
    {
        cout << x << " \n"[i == n-1];
        x = a[i] - x;
    }
}

Measured memory_bytes: 2176
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn a() {
    let s = read!(String);
    let t = read!(String);

    let c_s: Vec<char> = s.chars().collect::<Vec<char>>();
    let t_s: Vec<char> = t.chars().collect::<Vec<char>>();
    let mut ans = 0;
    for i in 0..c_s.len() {
        if c_s[i] == t_s[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn b() {
    unimplemented!();
}

fn c() {
    unimplemented!();
}

fn d() {
    unimplemented!();
}

fn e() {
    unimplemented!();
}

fn f() {
    unimplemented!();
}

fn main() {
    a();
}


Measured memory_bytes: 4352
#https://atcoder.jp/contests/abc076/submissions/10092893
INF=Float::INFINITY
s=gets.chomp
t=gets.chomp
slen=s.length
tlen=t.length

start=INF
(slen-tlen).downto(0) do |i|
    flag=true
    tlen.times do |j|
        if s[i+j] != t[j] && s[i+j] != '?'
            flag=false
            break
        end
    end
    if flag
        start = i
        break
    end
end
if start == INF
    puts 'UNRESTORABLE'
else
    s[start, tlen] = t
    puts s.gsub(/\?/, 'a')
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for(int i = m; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define dup(x, y) (((x) + (y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template <class T> inline void chmax(T &a, T b) {
    if(a < b) {
        a = b;
    }
}
template <class T> inline void chmin(T &a, T b) {
    if(a > b) {
        a = b;
    }
}
template <class T> inline T gcd(T x, T y) {
    if(y == 0) {
        return x;
    } else if(x == 0) {
        return y;
    }
    return gcd(y, x % y);
}
template <class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template <class T> inline void print_vector(vector<T> vec) {
    for(int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    cout << endl;
}
const LL MOD = 1e9 + 7;
const LL LLINF = 1LL << 60;
const int INF = 1 << 30;

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

    vector<int> A(N);
    rep(i,N) cin >> A[i];

    string ans = "APPROVED";
    rep(i,N){
        if(A[i]%2 == 0 and not(A[i]%3 == 0 or A[i]%5 == 0)){
            ans = "DENIED";
            break;
        }
    }

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

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

sample_list = []
sample_list.append(a)
sample_list.append(b)
sample_list.append(c)
sample_list.append(d)
sample_list.append(e)

x = []
for i in sample_list:
  if i%10 == 0:
    x.append(0)
  else:
    x.append(10-(i%10))

print(sum(sample_list)+sum(x)-max(x))

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

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

    int N;
    cin >> N;
    priority_queue<double, vector<double>, greater<double>> que;
    for (int i = 0; i < N; i++) {
        double v;
        cin >> v;
        que.push(v);
    }
    double ret = 0;
    while (que.size() >= 2) {
        double i = que.top();
        que.pop();
        double j = que.top();
        que.pop();
        que.push((i + j) / 2);
    }
    cout << fixed << que.top() << endl;

    return 0;
}


Measured memory_bytes: 256
from collections import Counter

def prime_factor(n):
    res = Counter()
    for i in range(2, int(n**.5) + 1):
        while n % i == 0:
            res[i] += 1
            n //= i
    if n != 1:
        res[n] += 1
    return res

N, P = map(int, input().split())
cnt = prime_factor(P)
ans = 1
for f in cnt:
    if cnt[f] >= N:
        ans *= f ** (cnt[f] // N)
print(ans)

Measured memory_bytes: 3444
"use strict"

const main = (input) => {
    const { a, b, n } = parser(input);
    console.log(maxFloor(a, b, n));
}

const parser = (inputStr) => {
    const [aStr, bStr, nStr] = inputStr.split(' ');
    return {
        a: Number(aStr),
        b: Number(bStr),
        n: Number(nStr),
    };
}

const maxFloor = (a, b, n) => {
    if ( b - 1 < n ) {
        return Math.floor((a * (b - 1)) / b) - (a * Math.floor((b - 1) / b));
    } else {
        return Math.floor((a * n) / b) - (a * Math.floor(n / b));
    }
}
// test
// const Q1 = '5 7 4'
// const Q2 = '11 10 2000';
// main(Q1);
// main(Q2);
// main(Q2);
// main(Q3);
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29592
sx,sy,tx,ty = map(int ,input().split(" "))
reco = []
reco.append((ty-sy)*"U"+(tx-sx)*"R")
reco.append((ty-sy)*"D"+(tx-sx)*"L")
reco.append("L"+(ty-sy+1)*"U"+(tx-sx+1)*"R"+"D")
reco.append("R"+(ty-sy+1)*"D"+(tx-sx+1)*"L"+"U")
print("".join(reco))

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <algorithm>
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
const int maxn = 1000 + 5;

int d, n;

int main(){
    cin >> d >> n;
    if (n != 100){
        cout << n;
        if (d == 2) cout << "0000";
        else if (d == 1) cout << "00";
    }
    else{
        if (d == 0) cout << 101;
        else if (d == 1) cout << "10100";
        else if (d == 2) cout << "1010000";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cfloat>
#include <algorithm>
#define PB push_back
#define ll long long
#define ull unsigned long long
#define uint unsigned
#define PIE (3.14159265358979323846)
#define MOD 1000000007;
using namespace std;

void checkStream() {
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
}

bool leftPal(const string &s) {
    size_t len {s.size()/2};
    for (size_t i {}, j {len}; i < j; ++i, --j) {
        if (s.at(i) != s.at(j-1)) return false;
    }
    return true;
}

bool rightPal(const string &s) {
    size_t len {(s.size()/2) + 2};
    for (size_t i {len}, j {s.size()}; i < j; ++i, --j) {
        if (s.at(i-1) != s.at(j-1)) return false;
    }
    return true;
}

bool isPal(const string &s) {
    for (size_t i {}, j {s.size()}; i < j; ++i, --j) {
        if (s.at(i) != s.at(j-1)) return false;
    }
    return true;
}

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

    string s {};
    cin >> s;

    if (isPal(s) && leftPal(s) && rightPal(s)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define INF 2139062143
#define inf -2139062144
#define ll long long
using namespace std;
#define N 101000
struct KSD {
	int v,next;
} e[N<<1];
int head[N],cnt;
inline void add(int u,int v) {
	e[++cnt].v=v;
	e[cnt].next=head[u];
	head[u]=cnt;
}
int n;
int sg[N];
void dfs(int x,int p) {
	int i,v;
	sg[x]=0;
	for(i=head[x]; i; i=e[i].next) {
		v=e[i].v;
		if(v==p)continue;
		dfs(v,x);
		sg[x]^=(sg[v]+1);
	}
}
int main() {
	int i,j,T;
	int a,b;
	cnt=1;
	memset(head,0,sizeof(head));
	scanf("%d",&n);
	for(i=1; i<n; i++) {
		scanf("%d%d",&a,&b);
		add(a,b),add(b,a);
	}
	dfs(1,0);
	if(sg[1])puts("Alice");
	else puts("Bob");
	return 0;
}

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

vector<int> edge[1000010];
int n,poi[1000010],u,v;

void dfs(int u,int fa)
{
    poi[u]=0;
    for(auto v : edge[u])
    {
        if(v==fa) continue;
        dfs(v,u);
        poi[u]^=poi[v]+1;
    }
}

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n-1;++i)
    {
        scanf("%d%d",&u,&v);
        edge[u].push_back(v);
        edge[v].push_back(u);
    }
    dfs(1,0);
    puts(poi[1]?"Alice":"Bob");
}

Measured memory_bytes: 35328
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{ 
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var nk = Input.ar;var res = 0d;
        var list = new List<int>();var m = 0;
        for(var i = 1; i <= nk[0]; i++)
        {
            var ct = 0;var k = i;
            while (nk[1] > k) { k *= 2;ct++; }
            list.Add(ct);m = Max(m, ct);
        }var r = 0L;
        foreach (var a in list)
        {
            r += (long)Pow(2, m - a);
        }

        WriteLine((r/(nk[0]*Pow(2,m))).ToString("F10"));
        //var mk = Input.ar;

    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

signed main(){
    int X;
  	cin >>X;
    bool ans=false;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j == X){
                ans=true;
                break;
            }
        }
    }
    if(ans){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


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

int main(){
	double x1,y1,x2,y2,x3,y3,xq,yq;
	while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xq,&yq)){
		double X,Y,x,y;
		if(fabs(x2-x1)<1e-9){
			 printf("%.6lf %.6lf\n",x2-(x3-x2),y3);
		}
		else if(fabs(y2-y1)<1e-9){
			printf("%.6lf %.6lf\n",x3,y2-(y3-y2));
		}
		else{
			X=(y2-y1)/(x2-x1);
			Y=y1-x1*X;
			x=(2*y3*X-2*X*Y+x3-X*X*x3)/(X*X+1);
			y=(x3-x)/X+y3;
			printf("%.6lf %.6lf\n",x,y);
		}
	}
}

Measured memory_bytes: 0
#include<stdio.h>

int main()
{
    int N=0,temp=0, i=0,j=0, counter=0,m=0;
    scanf("%d", &N);

    int arr[N];

    for(i=0; i<N; i++)
    {
        scanf(" %d", &arr[i]);
    }

    for(i=0; i<N; i++)
    {
        m=i;
        for(j=i+1; j<N; j++)
        {
            if(arr[j]<arr[m]) m=j;

        }
        if (m!=i) counter++;
        temp=arr[m];
        arr[m]=arr[i];
        arr[i]=temp;

    }

    for(i=0; i<N; i++)
    {
        if (arr[i]!=i+1) counter++;
    }



    if (counter<=1) printf("YES\n");
    else printf("NO\n");

    return 0;
}


Measured memory_bytes: 1644