akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int A[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    int N;
    cin >> N;
    cout << A[N - 1] << endl;
}

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

public class Main{

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int m = sc.nextInt();
		System.out.println(n*(n-1)/2 + m*(m-1)/2);
	}
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}

}


Measured memory_bytes: 22740
#include<iostream>
    #include<math.h>
    #include<string>
    #include<algorithm>
    using namespace std;
    int ans[60];
    int found;
    int main(){
    	
    	for(int i=2;found<=60;i+=5){
    		bool b=true;
    		for(int j=2;j<=i/2;j++){
    			if(i%j==0)
				   b=false;
    		}
    		if(b){
    			ans[found]=i;
    			found++;
    		}
    	}
    	int n;
		  cin>>n;
    	for(int i=0;i<n;i++)
		   cout<<ans[i]<<" ";
    	return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

bool f(int x) {
    return x>0 && x<=12;
}

int main(){
    string s;
    cin >> s;
    int x = (s[0]-'0')*10 + s[1]-'0';
    int y = (s[2]-'0')*10 + s[3]-'0';
    //debug(x); debug(y);

    string ans;
    if (f(x) && f(y)) ans = "AMBIGUOUS";
    else if (!f(x) && !f(y)) ans = "NA";
    else if (f(x) && !f(y)) ans = "MMYY";
    else ans = "YYMM";
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    int ans=0;
    int N,M;
    cin>>N;
    cin>>M;
    for(int i=0;i<M;i++){
        int days=0;
        cin>>days;
        ans+= days;
    }
    if(ans<=N) cout<<N-ans;
    else cout<<-1;
}




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

int main(){
	int n,a,b,c,d;
	string s;
	cin >> n >> a >> b >> c >> d >> s;
	a--;
	b--;
 	c--;
	d--;
	int x=-1;
	bool die=true,ok=false;
	for (int i=a; i<c; ++i){
		if (s[i] == '#' and s[i+1] == '#') die=false;
	}
	for (int i=b; i<d; ++i){
		if (s[i] == '#' and s[i+1] == '#') die=false;
	}
	for (int i=b-1; i<d; ++i){	
		if (s[i] == '.' and s[i+1] == '.' and s[i+2] == '.'){
			ok=true;
			x=i;
		}
	}
	if (!die) cout << "No";
	else if (!ok and c > d) cout << "No";
//	else if (s[d-1] == '#' and c > d and x+1 < b) cout << "No";
//	else if (c > b and c < d and s[c-1] == '#') cout << "No"; 
	else cout << "Yes";
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N;
  cin >> N;
  vector<int> D(N);
  for (int i=0; i<N; i++) cin >> D[i];
  int M;
  cin >> M;
  vector<int> T(M);
  for (int i=0; i<M; i++) cin >> T[i];
  // DとTそれぞれに登場する数字とその登場回数
  map<int, int> memoD, memoT;
  for (int i=0; i<N; i++) {
    if (memoD.count(D[i])) memoD[D[i]]++;
    else memoD[D[i]] = 1;
  }
  for (int i=0; i<M; i++) {
    if (memoD.count(T[i])) memoT[T[i]]++;
    else memoT[T[i]] = 1;
  }
  bool can = true;
  for (int i=0; i<M; i++) {
    if (memoT[T[i]]>memoD[T[i]]) {
      can = false;
      break;
    }
  }
  if (can) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 20608
N = int(input())
D,X = map(int,input().split())
A = [int(input()) for _ in range(N)]

cnt = 0

for i in range(N):
    flag = True
    n = 0
    while flag:
        if n*A[i] + 1 <= D:
            cnt += 1
            n += 1
        else:
            flag = False

print(X+cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long LL;
typedef unsigned int uint;
typedef pair<int,int> pii;
//-------------------------------------------------------------------LYYY↓
namespace LYYY{
	int rd()
	{
		int s=0;char c=getchar();int f=1;
		while(c<48||c>57)
		{
			if(c==45) f=-1;
			c=getchar();
		}
		while(c>=48&&c<=57) s=(s<<3)+(s<<1)+(c^48),c=getchar();
		return s*f;
	}
	LL rdl()
	{
		LL s=0;char c=getchar();int f=1;
		while(c<48||c>57)
		{
			if(c==45) f=-1;
			c=getchar();
		}
		while(c>=48&&c<=57) s=(s<<3)+(s<<1)+(c^48),c=getchar();
		return s*f;
	}
	void wt(int x)
	{
		if(x>=10) wt(x/10);
		putchar(x%10+48);
	}
	void WT(int x)
	{
		if(x<0) x=-x,putchar(45);
		wt(x);
	}
	void wtl(LL x)
	{
		if(x>=10) wtl(x/10);
		putchar(x%10+48);
	}
	void WTL(LL x)
	{
		if(x<0) x=-x,putchar(45);
		wtl(x);
	}
}using namespace LYYY;
//-------------------------------------------------------------------bianliang↓
int A[2222];
//-------------------------------------------------------------------hanshu↓
//-------------------------------------------------------------------main()↓
int main()
{
	int N=rd(),ans=0;
	for(int i=1;i<=N;++i) A[i]=rd();
	sort(A+1,A+1+N);
	for(int i=1;i<=N;++i)for(int j=i+1,k=j;j<=N;++j)
	{
		while(k<N&&A[i]+A[j]>A[k+1]) ++k;
		ans+=k-j;
	}
	WT(ans);
}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int a[2005];

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

    int n, k, q;
    cin >> n >> k >> q;
    vector<int> v;
    for (int i=0; i<n; i++) {
        cin >> a[i];
        v.push_back(a[i]);
    }

    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    vector<int> acc;
    int ret = INT_MAX;
    for (int y : v) {
        vector<int> tot;
        for (int i=0; i<=n; i++) {
            if (a[i] < y) {
                // segment of length L, remove L - k + 1
                sort(acc.begin(), acc.end());
                for (int j=0; j<(int)acc.size()-k+1; j++)
                    tot.push_back(acc[j]);
                acc.clear();
            } else {
                acc.push_back(a[i]);
            }
        }
        if ((int) tot.size() >= q) {
            sort(tot.begin(), tot.end());
            ret = min(ret, tot[q-1] - y);
        }
    }
    cout << ret << "\n";

    return 0;
}


Measured memory_bytes: 3668
n = int(input())
l = list(map(int, input().split()))

l.sort()

count = 0

for i in range(n-2):
	for j in range(i+1, n-1):
		if l[i] == l[j]:
			continue

		for k in range(j+1, n):
			if l[j] == l[k]:
				continue

			if l[i]+l[j] > l[k]:
				count += 1

print(count)

Measured memory_bytes: 9060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < 3; i++) {
            set.add(ni());
        }
        out.print(set.size());
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}


Measured memory_bytes: 8148
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A, *X = map(int, read().split())

    M = sum(X)
    dp = [[0] * (M + 1) for j in range(N + 1)]
    dp[0][0] = 1

    for i in range(N):
        for j in range(N, 0, -1):
            for k in range(X[i], M + 1):
                dp[j][k] += dp[j - 1][k - X[i]]

    ans = 0
    for j in range(1, min(N, M // A) + 1):
        ans += dp[j][A * j]

    print(ans)
    return


if __name__ == '__main__':
    main()


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

int main(){
  int64_t X, Y, S;
  
  cin >> X >> Y;
  
  if (X % Y == 0){
    cout << -1 << endl;
  }
  else{
    S = X * (Y - 1);
    cout << S << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>

int main(void) {
	char ch;
	
	while (1) {
		scanf("%c", &ch);
		
		if (islower(ch)) ch = (char)toupper(ch);
		else if (isupper(ch)) ch = (char)tolower(ch);
		
		putchar(ch);
		
		if (ch == '\n') break;
	}
	
	return 0;
}

Measured memory_bytes: 524
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

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

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

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return 1;
    }
    return 0;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return 1;
    }
    return 0;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;

    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;

// 素因数分解
map<ll,ll> prime_cnt;
void decompositPrime(ll n){
    int a=2;
    while(n>=a*a){
        if(n%a==0){
            prime_cnt[a]++;
            n/=a;
        }else{
            a++;
        }
    }
    prime_cnt[n]++;
}

// Combination
class Combination{
    long long powmod(long long a, long long p){
        long long ans = 1LL;
        long long mul = a;
        while(p>0){
            if((p&1)==1) {
                ans = (ans * mul) % MOD;
            }
            mul=(mul*mul)%MOD;
            p>>=1;
        }
        return ans;
    }

public:
    int N;
    long long mod;
    vector<long long> fact;
    vector<long long> revfact;

    Combination(long long n, long long m) : N(n), mod(m), fact(n+1), revfact(n+1){
        fact[0]=1;
        for(int i=1; i<=N; i++){
            fact[i]=fact[i-1]*i;
            fact[i]%=mod;
        }

        revfact[N] = powmod(fact[N], mod-2);
        for(int i=N-1; i>=0; i--){
            revfact[i]=revfact[i+1]*(i+1)%mod;
        }
    }

    long long getCombination(long long a, long long b){
        if(a<0 || b<0) return 0;
        if(b>a)return 0;
        return fact[a]*revfact[b]%mod*revfact[a-b]%mod;
    }
};

int main(){
    ll N,M;
    cin >> N >>M;
    ll ans=1;

    decompositPrime(M);
    Combination com=Combination(200000,MOD);

    for(auto x: prime_cnt){
        if(x.first!=1) {
            ans = ans * com.getCombination(x.second + N - 1, x.second);
            ans%=MOD;
        }
    }
    cout << ans <<endl;
    return 0;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define INF 1000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N;
  cin >> N;
  string S;
  cin >> S;
  vector<ll> rgb(3);
  for (ll i = 0; i < N; ++i)
  {
    if (S[i] == 'R')
    {
      rgb.at(0) += 1;
    }
    else if (S[i] == 'G')
    {
      rgb.at(1) += 1;
    }
    else
    {
      rgb.at(2) += 1;
    }
  }
  ll ans = rgb.at(0) * rgb.at(1) * rgb.at(2);
  for (ll i = 0; i < N; ++i)
  {
    for (ll j = 1; j < N - i; ++j)
    {
      if (i + 2 * j > N - 1)
      {
        continue;
      }
      if (S[i] != S[i + j] && S[i] != S[i + 2 * j] && S[i + j] != S[i + 2 * j])
      {
        // cout << i << j << endl;
        ans -= 1;
      }
    }
  }
  cout << ans << endl;
}


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



#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>

#define rep(a,i,n) for(int i = (a) ; i< (n);i++)
#define ic(n) int (n); cin>>(n);
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;



typedef pair<int,int> P;




int main(){

  ic(n);ic(m);/*Nつの県とMつの市がある。考えるはひとまずMつ
  の市がどこに属するか。作る値は、どこの県に属するか、何年に誕生したか。と
  いうのと、市自体の番号（入力するときのi＋1)*/
	vector<tuple<long long,long long,long long>> M(m);
	rep(0,i,m){
		ic(where);ic(when);
		M[i] = make_tuple(where,when,i+1);;
	  }
	long long a , b ;//aに市の番号、countにその県で何番目にできたか、cにIDを入れよう
	long long c;
	/*rep(i,m){ 
		tie(a,b,c) = M[i];
		cout<<"a:"<<a<<" b:"<<b<<" c:"<<c<<endl;
	}*/
	SORT(M);

	/*rep(i,m){ 
		tie(a,b,c) = M[i];
		cout<<"a:"<<a<<" b:"<<b<<" c:"<<c<<endl;
	}
*/
	//あとすることは、IDの作成、後に市の番号昇順に並べ替えてからの出力
	//この後はpairを作って、市とIDだけの箱に詰め替えよう
	vector<pair<long long,long long>> A(m);
	long long x,y;
	long long count = 1;
	long long p=0;//とりあえず存在しない県番号1を作っておく
	rep(0,i,m){
	tie(x,y,a) =M[i];
	//その県で何番目にできたかをcountに入れておく
	if(x==p){
	  count++;
	  }
	else if(x!=p){
		count=1;
		p=x;
	  }
	  //cにIDを入れていく。県番号は10^6すれば2000003みたいな感じになるので、
	  //最後出力するとき、00000をつければいいはず
	x*=pow(10,6);
	c = x+count;
	A[i] = make_pair(a,c);//aは市の番号,cがIDの先頭に0ついてないやつ
	
	  }
	  SORT(A);
	  rep(0,i,m){
		  long long id;
		  tie(ignore,id) = A[i];
		  //後はprintfで足りない分０をつけて出力
		  printf("%012lld\n",id);
		}
}	



Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int fa[N],ans[N],sz[N];
vector<int>friendgraph[N];
int n,m,k;
int find(int x)
{
    if(fa[x]==x)
    return x;
    else
    return fa[x]=find(fa[x]);
}
void merge(int x,int y)
{
    x=find(x);
    y=find(y);
    if(x==y)
    return;
    if(sz[y]<sz[x])
    swap(x,y);
    sz[x] += sz[y];
    fa[y]=x;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
    {
        sz[i]=1;
        fa[i]=i;
    }
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        friendgraph[x].push_back(y);
        friendgraph[y].push_back(x);
        merge(x,y);
    }
    //merge(1,2);
    for(int i=1;i<=n;i++)
    {
        //cout<<i<<" "<<find(i)<<"\n";
        ans[i]=sz[find(i)]-friendgraph[i].size()-1;
        //cout<<ans[i]<<"\n";
    }    
    for(int i=0;i<k;i++)
    {
        int x,y;
        cin>>x>>y;
        if(find(x)==find(y))
        {
            ans[x]--;
            ans[y]--;
        }
    }
    //cout<<find(2)<<endl;
    for(int i=1;i<=n;i++)
    cout<<ans[i]<<" ";
    cout<<"\n";
    return 0;
}

Measured memory_bytes: 9080
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
typedef pair<LL,LL>P;
LL H[5001];
LL PP[5001];



int main(){
    int N;
    cin>>N;
    vector<LL> dp(N+1);
    REP(i,N+1){
        dp[i]=1e15;
    }
    vector<P>v;
    REP(i,N){
        cin>>H[i]>>PP[i];
        v.push_back(P(H[i]+PP[i],i));
    }
    sort(v.begin(),v.end());
    dp[0]=0;
    REP(i,N){
        vector<LL>nxt(N+1);
        REP(j,N+1)nxt[j]=dp[j];
        REP(j,N){
            int now=v[i].second;
            if(dp[j]<=H[now]){
               nxt[j+1]=min(nxt[j+1],dp[j]+PP[now]);
            }
        }
        swap(dp,nxt);
    }
    int ans=0;
    REP(i,N+1){
        if(dp[i]<1e15)ans=i;
        
    }
    cout<<ans<<endl;
    
    return(0);
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll H[100005];
struct Vertex {
    vector<ll> node;
};

Vertex V[100005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    REP(i, N) {
        cin >> H[i];
    }
    REP(i, M) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        V[a].node.push_back(b);
        V[b].node.push_back(a);
    }

    ll ans = 0;
    REP(i, N) {
        bool e = true;
        REP(j, V[i].node.size()) {
            ll n = V[i].node[j];
            if (H[n] >= H[i]) {
                e = false;
                break;
            }
        }
        if (e)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    string s;cin >>s;
    int n=s.size();
    int sum=0;
    for (int i = 0; i < n; ++i) {
        sum+=s[i]-'0';
    }
    int ans=max(sum,(n-1)*9+(s[0]-'1'));
    cout <<ans <<endl;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define range(x,l,r) (l<=x && x<r)
#define fs first
#define sc second
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> tri;

int w,h;
int g[20][20];
int rem[20][20];
vector<tri> carpet[20][20];
int depth;

void search(int d){
  if(d==depth)return;

  vector<tri> priority;
  rep(i,h)rep(j,w){
    if(rem[i][j]){
      priority.push_back(tri(pii(carpet[i][j].size(),i),j));
    }
  }

  if(priority.size()==0){
    depth = d;
    return;
  }

  int y = priority[0].fs.sc, x = priority[0].sc;

  rep(k,carpet[y][x].size()){
    tri t = carpet[y][x][k];
    
    int tmp[20][20];
    for(int i=t.fs.fs;i<t.fs.fs+t.sc;i++){
      for(int j=t.fs.sc;j<t.fs.sc+t.sc;j++){
	tmp[i][j] = rem[i][j];
      }
    }

    for(int i=t.fs.fs;i<t.fs.fs+t.sc;i++){
      for(int j=t.fs.sc;j<t.fs.sc+t.sc;j++){
	rem[i][j] = 0;
      }
    }
    
    search(d+1);

    for(int i=t.fs.fs;i<t.fs.fs+t.sc;i++){
      for(int j=t.fs.sc;j<t.fs.sc+t.sc;j++){
	rem[i][j] = tmp[i][j];
      }
    }
    if(depth == d+1)return;
  }
}

int main(){
  while(cin >> w >> h, w){
    memset(g,0,sizeof(g));
    rep(i,h)rep(j,w){
      cin >> g[i][j];
      rem[i][j] = g[i][j];
      carpet[i][j].clear();
    }

    vector<tri> c;
    rep(i,h)rep(j,w){
      int k = 0;
      while(true){
	if(!range(i+k,0,h) || !range(j+k,0,w))break;
	int f = 1;
	for(int y=i;y<=i+k;y++)f &= g[y][j+k];
	for(int x=j;x<=j+k;x++)f &= g[i+k][x];
	if(!f)break;
	k++;
      }
      if(k)c.push_back( tri(pii(i,j), k) );
    }
    
    rep(i,c.size()){
      bool f = false;
      rep(j,c.size()){
	if(i==j)continue;
	if( range(c[i].fs.fs, c[j].fs.fs, c[j].fs.fs + c[j].sc) &&
	    range(c[i].fs.fs + c[i].sc, c[j].fs.fs, c[j].fs.fs + c[j].sc+1) &&
	    range(c[i].fs.sc, c[j].fs.sc, c[j].fs.sc + c[j].sc) &&
	    range(c[i].fs.sc + c[i].sc, c[j].fs.sc, c[j].fs.sc + c[j].sc+1) ){
	  f = true;
	  break;
	}
      }

      if(f){
	c.erase(c.begin()+i);
	i--;
      }
    }

    rep(i,c.size()){
      for(int y=c[i].fs.fs;y<c[i].fs.fs+c[i].sc;y++){
	for(int x=c[i].fs.sc;x<c[i].fs.sc+c[i].sc;x++){
	  carpet[y][x].push_back(c[i]);
	}
      }
    }

    int ans = 0;
    while(true){
      bool f = false;
      rep(i,h)rep(j,w){
	if(rem[i][j] && carpet[i][j].size()==1){
	  f = true;
	  ans++;
	  tri t = carpet[i][j][0];
	  for(int y=t.fs.fs;y<t.fs.fs+t.sc;y++){
	    for(int x=t.fs.sc;x<t.fs.sc+t.sc;x++){
	      rem[y][x] = 0;
	    }
	  }
	}
      }
      if(!f)break;
    }

    depth = h*w;
    search(0);
    
    cout << ans + depth  << endl;
  }
}

Measured memory_bytes: 1296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

int main(){

    int N;cin>>N;
    vector<double> X(N),Y(N);
    vector<char> S(N);
    for(int i=0;i<N;i++){
        cin>>X[i]>>Y[i]>>S[i];
    }
    double UX1,LX1,RX1,DX1,UX2,LX2,RX2,DX2,UY1,LY1,RY1,DY1,UY2,LY2,RY2,DY2;//1は正
    UX1=LX1=RX1=DX1=UY1=LY1=RY1=DY1=-INF;
    UX2=LX2=RX2=DX2=UY2=LY2=RY2=DY2=INF;
    
    for(int i=0;i<N;i++){
        if(S[i]=='U'){
            UX1=max(UX1,X[i]);
            UX2=min(UX2,X[i]);
            UY1=max(UY1,Y[i]);
            UY2=min(UY2,Y[i]);
        }else if(S[i]=='L'){
            LX1=max(LX1,X[i]);
            LX2=min(LX2,X[i]);
            LY1=max(LY1,Y[i]);
            LY2=min(LY2,Y[i]);
        }else if(S[i]=='R'){
            RX1=max(RX1,X[i]);
            RX2=min(RX2,X[i]);
            RY1=max(RY1,Y[i]);
            RY2=min(RY2,Y[i]);
        }else{
            DX1=max(DX1,X[i]);
            DX2=min(DX2,X[i]);
            DY1=max(DY1,Y[i]);
            DY2=min(DY2,Y[i]);
        }
    }
    
    double ans;
    
    double xmax=max({UX1,LX1,RX1,DX1});
    double xmin=min({UX2,LX2,RX2,DX2});
    double ymax=max({UY1,LY1,RY1,DY1});
    double ymin=min({UY2,LY2,RY2,DY2});
    
    double a=(xmax-xmin)*(ymax-ymin);
    ans=a;
    
    for(double t=0.5;t<=100000000.0;t+=0.5){
        double xmax=max({UX1,LX1-t,RX1+t,DX1});
        double xmin=min({UX2,LX2-t,RX2+t,DX2});
        double ymax=max({UY1+t,LY1,RY1,DY1-t});
        double ymin=min({UY2+t,LY2,RY2,DY2-t});
        
        double a=(xmax-xmin)*(ymax-ymin);
        ans=min(ans,a);
    }
    
    cout<<setprecision(25)<<ans<<endl;
    
}


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

typedef long long ll;
#define pb emplace_back
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define test ll t ; cin>>t; while(t--)

ll n,W;
ll dp[101][100001];

ll knapsack(ll W,ll w[],ll v[],ll n)
{
    if(n==0 ||  W==0)   return 0;
    
    if(n<=100 && W<=100000)
    {
        if(dp[n][W]!=-1)    return dp[n][W];
        if(w[n]<=W)  return     dp[n][W]=max(knapsack(W,w,v,n-1),v[n]+knapsack(W-w[n],w,v,n-1));
        else    return  dp[n][W]=knapsack(W,w,v,n-1);
    }
    else
    {
        if(w[n]<=W)  return     max(knapsack(W,w,v,n-1),v[n]+knapsack(W-w[n],w,v,n-1));
        else    return  knapsack(W,w,v,n-1);
    }
}

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	ll n,W;
	cin>>n>>W;
	ll w[n+1]={0},v[n+1]={0};
	loop(i,1,n+1)
	{
	    cin>>w[i]>>v[i];
	}
	memset(dp,-1,sizeof(dp));
	ll ans=knapsack(W,w,v,n+1);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 79232
solve :: String -> Int
solve s
  | length sList /= 2 = error $ show (length sList) ++ "wtf in solve"
  | b `mod` a == 0 = a + b
  | otherwise = b - a
  where
    sList = fmap read $ words s
    a = head sList
    b = last sList

main :: IO ()
main = do
  getLine >>= return.solve >>= print


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define ssort(n) sort((n).begin(),(n).end())
#define rsort(n) sort((n).begin(),(n).end(),greater<int>())
#define mp make_pair
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
typedef pair<P,int> COST;
#define repl(i,n) for(ll i=0;i<(n);++i)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
using Graf=vector<vector<int>>;
#define MAX 1000000007

class Calc_Mod{//calculate mod
    public:
        unsigned int mod=1000000007;
        ll plus_mod(ll a,ll b){
            return (a+b)%mod;
        }
        ll minus_mod(ll a,ll b){
            return (a-b)%mod;
        }
        ll multi_mod(ll a,ll b){
            return a*b%mod;
        }
        ll LSM(ll a,int b){//a^b%mod
            queue<int> q;
            while(b>=1){
                q.push(b%2);
                b/=2;
            }
            ll ans=1;
            while(!q.empty()){
                if(q.front()==1){
                    ans=multi_mod(ans,a);
                }
                a=multi_mod(a,a);
                q.pop();
            }
            return ans;
        }
        ll div_mod(ll a,ll b){// a/b
            return multi_mod(a,LSM(b,mod-2));
        }
        ll combi(ll a,ll b){//aCb
            ll ans=1;
            ll kaijo=1;
            rep(i,b){
                ans=multi_mod(ans,a-i);
                kaijo=multi_mod(kaijo,b-i);
            }
            ans=div_mod(ans,kaijo);
            return ans;
        }
        
};

int main()
{
    ll a,b;
    cin >> a >> b;
    bool flag=false;
    bool flag_3=false;
    if(a%2==0){
        flag=true;
    }
    if(flag==false&&a!=1){
        flag_3=true;
    }
    ll num;
    int dist;
    ll ans;
    if(flag==true){
        num=(b-a)/4;
        num=a+4*num;
        ans=num;
        dist=(b-a)%4;
        rep(i,dist){
            ans^=(num+i+1);
        }
    }
    else{
        if(flag_3==false){
            num=(b-a)/3;
            num=a+3*num;
            dist=(b-a)%3;
            ans=num;
            rep(i,dist){
                ans^=(num+i+1);
            }
        }else{
            num=(b-a)/4;
            num=a+4*num;
            dist=(b-a)%4;
            ans=a;
            rep(i,dist){
                ans^=(num+i+1);
            }
        }

    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
#define N 1000000
bool p[1000000];
int main(){
  int n;

  for(int i=0;i<N;i++)p[i]=true;
  p[0]=p[1]=false;
  for(int i=0;i<N;i++)
    if(p[i]==true)
      for(int j=i*2;j<N;j+=i)
	p[j]=false;

  while(cin>>n){
    int count=0;
    for(int i=0;i<=n;i++)
      if(p[i]==true)count++;
    cout<<count<<endl;
  }
  return 0;
}

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



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    ll k;
    cin>>k;
    for(int i=0;i<s.size();i++){
        if(s[i]=='1')k-=1;
        else k=0;
        if(k==0){cout<<s[i];return 0;}
    }
}


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

#define       sf                 scanf
#define       pf                 printf
#define       pb                 push_back
#define       sz                 200005
#define       inf                0x3f3f3f3f
#define       MOD                1000000007
#define       READ               freopen("in.txt", "r", stdin);
#define       WRITE              freopen("out.txt", "w", stdout);
#define       optimize           ios::sync_with_stdio(0);cin.tie(0);

using namespace std;

typedef       long long int      ll;

int main()
{
    // READ
    optimize

    int n, a[105], ans = 0;

    cin >> n;

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

    for(int i = 0; i < n; i++)
    {
    	for(int j = i+1; j < n; j++)
    	{
    		for(int k = j+1; k < n; k++)
    		{
    			set <int> st;
    			st.insert(a[i]); st.insert(a[j]);st.insert(a[k]);

    			if(a[i]+a[j]>a[k] and a[i]+a[k]>a[j] and a[j]+a[k]>a[i] and st.size()==3)
    			{
    				ans++;
    				// cout << i+1 << " " << j+1 << " " << k+1 e< endl;
    			}
    		}
    	}
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
double dp[3000][3000];
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  dp[0][0] = 1;
  int n; cin >> n;
  for (int i = 0; i < n; ++i) {
    double p; cin >> p;
    for (int j = 0; j < 3000; ++j) {
      dp[i + 1][j] = dp[i][j - 1] * p + dp[i][j] * (1 - p);
    }
  }
  double ans = 0;
  for (int i = n / 2 + 1; i <= n; ++i) ans += dp[n][i];
  cout << fixed << setprecision(10) << ans << '\n';
}


Measured memory_bytes: 70528
n=int(input())
line=''
for i in range(1,1+n):
  if i%3==0:
    line+=' '+str(i)
  elif i%10==3:
    line+=' '+str(i)
  else: 
    x=i//10
    while(x):
      if x%10==3:
        line+=' '+str(i)
        break
      x=x//10
print(line)


Measured memory_bytes: 5632
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
const int c=1e6;
const ll mod=1e9+7;
bool p[1000];
void sieve(){
p[0]=p[1]=1;
for(int i=2;i<=100;i++){
    for(int j=i*i;j<=100;j+=i){
        p[j]=1;
    }
}
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    cout<<(n+1)/2;
    return 0;
}


Measured memory_bytes: 256
N, T = map(int, input().split())
dishes = [tuple(map(int, input().split())) for _ in range(N)]
dishes = sorted(dishes)
dp = [[-1 for j in range(T+3001)] for i in range(N+1)]
for i in range(N+1):
    dp[i][0] = 0
for i in range(N):
    a, b = dishes[i]
    for j in range(T+3001):
        if j < a or T + a <= j:
            dp[i+1][j] = dp[i][j]
        else:
            if dp[i][j-a] < 0:
                dp[i+1][j] = dp[i][j]
            else:
                dp[i+1][j] = max(dp[i][j], dp[i][j - a] + b)
print(max(dp[-1]))

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

int main()
{
	int apple = -1, piece = -1, pie = 0;
	std::string test;
	std::string::size_type pos;

	std::getline(std::cin, test);
	pos = test.find_first_of(" ");
	apple = std::stoi(test.substr(0, pos));
	piece = std::stoi(test.substr(test.size()-pos, pos));
	if(apple < 0)
		return -1;
	if(piece > 100)
		return -1;
	while(apple != 0)
	{
		piece += 3;
		apple--;
	}
	while(piece > 1)
	{
		pie++;
		piece -= 2;
	}
	std::cout << pie << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;


int main() {


    string s;

    cin >> s;

    string result;

    for (int i = 0; i < s.length(); i++) {

        if (i % 2 == 0) {
            result += s[i];
        }
    }

    cout << result << "\n";

    return 0;
}

Measured memory_bytes: 512
n = gets.to_i

# 前に存在していた点
lx = ly = 0
# 前に存在していた点にいた時刻
lt = 0
# 合否
is_enable = true

n.times do
  t, x, y = gets.split.map(&:to_i)
  if !is_enable
    next  # 既にNGだとわかっているので読み飛ばすだけ ※最後まで読み込まないとAtCoderではRuntimeErrorになる
  end

  # 前に存在していた点からの距離（道のり）
  distance = (x - lx).abs + (y - ly).abs

  # 前に存在していた点にいた時刻からの経過時刻
  dt = t - lt

  if dt < distance
    is_enable = false
    next
  end

  # 経過時刻が偶数なら距離も偶数じゃなければならない。奇数でも同様。
  if dt.even? != distance.even?
    is_enable = false
    next
  end

  lt = t
  lx = x
  ly = y
end

puts (is_enable ? 'Yes' : 'No')


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}

int N,M;
bool ok[111111];
int cnt[111111];
signed main(){
    cin>>N>>M;
    rep(i,M){
        int p;
        string s;
        cin>>p>>s;
        p--;
        if(s=="AC"){
            ok[p]=true;
        }
        else if(!ok[p]){
            cnt[p]++;
        }
    }

    int ac=0,pe=0;
    rep(i,N)if(ok[i]){
        ac++;
        pe+=cnt[i];
    }
    cout<<ac<<" "<<pe<<endl;
    return 0;
}

Measured memory_bytes: 1152
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Factorial II
 */
public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int n = Integer.parseInt(line);
			if (n == 0) {
				break;
			}

			int two = 0;
			int five = 0;

			for (int i = 2; i < n + 1; i += 2) {
				int j = i;
				while (j % 2 == 0) {
					two++;
					j /= 2;
				}
			}
			for (int i = 5; i < n + 1; i += 5) {
				int j = i;
				while (j % 5 == 0) {
					five++;
					j /= 5;
				}
			}

			System.out.println(two < five ? two : five);
		}
	}
}

Measured memory_bytes: 17940
class Dice:
    def __init__(self):
        self.side = {"top": 0, "front": 0, "right": 0, "left": 0, "back": 0, "bottom": 0}

    # サイコロを東西南北、どちらか一方に転がした時、それぞれの面の変化
    def roll(self, direction):
        self.direction = direction
        if self.direction == "N":
            w = self.side["top"]
            self.side["top"] = self.side["front"]
            self.side["front"] = self.side["bottom"]
            self.side["bottom"] = self.side["back"]
            self.side["back"] = w
        elif self.direction == "S":
            w = self.side["top"]
            self.side["top"] = self.side["back"]
            self.side["back"] = self.side["bottom"]
            self.side["bottom"] = self.side["front"]
            self.side["front"] = w
        elif self.direction == "E":
            w = self.side["top"]
            self.side["top"] = self.side["left"]
            self.side["left"] = self.side["bottom"]
            self.side["bottom"] = self.side["right"]
            self.side["right"] = w
        elif self.direction == "W":
            w = self.side["top"]
            self.side["top"] = self.side["right"]
            self.side["right"] = self.side["bottom"]
            self.side["bottom"] = self.side["left"]
            self.side["left"] = w

    # サイコロの目を作成
    def create(self):
        for s, n in zip(dice.side, input().split()):
            dice.side[s] = int(n)

# ランダムに東西南北を出現し、シュミレーションする
def simulation():
    for line in a:
        dir = random.sample("NSEW"*5, 20) # サンプル数は２０個
        for direction in dir:
            dice.roll(direction)
            # サイコロが同一なら、"NO"を返す。
            if dice.side == line:
                return "No"
    else:
        a.append(dict(dice.side)) # 同一のサイコロがないなら、比較候補のリストに追加する。

import random
n = int(input())
dice = Dice()

# 最初のサイコロの目を作成して、比較候補のリストに追加する。
dice.create()
a = []; a.append(dict(dice.side))
    
for i in range(1, n):
    dice.create()
    judge = simulation()
    # 同一のサイコロがあったら、"No"を出力して、処理を終了する。
    if judge == "No":
        print("No")
        break
# すべての比較候補と同一のサイコロがないなら、"Yes"を出力して、処理を終了する。
else:
    print("Yes")



Measured memory_bytes: 8240
import sys
import math
input = sys.stdin.readline


def main():
    A, B = map(int, input().split())
    for i in range(1000):
        if math.floor((i+1) * 0.08) == A and math.floor((i+1) * 0.1) == B:
            print(i+1)
            exit()
    print("-1")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#define ll long long
#define lld long double
#define cn(n)  ll n;cin >> n;
#define tes(t) ll t;cin>>t;while(t--) 
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define al(v) v.begin(), v.end()
#define oset(X) tree<X, null_type, less<X>, rb_tree_tag, tree_order_statistics_node_update>
#define roset(X) tree<X, null_type, greater<X>, rb_tree_tag, tree_order_statistics_node_update>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
ll power(ll x, ll y, ll p){ll res = 1;x %= p;while (y > 0){if (y & 1)res = (res * x) % p;y = y >> 1;x = (x * x) % p;}return res;}
ll po(ll base, ll powerRaised){if (powerRaised != 0)return (base * po(base, powerRaised - 1));else return 1;}
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
ll lcm(ll a, ll b){return (a * b) / gcd(a, b);}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
// #ifndef ONLINE_JUDGE
//   freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);
// #endif //*
  // tes(t)
  // {
  // }
  ll n,x,t;
  cin>>n>>x>>t;
  ll ans=(n/x)*t;
  ans+=(n%x!=0?t:0);
  cout<<ans;

}


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

int main(){
	int a, b;
	cin >> a >> b;

	if(a > b){
		cout << "a > b" << endl;}
	else if (a < b){
		cout << "a < b" << endl;}
	else{
		cout << "a == b" << endl;}
	return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pi pair<int,int>
#define pl pair<ll, ll>
#define ppi pair<int, pii>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7;
const ll inf = 1e18;

bool cmp(const pair<ll, ll> &a, const pair<ll, ll> &b){
    if(a.F == b.F) return a.S < b.S;
    return a.F > b.F;
}
ll power(ll x, ll p){
    ll r = 1ll;
    x = x % mod;
    while(p > 0){
        if(p & 1) r = (r * x) % mod;
        p = p >> 1;
        x = (x * x) % mod;
    }
    return r;
}

void solve(){
    int x;
    cin >> x;
    if(x >= 30){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);//cout.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("Input.txt", "r", stdin);
    #endif*/
    //freopen("running_on_fumes_chapter_1_input (1).txt", "r", stdin);
    //freopen("Output.txt", "w", stdout);
    int t = 1, p;
    //cin >> t;
    for(p = 1; p <= t; p++){
        //cout << "Case #" << p << ": ";
        solve();
    }
    return 0;
}



Measured memory_bytes: 3656
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]


N = int(input())
a = []
ans = []
for i in range(1, N+1):
    a.append(i)
# print(a)
for i in range(len(a)):

    if a[i] % 3 != 0 and a[i] % 5 != 0 and a[i] % 15 != 0:
        ans.append(a[i])
    if a[i] % 15 == 0:
        ans.append('FizzBuzz')
    if a[i] % 3 == 0:
        ans.append('Fizz')

    if a[i] % 5 == 0:
        ans.append('Buzz')


# print(ans)
sum = 0
for i in range(len(ans)):
    if ans[i] != 'FizzBuzz' and ans[i] != 'Fizz' and ans[i] != 'Buzz':
        sum += ans[i]
print(sum)


Measured memory_bytes: 182844
#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int):
    print(min(N*A, B))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(N, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for (int i=0,_n=(int)(n); i < _n; i++)
template<class T> bool chmax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<class T> bool chmin(T &a, T b) { return a > b ? (a = b, true) : false; }
 
typedef long long ll;

const ll MOD = 1e9 + 7;
ll dp[64][3];

int main2() {
  ll N;
  cin >> N;
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;

  for (int i = 0; i < 61; i++) {
    for (int c = 0; c < 3; c++) {
      for (int a = 0; a < 2; a++) {
        for (int b = a; b < 2; b++) {
          int n = (N >> i) & 1;
          int nc = -(n - c - a - b - 1) / 2;
          (dp[i+1][nc] += dp[i][c]) %= MOD;
        }
      }
    }
  }

  ll ans = dp[61][0] % MOD;
  cout << ans << endl;

  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <memory.h>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <time.h>
#include <assert.h>
#include <cmath>
#include <stack>
#include <string.h>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
char s[32];
int dp[32][2];
int n;
int calc(int i, bool l) {
	if (i==n)
		return 0;
	int &ret = dp[i][l];
	if (ret != -1)
		return ret;
	ret = 0;
	for (int d = l ? 9 : s[i]; d >= 0; --d)
		ret = max(ret, d + calc(i + 1, l || d < s[i]));
	return ret;
}
int main()
{
	scanf("%s", s);
	n = strlen(s);
	for (int i = 0; s[i]; ++i)
		s[i] -= '0';
	memset(dp, -1, sizeof(dp));
	printf("%d\n", calc(0, false));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
int count=0;

int method(int n,int s,int k){
  if(n==0){
    if(s==0){
      count++;
    }
    return 0;
  }
  if(n<0||s<0){
    return 0;
  }
  if(k>9){
    return 0;
  }
  method(n-1,s-k,k+1);
  method(n,s,k+1);
  return 0;
}

int main(){
  int n,s;
  while(std::cin >> n >> s){
    if(n==0&&s==0){
      break;
    }
    count =0;
    method(n,s,0);

    std::cout << count << std::endl;
  }
}

Measured memory_bytes: 3060
gets.to_i.times do
	arr = gets.split().map(&:to_i).sort()
	puts arr[0]**2 + arr[1]**2 == arr[2]**2 ? "YES" :"NO"
end
# set = gets
# arr = Array.new(3)

# while line = gets do
# 	num = line.split
# 	arr[0] = num[0].to_i
# 	arr[1] = num[1].to_i
# 	arr[2] = num[2].to_i
# 	arr_s = arr.sort

# 	a = arr_s[0]**2 + arr_s[1]**2
# 	if a == arr_s[2]**2
# 		puts "YES"
# 	else
# 		puts "NO"
# 	end

# end

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

int main(){
  int n; cin >>n;
  int hi=ceil(n/1.08);
  int low=floor(n/1.08);
  int ans=low;
  int tmp;
  bool flag=false;
  while(ans<=hi){
    //cout << ans <<" " <<ans*1.08 <<endl;
    tmp=ans*1.08;
    if( tmp== n){
      //cout <<"ok"<<endl;
      flag=true;
      break;
    }else{
      ans++;
    }
  }
  if(flag) cout <<ans <<endl;
  else cout <<":(";
  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int ans = 0;

    for(int i = 1; i <= N; i++){
        int cnt = 0;
        for(int j = 1; j <= i; j++ ){
            if(i % j == 0) cnt++;
        }
        if(cnt == 8 && i % 2 != 0) ans++;
    }

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


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>

using namespace std;

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

  string s[3];
  for (int i = 0; i < 3; ++i)
    cin >> s[i];

  cout << s[0][0] << s[1][1] << s[2][2] << endl;

  return 0;
}


Measured memory_bytes: 256
import math
import numpy as np

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

nW = [0 for i in range(N)] #iまでのWの数
nE = [0 for i in range(N)] #iまでのEの数

if S[0] == 'W':
    nW[0] = 1
else:
    nE[0] = 1

for i in range(1, N):
    if S[i] == 'W':
        nW[i] = nW[i-1] + 1
        nE[i] = nE[i-1]
    else:
        nW[i] = nW[i-1]
        nE[i] = nE[i-1] + 1

if nE[N-1] - nE[0] < nW[N-1]:
    count = nE[N-1] - nE[0]
else:
    count = nW[N-1]

for i in range(1,N-1):
    if nW[i-1] + nE[N-1] - nE[i] < count:
        count = nW[i-1] + nE[N-1] - nE[i]

print(count)


Measured memory_bytes: 28904