akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.rbegin(), v.rend());//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define OUT(x) cout << x << endl
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    set<int> s;
    REP(i,n){
        int a;
        cin >> a;
        s.insert(a);
    }
    //要素の検索
    set<int>::iterator ite;;
    int cnt=0;
    for(ite=s.begin();ite!=s.end();++ite) cnt++;
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#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()
#define chmax(a,b) (a<b?(a=b,1):0)
#define chmin(a,b) (a>b?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int g[100][100];
int k[100];

void add(int a, int b) {
  if (a<0||b<0) return;
  // printf("add %d %d\n", a, b);
  g[a][b]++;
  g[b][a]++;
  k[a]--;
  k[b]--;
}

int main() {
  int T;cin>>T;
  while(T--) {
    int a;
    vector<int> v;
    while(cin>>a, a) {
      v.push_back(a);
    }
    memset(g,0,sizeof(g));
    int curroom = 0;
    int roomnum = 0;
    int counter = 0;
    
    vector<int> stk;  
    FOR(it, v) {
      int now = -1;
      if (stk.size()) {
        now = stk.back();
      }
      // cout << *it << endl;
      // cout << "stk = ";FOR(jt, stk) cout << *jt << " "; cout << endl;
      // cout << "k   = "; REP(i,stk.size()) cout << k[i] << " "; cout << endl;
      if (*it > 0) {
        stk.push_back(roomnum);
        k[roomnum] = *it;
        add(now,roomnum);
        roomnum++;
      } else {
        int dst = stk[stk.size()+*it-1];
        add(now,dst);
      }
      while(stk.size() && k[stk.back()]==0) {
        stk.pop_back();
      }
    }
    REP(i,roomnum) {
      cout << i+1;
      REP(j,roomnum) {
        REP(k,g[i][j]) {
          cout << " " << j+1;
        }
      }
      cout << endl;
    }
  }
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

ll f(string& s, ll x) {
    ll res = 0;
    ll a = 1, j = 0;
    for (int i = 0; i < s.size(); ++i) {
        res += (s[i] - '0') * a;
        if ((x >> i) & 1) {
            a = 1;
        } else {
            a *= 10;
        }
    } 

    return res;
}

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

    reverse(S.begin(), S.end());

    int N = S.size() - 1;

    ll ans = 0;
    for (ll i = 0; i < (1 << N); ++i) {
        ans += f(S, i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
bool custom1 (pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first);
}
bool custom2(pair<int, int> a, pair<int, int> b) {
  return (a.second < b.second);
}

const int MAX = 200005;
const long long MOD = 1000000007;
const long long MODMOD = 998244353;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  vector<long long> subTotal(n);
  subTotal[0] = a[0];
  for(int i=1;i<n;i++) subTotal[i] = subTotal[i-1] + a[i];
  int lim = 0;
  rep(i, n-1) {
    if(subTotal[i] * 2LL < a[i+1]) {
      lim = i + 1;
    }
  }

  cout << n - lim << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(){
  long n,i,j,tmp,count=0;
  long a[200000],index[200000]={0};
  
  scanf("%ld",&n);
  for(i=0;i<n;i++){
    scanf("%ld",&a[i]);
    index[a[i]-1]++;
  }
  
  //all patterns
  for(j=0;j<n;j++){
    count+=index[j]*(index[j]-1)/2;
  }
  
  for(i=0;i<n;i++){
    tmp=count;
    
    tmp-=index[a[i]-1]*(index[a[i]-1]-1)/2;
    tmp+=(index[a[i]-1]-1)*(index[a[i]-1]-2)/2;
    
    printf("%ld\n",tmp);
  }
} 

Measured memory_bytes: 5632
=begin
400
 以上 
599
 以下：
8
 級
600
 以上 
799
 以下：
7
 級
800
 以上 
999
 以下：
6
 級
1000
 以上 
1199
 以下：
5
 級
1200
 以上 
1399
 以下：
4
 級
1400
 以上 
1599
 以下：
3
 級
1600
 以上 
1799
 以下：
2
 級
1800
 以上 
1999
 以下：
1
 級
=end

case gets.to_i
  when 400..599
  puts 8
  when 600..799
  
  puts 7
  when 800..999
  
  puts 6
  when 1000..1199
  puts 5
  when 1200..1399
  puts 4
  when 1400..1599
  puts 3
  when 1600..1799
  puts 2
  when 1800..1999
  puts 1
end

Measured memory_bytes: 14196
import java.util.Scanner;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner scan = new Scanner(System.in);
		ArrayList<Integer> number = new ArrayList<Integer>();
		
		int n = 0;
		int x = 0;
		int countA = 0;
		
		while(true){
			n = scan.nextInt();
			x = scan.nextInt();
			int count = 0;
			if(n == 0 && x == 0){
				break;
			}
			
			for (int i = 1; i <= n; i++) {
				for (int j = 1; j <= n; j++) {
					for (int k = 1; k <= n; k++) {
						if (i == j || j == k) {
							continue;
						} else if (i < j && j < k) {
							int s = i + j + k;
							if (s == x) {
								count = count + 1;
							}
						}
					}
				}
			}
			number.add(count);
			countA++;
		}
		for(int h = 0; h < countA; h++){
			System.out.println(number.get(h));
		}
	}
}

Measured memory_bytes: 27412
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int w,h,a,b;
    scanf("%d%d%d%d",&h,&w,&a,&b);
    int mat[1005][1005]={};
    for(int y=b;y<h;y++){
        for (int x=a;x<w;x++){
            mat[y][x]=1;
        }
    }
    for(int y=0;y<b;y++){
        for (int x=0;x<a;x++){
            mat[y][x]=1;
        }
    }
    REP(y,h){
        REP(x,w){
            printf("%d",mat[y][x]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>

using namespace std;

typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> pl;
typedef double db;

#define ini(x) int x; cin >> x
#define inl(x) ll x; cin >> x
#define ins(x) string s; cin >> x

#define out(x) cout << x;
#define outb(x) cout << x << ' ';
#define outn(x) cout << x << '\n';

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for (int i = s; i < e; ++i)
#define fors(i, n) for (int i = 1; i*i <= n; ++i)

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	ini(k);
	if (k % 2) {
		outn((k/2+1)*(k/2));
	} else {
		outn(k/2*k/2);
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<string>
#include<iostream>
using namespace std;
int main()
{
	int T;
	cin>>T;
	long long Max=-1,t=-1;
	long long ans=0;
	for(int i=0;i<T;i++)
	{
		long long a,b;
		cin>>a>>b;
		if(Max<a)
		{
			Max=a;
			t=b;
		}
		ans=Max+t;
	}	
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define itn int
#define int ll
using namespace std;

int N;
int H[25];

signed main(void) {
    cin>>N;
    rep(i, N) {
        cin>>H[i];
    }
    int ans=1;
    Rep(i,1,N) {
        bool ok=true;
        Rep(j,0,i) {
            if (H[i]<H[j]) ok=false;
        }
        if (ok) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;



signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int s, w; cin >> s >> w;
	if (s <= w) cout << "unsafe" << endl;
	else cout << "safe" << endl;

}


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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

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

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

int main(){
    int h, w; cin>>h>>w;
    vector<string> s(h);
    for(int i=0; i<h; i++) cin>>s[i];

    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(s[i][j]=='#'){
                int cnt=0;
                for(int k=0; k<4; k++){
                    int ny=i+dy[k], nx=j+dx[k];
                    if(0<=ny && ny<h && 0<=nx && nx<w){
                        if(s[ny][nx]=='#'){
                            cnt++;
                        }
                    }
                }
                if(cnt==0){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "Yes" << endl;
}

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

int main(){
  int H,W; cin >> H>>W;
  string board[H];
  bool check[H][W];
  REP(i,H){
    cin>>board[i];
    REP(j,W){
      check[i][j] = true;
    }
  }
  REP(i,H){
    REP(j,W){
      char mas = board[i][j];
      if(mas=='#'){
        for(int k=i+1;k<H;k++){ for(int l=0;l<j;l++){
          check[k][l] = false;
        } }
      }
    }
  }
  bool r = true;
  REP(i,H){
    REP(j,W){
      if(check[i][j]==false){
        if(board[i][j]=='#'){
          r = false;
          break;
        }
      }
    }
    if(!r) break;
  }
  if(r){ cout << "Possible\n";}
  else{ cout << "Impossible\n";  }       
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		Map<String, Integer> blueMap = new HashMap<>();
		for (int i = 0; i < N; i++) {
			String input = sc.next();
			if (blueMap.containsKey(input)) {
				Integer count = blueMap.get(input) + 1;
				blueMap.put(input, count);
			} else {
				blueMap.put(input, 1);
			}
		}

		Map<String, Integer> redMap = new HashMap<>();
		int M = sc.nextInt();
		for (int i = 0; i < M; i++) {
			String input = sc.next();
			if (redMap.containsKey(input)) {
				Integer count = redMap.get(input) + 1;
				redMap.put(input, count);
			} else {
				redMap.put(input, 1);
			}
		}

		int max = 0;
		for(Map.Entry<String, Integer> entry : blueMap.entrySet()) {
			String blueKey = entry.getKey();
			int blueCount = entry.getValue();
			int point = 0;
			if (redMap.containsKey(blueKey)) {
				int redCount = redMap.get(blueKey);
				point = blueCount - redCount;

			} else {
				point = blueCount;
			}
			if (point > max) {
				max = point;
			}
		}
		System.out.println(max);

	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    int A, B;
    cin >> A >> B;
    string S;
    cin >> S;
    int n = S.find('-');
    if (n == A)
    {
        string strb = S.substr(n + 1);
        int m = strb.find('-');
        if (m == -1)
        {
            cout << "Yes" << endl;
        }else
        {
            cout << "No" << endl;
        }
        
    }else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();

            if(H == 0 && W == 0){
                break;
            }for(int i=1;i<=H;i++){
                if(i == 1 || i == H){
                    for  (int j=1;j<=W;j++){
                    System.out.print("#");                   
                }
                }else 
                for(int j=1;j<=W;j++){
                    if(j == 1||j == W){
                        System.out.print("#");
                        }else
                        System.out.print(".");
                }System.out.print("\n");
            }System.out.print("\n");
        }
    }
}


Measured memory_bytes: 36060
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;

int main(void) {
	vector<int> d(3);
	for (int i = 0; i < 3; i++)cin >> d[i];
	sort(d.begin(), d.end());
	for (int i = 0; i < 2; i++)cout << d[i] << " ";
	cout << d[2] << endl;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define all(v) v.begin(), v.end()
vector<int> graf[100001];
int gv;
string gs, gst;
double dp[5000][5000];
double garr[5000];
double whatdo(int n, int heads) {
  if (dp[n][heads] < 2) {
    return dp[n][heads];
  }
  if (n == gv && heads > n / 2)
    return 1;
  else if (n == gv && heads <= n / 2)
    return 0;

  double ans = whatdo(n + 1, heads) * (1 - garr[n]);
  ans += whatdo(n + 1, heads + 1) * garr[n];
  // cout << ans << " ";
  dp[n][heads] = ans;

  return ans;
}

void solve() {
  //----------------------VARs---------------------------------------------
  char car, car2;
  string s, st;
  long long n = 0, a = 0, b = 0, c = 0, e, d = 0, m = 0, t = 0, q = 0, r = 0,
            l = 0, middle = 0, count = 0, add = 0, k, ans = 0, temp = 0, rootsa,
            save = 0, bigg = 0, save2 = 0, counter = 0, counter2 = 0, sum = 0,
            x, y;
  bool flag = false, flag2;

  //-------- --------------VARs--------------------------------------------
  vector<int> vec;
  for (int i = 0; i < 5000; i++) {
    for (int i2 = 0; i2 < 5000; i2++)
      dp[i][i2] = 2.0;
  }
  cin >> gv;
  for (int i = 0; i < gv; i++)
    cin >> garr[i];
  cout << whatdo(0, 0);
}
int main() {
#ifndef ONLINE_JUDGE
  system("clear");
  freopen("Test0.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false), cin.tie(0);

  cout << fixed << setprecision(10);
  int t = 1;
  // cin >> t;
  while (t--) {
    solve();
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 201736
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define m_p			make_pair
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define sz(x)       (int)x.size()
#define f			first
#define debug		cout<<"##########3"<<endl
#define mod			1000000007
#define ll			long long int
#define lMax		LLONG_MAX
// queue<int> , prefix_sum(a,a+n) , reverse(a,a+n) , priority_queue <int> max heap , priority_queue <int, vector<int>, greater<int> > min heap;
// == precedence gretaer then &
ll n,m;
ll arr[105];
// Prefix sum calculation wala dp !!!!
ll dp[105][100006];
ll prefix [105][100006];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);

    ll i,j,k,c=0,ans=0,t,z,x=0,y;
	cin>>n>>k;
	rep(i,0,n)
		cin>>arr[i];
	dp[0][0] = 1;
	for(j=0;j<=k;j++){
		prefix[0][j] = 1;
	}

	for(i=1;i<=n;i++){
		for(j=0;j<=k;j++){
			if (j-arr[i-1]-1 >=0)
				dp[i][j] = (prefix[i-1][j]-prefix[i-1][j-arr[i-1]-1]+mod)%mod;
			else 
				dp[i][j] = prefix[i-1][j];
			prefix[i][j] = (prefix[i][j-1]%mod+dp[i][j]%mod)%mod ;
		}
	}
	
	cout<<dp[n][k]%mod;

 	return 0;
}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod = 1000000007;		




int main() {

	string s;
	cin >> s;

	int ans = 0;

	REP(i, s.size()+1) {
		REP(j, s.size()+1) {
			bool b = true;
			string t = s.substr(i, j);

			REP(k, t.size()) {
				if (t[k] == 'A' || t[k] == 'C' || t[k] == 'G' || t[k] == 'T')continue;
				b = false;
			}
			if (b)ans = max(ans, (int)t.size());
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a, b, c, x, q,w,e,s=0;
	scanf("%d%d%d%d", &a, &b, &c, &x);
	for(int i=0; x-(500)*i>=0; i++)
	{
		q=x-(500)*i;
		if(i>a) break;
		for(int j=0;  q-(100)*j>=0; j++)
		{
			w=q-(100)*j;
			if(j>b) break;
			for(int k=0; w-(50)*k>=0; k++)
			{
				if(k>c) break;
				if(w-(50)*k==0) s++;
			}
			
		}
	}
	printf("%d", s);
}

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

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

    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && a == c && b == c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <map>
#define for1(x,y) for(long long x = 1; x<ll(y); x++)
#define forn(x,y,z) for(long long x = y; x< ll(z); x++)
#define for0(x,y,z) for(long long x = y; x< ll(z); x++)
# define PII pair<int,int>
# define FF first
# define SS second
# define PB push_back

#define forn(x,y,z) for(long long x = y; x< ll(z); x++)
#define for0(x,y,z) for(long long x = y; x< ll(z); x++)
using namespace std;
typedef long long ll;
typedef long double ld;	

#define maxn 1000015
const double EPS = (1e-7), EPSm= (1e7);
const ll linf = (ll)1e17 + 5;
long double PI = 3.14159265359;
int dir[8][2]={{1,0},{-1,0},{0,1},{0,-1},{-1,-1},{1,1},{-1,1},{1,-1}};
	
const int MAXN = 1e5+10;
const int NINF = -1e5;
const int INF = 20000000;

void solve()
{
	ll n,x,t;
	cin>>n>>x>>t;
	cout<<((n+x-1)/x)*t<<endl;
	return;
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int test;
	//cin >> test;
	//while(test--)
		solve();
	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main() {
    long long int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a == 0)
        cout<<1;
    else if(b == 0)
        cout<<2;
    else if(c == 0)
        cout<<3;
    else if(d == 0)
        cout<<4;
    else if(e == 0)
        cout<<5;
    return 0;
}

Measured memory_bytes: 3580
// Contest.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include"iostream"
#include"string"
#include"vector"
#include"algorithm"

using namespace std;

int main()
{
	/*int n,k;
	cin >> n;
	vector<char>s(n);
	for (int j = 0; j < n; j++)  cin >> s[j];
	cin >> k;
	for (int i = 0; i < n; i++)
	{
		if (s[i] != s[k-1]) {
			s[i] = '*';
		}
	}

	for (int l = 0; l < n; l++)
	{
		cout << s[l] ;
	}*/
	
	int m, d;
	cin >> m >> d;

	int d1, d10;
	int sum=0;

	for (int k = 1; k <= m; k++) {
		for (int j = 2; j <d/10; j++) {
			d10 = j;
			for (int i = 2; i < 10; i++) {
				d1 = i;
				if (d1*d10 == k) {
					sum++;
				}
			}
		}

		for (int i = 2; i <= d % 10; i++) {
			if (i*(d / 10) == k) {
				sum++;
			}
		}

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






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

#define ff              first1
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define set             set<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

int32_t main()
{
    int a,b;cin>>a>>b;
    cout<<a*b;
}


Measured memory_bytes: 3628
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class MyProgram
{	
  
    public static void Main()
	{
        int[] n = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int N = n[0];
        int K = n[1];
        long c1 = 0, c2 = 0;
        for(int i = 1 ; i <= N ; i++)
        {
           
            if(i%K == 0)
            {
                c1++;
            }
            else  if(K%2 == 0 && i%K == K/2)
            {
                c2++;

            }
        }
        Console.WriteLine(c1*c1*c1 + c2 *c2 * c2);
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <string>

using namespace std;

int main () {
    int n;
    int l[100000], r[100000];

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

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        cnt += r[i] - l[i] + 1;
    }

    cout << cnt << endl;
}

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

  int nowt=0,nowa=0,nowb=0,nextt,nexta,nextb;
  bool empty=0;
  for(int i=0;i<n;i++){
    cin>>nextt>>nexta>>nextb;
    if(abs(nextt-nowt)>=abs(nowa-nexta)+abs(nowb-nextb)){
      if(abs(nextt-nowt)%2==(abs(nowa-nexta)+abs(nowb-nextb))%2){continue;}
    }
    cout<<"No"<<endl;empty=1;break;
  }

  if(empty==0){cout<<"Yes"<<endl;}

  return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Data.Array
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
readString = map BS.unpack . BS.words

getIntList = readIntList <$> BS.getLine
getNString n = map readString <$> replicateM n BS.getLine

checkNeibor :: Array (Int, Int) Char -> [(Int, Int)] -> Bool
checkNeibor sss [] = False
checkNeibor sss (hw : hws)
  | sss ! hw == '#' = True
  | otherwise = checkNeibor sss hws

calc sss h w i = do
  let i' = i + 1
  let h' = i' `div` w
  let w' = i' `mod` w
  let w''
        | w' == 0 = w
        | otherwise = w'
  let h''
        | w' == 0 = h'
        | otherwise = h' + 1
  if sss ! (h'', w'') == '#'
    then do
      let hws = [(h'' - 1, w''), (h'' + 1, w''), (h'', w'' -1), (h'', w'' + 1)]
      if checkNeibor sss hws == True
        then do
          if i' /= h * w
            then calc sss h w (i + 1)
            else return True
        else return False
    else do
      if i' /= h * w
        then calc sss h w (i + 1)
        else return True

main = do
  [h, w] <- getIntList
  sss <- getNString h
  let dots = replicate (w + 2) "."
  let sss' = concat (dots ++ (map (\x -> "." ++ x ++ ".") (map head sss)) ++ dots)
  let sss'' = listArray ((0, 0), (h + 1, w + 1)) sss'
  result <- calc sss'' h w 0
  let tf = if result == True then "Yes" else "No"
  putStrLn tf


Measured memory_bytes: 4568
#include "bits/stdc++.h"
using namespace std;

int main()
{
	int n, k;
	int xn[110];
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		cin >> xn[i];
	}
	int count = 0;
	for (int i = 0; i < n; i++)
	{
		count += min(2 * xn[i], 2 * (k - xn[i]));
	}
	cout << count << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
Node treeMinimum(Node x){
  while(x->left != NIL)
    x = x->left;
  return x;
}
 
Node treeMaximum(Node x){
  while(x->right != NIL)
    x = x->right;
  return x;
}
 
Node treeSearch(Node u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}
 
Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    x = y->parent;
  }
  return y;
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);
  if(y->left != NIL) x = y->left;
  else x = y->right;
  if(x != NIL) x->parent = y->parent;
  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
  if(y != z) z->key = y->key;
  }
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else  x = x->right;   
  }
  z->parent = y;
  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
     
}
 
void inorder(Node u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
void preorder(Node u){ 
  if(u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}
 
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  return 0;
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

using ll = long long;

ll n, a[300000];

int main() {
    cin >> n;
    for (int i = 0; i < n * 3; ++i)
        cin >> a[i];
    sort(a, a + n * 3, greater<ll>());
    
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += a[i * 2 + 1];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
h , w = map(int,input().split())
g = ['#'*(w+2)]+['#'+input()+'#' for i in range(h)]+['#'*(w+2)]
s = [[100]*(w+2)]+[[100]+[0]*w+[100]for i in range(h)]+[[100]*(w+2)]
queue=[]
head = 0
tail = 0
s[1][1]=1
queue.append([1,1])
tail+=1
while tail!=head:
    y = queue[head][0]
    x = queue[head][1]
    if g[y][x+1]=='.' and s[y][x+1]==0:
        queue.append([y,x+1])
        tail+=1
        s[y][x+1]=s[y][x]+1
    if g[y][x-1]=='.' and s[y][x-1]==0:
        queue.append([y,x-1])
        tail+=1
        s[y][x-1]=s[y][x]+1
    if g[y+1][x]=='.' and s[y+1][x]==0:
        queue.append([y+1,x])
        tail+=1
        s[y+1][x]=s[y][x]+1
    if g[y-1][x]=='.' and s[y-1][x]==0:
        queue.append([y-1,x])
        tail+=1
        s[y-1][x]=s[y][x]+1
    head+=1
if s[h][w]==0:
    print('-1')
else:
    count = 0
    for i in range(1,h+1):
        for j in range(1,w+1):
            if g[i][j]=='#':
                count+=1
    ans = h*w - s[h][w]-count
    print(ans)

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

using namespace std;

vector<int> to[100005];
const int INF = 1001001001;

int main(){
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        --a;--b;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    queue<int> q;
    vector<int> dist(n,INF);
    vector<int> pre(n,-1);
    dist[0] = 0;
    q.push(0);
    while(!q.empty()){
        int v = q.front();q.pop();
        for(int u : to[v]){
            if (dist[u] != INF)continue;
            dist[u] = dist[v] + 1;
            pre[u] = v;
            q.push(u);
        }
    }

    cout << "Yes" << endl;
    rep(i,n){
        if(i == 0)continue;
        cout << (pre[i]+1) << endl;
    }
    return 0;
}

Measured memory_bytes: 10712
while s = gets
    puts /o..o..o|o{3}.{6}|.{3}o{3}.{3}|.{6}o{3}|o.{3}o.{3}o|.{2}o.o.o.{2}/ === s ? "o" : (/x..x..x|x{3}.{6}|.{3}x{3}.{3}|.{6}x{3}|x.{3}x.{3}x|.{2}x.x.x.{2}/ === s ? "x" : "d")
end


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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long
#define ll long long
#define ins insert
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define ld long double
#define rsz resize
#define pii pair<int, int>

#define prev prev228
#define left left228
#define right right228
#define dist dist228

using namespace std;

mt19937 rnd(time(nullptr));

const long long INF = 1e18, N = 110;
vector<pii> mv = {{1, 0}, {0, 1}};
int dist[N][N];

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m;
    cin >> n >> m;
    vector<vector<int> > a(n, vector<int> (m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            char c;
            cin >> c;
            if (c == '#') {
                a[i][j] = 1;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            dist[i][j] = INF;
        }
    }
    dist[0][0] = a[0][0];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            //cout << dist[i][j] << ' ';
            if (dist[i][j] == INF) {
                continue;
            }
            for (pii elem : mv) {
                int x = i + elem.ff, y = j + elem.ss;
                if (0 <= x && x < n && 0 <= y && y < m) {
                    int d = dist[i][j];
                    if (a[x][y] == 1 && a[i][j] == 0) {
                        d++;
                    }
                    dist[x][y] = min(dist[x][y], d);
                }
            }
        }
        //cout << "\n";
    }
    cout << dist[n - 1][m - 1];
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;

#define Forn(i, n) for(int i=1; i<=(n); i++)
#define forn(i, n) for(int i=0; i<(n); i++)
#define lid id<<1|1
#define rid (id<<1)+2
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define int long long

const int MAX=1e5+5;

int N, M, ptr, ret, a[MAX];

struct Suff
{
    int tag1[MAX*4], tag2[MAX*4];
    Suff()
    {
        memset(tag1, 0, sizeof(tag1));
        memset(tag2, 0, sizeof(tag2));
    }
    inline void update(int a, int b, int k1, int b1)
    {
        if(a>=b) return;
        tag1[a]+=k1;
        tag1[b]-=k1;
        
        tag2[a]+=b1;
        tag2[b]-=b1;
    }
    inline void print(int &ret)
    {
        Forn(i, M)
        {
            tag1[i]+=tag1[i-1];
            tag2[i]+=tag2[i-1];
            ret=min(ret, tag1[i]*i+tag2[i]);
        }
    }
}S;

signed main()
{
    scanf("%lld %lld", &N, &M);
    forn(i, N)
        scanf("%lld", &a[i]);
    ptr=M+1;
    
    forn(i, N-1)
    {
        if(a[i]==a[i+1]) continue;
        if(a[i]<a[i+1])
        {
            S.update(1, a[i]+1, 0, a[i+1]-a[i]);
            S.update(a[i]+1, a[i+1]+1, -1, a[i+1]+1);
            S.update(a[i+1]+1, ptr, 0, a[i+1]-a[i]);
        }
        else
        {
            S.update(1, a[i+1]+1, -1, a[i+1]+1);
            S.update(a[i+1]+1, a[i]+1, 0, M-a[i]+a[i+1]);
            S.update(a[i]+1, ptr, -1, M+a[i+1]+1);
        }
    }
    ret=2e18;
    S.print(ret);
    printf("%lld\n", ret);
    return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define pll pair<lli,lli>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mpr  make_pair
#define ff  first
#define ss  second
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define all(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define testcase() int t;cin>>t;while(t--)
#define clean(x) memset(x,0,sizeof(x))
#define FOR(x,y) for(int i=x;i<=y;i++)
const lli maxn = 2e5+9;
vector<lli> catlan(int n) {
    vector<lli> dp(n + 1, 0);
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 2; i <= n; i ++) {
        for (int j = 0; j < i; ++ j) {
            dp[i] += dp[j] * dp[i - j - 1];
        }
    }
    return dp;
}
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli lcm(lli a,lli b){lli ans=(a*b)/(__gcd(a,b));return ans;}
lli set_bits(lli n)
{
    int c=0;
    if(n==0)return 0;
    while(n)
    {
        if((n&1)==1)
        {
           cout<<c<<" ";
        }
        c++;
        n=n>>1;
    }
    return c;
}

string X="IF THE CONSTRAINTS ARE LOW JUST BRUTE FORCE IT!!!!!!!!!!!!!!!!!!!!!";
///------------------ALWAYS lli-----TEMP TSF99--------------------------------------------------------------------------------------///


void solve()
{
    string z="";
    int a,b,c,d;cin>>a>>b>>c>>d;
    /// 1st traversal
    int dx=c-a,dy=d-b;
    cout<<string(dy,'U') <<string(dx,'R');
    cout<<string(dy,'D')<<string (dx,'L');
    cout<<'L'<<string(dy+1,'U')<<string(dx+1,'R')<<'D';
    cout<<'R'<<string(dy+1,'D')<<string(dx+1,'L')<<'U';
    cout<<endl;


}
int main()
{
    solve();
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
long long  int static t[100+5][1000000+5];



long long int knapsack(int w, int wt[], int val[], int n)
{

    if(n == 0 || w == 0)
    {
        return 0;
    }
    if(t[n][w] != -1)
    {
        return t[n][w];
    }
    else
    {
        if(w<wt[n-1])
        {
            return t[n][w] = knapsack(w, wt, val, n-1);
        }
        else if (w>=wt[n-1])
        {
            return t[n][w] =max(val[n-1]+knapsack(w-wt[n-1], wt, val, n-1),knapsack(w, wt, val, n-1));
        }
    }
}

int main()
{
    int n, w;
    cin>>n;
    cin>>w;
    int wt[n];
    int val[n];
    for(int i=0;i<n;i++)
    {
        long long int wh,vk;
        cin>>wh>>vk;
        wt[i] = wh;
        val[i] = vk;
    }
    memset(t, -1, sizeof(t));

    cout<<knapsack(w, wt, val, n);
}


Measured memory_bytes: 820608
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class T>
inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>
inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int dp[200][5][2];

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    string N; cin >> N;
    int K; cin >> K;
    dp[0][0][0]=1;
    rep(i,SZ(N)){
        per(j,K+1){
            if(dp[i][j][1]>0){
                dp[i+1][j+1][1]+=9*dp[i][j][1];
                dp[i+1][j][1]+=dp[i][j][1];
            }
            if(N[i]!='0'){
                dp[i+1][j+1][1]+=dp[i][j][0]*((N[i]-'0')-1);
                dp[i+1][j+1][0]+=dp[i][j][0];
                dp[i+1][j][1]+=dp[i][j][0];
            } else {
                dp[i+1][j][0]+=dp[i][j][0];
            }
        }
    }
    cout << dp[SZ(N)][K][1]+dp[SZ(N)][K][0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const int INF = 1e9;
double temp_start = 100.0;
double temp_end = 0.001; 
int climb_loop = 7000000;
double temp;

int main(){
  int seed = 12345;
  mt19937 eng(seed);
  uniform_real_distribution<> uniform_01;

  // input
  int D;
  cin >> D;
  int c[26];
  rep(i,26) cin >> c[i];
  int s[D+1][26];
  rep(i,D) rep(j,26) cin >> s[i+1][j];
  
  // define parameter
  int last[D+1][26];
  int t[D+1];
  rep(i,D+1) rep(j,26) last[i][j] = 0;
  
  // calculate initial content climbing
  int content = 0;
  for(int day = 1; day <= D; day++) {
    int content_after = -INF;
    int best_kind = 0;
    rep(kind,26) {
      int res = content + s[day][kind];
      rep(j,26) {
        if(j == kind) last[day][j] = day;
        else last[day][j] = last[day-1][j];
        res -= c[j] * (day - last[day][j]);
      }
      if(res > content_after) {
        best_kind = kind;
        content_after = res;
      }
    }
    t[day] = best_kind;
    content = content_after;
    rep(j,26) {
      if(j == t[day]) last[day][j] = day;
      else last[day][j] = last[day-1][j];
    }
  }
   
  // simulated annealing
  rep(x,climb_loop) {
    int d = (eng() % D) + 1;
    int q = eng() % 26;
    if(q != t[d]) {
      temp = temp_start + (temp_end - temp_start)*x/climb_loop;
      int diff = s[d][q] - s[d][t[d]];
      int cur = d;
      while(cur <= D && last[cur][t[d]] == d) {
        diff -= c[t[d]] * (d - last[cur-1][t[d]]);
        last[cur][t[d]] = last[cur-1][t[d]];
        cur++;
      }
      cur = d;
      while(cur <= D && last[cur][q] < d) {
        diff += c[q] * (d - last[cur][q]);
        last[cur][q] = d;
        cur++;
      }
      if(diff > 0 || uniform_01(eng) < exp((double)diff/temp)) {
        t[d] = q;
        content += diff;
      } else {
        int day = d;
        while(day <= D && last[day][t[d]] < d) {
          last[day][t[d]] = d;
          day++;
        }
        day = d;
        while(day <= D && last[day][q] == d) {
          last[day][q] = last[day-1][q];
          day++;
        }
      }
    }
  }
  // output
  for(int day = 1; day <= D; day++) cout << t[day]+1 << endl;
  return 0;
}


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

int l, n;
const int MAXN = 2e5 + 10;

int a[MAXN];

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

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

    int mx = 0;
    for(int i = 1; i < n; ++i) {
        int nw = a[i + 1] - a[i];
        if(mx < nw) mx = nw;
    }

    int nw = a[1] + l - a[n];
    if(mx < nw) mx = nw;

    cout << l - mx << "\n";

    return 0;
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
			Scanner scanner = new Scanner(System.in);

            // 空白で分割して変数を定義

			// 長方形の変数
            int W = scanner.nextInt();

            int H = scanner.nextInt();

            // 円の変数（座標、半径）
            int x = scanner.nextInt();

            int y = scanner.nextInt();

            int r = scanner.nextInt();

            // 円の座標と半径の計算
            int xr1 = x + r;
            int xr2 = x - r;
            int yr1 = y + r;
            int yr2 = y - r;

            if (W < xr1 || xr2 < 0) {
            	System.out.println("No");
            } else if (H < yr1 || yr2 < 0) {
            	System.out.println("No");
            } else {
            	System.out.println("Yes");
            }
	}
}



Measured memory_bytes: 26324
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);

LL num[3][(int)1e5 + 5], lt[(int)1e5 + 5], N;
LL cnt = 0;

int main(){
  FAST_IO
  cin >> N;
  for(int rep = 0; rep < 3; ++rep){
    for(int itr = 1; itr <= N; ++itr){
      cin >> num[rep][itr];
    }

    sort(num[rep] + 1, num[rep] + N + 1);
  }

  int lft = 0;
  for(int rgt = 1; rgt <= N; ++rgt){
    while(lft <= N && num[0][lft] < num[1][rgt]) lft++;
    lt[rgt] = lft - 1;
  }

  for(int rep = 1; rep <= N; ++rep){
    lt[rep] += lt[rep - 1];
  }

  lft = 0;
  for(int rgt = 1; rgt <= N; ++rgt){
    while(lft <= N && num[1][lft] < num[2][rgt]) lft++;
    cnt += (LL)lt[lft - 1];
  }
    
  cout << cnt << '\n';
  return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n; cin >> n;
        if(n == 0) return 0;
        else{
            pair<int, int> ans;
            FOR(i, 1, sqrt(2 * n) + 1){
                if((2 * n) % i == 0){
                    int a = ((2 * n / i) - i + 1);
                    if(a % 2 == 0 and a / 2 >= 1) ans = make_pair(a / 2 , i );
                }
            }
            cout << ans.first << " " << ans.second << endl;
        }
    }
}


Measured memory_bytes: 3096
# coding: utf-8

import sys
import math

args = input().split()

n = int(args[0])
a = int(args[1])
b = int(args[2])

reta = a
retb = (n - a) - b

if retb > 0:
  retb = 0
else:
  retb = abs(retb)

print('{reta} {retb}'.format(reta=min(a,b),retb=retb))

sys.exit(0)

Measured memory_bytes: 3060
#include<iostream>

#include<cstring>
using namespace std;
const int N=10010;
int n;
string str;
int main()
{
    cin>>n;
    cin>>str;
    for(int i=0;i<n&&i<str.size();i++) cout<<str[i];
    if(n<str.size()) cout<<"..."<<endl;
    return 0;
    
}

Measured memory_bytes: 3600
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=200005,M=1000005;
int n;
string s[N];
struct Node
{
	int col[26];
	int ch[26];
}trie[M];
int tot=1;
void insert(const string &s)
{
	static int col[26];
	int len=s.size();
	for(int i=0;i<len;i++)
		col[s[i]-'a']++;
	int u=1;
	for(int i=0;i<len;i++)
	{
		int c=s[i]-'a';
		for(int j=0;j<26;j++)
			if(col[j]) trie[u].col[j]++;
		if(!trie[u].ch[c]) trie[u].ch[c]=++tot;
		u=trie[u].ch[c];
		col[c]--;
	}
	return;
}
int query(const string &s)
{
	int len=s.size();
	int u=1;
	for(int i=0;i<len-1;i++)
		u=trie[u].ch[s[i]-'a'];
	return trie[u].col[s[len-1]-'a']-1;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>s[i];
		reverse(s[i].begin(),s[i].end());
		insert(s[i]);
	}
	long long ans=0;
	for(int i=1;i<=n;i++)
		ans+=query(s[i]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 214128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>

using namespace std;
using ll = long long int;
ll mod = 1e9 + 7;

template <typename number>
pair<number, number> extended_euclid(number a, number b)
{
    number r0, r1, a0, a1, b0, b1;
    r0 = a; r1 = b;
    a0 = 1; a1 = 0;
    b0 = 0; b1 = 1;
    while (r1>0) {
        number q1 = r0 / r1;
        number r2 = r0 % r1;
        number a2 = a0 - q1 * a1;
        number b2 = b0 - q1 * b1;
        r0 = r1 ; r1 = r2;
        a0 = a1 ; a1 = a2;
        b0 = b1 ; b1 = b2;
    }
    number c = r0;
    a = a0; //x
    b = b0; //y
    return  {a, c};
}

//Nを法とした逆元を求める関数
template  <typename number>
number inverse_N(number a, number N)
{
    pair<number, number> result = extended_euclid(a, N);
    if(result.first < 0)
    {
        result.first = result.first + N;
    }
    return result.first;
}

ll calc(ll unit, ll n, ll m)
{
  ll result = 0;
  //m = (m * m) % mod;
  m = (m * m);
  for(ll i = 1; i < n; i++)
  {
    ll temp = (m * (n - i)) % mod;
    ll temp2 = (temp * unit) % mod;
    ll temp3 = (temp2 * i) % mod;
    result = (result + temp3) % mod;
  }
  return result;
}

int main()
{
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> dp(n * m + 1, 0);
  dp[0] = 1;
  for(int i = 1; i <= n * m; i++)
  {
    dp[i] = (dp[i - 1] * i) % mod;
  }
  ll unit = (dp[k - 2] * dp[n * m - k]) % mod;
  unit = inverse_N(unit, mod);
  unit = (dp[n * m - 2] * unit) % mod;
  if(k - 2 == 0)
  {
    unit = 1;
  }
  ll result = 0;
  result = calc(unit, n, m);
  result = (result + calc(unit, m, n)) % mod;
  cout << result << endl;
}


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

int gcd(int a,int b){
	return a%b==0? b:gcd(b,a%b);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,a,b;cin >> n >> a >> b;
	if(abs(a-b)%2==0) cout << "Alice" << endl;
	else cout << "Borys" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N,K,sum,x;
  cin>>N>>K;
  sum = 0;
  for(int i=0 ; i<N ; i++){
  cin>>x;
  if(K >= 2*x){
  sum += 2*x;
  }
  else{
  sum += 2*(K-x);
  }
  }
  cout<<sum;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n,0);  
  REP(i,n) cin >> a[i];
  
  sort(a.begin(), a.end());
  
  bool ok = true;
  REP(i,n){
    if(i != n-1){
      if(a[i] == a[i+1]){
        ok = false;
      }
    }
  }
  
  
  if(ok) cout << "YES" << endl;
  else cout << "NO" << endl;
  


}

Measured memory_bytes: 3996