akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=10e9+7;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}

int main(void){
    int N;
    cin>>N;
    if(N<=2){
        cout<<1<<endl;
        return 0;
    }
    vector<int> A(N);
    rep(i,N) cin>>A.at(i);
    
    ll ans=1;
    bool inc=false,dec=false;
    rep(i,N-1){
        if(A.at(i)<A.at(i+1)){
            if(dec){
                dec=false;
                ans++;
            }
            else inc=true;
        }
        else if(A.at(i)>A.at(i+1)){
            if(inc){
                inc=false;
                ans++;
            }
            else dec=true;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] arg) {
		boolean[] notPrime = new boolean[50001];
		notPrime[0] = true;
		notPrime[1] = true;
		int primeCount = 50000 - 1;
		for (int i = 4; i <= 50000; i += 2) {
			if (!notPrime[i]) {
				notPrime[i] = true;
				primeCount--;
			}
			final int k = i - 1;
			if (!notPrime[k]) {
				for (int j = k * 2; j <= 50000; j += k) {
					if (!notPrime[j]) {
						notPrime[j] = true;
						primeCount--;
					}
				}
			}
		}
		int[] primes = new int[primeCount];
		primes[0] = 2;
		int index = 1;
		for (int i = 3; i <= 50000; i += 2) {
			if (!notPrime[i]) {
				primes[index++] = i;
			}
		}
		int[] gbc = new int[50001];
		for (int i = 0; i < primes.length; i++) {
			for (int j = i; j < primes.length; j++) {
				int val = primes[i] + primes[j];
				if (val > 50000) {
					break;
				}
				gbc[val]++;
			}
		}

		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			int n = in.nextInt();
			if (n != 0) {
				System.out.println(gbc[n]);
			}
		}

	}
}

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

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


int main() {
    // input, ready
    int N;
    cin >> N;

    vector<ll> vec_A;
    vector<ll> vec_sum_A;
    vec_A.resize(N);
    vec_sum_A.resize(N);
    ll sum = 0;
    for (int i=0; i<N; i++) 
    {
        ll tmp;
        cin >> tmp;
        vec_A.at(i) = tmp;
        sum += tmp;
        vec_sum_A.at(i) = sum;
    }

    // resolve
    ll ave = sum / 2;
    auto lower = lower_bound(vec_sum_A.begin(), vec_sum_A.end(), ave);
    int idx_lower = distance(vec_sum_A.begin(), lower);

    // output 
    ll left=0;
    if (idx_lower > 0) left = vec_sum_A[idx_lower-1];
    ll right = sum - vec_sum_A[idx_lower];
    cout << 2*min(abs(ave-left),abs(ave-right)) + sum%2 << endl;

    return 0;
}


Measured memory_bytes: 3328
k, n = list(map(int, input().split()))
a_list = list(map(int, input().split()))

max_v = 0
for i in range(1, len(a_list)):
    max_v = max(max_v, a_list[i] - a_list[i - 1])

# 最初と最後の家の距離
max_v = max(max_v, k - a_list[-1] + a_list[0])

print(k - max_v)


Measured memory_bytes: 26444
#include<iostream>

bool solve(int n, int y){
    y /= 1000;

    for(int a = 0; a <= 2000; a++){
        for(int b = 0; b <= 4000; b++){
            int c = n - a - b;
            if(0 <= c && c <= 20000 && 10*a + 5*b + c == y){
                std::cout << a << " " << b << " " << c << std::endl;
                return true;
             }
        }
    }
    return false;
}

int main(){
    int n, y;
    std::cin >> n >> y;

    if(!solve(n,y)) std::cout << -1 << " " << -1 << " " << -1 << std::endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

#include<unistd.h>
char buff[1 << 22];
template <int size>
struct Buffer{
    int idx = 0;
    Buffer(){ read(0, buff, size); }
    // void next(int& ret){
    int next(){
        int ret = 0;
        // ret = 0;
        // while(!(buff[idx] & 0x10)){ idx++; }
        while(buff[idx] & 0x10){ ret = ret * 10 + buff[idx++] - '0'; }
        idx++;
        // while(!isdigit(buff[idx])){ idx++; }
        // while(isdigit(buff[idx])){ ret = ret * 10 + buff[idx++] - '0'; }
        return ret;
    }
};
struct FastInput {
    Buffer<1 << 22> buf;
    template <class T>
    // FastInput& operator >> (T& num) { buf.next(num); return *this; }
    FastInput& operator >> (T& num) { num = buf.next(); return *this; }
    void tie(int){ }
    template <class S, class T>
    friend FastInput& operator >> (FastInput& in, pair<S, T>& p){ return in >> p.first >> p.second; }
    template <class T>
    friend FastInput& operator >> (FastInput& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
};
FastInput fin;
#define cin fin

enum { SIZE = 1 << 20 };
char buf[SIZE];
int accs[512][512];
pair<int, int> pqs[100000];
int main(){
    int n, m, q;
    cin >> n >> m >> q;
    for(int i = 0; i < m; i++){
        int l, r;
        cin >> l >> r;
        accs[1][r]++;
        accs[l + 1][r]--;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            accs[i + 1][j] += accs[i][j];
            accs[i][j] += accs[i][j - 1];
        }
    }
    char* ptr = buf + SIZE;
    for(int i = 0; i < q; i++){
        cin >> pqs[i].first >> pqs[i].second;
    }
    for(int i = q - 1; i >= 0; i--){
        int p = pqs[i].first, q = pqs[i].second;
        *--ptr = '\n';
        div_t num2;
        num2.quot = accs[p][q];
        do{
            num2 = div(num2.quot, 10);
            *--ptr = num2.rem | '0';
        }while(num2.quot);
    }
    write(1, ptr, buf + SIZE - ptr);
}


Measured memory_bytes: 6784
// Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      cout << i << "x" << j << "=" << i*j << endl;
    }
  }    
}




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

#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ll long long int
 
using namespace std;

 
int main()
{
     int x,n;
     cin>>x>>n;
     if(n==0)
     cout<<x;
     else{
          vector<int> a;
          for(int i=0;i<n;i++)
          {
               int temp;
               cin>>temp;
               a.push_back(temp);
          }
          int reqd=0;
          sort(a.begin(),a.end());
          int m=INT_MAX;
          for(int i=0;i<105;i++)
          {
               if(find(a.begin(), a.end(), i) != a.end())
               continue;
               else
               {
                    int diff=abs(i-x);
                    if(diff<m){
                    m=diff;
                    reqd=i;
                    }
               }
          }
          cout<<reqd;
     }
	return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<pair<int, int>> p(N);
    rep(i, N)
    {
        cin >> p.at(i).first;
        p.at(i).second = i + 1;
    }
    sort(all(p));
    rep(i, N)
    {
        cout << p.at(i).second << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 1664
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc =  new Scanner(System.in);
		int num = sc.nextInt();
		int maxHeight = sc.nextInt();
		int count = 1;
		for(int i=1;i<num;i++) {
			int me = sc.nextInt();
			if(maxHeight <= me) {
				count++;
				maxHeight = me;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<limits.h>
#include<string>
#include<iomanip>
#include<numeric>
#include<queue>
using namespace std;

long long  mod = 1000000007;

long max(long x, long y) {
	return x > y ? x : y;
}

long min(long x, long y) {
	return x < y ? x : y;
}

long factorial(long n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * factorial(n - 1);
	}
}

long long  fel(long long  n,long long  f) {

		if (f == 1) {
			return n % mod;
		}
		else if (f % 2 == 0) {
			return (fel(n,f / 2) * fel(n,f / 2)) % mod;
		}
		else {
			return ((n  * fel(n,f / 2) %mod) * fel(n,f / 2))% mod;
		}
	

}

int keta(long long n) {
	int c = 0;
	while (n != 0) {
		n = n / 10;
		c++;
	}
	return c - 1;
}

int main(){
	
	long n;
	long long b;
	long long ans = 1;

	cin >> n;
	

	for (int i = 0;i < n;i++) {
		cin >> b;
		
		if (b == 0) {
			ans = 0;
		}
		else {
			if (ans > 1000000000000000000 / b) {
				ans = -1;
			}
			else {
				if (ans != -1) {
					ans = ans * b;
				}
			}
		}

	}
	cout << ans;
}







Measured memory_bytes: 3180
/*input
5
24 11 8 3 16
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

void run() {
	int n, i, j, ret = 0;
	cin >> n;
	vector<int> a(n);
	for(auto &x : a) cin >> x;
	sort(a.begin(), a.end());
	vector<int> good(1000010, true);
	for(i=0; i<n; i++) {
		if(!good[a[i]]) continue;
		if(i==n-1 || a[i]!=a[i+1])
			ret++;
		for(j=a[i]; j <= a[n-1]; j += a[i])
			good[j] = false;
	}
	cout << ret << endl;
}

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


Measured memory_bytes: 7948
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;

#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1.0)

#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pf(a) printf("%lld\n",a)

#define stll(a) stoll(a,nullptr,10)
#define all(a) a.begin(),a.end()
#define PII pair<ll,ll>
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define EL printf("\n")
#define ff first
#define ss second
#define rev(a) reverse(all(a))


#define mem(ar,val) memset(ar,val,sizeof(ar))
#define ssort(ar) sort(ar.begin(),ar.end())
#define csort(ar,comp) sort(ar.begin(),ar.end(),comp)

#define bug1(a) cout<<"test "<<a<<endl;
#define bug2(a,b) cout<<"test "<<a<<" "<<b<<endl;
#define bug3(a,b,c) cout<<"test "<<a<<" "<<b<<" "<<c<<endl;
#define bug4(a,b,c,d) cout<<"test "<<a<<" "<<b<<" "<<c<<" "<<d<<endl;

#define fout freopen("output.txt","w",stdout)
#define fin  freopen("input.txt","r",stdin)

/// unordered_map<int,int>mp;
/// mp.reserve(1024);
/// mp.max_load_factor(0.25);

/// pbds
/// *find_by_order(k) - return k th largest element.. 0 based
/// order_of_key(k) - number of items strictly smaller than k

/*
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};
*/

typedef long long ll;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;


int main()
{
    ll n,k;
    string st;
    cin>>n>>k>>st;
    ll ans =0;
    for(int i=0;i<n-1;i++)
        if(st[i]==st[i+1])
            ans++;
    cout<<min(n-1,ans+2*k)<<endl;

}















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

int main() {
    int64_t n, a, b;
    cin >> n >> a >> b;
    int pre;
    cin >> pre;
    int64_t ans = 0;
    rep(i,n-1) {
        int x;
        cin >> x;
        if ((x - pre) * a < b) {
            ans += (x - pre) * a;
        }
        else ans += b;
        pre = x;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define fr(i, p, n) for(int i = (int )p; i < (int )n; i++)
#define frn(i, p, n) for(int i = (int )p; i <= (int )n; i++)
#define rev(i, n, p) for(int i = (int )n; i >= (int )p; i--)

typedef long long int LL;
typedef pair< int, int> ii;
const int mod = 1e9 + 7;
const int mx = 1e6;
const int i27 = 1 << 27;

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
	int n, a; cin >> n;
	int f[8] = {0};
	int mxa = 0, mna = 0;
	while(n--) {
	    cin >> a;
	    a /= 400;
	    if(a > 7) {mxa++; continue;}
	    if(!f[a]) {mna++; f[a]++;}
	}
	if(mna == 0) cout << "1 " << mxa;
	else cout << mna << ' ' << mna + mxa;
	return 0;
}

Measured memory_bytes: 256
mod = 10 ** 9 + 7

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

dp = [1] + [0] * (K + 1)
for a in A:
    for i in range(1, K + 1):
        dp[i] += dp[i - 1]
    for i in reversed(range(1, K + 1)):
        dp[i] -= dp[max(0, i - a) - 1]
        dp[i] %= mod

print(dp[K])

Measured memory_bytes: 42728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll n;
  cin>>n;
  if(n==1)
  {
    cout<<0;
    return 0;
  }
  map<ll,ll> mp;
  ll y=n;
  while(n>1 && n%2==0)
  {
      n/=2;
      mp[2]++;
  }
  for(ll i=3;i*i<=n;i+=2)
  {
      while(n>1 && n%i==0)
      {
          n/=i;
          mp[i]++;
      }
  }
  if(n>2)
  mp[n]++;
  ll ans=0;
  for(auto &it:mp)
  {
      ll x=it.second;
      ll t=1;
      for(ll i=1;i<=x;i++)
      {
          t*=(it.first);
          if((y%t)==0)
          {
            y/=t;
            ans++;
          }
      }
      if(y==1)
      break;
  }
  cout<<ans;
  return 0;
}

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

int main(){
    int H, W;
    
    while(1){
        scanf("%d %d", &H, &W);
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i++){
            for(int i = 0; i < W; i++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    
    return 0;
}


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

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define DIFF(x, y) ((x) > (y) ? ((x) - (y)) : ((y) - (x)))

#define MOD(x, y) ((x) % (y))
// ceil() for integer dividing
#define DIVCEIL(x, y) (((x) + ((y) - 1)) / (y))
// floor() for integer dividing
#define DIVFLOOR(x, y) (((x) + ((y) / 2)) / (y))
// round() for integer dividing
#define DIVROUND(x, y) ((x) - MOD(x, y) >= MOD(x, y) ? DIVCEIL(x, y) : DIVFLOOR(x, y))

struct D {
  int x;
  int y;
  int h;
};

constexpr int MAX_N = 100;
constexpr int MAX_X = 100;
constexpr int MAX_Y = 100;

int main() {
  int N;
  cin >> N;
  D d[N + 1];
  for (int i{}; i < N; ++i) {
    cin >> d[i].x >> d[i].y >> d[i].h;
    if (d[i].h > 0) {
      d[N] = d[i];
    }
  }

  int x, y;
  long long H;
  for (x = 0; x <= MAX_X; ++x) {
    for (y = 0; y <= MAX_Y; ++y) {
      bool result{true};
      H = d[N].h + DIFF(d[N].x, x) + DIFF(d[N].y, y);
      for (int i{0}; i < N; ++i) {
        long long h = MAX(H - DIFF(d[i].x, x) - DIFF(d[i].y, y), 0LL);
        if (h != d[i].h) {
          result = false;
          break;
        }
      }
      if (result) {
        cout << x << ' ' << y << ' ' << H << endl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * @author yoshida3203
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		char[]S=sc.next().toCharArray();

		String ans="";
		for(int i=1;i<S.length;i++){
			if(S[i-1]==S[i]){
				ans="Bad";
				break;
			}else{
				ans="Good";
			}

		}

		System.out.println(ans);

	}
}


Measured memory_bytes: 35756
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 60) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n, m, k;

int main() {
	while (cin >> n >> k >> m&&n + m + k) {
		vector<int> vi;
		rep(i, n)vi.push_back(i + 1);
		m--; k--;
		while (vi.size() > 1) {
			vi.erase(vi.begin() + m);
			m += k;
			m %= vi.size();
		}
		cout << vi[0] << endl;
	}
}

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

#define MAXN 200005

using namespace std;

int n, x;
int d[MAXN << 1], p[MAXN], h[MAXN];

int main() {
    scanf("%d%d%d", &n, &d[1], &x);
    for (int i = 2; i <= (n << 1); ++i)
        d[i] = d[i - 1] + x;
    for (int i = 1; i <= (n << 1); ++i)
        d[i] += d[i - 1];
    for (int i = 1; i <= n; ++i)
        p[i] = d[(i << 1) - 1];
    for (int i = 1; i <= n; ++i)
        h[i] = d[i << 1];
    long double ans = 0, sum = 0;
    for (int i = 2; i <= n; ++i)
        sum += 1.0 / i;
    for (int i = 1; i <= n; ++i) {
        ans += 0.5 * (abs(p[i] - h[i - 1]) + abs(p[i] - h[i])) + 0.25 * abs(h[i] - h[i - 1]) * sum;
        sum = sum + 1.0 / (i + 1) - 1.0 / (n - i + 1);
    }
    /*for (int i = 1; i <= n; ++i) {
        ans += 0.5 * (abs(p[i] - h[i - 1]) + abs(p[i] - h[i]));
        for (int j = i - 1; j >= 1; --j)
            ans += 0.25 * abs(h[i] - h[i - 1]) / (i - j + 1);
        for (int j = i + 1; j <= n; ++j)
            ans += 0.25 * abs(h[i] - h[i - 1]) / (j - i + 1);
    }*/
    printf("%.10Lf\n", ans);
}


Measured memory_bytes: 3328
x,_ = list(map(int,input().split()))
p = list(map(int,input().split()))
x_l = x
x_u = x
while(True):
    if(not x_l in p):
        print(x_l)
        break
    if(not x_u in p):
        print(x_u)
        break
    x_l -= 1
    x_u += 1

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

long long n;
map<long long,long long> f;
int A,B,C,D,T;

long long getf(long long n)
{
	if (f[n]!=0) return f[n];
	long long ans=1000000000000000000ll;
	if (ans/D>=n) ans=n*D;
	if (!(n&1)) ans=min(ans,getf(n/2)+A); else
	ans=min(ans,min(getf(n/2),getf(n/2+1))+A+D);
	if (n%3<=1&&n>=3) ans=min(ans,getf(n/3)+D*(n%3)+B);
	else ans=min(ans,getf(n/3+1)+D+B);
	if (n%5<=2&&n>=5) ans=min(ans,getf(n/5)+D*(n%5)+C);
	else ans=min(ans,getf(n/5+1)+D*(5-n%5)+C);
	return f[n]=ans;
}

int main()
{
	scanf("%d",&T);
	while (T--)
	{
		scanf("%lld%d%d%d%d",&n,&A,&B,&C,&D);
		f.clear(),f[1]=D,printf("%lld\n",getf(n));
	}
	return 0;
}

Measured memory_bytes: 4532
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n,d,x; cin>>n>>d>>x;
	ll ans=0;
	rep(i,0,n){
		int a; cin>>a;
		int day=1,cnt=0;
		//cout<<"day: ";
		while(day<=d){
			cnt++;
			day+=a;
			//cout<<day<<" ";
		}
		ans+=cnt;
		//cout<<endl;
	}
	cout<<ans+x;
	
	return 0;
}

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

int A[200];

int main() {
  auto n = 2 * get<int>();
  for(int i = 0; i < n; ++i) {
    A[i] = get<int>();
  }
  std::sort(A, A + n);
  std::reverse(A, A + n);
  int res = 0;
  for(int i = 0; i < n; i+=2) {
    res += std::min(A[i], A[i+1]);
  }
  put(res);
  
  return 0;
}

#else

template<typename T>
T get() { return 0; }
template<>
int get() { int x; scanf("%d", &x); return x; }

template<typename T>
void put(T x) {}
template<>
void put(int x) { printf("%d\n", x); }


#define CHECK_
#include __FILE__
#endif



Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = arg[0];
    
    let answer;
    
    if(S === "Sunny") {
        answer = "Cloudy";
    } else if(S === "Cloudy") {
        answer = "Rainy";
    } else {
        answer = "Sunny";
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7496
#include<stdio.h>
int absv(int x);
int main()
{
    int a,b,k;
    scanf("%d%d",&a,&b);
    k=(a+b)/2;
    int c=a-k;
    int d=b-k;
    int absv_c= absv(c);
    int absv_d= absv(d);
    if(absv_c == absv_d) printf("%d",k);
    else printf("IMPOSSIBLE");
    return 0;
}
int absv(int x)
{
    int a
    ;
    if(x<0)
    {
       a=x*(-1);
       return a;
    }
    else return x;
}


Measured memory_bytes: 128
use std::io;
use std::str::FromStr;
use std::f64::consts::PI;

fn input_tuple() -> (f64, f64, f64, f64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<f64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1], vec[2], vec[3])
}


fn main() {
    let (a, b, h, m) = input_tuple();
    let a_rad = (h + m / 60.0) / 6.0 * PI;
    let b_rad = m / 30.0 * PI;
    let a_x = a_rad.cos() * a;
    let a_y = a_rad.sin() * a;
    let b_x = b_rad.cos() * b;
    let b_y = b_rad.sin() * b;
    println!("{}", ((a_x - b_x).powf(2.0) + (a_y - b_y).powf(2.0)).sqrt());
}

Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main()
{
    int h, m, s;
    cin >> s;
    
    h = s/3600; s %= 3600;
    m = s/60; s %= 60;
   cout << h << ":" << m << ":" << s << endl; 
   
   return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m,a[100005],cnt[100005],cnt2[100005],gen[100005],ans;
int main(){
	cin>>n>>m;
	rep(i,n){
		cin>>a[i];
		cnt[a[i]%m]++;
		cnt2[a[i]]++;
	}
	for(int i=0;i<=100000;i++){
		if(cnt2[i] >= 2){
			gen[i%m] += cnt2[i]/2;
		}
	}
	for(int i=0;i<=m/2;i++){
		int x = cnt[i];
		int y = cnt[(m-i)%m];
		if(i == (m-i)%m){
			ans += x/2;
		}
		else{
			if(x == y){
				ans += x;
			}
			else if(x > y){
				if(x-gen[i]*2 <= y){
					ans += (x+y)/2;
				}
				else{
					ans += gen[i] + y;
				}
			}
			else{
				if(y-gen[(m-i)%m]*2 <= x){
					ans += (x+y)/2;
				}
				else{
					ans += gen[(m-i)%m] + x;
				}
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
	int m,f,r,p;
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m == -1 && f == -1 && r == -1)break;
		p = m + f;
		if(m == -1 || f == -1){
			printf("F\n");
		}else if(p >= 80){
			printf("A\n");
		}else if(p >= 65 && p < 80){
			printf("B\n");
		}else if(p >= 50 && p < 65){
			printf("C\n");
		}else if(p >= 30 && p < 50){
			if(r >= 50){
				printf("C\n");
			}else{
				printf("D\n");
			}
		}else if(p < 30){
			printf("F\n");
		}
	}
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	int i = s.size() - 1;
	while (i >= 0 && s[i] != 'F') {
		--i;
	}
	s.erase(i, s.size() - 1);
	cout << s;
}

Measured memory_bytes: 256
N = gets.to_i
S = gets.chomp.split('')

before = Hash.new(0)
after = Hash.new(0)
S.each {|c| after[c] += 1}

ans = 0
N.times do |i|
    before[S[i]] += 1
    after[S[i]] -= 1
    result = ('a'..'z').count{|c|before[c] > 0 && after[c] > 0}
    ans = result if ans < result
end
puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n, k;
	cin >> n >> k;
	vector<ll> h(n);
	for(int i=0; i<n; i++) cin >> h.at(i);
	sort(h.begin(), h.end());
	ll ans=1E9;
	for(int i=0; i+k<=n; i++){
		ll diff=h.at(i+k-1)-h.at(i);
		if(diff<ans) ans=diff;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
N = int(input())

nn = N + 10
P = 998244353

fa = [1] * (nn+1)
fainv = [1] * (nn+1)
for i in range(nn):
    fa[i+1] = fa[i] * (i+1) % P
fainv[-1] = pow(fa[-1], P-2, P)
for i in range(nn)[::-1]:
    fainv[i] = fainv[i+1] * (i+1) % P
C = lambda a, b: fa[a] * fainv[b] % P * fainv[a-b] % P if 0 <= b <= a else 0

ans = pow(3, N, P)
p2 = 2
for i in range(N, N // 2, -1):
    ans = (ans - C(N, i) * p2) % P
    p2 = p2 * 2 % P

print(ans)

Measured memory_bytes: 190616
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define MAX 1000000000


int main()
{
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(n, vector<int>(m));
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}

	int mincost = MAX;
	for (int b = 0; b < pow(2, n); b++) {
		int d = b;
		vector<int> rikaido(m);
		int cost = 0;
		for (int i = 0; i < n; i++) {
			if (d % 2 == 1) {
				for (int j = 0; j < m; j++) {
					rikaido[j] += a[i][j];
				}
				cost += c[i];
			}
			d >>= 1;
		}

		bool rikai = true;
		for (int i = 0; i < m; i++) {
			if (rikaido[i] < x)
				rikai = false;
		}
		if (rikai) {
			mincost = min(mincost, cost);
		}
	}
	if (mincost == MAX) {
		cout << -1 << endl;
	}
	else {
		cout << mincost << endl;
	}
	return 0;
}

Measured memory_bytes: 4116
q,w,e=range,input,raw_input
while True:
  n=w()
  if n==0:break
  d={}
  for i in q(n):
    o=e().split()
    d[o[0]]=int(o[1])
  for j in q(w()):
    t=e().split()
    a=sum([d[i] if i in d else 0 for i in t[2:]])
    d[t[0]]=a if a<d[t[0]] else d[t[0]]
  print d[e()]

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

#define MOD (1000000007LL)

using namespace std;

long long expmod(long long b, long long i){
    if(i == 0) return 1;
    long long ans = 1;
    long long e = expmod(b, i / 2);
    e *= e;
    e %= MOD;
    if(i % 2 == 1) e *= b;
    e %= MOD;
    return e;
}

long long inv(long long n){
    return expmod(n, MOD - 2);
}

int main(void){
    vector<long long> primes;
    primes.reserve(100000);
    primes.push_back(2);
    for(long long n = 3; n <= 1000000; n += 2){
        for(auto itr = primes.begin(); (*itr) * (*itr) <= n && itr != primes.end(); itr++){
            if(n % (*itr) == 0) goto next;
        }
        primes.push_back(n);
        // cout << n << endl;
        next:;
    }

    int N;
    cin >> N;
    map<long long, long long> fact;
    vector<long long> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i];
        long long AA = A[i];
        map<long long, long long> factt;
        for(auto itr = primes.begin(); itr != primes.end(); itr++){
            while(AA % *itr == 0){
                factt[*itr]++;
                AA /= *itr;
            }
            if(AA == 1) break;
            if(*itr * *itr > AA){
                factt[AA]++;
                break;
            }
        }
        for(auto itr = factt.begin(); itr != factt.end(); itr++){
            if(fact[itr->first] < itr->second) fact[itr->first] = itr->second;
        }
    }

    long long lcm = 1;
    for(auto itr = fact.begin(); itr != fact.end(); itr++){
        lcm *= expmod(itr->first, itr->second);
        lcm %= MOD;
    }
    // cout << lcm << endl;

    long long ans = 0;
    for(int i = 0; i < N; i++){
        long long B = lcm * inv(A[i]);
        B %= MOD;
        ans += B;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
using namespace std;
#define rep(i, n) for ( int i = 0; i < n ;i++ )
#define MAX 100

int H, W;
int dy[3] = {0, 0, 1};
int dx[3] = {1, -1,0};

class State{
    public:
    int l, r, y, x, o;
    State(int y=0, int x=0, int o=0):y(y), x(x), o(o){
	reset();
    }
    
    void reset(){ l = W; r = -1; }
    void visit(int j){
	l = min(l, j);
	r = max(r, j);
    }
    bool visited(int j){
	return l <= j && j <= r;
    }

    bool operator < ( const State &s) const{
	if ( o != s.o ) return o < s.o;
	if ( l != s.l ) return l < s.l;
	if ( r != s.r ) return r < s.r;
	if ( y != s.y ) return y < s.y;
	if ( x != s.x ) return x < s.x;
	return false;
    }
};

class QState{
    public:
    State state;
    int cost;
    QState(){}
    QState(State state, int cost): state(state), cost(cost){}
    bool operator < ( const QState &s) const{
	return cost > s.cost;
    }
};

int F, M, O, C[MAX][MAX];
int maxs;

int dijkstra(){
    if ( O == 0 ) return -1;
    int ncost;

    priority_queue<QState> PQ;
    set<State> visited;

    maxs = 0;

    rep(j, W){
	State source = State(0, j, O);
	source.visit(j);
	source.o--;
	if ( source.o == 0 ) continue;

	if ( C[0][j] >= 0 ){
	    source.o = min(M, source.o + C[0][j]);
	    ncost = 0;
	} else {
	    ncost = C[0][j]*(-1);
	}
	visited.insert(source);

	PQ.push(QState(source, ncost));
    }

    QState u, v;
    int nx, ny;
    while(!PQ.empty()){
	u = PQ.top(); PQ.pop();
	if ( u.cost > F ) continue;
	if ( u.state.y == H-1) return u.cost;

	rep(r, 3){
	    nx = u.state.x + dx[r];
	    ny = u.state.y + dy[r];
	    if ( nx < 0 || ny < 0 || nx >= W || ny >= H ) continue;
	    
	    v = u;
	    v.state.o--;
	    if ( v.state.o == 0 ) continue;
	    v.state.x = nx;
	    v.state.y = ny;

	    if ( r == 2 ) v.state.reset();

	    if ( !v.state.visited(nx) ){
		if ( C[ny][nx] >= 0 ){
		    v.state.o = min(M, v.state.o + C[ny][nx]);
		    v.state.visit(nx);
		} else if ( C[ny][nx] < 0 ){
		    v.cost = u.cost + (C[ny][nx]*(-1));
		    v.state.visit(nx);
		}
	    }

	    if( visited.find(v.state) == visited.end()){
		visited.insert(v.state);
		PQ.push(v);
	    }
	}
    }

    return -1;
}

main(){
    while( cin >> W >> H && W && H ){
	cin >> F >> M >> O;
	rep(i, H) rep(j, W) cin >> C[i][j];
	int cost = dijkstra();
	if ( cost < 0 || F < cost) cout << "NA" << endl;
	else cout << cost << endl;
    }
}

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

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using vl = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;
const ll inf = 1000000000000000;

#define pi acos(-1)
#define pb push_back
#define test int TEST;cin>>TEST;while(TEST--)
#define vsort(xx) sort(xx.begin(),xx.end())
#define vrevsort(xx) sort(xx.rbegin(),xx.rend())


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);   
    ll ans=inf;
    int n,m; cin>>n>>m;
    if (n>=3){
        if (n%3) ans=min(ans,1ll*m); else ans=0;
    }
    if (m>=3){
        if (m%3) ans=min(ans,1ll*n); else ans=0;
    }
    for (int i=1;i<=n-1;i++){
        ll a=1ll*i*m,b=1ll*(m/2)*(n-i),c=1ll*(m-m/2)*(n-i);
        ans=min(ans,max({a,b,c})-min({a,b,c}));
    }
    for (int i=1;i<=m-1;i++){
        ll a=1ll*i*n,b=1ll*(n/2)*(m-i),c=1ll*(n-n/2)*(m-i);
        ans=min(ans,max({a,b,c})-min({a,b,c}));
    }
    cout<<ans<<"\n";
   
    return 0;
}




Measured memory_bytes: 256
/**
 *      author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *      created : 2019-11-23 20:15:03
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<typename T> inline void chmin(T &a, T b) { if (a > b) a = b; return; }
template<typename T> inline void chmax(T &a, T b) { if (a < b) a = b; return; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec) { os << '{'; for (size_t i = 0; i < vec.size(); ++i) { os << vec[i]; if (i != vec.size() - 1) os << ','; } os << '}'; return os; }
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

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

  int x, y; cin >> x >> y;
  if (x == 1 && y == 1) {
    cout << 400000 + 300000 + 300000 << endl;
    return 0;
  }

  int ans = 0;
  if (x == 1) ans += 300000;
  if (y == 1) ans += 300000;
  if (x == 2) ans += 200000;
  if (y == 2) ans += 200000;
  if (x == 3) ans += 100000;
  if (y == 3) ans += 100000;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {N:i64}

    for n in 1..=3500 {
        for h in 1..=3500 {
            if 4 * n * h <= N * h + N * n {
                continue;
            }

            if (N * h * n) % (4 * n * h - N * h - N * n) == 0 {
                let w = (N * h * n) / (4 * n * h - N * h - N * n);
                if w > 0 {
                    println!("{} {} {}", h, n, w);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
using Graph = vector<vector<int>>;
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; }
const int INF = 1e9;
const LL LLINF = 1e16;

vector<int> c, nozero;
// 和、使った数字(bit)
vector<pair<int, int>> l, r;
int lnum, rnum;
void dfs(int d, int used, int sm){
    if(d == lnum){
        l.emplace_back(sm, used);
        return;
    }
    rep(i, 10){
        if(i==0 && nozero[d]) continue;
        if((used&(1<<i))==0){
            dfs(d+1, used|(1<<i), sm+c[d]*i);
        }
    }
}

void dfs2(int d, int used, int sm){
    if(d == rnum){
        r.emplace_back(sm, used);
        return;
    }
    rep(i, 10){
        if(i==0 && nozero[d+lnum]) continue;
        if((used&(1<<i))==0){
            dfs2(d+1, used|(1<<i), sm+c[d+lnum]*i);
        }
    }
}


int main(){
    fastcin();

    int n;
    cin >> n;
    while(n > 0){
    vector<string> s(n);
    rep(i, n) cin >> s[i];

    map<char, int> mp;
    int now = 0;
    rep(i, n)repe(j, s[i]){
        if(mp.count(j) == 0){
            mp[j] = now++;
        }
    }

    int num = now;
    c.assign(num, 0);
    rep(i, n){
        int dig = 1;
        for(int j=s[i].size()-1; j>=0; j--){
            int alph = mp[s[i][j]];
            if(i < n-1) c[alph] += dig;
            else c[alph] -= dig;
            dig *= 10;
        }
    }
    // repe(i, c) cout << i << " "; cout << endl;

    nozero.assign(num, 0);
    rep(i, n)if(s[i].size() >= 2) nozero[mp[s[i][0]]] = 1;
    // repe(i, nozero) cout << i; cout << endl;

    lnum = num/2;
    rnum = num - lnum;
    l.clear();
    r.clear();

    dfs(0, 0, 0);
    dfs2(0, 0, 0);

    sort(all(l));
    sort(all(r));
    reverse(all(r));

    // repe(i, l) cout << i.first << " " << bitset<10>(i.second) << endl; cout<<endl;
    // repe(i, r) cout << i.first << " " << bitset<10>(i.second) << endl;

    int ans = 0;
    int li = 0, ri = 0;
    while(li < l.size() && ri < r.size()){
        int lsum, lbit, rsum, rbit;
        tie(lsum, lbit) = l[li];
        tie(rsum, rbit) = r[ri];
        if(lsum+rsum > 0) ri++;
        else if(lsum+rsum < 0) li++;
        else{
            // cout << lsum << " " << bitset<10>(lbit) << " / " << rsum << " " << bitset<10>(rbit) << endl;
            if((lbit&rbit)==0) ans++;
            int rnow = ri;
            while(rnow < r.size()-1 && r[rnow].first == r[rnow+1].first){
                rnow++;
                rbit = r[rnow].second;
                if((lbit&rbit)==0) ans++;
            }
            li++;
        }
    }
    cout << ans << endl;
    cin >> n;
    }
}


Measured memory_bytes: 3440
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  3005

ll n,sum;
ll a[N];
ll dp[N][N];
ll dps(ll l,ll r)
{
    if(l>r)
        return 0;
    if(dp[l][r]!=-1)
        return dp[l][r];
    dp[l][r]=max(a[l]+min(dps(l+2,r),dps(l+1,r-1)),a[r]+min(dps(l,r-2),dps(l+1,r-1)));
    return dp[l][r];
}   
void solve()
{
    cin>>n;
    rep(i,0,n)
    {
        cin>>a[i];
        sum+=a[i];
    }
    memset(dp,-1,sizeof(dp));
    cout<<2*dps(0,n-1)-sum<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 74308
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<math.h>
#define rep(i,l,r) for(ll i=l;i<r;i++)

typedef long long ll;

int main() {
    ll n, x,t;
    scanf("%lld%lld%lld", &n,&x,&t);
    printf("%lld", (n + x - 1) / x * t);

    return 0;
}

Measured memory_bytes: 2144
#include <iostream>
#include <vector>
using namespace std;
 
class Dice{
public:
    long r[6];
    Dice(){};
    void roll(long a, long b, long c, long d){swap(r[a], r[b]);swap(r[b], r[c]);swap(r[c], r[d]);}
    void spin(char c){if (c == 'W') roll(0, 2, 5, 3);else roll(0, 1, 5, 4);}
};
 
int main() {
    int n;
    cin >> n;
    vector<Dice> D(n);
    for (int i = 0; i < n ; i++) for (int j = 0; j < 6; j++) cin >> D[i].r[j];
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            char SWS[8]={"NNNWNNN"};
            for (int k = 0; k < 8; k++){
                if (D[i].r[1] == D[j].r[1]) break;
                D[j].spin(SWS[k]);
            }
            for (int k = 0; k < 4; k++){
                if (D[i].r[0] == D[j].r[0]){
                    if (D[i].r[1] == D[j].r[1] && D[i].r[2] == D[j].r[2] && D[i].r[3]==D[j].r[3] && D[i].r[4] == D[j].r[4] && D[i].r[5] == D[j].r[5]){
                        cout << "No" << endl; return 0;
                    }
                }
                D[j].spin('W');
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1196
object Main {
	def main(args:Array[String]) = {
	    val sc = new java.util.Scanner(System.in)
	    while(sc.hasNext){
	      val a,b = sc.nextLong()
	      val gcd = GCD(a,b)
	      val lcm:Long = a*b / gcd
	      println(gcd+" "+lcm)
	    }
    }
	def GCD(a:Long, b:Long): Long = if(b==0) a else GCD(b, a%b)
}

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

using namespace std;

string s;
long double sum;

int main()
{
    int n;
    cin>>n;
    while (n--)
    {
        string s;
        long double x;
        cin>>x>>s;
        if (s=="JPY")
            sum+=x;
        else
            sum+=x*380000.0;
    }
    cout<<setprecision(8)<<fixed<<sum;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 1e18;
double Pi = 3.1415926535897932384626;
 
//vector<ll> G[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 998244353;
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,ans,a,b,c,e,g,h,w,i,j,k,q;
ll t,d;
ll x[500005],y[500005],z[500005];
bool ans_table[500005];
string s;

int main(){
    cin >> n >> k;
    for(int i=0;i<n;i++){
    	cin >> a;
    	if(a >= k)ans++;
    }
    p(ans);
    
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#define int long long
#define double long double
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位
int imos[2000000];
int ch[31][2000000];
int chend[2000000][31];
signed main() {
	//imos[i]は時刻2iを表す。時刻0は0、1は2、1.5は3。
	int N, C;
	cin >> N >> C;
	for (int i = 0; i < N; i++) {
		int s, t, c;
		cin >> s >> t >> c;
		//imos[s * 2 -1] += 1;
		//imos[t * 2 ] -= 1;

		//始点と終点が被っていたら

		if (ch[c][s * 2] == -1 && ch[c][t * 2 - 1] == 1) {
			ch[c][s * 2] = 0;
			ch[c][t * 2 - 1] = 0;
			continue;
		}

		if (ch[c][s * 2] == -1) {
			ch[c][s * 2] = 0;
			ch[c][t * 2] -= 1;
			continue;
		}
		if (ch[c][t * 2-1] == 1) {
			ch[c][s * 2 - 1] += 1;
			ch[c][t * 2-1] = 0;
			continue;
		}


		ch[c][s * 2 - 1] += 1;
		ch[c][t * 2] -= 1;

	}
	//チャンネルごとにチューナー使うかを計算

	for (int channel = 1; channel <= C; channel++) {
		for (int i = 1; i <= 200005; i++) {
			ch[channel][i] = ch[channel][i - 1] + ch[channel][i];
		}

	}

	int ans=-1;

	for (int i = 1; i < 200005; i++) {
		int num = 0;
		for (int channel = 1; channel <= C; channel++) {
			num += ch[channel][i];
		}
		if (ans < num) ans = num;
	}



	cout << ans << "\n";


	return 0;
}

Measured memory_bytes: 108800
#include <iostream>
#include <string>
using namespace std;
bool primeNum[55556];

void makePrimeArray(){
  for(int i = 0; i < 55556; i++) primeNum[i] = true;
  primeNum[0] = false;
  primeNum[1] = false;
  for(int i = 2; i * i < 55556; i++){
    if(!primeNum[i]) continue;
    int x = 2;
    while(i * x < 55556) {
      primeNum[ i * x ] = false;
      x++;
    }
  }
}
int main(){
  int N;
  cin >> N;
  makePrimeArray();
  int primeIndex = 6;
  for(int i = 0; i < N; i++){
    while(true){
      if(primeNum[primeIndex] && primeIndex % 5 == 1 && i != N - 1){
        cout << primeIndex << " ";
        primeIndex ++;
        break;
      }else if( primeNum[primeIndex]  && primeIndex % 5 == 1){
        cout << primeIndex << endl;
        return 0;
      }
      primeIndex ++;
    }
  }
  return 0;
}


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

int main(){
  long long int n,m,k;
  cin>>n;
  k=0;
  if(n%2==0){
    do{
      n/=5;
      k+=n/2;
    }while(n>0);
  }
  cout<<k;
}


Measured memory_bytes: 256
#include <stdio.h>
int a[6];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int k;
		scanf("%d",&k);
		int d[3]={0,1,2};
		while(k--){
			int x;
			scanf("%d",&x);
			if(x){int t=d[1];d[1]=d[2];d[2]=t;}
			else{int t=d[1];d[1]=d[0];d[0]=t;}
		}
		a[d[0]*2+(d[1]>d[2])]++;
	}
	if(a[0]>=1||a[1]>=2||a[2]>=2||a[5]>=2||a[3]>=3||a[4]>=3||(a[3]&&a[4])||(a[1]+a[2]+a[5]>=2&&(a[3]||a[4])))puts("yes");
	else puts("no");
}


Measured memory_bytes: 2148
#include<iostream>
using namespace std;
int main(){
	int x;
	cin >> x;
	int y=0;
	int ans;
	for(int i=1;i<1e9;i++){
		y+=i;
		if(y>=x) {
			ans=i;
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:16777216")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <cassert>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <time.h>
#include <complex>
using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 2020;
int A[MAX];
int M[MAX];


int main()
{
	//freopen("in.txt","r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n, k;
	scanf("%d%d", &n, &k);

	FOR (i, 0, n)
	{
		scanf("%d", &A[i]);
		M[i] = A[i];
	}

	LL res = LINF;

	FOR (it, 0, n+1)
	{
		LL cur = it * (LL)k;

		FOR (i, 0, n)
		{
			cur += M[i];
		}

		res = min(res, cur);
		FOR (i, 0, n)
		{
			int to = (i + it + 1) % n;
			M[to] = min(M[to], A[i]);
		}
	}

	cout<<res<<endl;

}


Measured memory_bytes: 256