akhauriyash/Code-Regression huggingface dataset:
import java.awt.geom.*;
import java.io.*;
import java.util.*;
public class Main {
	
	boolean [] isprime;
	ArrayList<Integer> list;
	int MAX = 100000;
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		init();
		while(true){
			int m = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if((m|a|b) == 0)break;
			double ab = (double)a / b;
			int len = list.size();
			int max = 0;
			int maxp = -1, maxq = -1;
			for(int i = 0; i < len; i++){
				int q = list.get(i);
				int p = m / q;
				if(p < 2) continue;
				while(true){
					if(isprime[p] && (double) p / q <= 1.0) break;
					p--;
				}
				
				if((double) p / q <= 1.0 && (double) p / q >= ab){
					if(p * q > max){
						max = p * q;
						maxp = p;
						maxq = q;
					}
				}
			}
			System.out.println(maxp + " " + maxq);
		}
	}
	
	private void init() {
		isprime = new boolean[MAX + 1];
		list = new ArrayList<Integer>();
		Arrays.fill(isprime, true);
		isprime[0] = false;
		isprime[1] = false;
		for(int i = 2; i <= MAX; i++){
			if(isprime[i]){
				list.add(i);
				for(int j = i + i; j <= MAX; j += i){
					isprime[j] = false;
				}
			}
		}
	}

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

Measured memory_bytes: 13000
X,K,D = map(int,input().split())
X = abs(X)

if X - (D*K) >= 0:
  print(X-D*K)
else:
  k = K - (X//D)
  if k % 2 == 0:
    print(X%D)
  else:
    print(min(abs(X%D+D), abs(X%D-D)))

Measured memory_bytes: 61876
using System;

namespace abc154B
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int N = S.Length;
            string M = "";
            for(int i = 0; i < N; i++)
            {
                M += "x";
            }
            Console.WriteLine(M);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<int, ull> piu;
typedef vector<vector<int>> matrix;

const ll INF = 1e18 + 123;
const ld EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 2023;
const int M = 1e6 + 123;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};

ll dp[N][N];

pii p[N];

ll diff(int a, int b){
    return abs(a-b);
}

void solve(){
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> p[i].x;
        p[i].y = i;
    }
    sort(p+1, p+1+n);
    reverse(p+1, p+1+n);
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= i; j++){
            dp[i+1][j] = max(dp[i+1][j], dp[i][j] + diff(n-i+j, p[i].y) * p[i].x);
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + diff(j, p[i].y) * p[i].x);
        }
    }
    cout << *max_element(dp[n+1], dp[n+1]+N);
}

int main(){
    #ifdef KAZAKH
        freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; i++){
        //cout << "case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 26376
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	long N,K,H[200000];
	long long sum=0;
	cin>>N>>K;
	for(int i=0;i<N;i++)cin>>H[i];
	sort(H,H+N);
	for(int i=0;i<N-K;i++){
		sum+=H[i];
	}
	cout<<sum;
	return 0;
}

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

int main(){

  int a,b,c,t=0,af,bf,end;
  cin>>a>>b>>c;
    af=a,bf=a+b,end=c;
    while(1){
      if(t>100000){
	cout<<"-1"<<endl;
	break;
      }
        if( end<=af){
	cout<<60*t+c<<endl;
	break;
      }
 if(end>af && bf>=end)t++;
      af=a+bf;
      bf=af+b;
      end=(60*t)+c;
    }
  return 0;
}

Measured memory_bytes: 1160
import sys
import numpy as np
from scipy.sparse.csgraph import bellman_ford, NegativeCycleError
from scipy.sparse import csr_matrix

sys.setrecursionlimit(10**5)

def dfs(s):
  for u in to[s]:
    if not toflag[u]:
      toflag[u]=True
      dfs(u)

def rdfs(s):
  for u in ot[s]:
    if not otflag[u]:
      otflag[u]=True
      rdfs(u)

def main():
  for i in range(m):
    a,b,c=map(lambda x:int(x)-1, input().split())
    edges[i]=[a,b,-(c+1-p)]
    to[a].append(b)
    ot[b].append(a)
  
  toflag[0]=True
  otflag[-1]=True
  dfs(0)
  rdfs(n-1)
  
  dic={}
  for a,b,c in edges:
    if toflag[a] and otflag[b]:
      if (a,b) in dic.keys():
        dic[(a,b)]=min(dic[(a,b)],c)
      else:
        dic[(a,b)]=c
        
  row=[]
  col=[]
  data=[]
  for (a,b),c in dic.items():
      row.append(a)
      col.append(b)
      data.append(c)
  g=csr_matrix((data,(row,col)), shape=(n,n))
  try:
    d=bellman_ford(g,indices=0).astype(int)
    print(max(0,-d[-1]))
  except NegativeCycleError:
    print(-1)

    
if __name__=='__main__':
  n,m,p=map(int,input().split())
  edges=[[] for i in range(m)]
  to=[[] for i in range(n)]
  ot=[[] for i in range(n)]
  toflag=[False]*n
  otflag=[False]*n
  main()

Measured memory_bytes: 40444
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
LL T[7];

int main() {
    LL N;
    scanf("%lld", &N);
    for (int i = 0; i < 5; i++)
        scanf("%lld", &T[i]);
    sort(T, T + 5);
    LL ans = 4 + ((N) / T[0]);
    if (N % T[0]) ans++;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define VEC(kata, num) (kata*)malloc(num * sizeof(kata))
#define DB puts("ok")
#define SENTINEL 1000000007
typedef long long lli;


int main()
{
    int i, n, m, l, r;
    int ll=0, rr=1e5;
    scanf("%d%d",&n,&m);
    for(i=0; i<m; i++) {
        scanf("%d %d",&l, &r);
        ll = MAX(ll, l);
        rr = MIN(rr, r);
    }
    printf("%d",MAX(0, rr-ll+1));

    return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeMap;

public class Main {

    public static  boolean canIn(int n, int a, int b, int c){
//return 1>2;        
return  ( 2*n > Math.sqrt(a*a+b*b) ) || (2*n > Math.sqrt(c*c+b*b)) || (2*n> Math.sqrt(a*a+c*c)) ;
    }
  
    public static void main(String[] args)  {

    	try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String line;
            while((line=br.readLine())!=null){if(line.isEmpty())break;
                    String[] spl = line.split(" ");
                    int a = Integer.parseInt(spl[0]); 
                    int b = Integer.parseInt(spl[1]); 
                    int c = Integer.parseInt(spl[2]);
                    if(a==0&&b==0&&c==0){break;}
                    line = br.readLine();
                    int kazu = Integer.parseInt(line);
                    for(int i =0 ; i<kazu ; i++){
                        line = br.readLine();
                        int n= Integer.parseInt(line);
                        boolean flag = canIn(n,a,b,c);
                        if(flag)System.out.println("OK");
                        else System.out.println("NA");
                    }
                    
                    
                    
                    
                    
            }//End WHILE

        }catch(Exception e){e.printStackTrace();}

    }


}

Measured memory_bytes: 16892
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

/*
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()
*/

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-9;

void solve() {
    ll d, n;
    cin >> d >> n;
    if(n == 100) n++;
    for(ll i = 0; i < d; i++) n *= 100;
    cout << n << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


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

int main(){
	int a,b,c;
	string K; 
	cin >> a>>K;
	while(K!="="){
		cin >> b;
		if(K=="+")c = a+b;
		if(K=="-")c = a-b;
		if(K=="*")c = a*b;
		if(K=="/")c= a/b;
		a = c;
		cin >>K;
	}
	cout << a<<endl;
	return 0;
}


Measured memory_bytes: 3128
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    ll x,y,z;
    cin>>x>>y>>z;
    vector<pair<pll,pll>> a(x+y+z);
    for(auto &i:a){cin>>i.F.S>>i.S.F>>i.S.S; i.F.F=i.F.S-i.S.S;}
    sort(a.begin(),a.end(),greater<pair<pll,pll>>());
    priority_queue<pair<pll,pll>> Q;
    vector<ll> dp(x+y+z,0),dp2(x+y+z,0);
    ll sum=0;
    for(int i=0;i<x;i++){
        sum+=a[i].F.S;
        Q.push({{a[i].S.F-a[i].F.S,a[i].F.S},a[i].S});
    }
    dp[x-1]=sum;
    for(ll i=x;i<x+y;i++){
        sum+=a[i].F.S;
        Q.push({{a[i].S.F-a[i].F.S,a[i].F.S},a[i].S});
        pair<pll,pll> W=Q.top(); Q.pop();
        sum+=W.F.F;
        dp[i]=sum;
    }
    while(!Q.empty()){Q.pop();}
    sum=0;
    for(int i=0;i<z;i++){
        sum+=a[x+y+z-1-i].S.S;
        Q.push({{a[x+y+z-1-i].S.F-a[x+y+z-1-i].S.S,a[x+y+z-1-i].F.S},a[x+y+z-1-i].S});
    }
    dp2[x+y]=sum;
    for(ll i=z;i<z+y;i++){
        sum+=a[x+y+z-1-i].S.S;
        Q.push({{a[x+y+z-1-i].S.F-a[x+y+z-1-i].S.S,a[x+y+z-1-i].F.S},a[x+y+z-1-i].S});
        pair<pll,pll> W=Q.top(); Q.pop();
        sum+=W.F.F;
        dp2[x+y+z-1-i]=sum;
    }
    ll ans=0;
    for(int i=1;i<x+y+z;i++){ans=max(ans,dp[i-1]+dp2[i]);}
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 10992
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define mat vector<vec>

using namespace std;

const ll mod=1000000007;
//const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

int main() {
  ll K,S; cin>>K>>S;
  ll cnt=0;
  
  for(ll i=K; i>=0; i--){
    if(S-i<0) continue;
    if(S-i>2*K) break;

    for(ll j=i; j>=0; j--){
      ll x=S-i-j;
      if(x>j) break;
      if(x<0) continue;
      
      if(i==j&&i==x) cnt++;
      else if(i!=j&&i!=x&&j!=x) cnt+=6;
      else cnt+=3;
    }
  }
  cout<<cnt<<endl;
}

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

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0; 

class Point{
	public:
		double x, y;

		Point(double x = 0, double y = 0): x(x), y(y) {}

		Point operator + (Point p){ return Point(x + p.x, y + p.y);}
		Point operator - (Point p){ return Point(x - p.x, y - p.y);}
		Point operator * (double a){ return Point(a * x, a * y);}
		Point operator / (double a){ return Point(x / a, y / a);}

		double abs(){ return sqrt(norm());}
		double norm(){ return x * x + y * y;}

		bool operator < (const Point &p) const{
			return x != p.x ? x < p.x : y < p.y;
		}

		bool operator == (const Point &p) const{
			return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
		}
};

struct Segment {
	Point p1, p2;
};
typedef Segment Line;

class Circle{
	public:
		Point c;
		double r;
		Circle(Point c = Point(), double r = 0.0): c(c), r(r) {}
};

typedef Point Vector;
typedef vector<Point> Polygon;

double dot(Vector a, Vector b){
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b){
	return a.x * b.y - a.y * b.x;
}

int ccw(Point p0, Point p1, Point p2){
	Vector a = p1 - p0;
	Vector b = p2 - p0;
	if(cross(a, b) > EPS) return COUNTER_CLOCKWISE;
	if(cross(a, b) < -EPS) return CLOCKWISE;
	if(dot(a, b) < EPS) return ONLINE_BACK;
	if(a.norm() < b.norm()) return ONLINE_FRONT;

	return ON_SEGMENT;
}

bool intersect(Point p1, Point p2, Point p3, Point p4){
	return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 &&
			ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}
bool intersect(Segment s1, Segment s2){
	return intersect(s1.p1, s1.p2, s2.p1, s2.p2);
}

double getDistance(Point a, Point b){
	return (a - b).abs();
}
double getDistanceLP(Line l, Point p){
	return abs(cross(l.p2 - l.p1, p - l.p1) / (l.p2 - l.p1).abs());
}
double getDistanceSP(Segment s, Point p){
	if(dot(s.p2 - s.p1, p - s.p1) < 0.0) return (p - s.p1).abs();
	if(dot(s.p1 - s.p2, p - s.p2) < 0.0) return (p - s.p2).abs();
	return getDistanceLP(s, p);
}
double getDistance(Segment s1, Segment s2){
	if(intersect(s1, s2)) return 0.0;
	return min(min(getDistanceSP(s1, s2.p1), getDistanceSP(s1, s2.p2)),
			min(getDistanceSP(s2, s1.p1), getDistanceSP(s2, s1.p2)));
}

int main(void){
	int q;
	Segment s1, s2;
	cin >> q;
	for(int i = 1; i <= q; i++){
		cin >> s1.p1.x >> s1.p1.y >> s1.p2.x >> s1.p2.y >> s2.p1.x >> s2.p1.y >> s2.p2.x >> s2.p2.y;
		double ans = getDistance(s1, s2);
		printf("%.8lf\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3208
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


fn main() {
    let s:Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let k = s[1];
    let line = read_line();
    let mut line = line.trim();
    
    let mut array: Vec<char> = line.chars().collect();
    array[k-1] = array[k-1].to_lowercase().next().unwrap();

    let ans: String = array.into_iter().collect();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}

const int N=1e5+5,OO=1e9+7;
pii a[N];

int32_t main(){

    int n;
    cin>>n;
    int mnr=OO,mxl=0;
    forn(i,n){
        cin>>a[i].f>>a[i].s;
        upn(mnr,a[i].s);
        upx(mxl,a[i].f);
    }
    int ans=0;
    forn(i,n)upx(ans,a[i].s-a[i].f+1);
    if(mxl<=mnr){//case 1
        vector<pii> v;
        int be=mnr-mxl+1;
        forn(i,n)upx(ans,a[i].s-a[i].f+1+be);
        dbg(ans);
        forn(i,n){
            int l=mxl-a[i].f;
            int r=a[i].s-mnr;
            v.pb(l,r);
            dbg(l,r,l+r);
        }
        sort(v.begin(),v.end());
        vector<pii> s;
        forn(i,n){
            if(!s.empty()&&s.back().s<=v[i].s)continue;
            s.pb(v[i]);
            dbg(v[i].f,v[i].s);
        }
        dbg(s.size());
        for(int i=1;i<s.size();++i){
            upx(ans,be*2+s[i-1].s+s[i].f);
        }
    }else{
        int ex3=0;
        forn(i,n)if(mnr<a[i].f&&a[i].s<mxl)ex3=1;
        if(!ex3){//case 2
            vector<pii> v;
            int gl=0,gr=OO;
            forn(i,n){
                int il=a[i].f<=mnr;
                int ir=a[i].s>=mxl;
                if(il&&ir){
                    v.pb(a[i]);
                }else if(il){
                    upx(gl,a[i].f);
                }else if(ir){
                    upn(gr,a[i].s);
                }
            }
            for(pii&p:v){
                int l=mnr-max(gl,p.f)+1;
                int r=min(gr,p.s)-mxl+1;
                p.f=l;p.s=r;
            }
            sort(v.begin(), v.end());
            int mr=gr-mxl+1;
            forn(i,v.size()){
                upx(ans,mr+v[i].f);
                upn(mr,v[i].s);
            }
            upx(ans,mnr-gl+1+mr);
        }else{
            //ok
        }
    }
    cout<<ans<<'\n';


    return 0;
}


Measured memory_bytes: 6512
def main():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))

    res = 0
    balls = {}
    bucket = [[] for _ in range(n+1)]

    for ball in A:
        if ball in balls:
            balls[ball] += 1
        else:
            balls[ball] = 1
    
    for key, value in balls.items():
        bucket[value].append(key)

    for i in range(len(bucket)):
        for j in range(len(bucket[i])):
            if bucket[i] != [] and len(balls) > k:
                res += i
                balls.pop(bucket[i][j])

    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 45112
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
template<typename T>
void max_self(T &a,T b){
    a=max(a,b);
}
template<typename T>
void min_self(T &a,T b){
    a=min(a,b);
}
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=5e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    int n,x,t;
    cin>>n>>x>>t;
    cout<<((n+x-1)/x)*t<<Endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
#define SIZE(v) int(v.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N;
	cin >> N;
	map<int, int> mp;
	for (int i = 2;i <= N;++i) {
		int n = i;
		for (int j = 2;j * j <= n;++j) {
			if (n % j) continue;
			while (n % j == 0) {
				mp[j]++;
				n /= j;
			}
		}
		if (n > 1) mp[n]++;
	}
	int n = SIZE(mp);
	vector<vector<int>> dp(n + 1, vector<int>(76));
	dp[0][1] = 1;
	int i = 0;
	for (auto &p : mp) {
		for (int j = 1;j <= 75;++j) {
			for (int k = 0;k <= p.second;++k) {
				if (j * (k + 1) > 75) break;
				dp[i + 1][j * (k + 1)] += dp[i][j];
			}
		}
		++i;
	}
	cout << dp[n][75] << endl;

	return 0;
}

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

int main(){
    int n; cin >> n;
    vector<int> t(n); 
    
    int sum=0;
    rep(i, n){
        cin >> t[i];
        sum += t[i];
    }
    int m; cin >> m;
    vector<int> p(m), x(m);
    rep(i, m) cin >> p[i] >> x[i];

    vector<int> res(m);
    for(int i=0; i<m; i++){
        res[i] = sum - t[p[i]-1] + x[i];
        cout << res[i] << endl;
    }
    return 0;
}

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#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 INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N,K,C; cin>>N>>K>>C;
    string S; cin>>S;

    //前から貪欲
    vector<int> L,R;
    int now = 0;
    while(now<N){
        if(S[now]=='o'){
            L.push_back(now+1);
            now += C;
        }
        now++;
    }
    
    now = N-1;
    while(now>=0){
        if(S[now]=='o'){
            R.push_back(now+1);
            now -= C;
        }
        now--;
    }
    reverse(R.begin(),R.end());
    if(L.size()==K&&R.size()==K){
        rep(i,K)if(L[i]==R[i])cout<<L[i]<<endl;
    }
}


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

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

	int start,end;
	for(int i=0;i<s.length();i++){
		if(s[i]=='A'){
			start=i+1;
			break;
		}
	}

	for(int j=start;j<s.length();j++){
		if(s[j]=='Z')end=j+1;
	}

	cout<<end-start+1<<endl;

	return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 9;

/* typedef */

/* global variables */

int as[N], bs[N], ids[N];

/* subroutines */

/* main */

int main() {
  int pn = 1;
  for (int i = 2; i <= N; i++) pn *= i;
  //cout << pn << endl;

  int tn;
  cin >> tn;

  while (tn--) {
    for (int i = 0; i < N; i++) cin >> as[i];
    for (int i = 0; i < N; i++) cin >> bs[i];
    for (int i = 0; i < N; i++) ids[i] = i;

    int awin = 0, bwin = 0;

    do {
      int asum = 0, bsum = 0;

      for (int i = 0; i < N; i++) {
	int ai = as[i], bi = bs[ids[i]];
	if (ai > bi) asum += ai + bi;
	else bsum += ai + bi;
      }

      if (asum > bsum) awin++;
      else if (asum < bsum) bwin++;
    } while (next_permutation(ids, ids + N));
    //printf("awin=%d, bwin=%d\n", awin, bwin);

    printf("%.5lf %.5lf\n", (double)awin / pn, (double)bwin / pn);
  }

  return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<vector>
using namespace std;



vector<string> split(const string &str,const string &sep){
	vector<string> res;
	string s;
	for(int i=0;i<str.size();i++){
		if(sep.find(str[i],0)==string::npos){
			s+=str[i];
		}else{
			res.push_back(s);
			s.clear();
		}
	}
	res.push_back(s);
	return res;
}


map<string,vector<string> > group;


void f(const string &g){
	vector<string> res;
	vector<string> &v=group[g];
	for(int i=0;i<v.size();i++){
		map<string,vector<string> >::iterator it=group.find(v[i]);
		if(it==group.end()){
			res.push_back(v[i]);
		}else{
			f(v[i]);
			vector<string> &a=it->second;
			for(int j=0;j<a.size();j++){
				res.push_back(a[j]);
			}
		}
	}
	v=res;
	sort(v.begin(),v.end());
	v.erase(unique(v.begin(),v.end()),v.end());
}

int main(){
	int n;
	while(cin>>n&&n){
		string first;
		cin.ignore();
		group.clear();
		for(int i=0;i<n;i++){
			string line,name;
			getline(cin,line);
			vector<string> v(split(line,":,."));
			name=v[0];
			if(i==0)first=name;
			v.erase(v.begin());
			v.pop_back();
			group[name]=v;
		}
		f(first);
		cout<<group[first].size()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1404
#include<bits/stdc++.h>
using namespace std;
int main (){
  int N;
  cin >>N;
  vector<string> SS(N);
  map<string,int> m;
  for(int j=0;j<N;j++){
    cin >> SS.at(j);
    sort(SS.at(j).begin(),SS.at(j).end());
    m[SS.at(j)]++;
  }
  long long count=0;
  for(int i=0;i<N;i++){
    count+=m.at(SS.at(i))-1;
  }
  count=count/2;
    
  cout << count << endl;
}

Measured memory_bytes: 18176
#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;
ll n,a,b,c,d;
int main()
{
  ll i;
  IOS
  cin>>n>>a>>b>>c>>d;
  a--;b--;c--;d--;
  string s;
  cin>>s;
  ll l=n;
  if(c<a || d<b)
  {
    cout<<"No";
    return 0;
  }
  ll mini=max(a,b);
  ll maxi=min(c,d);
  for(i=mini;i<=maxi;i++)
    if(s[i]=='#' && i+1<maxi && s[i+1]=='#')
    {
       cout<<"No";
       return 0;
    }
    for(i=mini;i<=maxi;i++)
      if(s[i]=='.')
      {
         ll c=0;
         while(i<=maxi && s[i]=='.')
         {
           c++;
           i++;
         }
         if(c>=3)
         {
           cout<<"Yes";
           return 0;
         }
      }
    s[b]='#';
    for(i=a;i<c;i++)
     if(s[i]=='#' && i+1<c && s[i+1]=='#')
      break;
    s[b]='.';
    if(i>=c)
    {
      s[c]='#';
      for(i=b;i<d;i++)
        if(s[i]=='#' && i+1<d && s[i+1]=='#')
          break;
      s[c]='.';
      if(i>=d)
      {
         cout<<"Yes\n";
         return 0;
      }
    }
    s[a]='#';
    for(i=b;i<d;i++)
     if(s[i]=='#' && i+1<d && s[i+1]=='#')
      break;
    s[a]='.';
    if(i>=d)
    {
      s[d]='#';
      for(i=a;i<c;i++)
        if(s[i]=='#' && i+1<c && s[i+1]=='#')
          break;
      s[d]='.';
      if(i>=c)
      {
         cout<<"Yes";
         return 0;
      }
    }
    cout<<"No";
  return 0; 
}

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

const double PI = 3.1415926535;

void solve(int a, int b, int x)
{
    cout << fixed << setprecision(10);
    double theta;
    if (x < (double)a * a * b / 2.0)
    {
        theta = PI / 2.0 - atan((2.0 * x) / ((double)a * b * b));
    }
    else
    {
        theta = atan((2.0 * b - (2.0 * x) / ((double)a * a)) / a);
    }
    cout << 180.0 * theta / PI << endl;
}

int main()
{
    int a;
    cin >> a;
    int b;
    cin >> b;
    int x;
    cin >> x;
    solve(a, b, x);
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int A,B,C,K;
  cin>>A>>B>>C>>K;
  if(A>=K)return cout<<K<<endl,0;
  if(A+B>=K)return cout<<A<<endl,0;
  if(A+B+C>=K)return cout<<2*A+B-K<<endl,0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;

const int N=305;
const int mod=1000000007;

int n,ans;
int dp[2][N+N][N],d[N],fac[N],inv[N];

int quickpow(int x,int y){
	int s=1;
	for (;y;y>>=1,x=1ll*x*x%mod)
		if (y&1) s=1ll*s*x%mod;
	return s;
}

void init(){
	int i;
	fac[0]=inv[0]=1;
	for (i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
	inv[n]=quickpow(fac[n],mod-2);
	for (i=n-1;i;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;
}

int main(){
	int i,j,k,now,pre,i2;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&d[i]);
	init();
	dp[0][0][0]=1; now=0; pre=1;
	for (i=1;i<=n;i++){
		now^=1; pre^=1;
		for (j=0;j<=n+n;j++)
			for (k=0;k<i;k++){
				if (!dp[pre][j][k]) continue;
				(dp[now][j][k]+=1ll*dp[pre][j][k]*inv[d[i]-1]%mod)%=mod;
				if (d[i]>1&&j+d[i]-2<=n+n)
				(dp[now][j+d[i]-2][k+1]+=1ll*dp[pre][j][k]*inv[d[i]-2]%mod)%=mod;
			}
		memset(dp[pre],0,sizeof(dp[pre]));
	}
	i2=quickpow(2,mod-2);
	for (j=0;j<=n+n;j++)
		for (k=3;k<=n;k++){
			if (!dp[now][j][k]) continue;
			if (k<n&&j==0) continue;
			if (k==n&&j==0){
				(ans+=1ll*i2*dp[now][j][k]%mod*fac[k-1]%mod)%=mod;
				continue;
			}
			(ans+=1ll*i2*dp[now][j][k]%mod*fac[k-1]%mod*fac[n-k-1]%mod*j%mod)%=mod;
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1792
import numpy as np
import sys

input = sys.stdin.readline

N,Y = map(int,input().split())

諭吉 = 10000
樋口 = 5000
野口 = 1000

for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if z >= 0:
            if  Y == ( 諭吉*x + 樋口*y + 野口*z):
                print("{0} {1} {2}".format(x,y,z))
                exit()

        else: continue

print("-1 -1 -1")




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

int main(){
    int a, b;
    cin >> a >> b;
    if (a < b) cout << "a < b" << endl;
    else if (a > b) cout << "a > b" << endl;
    else if (a == b) cout << "a == b" << endl;

    return 0;
}


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

int main() {
  int n;
  int count = 0;

  cin >> n;

  for (int i = 1; i <= n; i++) {
    int x = i;
    if (x % 3 == 0) {
      cout << " " << i;
    } else {
      while (x) {
        if (x % 10 == 3) {
          cout << " " << i;
          break;
        } else {
          x /= 10;
        }
      }
    }
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;

int main(){
  int a,b;cin >> a >> b;
  int ans = 1;
  int count = 0;
  while(ans<b){
    ans+=a-1;
    count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all int i=0; i<n; i++
#define pb push_back
#define pf push_front
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int> >
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define mod 1000000007
#define mp make_pair
#define pii pair<int,int>
#define T int t;cin>>t;while(t--)
#define I 
#define Think 
#define We 
#define Should 
typedef long long int ll;

bool sortinrev(const pair<ll,ll> &a,  
               const pair<ll,ll> &b) 
{ 
       return (a.first > b.first); 
}
int arr[2005]={0};
int bs(int start, int end, int target){
	int ans = -1;
	while(start<=end){
		int mid = (start+end)/2;
		if(arr[mid]>=target){
			end = mid - 1;
		}
		else{
			ans = mid;
			start = mid + 1;
		}
	}
	return ans;
}
int main(){ 
	FAST_IO;
	int n,ans=0;
	cin>>n;
	for(all)cin>>arr[i];
	sort(arr, arr+n);
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			int k = bs(j+1, n-1, arr[i]+arr[j]);
			//cout<<arr[i]<<" "<<arr[j]<<" "<<k<<endl;
			if(k!=-1)
			ans += k - j;
		}
	}
	cout<<ans<<endl;
	I Think We Should return 0;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define Task ""

using namespace std;
typedef long long ll;

const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;

int N, a[maxn], b[maxn];

signed main(void)
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (fopen("A.INP", "r")){
        freopen("A.INP", "r", stdin);
        freopen("A.OUT", "w", stdout);
    }
    if (fopen(Task".INP", "r")){
        freopen(Task".INP", "r", stdin);
        freopen(Task".OUT", "w", stdout);
    }
    cin >> N;
    for (int i=1; i<=N; ++i){
        cin >> a[i];
    }
    for (int i=1; i<=N; ++i){
        cin >> b[i];
    }
    int res = 0;
    for (int bit=0; bit<=28; ++bit){
        vector<int> va, vb;
        int need = (1 << bit);
        for (int i=1; i<=N; ++i){
            va.pb(a[i] % (2 * need));
            vb.pb(b[i] % (2 * need));
        }
        sort(vb.begin(), vb.end());
        int solan = 0;
        for (auto it : va){
            int l = lower_bound(vb.begin(), vb.end(), need - it) - vb.begin();
            int r = lower_bound(vb.begin(), vb.end(), 2 * need - it) - vb.begin();
            solan += r - l;
            l = lower_bound(vb.begin(), vb.end(), 3 * need - it) - vb.begin();
            r = lower_bound(vb.begin(), vb.end(), 4 * need - it) - vb.begin();
            solan += r - l;
        }
        if (solan & 1)
            res += need;
    }
    cout << res << '\n';
}


Measured memory_bytes: 4820
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<cmath>
#include<map>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

typedef unsigned int uint;
typedef long long ll;

using namespace std;

int main(){
  string str;
  map<int,pair<int,int> > m;
  while(getline(cin,str), str != ""){
    int a,b;
    sscanf(str.c_str(),"%d,%d",&a,&b);
    m[a].f |= 1;
    m[a].s++;
  }
  while(getline(cin,str) && str != ""){
    int a,b;
    sscanf(str.c_str(),"%d,%d",&a,&b);
    m[a].f |= 2;
    m[a].s++;
  }
  FOR(it,m)
    if(it->s.f == 3)
      cout << it->f << " " << it->s.s << endl;
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string a;
  cin>>a;
  if(a=="ABC"){
     cout<<"ARC"<<endl;
  }
  else{
    cout<<"ABC"<<endl;
  }
}


Measured memory_bytes: 3636
// Problem : H - Grid 1
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_h
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 1005

//Solution

char a[N][N];
int dp[N][N];

void solve(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++) cin>>a[i][j];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(i == 0 && j == 0) dp[i][j] = 1;
            else{
                if(a[i][j] == '#'){
                    dp[i][j] = 0;
                    continue;
                }
                if(i-1 >= 0) (dp[i][j] += dp[i-1][j]) %= mod;
                if(j-1 >= 0) (dp[i][j] += dp[i][j-1]) %= mod;
            }
        }
    }
    cout<<dp[n-1][m-1]<<endl;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 12488
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if  (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll a;
    string s;
    cin >> a >> s;
    cout << (a<3200?"red":s);
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
/**********************************************************/
/**            Bismillahir-rahmanir-rahim                **/
/**  In the name of Allah, the Beneficent, the Merciful. **/
/**********************************************************/
/****@author: Sayed Sohan, CSE 13th batch(2016), MBSTU*****/
/**********************************************************/

#include <bits/stdc++.h>
using namespace std;
//              Typedefs
typedef long long               ll;
typedef unsigned long long      ull;

//              Templates
template<class T>               using min_heap = \
                                priority_queue<T, \
                                std::vector<T>, std::greater<T>>;

//              Basic-Defs
#define PB                      push_back
#define MP                      make_pair
#define SP                      " "
#define NL                      "\n"
#define all(v)                  v.begin(), v.end()

//              DEBUG--SECTION
#define DE                      cout<<"HERE\n";
#define DE1(x)                  cout<<x<<"###\n";
#define DE2(x,y)                cout<<x<<"####"<<y<<"\n";
#define Pause                   system("pause");

//              Functions
#define clr(arr,value)          memset(arr,value,sizeof(arr))
#define __FAST_IO               ios_base::sync_with_stdio(0);\
                                cin.tie(0);cout.tie(0);
#define NUM1(x)                 __builtin_popcount(x)
#define LCM(x,y)                (x*y)/__gcd(x,y)

//              Sizes--Math     0123456789
#define MOD                     1000000007   //1e9+7 
#define MAX                     100050      
#define INF                     1e18
#define PI                      acos(-1)
#define eps                     1e-6

//** your code goes from here


int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    __FAST_IO;
    
    ll i,j,k,n,m,T; //basic variables

    string s;
    cin>>s;
    if(s[1]=='B') s[1] = 'R';
    else s[1] = 'B';
    cout<<s<<NL;


    /// Don't forget to set array size....
    return 0;
}




Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 1;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

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

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

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans %= mod;
        ans *= power(i + 1, mod - 2);
        ans %= mod;
    }
    return ans;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep0(i, n)cin >> a[i];
    sort(all(a));
    ll Max = a[n - 1];
    ll ans = a[0];
    if(Max % 2 == 1){
        Max /= 2;
        rep0(i, n - 1)if(abs(Max - ans) > abs(Max - a[i]))ans = a[i];
        ++Max;
        rep0(i, n - 1)if(abs(Max - ans) > abs(Max - a[i]))ans = a[i];
    }else{
        Max /= 2;
        rep0(i, n - 1)if(abs(Max - ans) > abs(Max - a[i]))ans = a[i];
    }
    cout << a[n - 1] << " " << ans << endl;
    return 0;
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}

void solve() {
    int n;
    ll k;
    cin >> n >> k;

    vector<ll> a(n);
    vector<ll> f(n);
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> f[i];
    sort(ALL(a));
    sort(ALL(f), greater<int>());

    auto isOk = [&](ll m, ll x) {
        bool b = true;
        REP(i, n) if (a[i] * f[i] > m) {
            x -= a[i] - m / f[i];
            if (x < 0) {
                b = false;
                break;
            }
        }
        return b;
    };

    ll l = -1;
    ll r = (ll)INF * INF;
    while (abs(r - l) > 1) {
        ll m = (l + r) / 2;
        if (isOk(m, k)) {
            r = m;
        } else {
            l = m;
        }
    }
    cout << r << EOL;
}


Measured memory_bytes: 3328
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	ll q, h, s, d; cin >> q >> h >> s >> d;
	ll n; cin >> n;
	q *= 8;
	h *= 4;
	vector<ll> v(4);
	v = { q,h,s * 2,d };
	sort(all(v));
	if (v[0] != d || v[0] == v[1])cout << (v[0] / 2) * n << endl;
	else
	{
		cout << d * (n / 2) + ((v[1] / 2) * (n % 2)) << endl;
	}
}

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

int main() {
    int n,m;
    cin >> n >> m;
    priority_queue<int> a;
    rep(i,n){
        int a_i;
        cin >> a_i;
        a.push(a_i);
    }
    rep(i,m){
        int max = a.top();a.pop();
        a.push(max/2);
    }
    ll ans = 0;
    rep(i,n){
        ans += a.top();a.pop();
    }
    cout << ans << '\n';
}

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

int main()
{
	int n,t;
	cin >> n >> t;
	int ans = 10000;
	for(int i = 0;i < n;i++){
		int c,tt;
		cin >> c >> tt;
		if(tt <= t){
			if(c < ans)
				ans = c;
		}
	}
	if(ans == 10000)
		cout << "TLE" << endl;
	else
		cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int n, a[21][21], mod = 1e9 + 7, dp[21][1 << 21];
int f(int p, int b) {
  if(p == n)
    return 1;
  if(dp[p][b] != -1)
    return dp[p][b];
  int sm = 0;
  for(int i = 0; i < n; ++i)
    if((~b & (1 << i)) && a[p][i])
      sm = (f(p + 1, b | (1 << i)) + sm) % mod;
  return dp[p][b] = sm;
  
}
int main() {
  cin >> n;
  memset(dp, -1, sizeof dp);
  for(int i = 0; i < n; ++i)
    for(int j = 0; j < n; ++j)
      cin >> a[i][j];
  cout << f(0, 0);
}

Measured memory_bytes: 172288