akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
  int n, ans = 0;
  cin >> n;
  char s[100];
  scanf("%s", &s);

  for (int i = 1; i < n; i++)
  {
    map<char, int> l;
    map<char, int> r;
    int cnt = 0;
    for (int j = 0; j < i; j++)
    {
      l[s[j]]++;
    }
    for (int j = i; j < n; j++)
    {
      r[s[j]]++;
    }
    for (auto itrL = l.begin(); itrL != l.end(); itrL++)
    {
      for (auto itrR = r.begin(); itrR != r.end(); itrR++)
      {
        if (itrL->first == itrR->first)
        {
          cnt++;
          break;
        }
      }
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3704
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long 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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= 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 {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b>>1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;


//////////////////////////

ll N, X;

vector<ll> x;

ll en(ll M) {
	ll ret = 0;
	repn(i, N) {
		ll t = (N - i) / M;
		if (t == 0) { ret += 5 * x[i]; }
		else { ret += (3 + t * 2) * x[i]; }
	}

	ret += X * M+X*N;

	return ret;

}


int main() {
	cin >> N >> X;
	x.assign(N + 1, 0);
	repn(i, N) cin >> x[i];

	ll l = 1;
	ll r = N + 1;

	while (r - l > 2) {
		ll u = (l * 2 + r) / 3;
		ll v = (l + r * 2) / 3;
		//cout << l << " " << r << endl;
		//cout << u << " " << v << endl;

		if (en(v) < en(u)) { l = u; }
		else { r = v; }
		
	}

	//repn(i, N+1) {
		//cout << i<<" "<<en(i) << endl;
	//}

	ll ans = INF;
	for (ll i = l; i <= r; i++) {
		ans = min(ans, en(i));
	}
	cout << ans << endl;
}


Measured memory_bytes: 1792
def solve():
    def check(i, j, m):
        for h in range(m):
            for w in range(m):
                if A[h+i][w+j] != B[h][w]:
                    return False
        return True
    N, M = map(int, input().split())
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]

    for i in range(N-M+1):
        for j in range(N-M+1):
            if check(i, j, M):
                print("Yes")
                return
    print("No")
    return

solve()

Measured memory_bytes: 9124
from operator import itemgetter

class UnionFind:  # 0-index
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n  # 親の番号 要素が根の場合は-(そのグループの要素数)を格納

    def find(self, x):  # 要素xが属するグループの根を返す
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):  # 要素xが属するグループと要素yが属するグループとを併合する
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):  # 要素xが属するグループのサイズ（要素数）を返す
        return -self.parents[self.find(x)]

    def same(self, x, y):  # 要素x, yが同じグループに属するかどうかを返す
        return self.find(x) == self.find(y)

    def members(self, x):  # 要素xが属するグループに属する要素をリストで返す
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):  # すべての根の要素をリストで返す
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):  # グループの数を返す
        return len(self.roots())

    def all_group_members(self):  # {根: [グループに含まれる要素のリスト], ...}の辞書を返す
        return {root: self.members(root) for root in self.roots()}

# ---------------------- #

def kruskal(n, edges):  # edges := [(u, v, weight), ...] weightでソート済み O(E)
    uf = UnionFind(n)
    ret = 0
    for u, v, w in edges:
        if not uf.same(u, v):
            ret += w
            uf.union(u, v)
    return ret

# ---------------------- #

n = int(input())
XY = []
for i in range(n):
    x, y = (int(x) for x in input().split())
    XY.append((i, x, y))

edges = []
XY.sort(key=itemgetter(1))
for (u, x1, _), (v, x2, _) in zip(XY, XY[1:]):
    edges.append((u, v, abs(x2 - x1)))

XY.sort(key=itemgetter(2))
for (u, _, y1), (v, _, y2) in zip(XY, XY[1:]):
    edges.append((u, v, abs(y2 - y1)))

edges.sort(key=itemgetter(2))
ans = kruskal(n, edges)
print(ans)


Measured memory_bytes: 129556
import sys
sys.setrecursionlimit(10 ** 5 + 10)


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


def resolve():

    H, N = map(int, input().split())
    A, B = [0] * N, [0] * N
    for i in range(N):
        A[i], B[i] = map(int, input().split())

    INF = 10**10  # INF+INFを計算してもオーバーフローしない範囲で大きく

    I, J = N, H
    # dpテーブル dp[i][j]:=i番目以下でjのダメージを与えるための最小コスト
    dp = [[INF]*(J+1) for _ in range(I+1)]
    # 初期条件
    for i in range(I):
        dp[i][0] = 0
    # ループ
    for i in range(I):
        for j in range(J+1):
            # i番目を使うときでも使わないときでも
            dp[i+1][j] = min(dp[i+1][j], dp[i][j])
            # 使うとき特有
            dp[i+1][min(j+A[i], J)] = min(dp[i+1][min(j+A[i], J)], dp[i+1][j]+B[i])
    print(dp[I][J])


resolve()

Measured memory_bytes: 119664
#include<stdio.h>
int main()
{
    int i,n,a,b,c;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d%d%d",&a,&b,&c);
if((a*a==b*b+c*c)||(b*b==c*c+a*a)||(c*c==a*a+b*b))
                printf("YES\n");
            else
                printf("NO\n");
    }
    return 0;
}

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

int main() {
  int k;
  vector<int>a;
  a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cin >> k;
  cout << a.at(k-1) << endl;  
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;
  ll ans = 0;
  vll lst;
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    ans -= b;
    lst.push_back(a + b);
  }
  sort(lst.rbegin(), lst.rend());
  rep(i, n) if (i % 2 == 0) ans += lst[i];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include<map>
#include<stack>
   
using namespace std;
    
#define NMAX 50
#define INF 1000000
#define WALL -1
typedef map<int,int>::value_type VT;
   
struct data{
    int x,y,turn;
};
   
int main(void){
       
    int t,n;
    int x,y;
    map<int,int> road;
    stack<data> no;
    data tm,da;
    int dx[]={1,1,0,-1,-1,0};
    int dy[]={0,1,1,0,-1,-1};
    int cnt;
   
    for(int i=-71;i<=71;i++){
        for(int j=-71;j<=71;j++){
        road.insert(VT(i+j*1000,INF));
        }
    }
    while(1){
        cin>>t>>n;
        if(t==0&&n==0) break;
        for(int i=-71;i<=71;i++){
            for(int j=-71;j<=71;j++){
                road[i+j*1000]=INF;
            }
        }
   
        for(int i=0;i<n;i++){
            cin>>x>>y;
            road[y+x*1000]=WALL;
        }
        cin>>x>>y;
        tm.x=x,tm.y=y,tm.turn=0;
        no.push(tm);
        road[y+x*1000]=0;
        cnt=1;
        while(!no.empty()){
            tm=no.top();
            no.pop();
            if(tm.turn==t) continue;
            for(int i=0;i<6;i++){
                if(road[(tm.y+dy[i])+(tm.x+dx[i])*1000]>road[(tm.y)+(tm.x)*1000]+1){
                    if(road[(tm.y+dy[i])+(tm.x+dx[i])*1000]==INF) cnt++;
                    road[(tm.y+dy[i])+(tm.x+dx[i])*1000]=road[(tm.y)+(tm.x)*1000]+1;
                    da.x=tm.x+dx[i];
                    da.y=tm.y+dy[i];
                    da.turn=tm.turn+1;
                    no.push(da);
                }
            }
        }
        cout<<cnt<<endl;
    }
       
    return 0;
}

Measured memory_bytes: 2160
N,M=map(int, input().split())
H=list(map(int, input().split()))
V=[[] for _ in range(N)]
for m in range(M):
    a,b=map(int, input().split())
    a=a-1
    b=b-1
    V[a].append(b)
    V[b].append(a)
for v in V:
    v=set(v)
ans=[1]*N
tmp=0
for n in range(N):
    for v in V[n]:
        if H[n]<=H[v]:
            ans[n]=0
print(sum(ans))

Measured memory_bytes: 32084
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map(String::toInt)
    val hList = readLine()!!.split(' ').map(String::toLong).sortedDescending()
    if(n<=k){
        println(0)
        return
    }
    val sum = hList.takeLast(n - k).sum()
    println(sum)
}

Measured memory_bytes: 86460
N = int(input())
li = [0]*N
for i in range(N):
    s = list(input())
    s.sort()
    li[i] = ''.join(s)
from collections import Counter
c = Counter(li)
ans = 0
key = list(c.keys())
for i in key:
    ans += c[i]*(c[i]-1)//2
print(ans)

Measured memory_bytes: 19720
#include <stdio.h>

int main(void) {
	int N, K;
	int i;
	int ans = 0;

	scanf("%d %d", &N, &K);
	for(i = 0; i < N; i++) {
		int x;
		scanf("%d", &x);
		if(x < K - x) ans += 2 * x;
		else ans += 2 * (K - x);
	}

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

	return 0;
}




Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		
		String[] ss = new String[n];
		String[] t = new String[n];
		int[] ps = new int[n];
		for(int i=0; i<n; i++) {
			String s = scan.next();
			int p = scan.nextInt();
			p=100-p;
			//String s2 = String.valueOf(p);
			String s2 = String.format("%05d", p);
			ss[i] = s+s2;
			t[i] = s+s2;
		}
		
		Arrays.sort(ss);
		for(int i=0; i<n; i++) {
			//System.out.println(t[i]);
			
			for(int j=0; j<n; j++) {
				if(ss[i].equals(t[j])) {
					System.out.println(j+1);
				}
			}
		}
	}

}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
//Int mod = 998244353;
Int INF = 1e18;
double EPS = 0.00000001;

int main() {
    Int n, m;
    cin >> n >> m;
    priority_queue<Int> q;
    for (Int i = 0; i < n; i++) {
        Int a;
        cin >> a;
        q.push(a);
    }
    for (Int i = 0; i < m; i++) {
        Int x = q.top();
        q.pop();
        q.push(x / 2);
    }
    Int res = 0;
    while (!q.empty()) {
        res += q.top();
        q.pop();
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);  //"for float-base
  // problem"
  ll X, ans = 0;
  ll num = 100;
  cin >> X;
  while (num < X) {
    ans++;
    num = num + num / 100;
  }
  cout << ans << endl;
}

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

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

  if (c == "a" || c =="e"|| c =="i"||c =="o"||c =="u") {
      cout << "vowel" << endl;
  }
  else {
      cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++) {
       scanf("%d", &a[i]);
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i];
    }
    float avg = 0;
    avg = (float)sum / (float)n;
    float min = 1000;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (abs((float)a[i] - avg) < min) {
            min = abs((float)a[i]-avg);
            ans = i;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+23;

int f[maxn],sz[maxn];

int find(int x){
	return f[x]==x?x:f[x]=find(f[x]);
}

int main(){
	for(int i=0;i<maxn;i++) f[i]=i,sz[i]=1;
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		int x=find(u),y=find(v);
		if(x!=y){
			f[x]=y;
			sz[y]+=sz[x];
		}
	}
	cout<<*max_element(sz+1,sz+n+1);
}

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

using namespace std;

int main(){
    string s;
    cin >> s;
    int a = atoi(s.substr(0,1).c_str());
    int b = atoi(s.substr(1,1).c_str());
    int c = atoi(s.substr(2,1).c_str());
    int d = atoi(s.substr(3,1).c_str());
    int ans=a;
    string op1,op2,op3;
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            for(int k=0;k<2;k++){
                ans = a;
                if(i == 0)ans += b;
                else ans -= b;
                if(j == 0)ans += c;
                else ans -= c;
                if(k == 0)ans += d;
                else ans -=d;
                if(ans == 7){
                    if(i == 0)op1 = "+";
                    else op1 = "-";
                    if(j == 0)op2 = "+";
                    else op2 = "-";
                    if(k == 0)op3 = "+";
                    else op3 = "-";
                    cout << a << op1 << b << op2 << c << op3 << d << "=7";
                    return 0;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n/2; i++){
        if (s[i] != s[n-i-1]){
            //printf("%d %d\n",i,n-i-1);
            printf("No"); return 0;
        }
        if (s[i] != s[n/2-i-1]){
            //printf("%d %d\n",i,n/2-i-1);
            printf("No"); return 0;
        }
        if (s[n/2+1+i] != s[n-i-1]){
            //printf("%d %d\n",n/2+1+i,n-i-1);
            printf("No"); return 0;
        }
    }
    printf("Yes");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ii pair < ll , ll >
#define fi first
#define se second

using namespace std;
const int N=1e5+55;
vector < ll > vec[N];
vector < ii > down[N];
vector < ll > pre[N];
vector < ll > suf[N];
ll up[N];
ll ans[N];
ll m;


void dfs(ll u , ll p)
{
    ans[u]=1;
    for(auto v:vec[u])
    {
        if(v==p)
            continue ;
        dfs(v,u);
        ans[u]*=1+ans[v];
        down[u].push_back({ans[v],v});
        ans[u]%=m;
    }
    ans[u]%=m;
    ll n=down[u].size();
    if(!n)
        return ;
    ll x=1;
    x*=1+down[u][0].fi;
    pre[u].push_back(x);
    for(ll i=1;i<n;i++)
    {
        x*=down[u][i].fi+1;
        x%=m;
        pre[u].push_back(x);
    }
    x=1;
    ll y=1;
    x*=down[u][n-1].fi+1;
    x%=m;
    suf[u].push_back(x);
    for(ll i=n-2;i>=0;i--)
    {
        x*=1+down[u][i].fi;
        y*=1+down[u][i].fi;
        y%=m;
        x%=m;
        suf[u].push_back(x);
    }
    reverse(suf[u].begin(),suf[u].end());

}


void dfs1(ll u , ll parent)
{
    ll n=down[u].size();
    for(ll i=0;i<n;i++)
    {
        ll v=down[u][i].se;
        ll x=1;
        if(i!=0)
            x*=pre[u][i-1];
        x%=m;
        if(i!=n-1)
        {
                x*=suf[u][i+1];
        }
        x%=m;
        if(u!=1)
            x*=up[u]+1;
        x%=m;
        up[v]=x;
        ans[v]*=x+1;
        ans[v]%=m;
    }
    for(auto v:vec[u])
    {
        if(v!=parent)
            dfs1(v,u);
    }
}

int main()
{
    ios::sync_with_stdio(false);
    ll n;
    cin>>n>>m;
    ll u,v;
    for(ll i=0;i<n-1;i++)
    {
        cin>>u>>v;
        vec[u].push_back(v);
        vec[v].push_back(u);
    }
    dfs(1,0);
    dfs1(1,0);
    for(ll i=0;i<n;i++)
        cout<<ans[i+1]%m<<endl;
    return 0;
}
/*
5 1000
1 2
2 3
2 4
3 5
*/
/*
6 1000
1 2
1 3
1 4
1 5
1 6
*/
/*
10
1000
1 2
1 3
2 4
2 5
3 6
3 7
4 8
4 9
5 10
*/


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

int main(){
	long N,A,B,C,D,E;
	cin>>N>>A>>B>>C>>D>>E;
	long ans=0;
	int tmp=0;
	if(A<=B&&A<=C&&A<=D&&A<=E&&tmp==0){
		tmp=1;
		if(N%A==0)ans+=N/A;
		else ans+=N/A+1;
		ans+=4;
	}
	if(B<=A&&B<=C&&B<=D&&B<=E&&tmp==0){
		tmp=1;
		if(N%B==0)ans+=N/B;
		else ans+=N/B+1;
		ans+=4;
	}
	if(C<=A&&C<=B&&C<=D&&C<=E&&tmp==0){
		tmp=1;
		if(N%C==0)ans+=N/C;
		else ans+=N/C+1;
		ans+=4;
	}
	if(D<=A&&D<=B&&D<=C&&D<=E&&tmp==0){
		tmp=1;
		if(N%D==0)ans+=N/D;
		else ans+=N/D+1;
		ans+=4;
	}
	if(E<=A&&E<=B&&E<=C&&E<=D&&tmp==0){
		tmp=1;
		if(N%E==0)ans+=N/E;
		else ans+=N/E+1;
		ans+=4;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atc {
    class Program {
        static void Main(string[] args) {
            var input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            List<int> num = new List<int>();
            num.Add(a + b);
            num.Add(a - b);
            num.Add(a * b);
            Console.WriteLine(num.Max());
        }
    }
}


Measured memory_bytes: 13268
N,K=map(int,input().split(" "))
A=sorted(map(int,input().split(" ")))

o = []
v = A[0]
z = 0
for i in range(1,N):
    if v != A[i]:
        o.append(i-z)
        v = A[i]
        z = i
o.append(N-z)
o.sort()
print(sum(o[:-K]))

Measured memory_bytes: 24748
import java.util.*;
public class Main {

	class Team implements Comparable<Team>{
		int win;
		int lose;
		String name;

		public Team(int win, int lose, String name) {
			this.win = win;
			this.lose = lose;
			this.name = name;
		}

		public int compareTo(Team other) {
			if(this.win < other.win){
				return 1;
			}
			else if(this.win > other.win){
				return -1;
			}
			else{
				if(this.lose < other.lose){
					return -1;
				}
				else if(this.lose > other.lose){
					return 11;
				}
				else{return 0;}
			}
		}

	}

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		while(n != 0){
			Team [] list = new Team[n];
			for(int i=0; i < n; i++){
				String name = sc.next();
				int winCount = 0, loseCount = 0;
				for(int j=0; j < n-1; j++){
					int result = sc.nextInt();
					switch(result){
					case 0:
						winCount++;
						break;
					case 1:
						loseCount++;
						break;
					case 2:
						break;
					}
				}
				list[i] = new Team(winCount, loseCount, name);
			}
			Arrays.sort(list);
			for(int i=0; i < list.length;i++){
				System.out.println(list[i].name);
			}
			 n = sc.nextInt();
		}

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

	}

}

Measured memory_bytes: 12000
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

const long long MOD = 1000000007;
vector<pair<long long, long long> > prime_factorize(long long n) {
  vector<pair<long long, long long> > res;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p != 0) continue;
    int num = 0;
    while (n % p == 0) { ++num; n /= p; }
    res.push_back(make_pair(p, num));
  }
  if (n != 1) res.push_back(make_pair(n, 1));
  return res;
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=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 {
    mint res(*this);
    return res/=a;
  }
};

mint choose(ll n, ll k) {
  mint x = 1, y = 1;
  for(ll i=0; i<k; i++) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

void solve(long long N){
  vector<mint> v(N+1, 0);
  mint ans = 1;
  for(ll i=1; i<=N; i++) {
    vector<pair<ll,ll>> pf = prime_factorize(i);
    for(auto p: pf) v[p.first]+=p.second;
  }
  for(ll i=1; i<=N; i++)
    if(v[i].x!=0) ans *= v[i]+1;
  std::cout << ans.x << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  solve(N);
  return 0;
}



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


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx,avx2,sse4,tune=native")

using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);
#define tl cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n"


typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc()); x*=f;
    return x;
}

int main(){
    int x = nxt(), y = nxt();
    cout << (__gcd(x,y) == y ? -1 : x) << '\n';


}


Measured memory_bytes: 256
#include <cstdio>
#pragma warning(disable : 4996)
int Q, x, lc[500009], rc[500009], key[500009], cnt; char b[10];
void inorder(int pos) {
	if (lc[pos]) inorder(lc[pos]);
	printf(" %d", key[pos]);
	if (rc[pos]) inorder(rc[pos]);
}
void preorder(int pos) {
	printf(" %d", key[pos]);
	if (lc[pos]) preorder(lc[pos]);
	if (rc[pos]) preorder(rc[pos]);
}
int main() {
	scanf("%d", &Q);
	while (Q--) {
		scanf("%s", b);
		if (b[0] == 'i') {
			scanf("%d", &x);
			if (cnt == 0) key[cnt++] = x;
			else {
				int pos = 0;
				while (true) {
					if (x < key[pos]) {
						if (lc[pos]) pos = lc[pos];
						else {
							lc[pos] = cnt;
							key[cnt++] = x;
							break;
						}
					}
					else {
						if (rc[pos]) pos = rc[pos];
						else {
							rc[pos] = cnt;
							key[cnt++] = x;
							break;
						}
					}
				}
			}
		}
		else {
			inorder(0); printf("\n");
			preorder(0); printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 8432
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


class BIT(object):
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

    def sum(self, i):
        s = 0
        #  ?????????????????????????????¢?????????????¶?????????????
        while i > 0:
            s += self.bit[i]
            i &= (i - 1)
#            i -= (i & -i)

        return s

    def add(self, i, x):
        while i <= self.n:
            self.bit[i] += x
            i += (i & -i)

    def find(self, s, t):
        t_sum = self.sum(t)
        s_sum = self.sum(s - 1)
        return t_sum - s_sum


def main(args):
    n, q = map(int, input().split(' '))

    rq = BIT(n+1)
    for _ in range(q):
        com, x, y = map(int, input().split(' '))
        if com == 0:
            rq.add(x, y)
        elif com == 1:
            res = rq.find(x, y)
            print(res)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 10124
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt");
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static List<int>[] bars1;
    static List<int>[] bars2;
    static long[] counts;

    static object process(TextReader input) {
        var s     = input.ReadLine();
        var spl   = s.Split(' ');
        int n     = int.Parse(spl[0]);
        int q     = int.Parse(spl[1]);
        
        counts = new long[n];

        bars1 = new List<int>[n];
        bars2 = new List<int>[n];

        for (int i = 0; i < n; i++) {
            bars1[i] = new List<int>();
            //bars2[i] = new List<int>();
        }

        for(int i=0; i<n-1; i++) {
            s = input.ReadLine();
            spl = s.Split(' ');
            int a = int.Parse(spl[0])-1;
            int b = int.Parse(spl[1])-1;
            bars1[a].Add(b);
            bars1[b].Add(a);
        }

        //mktree(0, -1);
        
        for (int i = 0; i < q; i++) {
            s = input.ReadLine();
            spl = s.Split(' ');
            int p = int.Parse(spl[0])-1;
            int x = int.Parse(spl[1]);

            counts[p] += x;
        }

        walk(0, -1);

        var buil = new StringBuilder();
        foreach(var x in counts) {
            buil.Append(x);
            buil.Append(' ');
        }
        return buil.ToString();
    }

    static void walk(int target, int root) {
        foreach (var z in bars1[target]) {
            if (root == -1) {
                counts[z] += counts[target];
                walk(z, target);
            } else{
                if (z != root) {
                    counts[z] += counts[target];// - counts[root];
                    walk(z, target);
                }
            }
        }
    }

    //static void mktree(int target, int root) {
    //    foreach(var z in bars1[target]) {
    //        if(z != root) {
    //            bars2[target].Add(z);
    //            mktree(z, target);
    //            bars2[target].AddRange(bars2[z]);
    //        }
    //    }
    //}
    
    //static void walk(int target, int from) {
    //    foreach(var z in bars2[target]) {
    //        if(from == -1)
    //            counts[z] += counts[target];
    //        else
    //            counts[z] += counts[target] - counts[from];

    //        walk(z, target);
    //    }
    //}

    //static void add(int target, int x) {
    //    foreach(var z in bars2[target]) {
    //        counts[z] += x;
    //        add(z, x);
    //    }
    //}
}

Measured memory_bytes: 72840
#include<stdio.h>
int main(int argc, char const *argv[]){
	long long n,a,b;
	scanf("%lld %lld %lld",&n,&a,&b);
	if(a>b || (n==1 && a!=b)) printf("0\n");
	else printf("%lld\n",(b-a)*(n-2)+1);
	return 0;
}

Measured memory_bytes: 128
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        ans += x * x + y * y <= d * d;
    }

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

Measured memory_bytes: 3580
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n,k,a[100],sum=0;
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a+0,a+n);
	for(int i=n-1;i>=n-k;i--) sum+=a[i];
	cout<<sum;
}

Measured memory_bytes: 256
package main

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

var (
	list []string
	al   []int
	bl   []int
	cl   []int
	leng int
	memo = make(map[string]bool)
)

func getStdin() []string {
	stdin := bufio.NewScanner(os.Stdin)
	lines := []string{}
	for stdin.Scan() {
		if err := stdin.Err(); err != nil {
			fmt.Fprintln(os.Stderr, err)
		}
		lines = append(lines, stdin.Text())
	}
	//	readLine()
	return lines
}

func main() {
	l := strings.Split(getStdin()[0], " ")
	x, _ := strconv.Atoi(l[0])
	y, _ := strconv.Atoi(l[1])
	fmt.Println(x * y)
}


Measured memory_bytes: 1756
import collections

N = int(input())
S = input()


def count_variation(s):
    c = collections.Counter(s)
    return c.keys()


ans = []

for i in range(1, N):
    s1 = S[:i]
    s2 = S[i:]
    mojis = len(count_variation(s1) & count_variation(s2))
    ans.append(mojis)

print(max(ans))


Measured memory_bytes: 3316
N = int(raw_input())
S = raw_input()

state = 0
count = 0
#print S
#print len(S)
for i in range(len(S)):
    if S[i] == 'A':
        state = 1
    elif state == 1 and S[i] == 'B':
        state = 2
    elif state == 2 and S[i] == 'C':
        count += 1; state = 0
    else:
        state = 0
print count


Measured memory_bytes: 2568
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

const int MAX=100010;
const int INF=1e9;

int n;
vector<pair<int,int>> G[MAX];
int d[MAX];

void bfs(int u){
  rep(i,n) d[i]=INF;
  d[u]=0;
  queue<int> q;
  q.push(u);
  int t;
  while(!q.empty()){
    t=q.front(); q.pop();
    for(auto x:G[t]){
      if(d[x.first]==INF){
        d[x.first]=d[t]+x.second;
        q.push(x.first);
      }
    }
  }
}

void dia(){
  bfs(0);
  
  int tgt,maxi=0;
  rep(i,n){
    if(maxi<d[i]){
      maxi=d[i];
      tgt=i;
    }
  }
  
  bfs(tgt);
  
  maxi=0;
  rep(i,n){
    maxi=max(maxi,d[i]);
  }
  cout<<maxi<<endl;
}

int main(){
  cin>>n;
  
  int s,t,w;
  rep(i,n-1){
    cin>>s>>t>>w;
    G[s].push_back({t,w});
    G[t].push_back({s,w});
  }
  
  dia();
  
  return 0;
}


Measured memory_bytes: 9816
package main

import (
	"fmt"
)

func main() {
	var n, a, b int

	fmt.Scanf("%d %d %d", &n, &a, &b)
	fmt.Println(logic(n, a, b))
}

func logic(n, a, b int) int {
	if n*a <= b {
		return n * a
	}
	return b
}


Measured memory_bytes: 512
N = int(input())
P = tuple(map(float, input().split()))

dp = [[0 for _ in range(N + 1)] for __ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
    for j in range(N):
        dp[i + 1][j + 1] += dp[i][j] * P[i]
        dp[i + 1][j] += dp[i][j] * (1 - P[i])
print(sum(dp[N][(N + 1) // 2:]))


Measured memory_bytes: 257800
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
 
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b){
    cout << c << endl;
  }else if (a == c){
    cout << b << endl;
  }else{
    cout << a << endl;
  }
 
 
  return 0;
 
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    if(n==1) System.out.println("Hello World");
    if (n==2) {
      int a=sc.nextInt();
      int b=sc.nextInt();
      System.out.println(a+b);
    }
  }
}


Measured memory_bytes: 21716
from math import hypot, factorial
from itertools import permutations

N, *XY = map(int, open(0).read().split())

XY = list(zip(*[iter(XY)] * 2))
ans = 0
for p in permutations(XY):
    ans += sum(hypot(ax - bx, ay - by) for (ax, ay), (bx, by) in zip(p, p[1:]))

print("{:.9f}".format(ans / factorial(N)))


Measured memory_bytes: 43320
import sys

s = input()
t = input()

def check(i):
	ns = s[i:] + s[:i]
	if ns == t:
		print('Yes')
		sys.exit()
	else:
		return

for i in range(len(s)):
	if s[i] == t[0]:
		check(i)
	if i == len(s)-1:
		print('No')
		sys.exit()



Measured memory_bytes: 3060
def selectionSort(L, n):
  cnt = 0
  for i in range(n):
    minj = i
    for j in range(i, n):
      if L[j] < L[minj]:
        minj = j
    L[i], L[minj] = L[minj], L[i]
    if i != minj:
      cnt += 1
  return L, cnt

N = int(input())
A = list(map(int, input().split()))
A, t = selectionSort(A, N)
print(' '.join(map(str, A)), t, sep='\n')


Measured memory_bytes: 5604
// https://beta.atcoder.jp/contests/abc073
// status:

#define SUBMIT
//#define DEBUG

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

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    stringstream stream(R"(6
12
22
16
22
18
12
)");
#endif
    set<int> A;
    int N;
    stream >> N;
    for (int i = 0; i < N; ++i) {
        int v;
        stream >> v;
        if (A.find(v) == A.end()) A.insert(v);
        else A.erase(v);
    }
    cout << A.size() << endl;
    return 0;
}

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

int main(void){
  string S; 
  cin >>S;
  
  bool a[26];
  rep(i,0,26) a[i] = false;
  
  int len = S.size();
  rep(i,0,len){
    a[S[i]-'a'] = true;
  } 
  
  set<char> st;
  rep(i,0,len) st.insert(S[i]);
  
  string ans;
  if(st.size()==26) ans = "None";
  else{
    rep(i,0,26){
      if(a[i]==false){
        ans += (char)(i+'a');
        break;
      }
    }
  }
  
  cout <<ans<< endl;
}

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

using namespace std;

int main() {
  string S;
  cin >> S;
  if (S.length() == 1) {
    cout << 1 << endl;
    return 0;
  }
  vector<int> G;
  for (int i = 0; i < S.length(); i++) {
    int count = 1;
    while (i < S.length() - 1 and S[i] == S[i + 1]) {
      i++;
      count++;
    }
    G.push_back(count);
  }
  int ans = 0;
  for (int i = 0; i < G.size(); i++) {
    ans += G[i] / 3 * 2;
    if (G[i] % 3 == 1) {
      ans++;
    }
    if (G[i] % 3 == 2) {
      if (i < G.size() - 1) {
        ans += 2;
        G[i + 1]--;
      } else {
        ans++;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main(){
   int n; cin>>n;
   string s; cin>>s;
   int ans=0;
   for(int i=0;i<n-1;i++){
      int cnt=0;
      for(char c='a';c<='z';c++){
         bool right=false,left=false;
         for(int k=i+1;k<n;k++){
            if(s[k]==c) left=true;
            for(int j=0;j<=i;j++){
               if(s[j]==c) right=true;
            }
         }
         if(right&&left) cnt++;
      }
      ans=max(ans,cnt);
   }
   cout<<ans<<endl;
   return 0;
}


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N, L;
int x[330000], t[330000];
int p[330000], l[330000], r[330000];

signed main() {
    cin >> N >> L;
    for (int i = 0; i < N; i++)cin >> x[i];
    for (int i = 0; i < N; i++)cin >> t[i];
    for (int i = 0; i < N; i++) {
        p[i] = t[i] - t[i] % (2 * L);
        if (p[i] < t[i])p[i] += 2 * L;

        l[i] = 2 * x[i];
        if (l[i] < t[i])l[i] = t[i] - (t[i] - l[i]) % (2 * L);
        if (l[i] < t[i])l[i] += 2 * L;
        l[i] -= 2 * x[i];

        r[i] = 2 * (L - x[i]);
        if (r[i] < t[i])r[i] = t[i] - (t[i] - r[i]) % (2 * L);
        if (r[i] < t[i])r[i] += 2 * L;
        r[i] += 2 * x[i];
        cerr << p[i] << " " << l[i] << " " << r[i] << endl;

    }

    int ans = r[N - 1];
    for (int i = 0; i < N - 1; i++)ans += p[i];
    vint stk;
    for (int i = 0; i < N - 1; i++) {
        if (l[i] != p[i] && r[i] != p[i])stk.push_back(i);
        if (l[i] == p[i] && r[i] == p[i] && !stk.empty()) {
            l[stk.back()] += 2 * L;
            r[i] += 2 * L;
            stk.pop_back();
            ans -= 2 * L;
        }
    }
    stk.clear();
    for (int i = 0; i < N - 1; i++) {
        if (l[i] != p[i] && r[i] != p[i])stk.push_back(i);
        if (l[i] != p[i] && r[i] == p[i] && !stk.empty()) {
            l[stk.back()] += 2 * L;
            l[i] += 2 * L;
            r[i] += 2 * L;
            stk.pop_back();
            ans -= 2 * L;
        }
    }
    stk.clear();
    for (int i = N - 2; i >= 0 ; i--) {
        if (l[i] == p[i] && r[i] == p[i])stk.push_back(i);
        if (l[i] != p[i] && r[i] == p[i] && !stk.empty()) {
            r[stk.back()] += 2 * L;
            l[i] += 2 * L;
            r[i] += 2 * L;
            stk.pop_back();
            ans -= 2 * L;
        }
    }
    stk.clear();
    for (int i = 0; i < N - 1; i++) {
        if (l[i] != p[i] && r[i] == p[i])stk.push_back(i);
    }
    ans -= stk.size() / 2 * 2 * L;

    cout << ans << endl;
}


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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf LLONG_MAX

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

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

    ll test=1;
    //cin>>test;
    while(test--)
    {
        ld a,as,b,bs;
        cin>>a>>as>>b>>bs;

        if(ceil(a/bs)<ceil(b/as))
        cout<<"No";
        else
        {
            cout<<"Yes";
        }
        
    }
}

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


int main(){
    
    while(true){
        int n;
        cin>>n;
        if(n==0) return 0;
        int now=0;
        int cnt=0;
        int r=0,l=0;
        while(n--){
            string s;
            cin>>s;
            if(s=="ru") r=1;
            if(s=="rd") r=0;
            if(s=="lu") l=1;
            if(s=="ld") l=0;

            if(now==0 && r==1 && l==1){
                cnt++;
                now=1;
            }else if(now==1 && r==0 && l==0){
                cnt++;
                now=0;
            }
        }
        cout<<cnt<<endl;
    }
}



Measured memory_bytes: 3120
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * for (int i = 0; i < N; i++) {}
 * System.out.println();
 * HashMap<Integer, Integer> hm = new HashMap<>();
 * int[] s = new int[M];
 * ArrayDeque<Integer> deq = new ArrayDeque<>();
 * @author mj
 *
 */
public class Main implements Runnable { //クラス名はMain3

	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1));
		new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行
	}

	public void run() {
		FastScannerMain3 sc = new FastScannerMain3(System.in);

		try {
			int A = sc.nextInt();
			int B = sc.nextInt();

			double itemA1 = 0;
			double itemB1 = 0;
			double itemA2 = 0;
			double itemB2 = 0;

			double taxA = 0.08;
			double taxB = 0.1;

			itemA1 = A / taxA;
			itemB1 = B / taxB;
			itemA2 = (A + 1) / taxA;
			itemB2 = (B + 1) / taxB;

			if ((itemA1 - (int) itemA1) > 0) {
				//System.out.println("yes");
				itemA1 += 1;
			}
			if ((itemB1 - (int) itemB1) > 0) {
				//System.out.println("yes2");
				itemB1 -= 1;
			}

			/*
			System.out.println(itemA1 - (int) itemA1);
			System.out.println(itemA1);
			System.out.println(itemA2);
			
			System.out.println(itemB1);
			System.out.println(itemB2);
			*/

			boolean ans = false;
			for (int i = (int) itemA1; i < (int) itemA2; i++) {
				for (int j = (int) itemB1; j < (int) itemB2; j++) {
					if (i == j) {
						if (!ans) {
							System.out.println(i);
						}
						ans = true;
						break;
					}
				}
				if (ans) {
					break;
				}
			}
			if (!ans) {
				System.out.println(-1);
			}

			System.out.println();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}

//高速なScanner
class FastScannerMain3 {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScannerMain3(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}


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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

int main() {

	FAST;

	int n;
	cin >> n;
	map <string, int> mp;
	while (n -- ) {
		string s;
		cin >> s;
		mp[s] ++;
	}
	string c[] = {"AC", "WA", "TLE", "RE"};
	for (int i = 0; i < 4; i ++) {
		cout << c[i] << " x " << mp[c[i]] << '\n';
	}
	return 0;
}

Measured memory_bytes: 3660
/*https://atcoder.jp/contests/dp/tasks/dp_e*/
#include <iostream>
#include <vector>
using namespace std;
int min(int a, int b){
	return a < b ? a : b;
}
int main(){
	int n, W, S = 0;
	cin >> n >> W;
	vector<int>w(n), v(n);
	for (int i = 0; i < n; i++){
		cin >> w[i] >> v[i];
		S += v[i];
	}
	int inf = 1e9 + 7;
	vector<vector<int>>dp(n + 1, vector<int>(S + 1, inf));
	/*dp[i][j]: weight nho nhat voi i phan tu va co gia tri la j*/
	dp[0][0] = 0;
	
	for (int i = 0; i < n; i++){
		for (int j = 0; j <= S; j++){
			dp[i + 1][j] = dp[i][j];
			if (j - v[i] >= 0){
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
			}
		}
	}
	for (int i = S; i >= 0; i--){
		if (dp[n][i] <= W){
			cout << i;
			return 0;
		}
	}
	
}

Measured memory_bytes: 40192
#include <bits/stdc++.h>
#define i_love_u_Phuong ios_base::sync_with_stdio(0); cin.tie(0);

using ll = long long;
using namespace std;
using ld = long double;

void enter()
{
    int a,b,c;
    int maxx;
    int k;
    cin >> a >> b >> c;
    cin >> k;
    k = (1<<k);
    maxx=max(max(a,b),c);
    int sum= a+b+c - maxx;
    sum+=maxx*k;
    cout << sum;
}

int main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#endif // ONLINE_JUDGE
    i_love_u_Phuong;
    enter();
    return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

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

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){

	int a, b, c;
	cin >> a >> b >> c;

	int ans = 0;

	for(int i = a; i <= b; i++){
		if(c % i == 0){
			ans += 1;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3104
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;

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

int main() {
	
	int n;
	cin >> n;
	int t = 0;
	int x = n;
	while (x) {
		t += x % 10;
		x /= 10;
	}
	if (n%t)cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
def main
  n, q, jobs = input

  ans = []
  time = 0
  while not jobs.empty?
    job = jobs.first

    if job[:time] <= q
      time += job[:time]
      ans << { :name => job[:name], :time => time}
      jobs.delete_at(0)
    else
      time += q
      newjob = { :name => job[:name], :time => job[:time] - q}
      jobs.delete_at(0)
      jobs << newjob
    end
  end
  ans.each do |info|
    puts "#{info[:name]} #{info[:time]}"
  end
end

def input
  n, q = gets.chomp.split(/\s/).collect { |x| x.to_i}
  jobs = []
  (1..n).each do |i|
    str = gets.chomp.split(/\s/)
    pname, time = str[0], str[1].to_i
    jobs << { :name => pname, :time => time}
  end
  [n, q, jobs]
end

main

Measured memory_bytes: 46124