akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void){
    // Your code here!
    int age, price;
    scanf("%d%d", &age, &price);
    if (age >= 13) {
        printf("%d", price);
    } else if (age <= 5) {
        printf("0");
    } else {
        printf("%d", price / 2);
    }
}

Measured memory_bytes: 128
n = input().split()
inputData = []
for s in n:
    if s == "+" or s == "-" or s == "*":
        b = inputData.pop()
        a = inputData.pop()
        if s == "+":
            inputData.append(a + b)
        elif s == "-":
            inputData.append(a - b)
        else:
            inputData.append(a * b)
    else:
        inputData.append(int(s))
print(inputData[0])



Measured memory_bytes: 5600
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int a,b;
  cin>>a>>b;
  if(a+b>=10)
    cout<<"error"<<endl;
  else 
    cout<<a+b<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
#include <cctype>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
int main() {
  int a,b;
  cin>>a>>b;
  if(a>=13) cout<<b;
  else if(a<=5) cout<<"0";
  else cout<<b/2;
  return 0;
}

Measured memory_bytes: 256
n = list(map(int, input().split()))
count_5 = 2
count_7 = 1
for i in range(len(n)):
    if n[i] == 5:
        count_5 -= 1
    elif n[i] == 7:
        count_7 -= 1
if count_5==0 and count_7==0:
    print('YES')
else:
    print('NO')


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

int main() {
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (i < B && j < A || i >= B && j >= A) cout << 0;
      else cout << 1;
    }
    cout << "\n";
  }
}

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


int main() {

  int N;
  cin >> N;

  vector<int> members(N+1);
  int boss;
  
  for (int i=2; i<=N; i++){
    cin >> boss;
    members.at(boss) ++;
  }
  
for (int i=1; i<=N; i++){
cout << members.at(i) << endl;
}
}


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

using ll = long long int;
using bigint = int64_t;

#define pll pair<ll, ll>
#define vll vector<ll>
#define vpll vector<pll>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define bitcount __builtin_popcount
#define endl "\n"
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define deb(x) cout << #x << " = " << x << endl;
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(ll i = a; i <= b; i++)
#define ffo(i, a, b) for(ll i = a; i >= b; i--)
#define ffi(i,a,b,c) for(ll i = a ; i <= b ; i += c)
#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
const int MOD = 1000000007;

void io_set(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

void solve(){
	ll a[3][3], b[3][3];
	rep(i, 3){
		rep(j, 3){
			cin >> a[i][j];
			b[i][j] = 0;
		}
	}
	ll q, x;
	map < ll, ll >mpp;
	cin >> q;
	while(q--){
		cin >> x;
		mpp[x] = 1;
	}
	rep(i, 3){
		rep(j, 3){
			if(mpp[a[i][j]]){
				b[i][j] = 1;
			}
		}
	}
	ll flag = 0;
	if(b[0][0] == 1 && b[0][0] == b[0][1] && b[0][1] == b[0][2]){
		flag = 1; 
	}
	else if(b[1][0] == 1 && b[1][0] == b[1][1] && b[1][1] == b[1][2]){
		flag = 1;
	}
	else if(b[2][0] == 1 && b[2][0] == b[2][1] && b[2][1] == b[2][2]){
		flag = 1;
	}
	else if(b[0][0] == 1 && b[0][0] == b[1][0] && b[1][0] == b[2][0]){
		flag = 1;
	}
	else if(b[0][1] == 1 && b[0][1] == b[1][1] && b[1][1] == b[2][1]){
		flag = 1;
	}
	else if(b[0][2] == 1 && b[0][2] == b[1][2] && b[1][2] == b[2][2]){
		flag = 1;
	}
	else if(b[0][0] == 1 && b[1][1] == b[0][0] && b[2][2] == b[1][1]){
		flag = 1;
	}
	else if(b[2][0] == 1 && b[2][0] == b[1][1] && b[1][1] == b[0][2]){
		flag = 1;
	}
	cout << (flag ? "Yes\n" : "No\n");
}

int main(){
    IOS;
    //io_set();
    ll tt = 1;
    //cin >> tt;
    while(tt--){
        solve();
    }
    return 0;
} 

Measured memory_bytes: 256
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    string S;cin>>S;
    if(S=="ABC")cout<<"ARC";
    else cout<<"ABC";
    cout<<"\n";
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int w,h,x,y;
    cin >> w >> h >> x >> y;
    cout << w * h / 2.0 << "\n";
    if(w == x + x && h == y + y)
    {
        cout << "1";
    }
    else
    {
        cout << "0";
    }

    return 0;
}


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

int main()
{
	int n, m;
	cin >> n >> m;
	int s[m], c[m];
	for (int i = 0; i < m; ++i)
	{
		cin >> s[i] >> c[i];
	}
	
	for (int i = 0; i < pow(10,n); ++i)
	{
		string str = to_string(i);
		
		if (str.length() != n)
		{
			continue;
		}
		
		bool flag = true;
		
		for (int j = 0; j < m; ++j)
		{
			if (str[s[j]-1] != c[j] + '0')
			{
				flag = false;
				break;
			}
		}
		
		if (flag)
		{
			cout << i << endl;
			return 0;
		}
	}
	
	cout << -1 << endl;
	
	return 0;
}


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

int main(){
  long long int n,k;
  cin >> n;
  int m = round(pow(n,0.5));
  for (int i=1; i<=m; i++){
    if (n%i == 0) k = i;    
  }
  //cout << k;
  cout << k+n/k-2;
}

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

int main(){
  long long N,P,A;
  long long odd=0,even=0;
  long long all=0;
  cin >> N >> P;

  for(int i=0;i<N;i++){
    cin >> A;
    if(A%2==0)even+=1;
    else odd+=1;
  }
  
  all=pow(2,N);
  if(odd==0){
   if(P==0) cout << all;
   else cout << 0;
  }
  else cout << all/2;
  return 0;
}

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

int main(){
    ll n; cin >> n;
    vector<pair<ll,ll>> r(n), b(n);
    rep(i, 0, n) cin >> r[i].first >> r[i].second;
    rep(i, 0, n) cin >> b[i].first >> b[i].second;

    sort(b.begin(), b.end());

    vector<bool> used(n, false);
    ll ans = 0;

    rep(i, 0, n){
        ll bx = b[i].first;
        ll by = b[i].second;
        ll target = -1, mx = -1;
        rep(j, 0, n){
            ll rx = r[j].first;
            ll ry = r[j].second;
            if(!used[j] && rx < bx && ry < by){
                if(ry > mx){
                    mx = ry;
                    target = j;
                }
            }
        }
        if(mx != -1){
            used[target] = true;
            ans++;
        }
    }

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

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int H = 1, W = 1, W_copy, i = 0;

	while (i == 0)
	{
		scanf("%d%d", &H, &W);
		if (H == 0 && W == 0)
			break;
		for (W_copy = W; H > 0; H--)
		{
			for (; W_copy > 0; W_copy--)
			{
				printf("#");
			}

			W_copy = W;

			printf("\n");
		}
		printf("\n");
	}

	return 0;
}


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

ans = N
for A in range(1, N):
    B = N - A
    Asum = sum([int(a) for a in list(str(A))])
    Bsum = sum([int(b) for b in list(str(B))])
    ans = min(Asum+Bsum, ans)
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define MOD 1000000007
typedef long long LL;
template<class T> inline void chmax(T & a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

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

	int count = 0;
	for (int i = 1; i <= N; i+=2)
	{
		int div_num = 0;
		for (int j = 1; j <= i; j++)
		{
			if (i%j == 0) {
				div_num++;
			}
		}

		if (div_num == 8) {
			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
using namespace std;
string ss;
bool w,n,e,s;
inline bool check()
{
	if(w==1&&e==1&&n==1&&s==1)return 1;
	if(w==1&&e==1&&n==0&&s==0)return 1;
	if(w==0&&e==0&&n==1&&s==1)return 1;
	if(w==0&&e==0&&n==0&&s==0)return 1;
	return 0;
}
int main()
{
	getline(cin,ss);
	for(reg int i=0;i<ss.length();i++)
	if(ss[i]=='W')w++;
	else if(ss[i]=='N')n++;
	else if(ss[i]=='E')e++;
	else if(ss[i]=='S')s++;
	puts(check()?"Yes":"No");
	return 0;
}

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

using namespace std;

int main(){
   int N,K;
   cin>>N>>K;
   int score=1;
   for(int i=1;i<=N;i++){
      if(score<K){
        score*=2;
      }else{
        score+=K;
      }
   }
   cout<<score<<endl;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N,Q = map(int,readline().split())
A = np.array(readline().split(),np.int64)
X = np.array(read().split(),np.int64)

INF=10**15
A = np.concatenate([[-INF,-INF,-INF,-INF],A])

"""
・ある数が後手の右端となるのはどのような場合か
・n番目の右側にr>=1個あるとする
・【長さが奇数のときは、先頭に0を追加しておく】
  → 後手は、[n-r+1,n]をとって、先手は[n+1:]およびn-rを回収する。
・n+1番目をとらない iff r-1個自由にとると n+1番目を含まない iff |A_{n+1}-x| >= |A_{n-r+2}-x|
  iff r = 1 or x <= (A_{n+1}+A_{n-r+2})/2 iff r = 1 or x <= (A_{n+1}+A_{n-r+2})//2
・n-r番目をとらない iff r個自由にとると、n-r番目を含まない iff |A_n-x| < |A_{n-r}-x|
  iff x > (A_n+A_{n-r})/2 iff x > (A_n+A_{n-r})//2
"""

n = np.arange(N+4)
r = N-n+3
ind = (n-r>=0)&(r>=1); n = n[ind]; r = r[ind]

lower = (A[n] + A[n-r])//2 + 1
# upper = (A[n+1] + A[n-r+2])//2 不要

#得点の計算：n+1～の和 + n-rから2つずつ下へ

Acum = np.cumsum(A)
Acum_ev = np.zeros_like(A)
Acum_ev[::2] = A[::2].cumsum()
Acum_ev[1::2] = A[1::2].cumsum()
score = Acum[-1] - Acum[n] + Acum_ev[n-r] + INF + INF

I = np.searchsorted(lower,X,side='right') - 1
answer = score[I]

print('\n'.join(answer.astype(str)))

Measured memory_bytes: 40868
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };


signed main() {
	int h, w;
	vector<string>list;
	int maxn = 0;
	int flag[2002][2002][4];
	
	for (int i = 0; i < 2002; i++) {
		for (int j = 0; j < 2002; j++) {
			for (int k = 0; k < 4; k++) {
				flag[i][j][k] = 0;
			}
		}
	}

	cin >> h >> w;

	list.push_back("aaa");
	
	for (int i = 0; i < h; i++) {
		string s = "a";
		string ss;
		cin >> ss;
		s += ss;
		list.push_back(s);
	}

	
	for (int i = 1; i <= h; i++) {
		int ima = 0;
		for (int j = 1; j <= w; j++) {
			if (list[i][j] == '#') {
				ima = 0;
			}
			else {
				ima++;
			}

			flag[i][j][0] = ima;
		}
	}

	for (int i = 1; i <= h; i++) {
		int ima = 0;
		for (int j = w; j >= 1; j--) {
			if (list[i][j] == '#') {
				ima = 0;
			}
			else {
				ima++;
			}

			flag[i][j][1] = ima;
		}
	}

	for (int i = 1; i <= w; i++) {
		int ima = 0;
		for (int j = 1; j <= h; j++) {
			if (list[j][i] == '#') {
				ima = 0;
			}
			else {
				ima++;
			}

			flag[j][i][2] = ima;
		}
	}

	for (int i = 1; i <= w; i++) {
		int ima = 0;
		for (int j = h; j >= 1; j--) {
			if (list[j][i] == '#') {
				ima = 0;
			}
			else {
				ima++;
			}

			flag[j][i][3] = ima;
		}
	}

	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			int sum = 0;
			for (int k = 0; k < 4; k++) {
				sum += flag[i][j][k];
			}
			maxn = max(maxn, sum);
		}
	}

	cout << max( maxn-3, 0) << endl;



	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 66944
#include <iostream>
#include <stdio.h>

using namespace std;

int sum(int n);
int main(){
  long int i, j, N, K;
  double tmp = 0.0;
  double max;
  
  cin >> N >> K;
  
  int *p = new int[N];
  double *E = new double[N];
  
  for(i = 0; i < N; i++){
    cin >> p[i];
    
    E[i] = (double)sum(p[i])/(double)p[i];
    
    if(i < K){
      tmp += E[i];
    }
  }
  
  max = tmp;
  
  i = K;
  j = 0;
  
  while(i < N){
    tmp = tmp - E[j] + E[i];
    
    if(max < tmp){
      max = tmp;
    }
    
    j++;
    i++;
  }
  
  printf("%0.12f\n", max);
  
  return 0;
}

int sum(int n){
  int sum = 0;
  int i;
  
  for(int i = 1; i <= n; i++){
    sum += i;
  }
  
  return sum;
}

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

int main(){
    int A,B,C;
    cin >> A >> B >> C;

    bool can=false;
    if((A==B) && (C!=A))  can=true;
    if((A==C) && (B!=A))  can=true;
    if((B==C) && (A!=B))  can=true;

    if(can) cout << "Yes" << endl;
    else cout << "No" <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {FIN
  	int n, m, i;
	bool is = false;
	cin >> n;
	for (i = 1; i < 10; i++) {
    	if (n % i == 0) {
          m = n / i;
          if (m <= 9) {
          	is = true;
            break;
          }
        }
    }
    cout << (is ? "Yes" : "No") << "\n";
	return 0;           
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

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

    int ans = (N - 1 > 1 ? 2 : 1);

    lint n = lint(sqrt(N-1));
    for_(k,2,n+1) {
        lint tmp = N - 1;
        if (tmp % k == 0) {
            //cerr << k << " " << tmp / k << endl;
            if (tmp / k == k) ++ans;
            else ans += 2;
        }
    }

    n = lint(sqrt(N));
    for_(k,2,n+1) {
        if ((N - 1) % k == 0) continue;

        lint tmp = N;
        while (tmp % k == 0) tmp /= k;
        if (tmp % k == 1) {
            //cerr << k << endl;
            ++ans;
        }

        if (N % k != 0) continue;

        int p = N / k;
        if (p == k) continue;
        tmp = N;
        while (tmp % p == 0) tmp /= p;
        if (tmp % p == 1) {
            ++ans;
            //cerr << p << endl;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[i] = v[i] - c[i]

ans.sort()
for i in range(n):
  if ans[i] < 0:
        ans[i] = 0
  else:
    break
print(sum(ans))

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
	int a[3];
	scanf("%d %d %d", &a[0], &a[1], &a[2]);
	sort(a, a + 3);
	printf("%d %d %d\n", a[0], a[1], a[2]);


	return 0;


}

Measured memory_bytes: 2768
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
                
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define max2(a,b) ((a)>(b) ? (a) : (b))   
#define min2(a,b) ((a)<(b) ? (a) : (b)) 
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i) 
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lli long long int 
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000

using namespace std;
typedef vector<lli>   vll;
typedef vector<int>   vi;
typedef set<lli>      sll;
typedef set<int>      si;
typedef pair<lli,lli> pll;
typedef pair<int,int> pii;
clock_t clk=clock();       

lli i,j;
void solve(void);

int main()
{
  speedio;
   int t=1;  
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
//
lli power(lli x,lli n,unsigned lli m=ULLONG_MAX)
{ 
  lli res=1;  	x%=m; 
     while(n>0)
       { 
         if(n&1==1) res=(res*x)%m;
          n/=2;
          x=(x*x)%m;
       }
   return res;
}
int n,m; 
void solve()
{	
	cin>>n>>m;

	vll v[m+1];
	rep(i,1,m)
	{
		int k; cin>>k;
		rep(j,1,k)
		 {
		 	int x; cin>>x;
		 	v[i].pb(x);
		 }
	}
  
  bool p[m+1]={0};
  rep(i,1,m) cin>>p[i];

  int val=0,bound=power(2,n)-1;
 lli cnt=0;
   while(val<=bound)
   {
   	 int a[n+1]={0};
   	  int temp=val; i=1;

   	  while(temp>0)
   	  {
        a[i]=temp%2;
        temp/=2; ++i;
   	  }


      rep(i,1,m)
      {
      	int ct=0;
      	rep(j,0,sz(v[i])-1)
      	 if(a[ v[i][j] ]==1) ++ct;

      	 if(ct%2!=p[i]) break;
      }
      if(i==m+1) ++cnt;
      
      // cout<<val<<" "<<cnt<<"\n";
      ++val;
   }

   cout<<cnt<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;
using pl = pair<ll,ll>;
using vvb=vector<vector<bool>>;
using vb= vector<bool>;

signed main(){
	ll n; cin>>n;
	ll k; cin>>k;
	map<ll,ll> a,b;
	rep(i,1,n+1){
		ll j=-i;
		a[i%k]++;
		if(i%k==(k+(j%k))%k)b[i%k]++;
	}
	ll ans=0;
	rep(i,0,k){
		ans+=a[i]*a[i]*b[i];
	}
	cout<<ans<<endl;
	

		
	

	return 0;
}

Measured memory_bytes: 28456
#include<iostream>
#include<math.h>
using namespace std;

int main(){
 int a, b, c, x, y;
 cin>>a>>b>>c>>x>>y;
 int temp1, temp2, temp3;
 temp1 = a*x+b*y;
 temp2 = c*max(x,y)*2;
 if(x>=y)temp3 = c*y*2+a*(x-y);
 else temp3 = c*x*2+b*(y-x);
 cout<<min(min(temp1, temp2), temp3)<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 103;
int n, m, K, mod, f[N][N], fac[N], inv[N];
int qpow(int b, int p) {
  int r = 1;
  for (; p; p >>= 1, b = (ll) b * b % mod) if (p & 1) {
    r = (ll) r * b % mod;
  }
  return r;
}
int main() {
  scanf("%d%d%d%d", &n, &m, &K, &mod);
  f[0][0] = 1;
  fac[0] = fac[1] = inv[0] = inv[1] = 1;
  for (int i = 2; i <= max(n, m); i++) {
    fac[i] = (ll) fac[i - 1] * i % mod;
    inv[i] = mod - (ll) mod / i * inv[mod % i] % mod;
  }
  for (int i = 2; i <= max(n, m); i++) {
    inv[i] = (ll) inv[i] * inv[i - 1] % mod;
  }
  for (int step = 0; step < K << 1; step++) {
    int cnt1 = (step >> 1) + 1, cnt2 = K - (step >> 1);
    if (!(step & 1)) {
      for (int i = n; ~i; i--) {
        for (int j = m; ~j; j--) if (f[i][j]) {
          int coef = (ll) (qpow(cnt1, m - j) + mod - qpow(cnt1 - 1, m - j)) * qpow(cnt2, j) % mod;
          for (int l = 1, c = (ll) coef * f[i][j] % mod * inv[i] % mod; i + l <= n; l++, c = (ll) c * coef % mod) {
            f[i + l][j] = (f[i + l][j] + (ll) c * fac[i + l] % mod * inv[l]) % mod;
          }
        }
      }
    } else {
      for (int j = m; ~j; j--) {
        for (int i = n; ~i; i--) if (f[i][j]) {
          int coef = (ll) qpow(cnt1, n - i) * (qpow(cnt2, i) + mod - qpow(cnt2 - 1, i)) % mod;
          for (int l = 1, c = (ll) coef * f[i][j] % mod * inv[j] % mod; j + l <= m; l++, c = (ll) c * coef % mod) {
            f[i][j + l] = (f[i][j + l] + (ll) c * fac[j + l] % mod * inv[l]) % mod;
          }
        }
      }
    }
  }
  printf("%d\n", f[n][m]);
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;

int main()
{
    string s; cin >> s;
    if(s == "Sunny") cout << "Cloudy";
    else if (s == "Cloudy") cout << "Rainy";
    else cout << "Sunny";
    cout << "\n";
    return 0;
    
}


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

using namespace std;

vector <int> v;

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

    for (int i = 0; i < 3 * N; ++ i) {
        int val;
        cin >> val;
        v.push_back(val);
    }

    sort(v.begin(), v.end());


    long long int ans = 0;

    int st = 0;
    int dr = 3 * N - 1;

    while (st <= dr) {
        ++ st;
        dr --;
        ans += v[dr --];
    }

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 2420
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int dp[10004];
int a[1000];
int b[1000];

int calc(int h, int i) {
    if (h <= a[i])
        return b[i];
    return dp[h-a[i]] + b[i];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h = gi();
    int n = gi();
    for (int i = 0; i < n; i++) {
        a[i] = gi();
        b[i] = gi();
    }

    for (int i = 1; i <= h; i++) {
        int b = calc(i, 0);
        for (int j = 1; j < n; j++) {
            int x = calc(i, j);
            b = MIN(b, x);
        }
        dp[i] = b;
    }

    printf("%d\n", dp[h]);

    return 0;
}


Measured memory_bytes: 256
import itertools
import numpy

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

grid = []
for i in range(N):
    X = list(map(int, input().strip().split()))
    grid.append(X)

# print(grid)
cnt = 0
grid2 = list(itertools.combinations(grid, 2))
for i in grid2:
    x = numpy.array(i[0])
    y = numpy.array(i[1])
  #  print(x, y)
    dis = numpy.linalg.norm(y - x)
    # print(dis)
    if (dis.is_integer()):
        # print(dis)
        cnt += 1

  # print("-------------")
print(cnt)
# distance = [math.sqrt(() ^ 2+() ^ 2) for i in rang(N)]
# for i in range(N):


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

using namespace std;

using int64 = long long;

struct UnionFind
{
  vector< int > data;

  UnionFind(int sz) : data(sz, -1) {}

  bool unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k)
  {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k)
  {
    return (-data[find(k)]);
  }
};

struct edge1
{
  int u, v, cost, idx;

  bool operator<(const edge1 &e) const
  {
    return (cost < e.cost);
  }
};

struct edge2
{
  int to, cost, idx;
};

int N, M, A[200000], B[200000], C[200000];
vector< edge1 > edges;
bool killed[200000];
vector< edge2 > tree[100000], g[100000];
int64 all, ans[200000];

set< pair< int, int > > component[100000];

void rec(int idx, int par = -1)
{
  for(auto &e : g[idx]) {
    component[idx].emplace(e.cost, e.idx);
  }

  for(auto &e : tree[idx]) {
    if(e.to == par) continue;
    rec(e.to, idx);

    auto &u = component[idx], &v = component[e.to];

    if(!v.empty()) {
      ans[e.idx] = all;
      ans[e.idx] -= e.cost;
      ans[e.idx] += v.begin()->first;
    }
    if(u.size() < v.size()) swap(u, v);

    for(auto &p : v) {
      if(u.count(p)) u.erase(p);
      else u.emplace(p);
    }
    v.clear();
  }
}

int main()
{
  scanf("%d %d", &N, &M);
  for(int i = 0; i < M; i++) {
    scanf("%d %d %d", &A[i], &B[i], &C[i]);
    --A[i], --B[i];
    edges.push_back((edge1) {A[i], B[i], C[i], i});
  }

  UnionFind uf(N);
  sort(begin(edges), end(edges));
  for(auto &e : edges) {
    if(uf.unite(e.v, e.u)) {
      killed[e.idx] = true;
      all += e.cost;
    }
  }

  if(uf.size(0) != N) {
    for(int i = 0; i < M; i++) puts("-1");
    return (0);
  }

  for(int i = 0; i < M; i++) {
    if(killed[i]) {
      tree[A[i]].emplace_back((edge2) {B[i], C[i], i});
      tree[B[i]].emplace_back((edge2) {A[i], C[i], i});
      ans[i] = -1;
    } else {
      g[A[i]].emplace_back((edge2) {B[i], C[i], i});
      g[B[i]].emplace_back((edge2) {A[i], C[i], i});
      ans[i] = all;
    }
  }

  rec(0);

  for(int i = 0; i < M; i++) {
    printf("%lld\n", ans[i]);
  }
}

Measured memory_bytes: 44904
<?php
  
  fscanf(STDIN,"%d",$N);

$count=0;
$tmp_div = 0;
$result = 0;

for($i=1;$i<= $N;$i++){
  $tmp_div = $i;
  if($i%2==1){
    
    
    
  	for($j=1;$j<=$i;$j++){
    if($i%$j == 0){
      	$count++;
      }
  	}
  }
  if($count==8){
    $result++;
  }
  $count=0;



}

echo $result."\n";

Measured memory_bytes: 4604
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 998244353
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

K,N = inpl()
MAX = K+N+10
fac = [1]*(MAX+1)
for i in range(1,MAX+1):
	fac[i] = (fac[i-1]*i)%mod

gyakugen = [1]*(MAX+1)
gyakugen[MAX] = pow(fac[MAX],mod-2,mod)
for i in range(MAX,0,-1):
	gyakugen[i-1] = (gyakugen[i]*i)%mod

def Comb(n,k):#nCk
	return (fac[n]*gyakugen[k]*gyakugen[n-k])%mod

#K=k,N=n,0pair = 0
def calc(k,n,i):
	x = (i-2)//2
	k -= x
	n -= x
	if k == 1:
		if n <= 1:
			return n
		else:
			return 0
	elif n == 0:
		return pow(2,x,mod)
	elif n < 0 or k <= 0:
		return 0

	tmp = 0
	for j in range(2):
		zb = n-j
		zm = k-2
		tmp += Comb(zb+zm,zb)%mod
	tmp %= mod
	tmp *= pow(2,x,mod)
	return tmp

ans = []
for i in range(2,K+2):
	if i%2 == 0:
		pairs = (i-2)//2
		tmp = 0
		for p0 in range(pairs+1):
			tmp += calc(K-p0*2,N,i-p0*2)*Comb(pairs,p0)%mod
			tmp %= mod
	ans.append(tmp)
	print(tmp)

ans = ans[::-1]
for i in range(1,K):
	print(ans[i])


Measured memory_bytes: 62808
S=input()
Q=int(input())
q=[input().split() for _ in range(Q)]

count=0
f=""
b=""

for i in range(Q):
    if q[i][0]=="1":
        count+=1
    else:
        if q[i][1]=="1":
            if count%2==0:
                f=q[i][2]+f
            else:
                b+=q[i][2]
        elif q[i][1]=="2":
            if count%2==1:
                f=q[i][2]+f
            else:
                b+=q[i][2]

if count%2==1:
    S=f+S+b
    print(S[::-1])
else:
    print(f+S+b)

Measured memory_bytes: 41464
n=int(input())
s=[int(input()) for i in range(n)]
s.append(0)
s.sort()
ans=sum(s)

for i in range(n+1):
    if (ans-s[i])%10!=0:
        print(ans-s[i])
        exit()
print(0)

    
    



        
    

    





    





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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;
typedef tuple<long long, long long, long long> tllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
static const int INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
bool compTuple(const tllint& arg1, const tllint& arg2) { return get<2>(arg1) > get<2>(arg2); }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;

    vector<set<int>> st(26, set<int>({INF}));
    for(int in=0;in<n;in++) {
        st[s[in]-'a'].insert(in);
    }

    for(int iq=0;iq<q;iq++) {
        int num;
        cin >> num;
        if(num==1) {
            int iq;
            char bq, cq;
            cin >> iq >> cq; iq--;
            bq = s[iq];
            s[iq] = cq;
            st[bq-'a'].erase(iq);
            st[cq-'a'].insert(iq);
        }
        else {
            int lq, rq;
            cin >> lq >> rq; lq--;
            int res = 0;
            for(int ic=0;ic<26;ic++) {
                if(st[ic].empty()) continue;
                int l = *st[ic].lower_bound(lq);
                if(rq>l) ++res;
            }
            cout << res << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 27276
a=int(input())
b=int(input())
c=int(input())
x=int(input())

ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                ans+=1

print(ans)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int ans = 0;
string S;

void solve(){
	for (int i = 0; i < S.size(); ++i)
	{
		if(S[i] == '1') ans++;
	}
}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> S;
	solve();
	answer();

	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

from collections import Counter

a = [None] * n
for i in range(n):
    if s[i] == "R":
        a[i] = 0
    if s[i] == "G":
        a[i] = 1
    if s[i] == "B":
        a[i] = 2

c = [0] * 3
for v in a:
    c[v] += 1

ans = 1
for v in c:
    ans *= v

cnt = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        k = 2 * j - i
        if j < k and k < n:
            if s[i] == s[j]:
                continue
            if s[i] == s[k]:
                continue
            if s[j] == s[k]:
                continue
            cnt += 1

ans -= cnt

print(ans)


Measured memory_bytes: 68980
from collections import deque

n,k = map(int,input().split())
v = list(map(int,input().split()))

mini = min(n,k)
mx = 0

for a in range(mini+1):
    for b in range(mini+1-a):
        if b==0:
            bb=-n-2
        else:
            bb=b
        ttl = sum(v[:a])+sum(v[-bb:])
        #print(a,b,sum(v[:a]),sum(v[-bb:]))
        hu = [i for i in v[:a] if i<0 ]
        hu.extend([i for i in v[-bb:] if i<0] )
        hu.sort()
        ttl-= sum(hu[:k-a-b])
        mx = max(mx,ttl)
print(mx)


Measured memory_bytes: 42352
from collections import deque
n = int(input())
A = sorted(list(map(int, input().split())))[::-1]

deq = deque([A[0]])
ans = 0
for x in A[1:]:
    ans += deq.popleft()
    deq.append(x)
    deq.append(x)
print(ans)

Measured memory_bytes: 32336
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> ii;
#define F first
#define S second
#define sqr(x) (x)*(x)
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,x,y) for(int i=x;i<(y);++i)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

const int mod = 2019;
const int N = 2e5+9;

int dp[N],cnt[mod];

int fastexp(int x){
	if(x==0) return 1;
	int ans = fastexp(x/2);
	ans = (ans*ans)%mod;
	if(x&1) ans = (ans*10)%mod;
	return ans;
}

signed main(){
	IOS;
	string s; cin >> s;
	reverse(all(s));
	dp[0] = 0;
	cnt[0]=1;
	rep(i,0,sz(s)){
		dp[i+1] = dp[i] + fastexp(i+1)*(int)(s[i]-'0');
		dp[i+1]%=mod;
		cnt[dp[i+1]]++; 
	}
	int ans = 0;
	for(int i = 0; i < 2019;i++){
		ans+=((cnt[i])*(cnt[i]-1))/2;
	}
	cout << ans << "\n";
}

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

const int maxn = 1e5+10;
const int mod = 1e9+7;

using namespace std;

void solve(){
	int n;
	ll ans=0;
	cin>>n;
	vi vs(n);
	for(int &x:vs) cin >> x;
	sort(vs.rbegin(),vs.rend());
	vll aux;
	aux.pb(vs[0]);
	for(int i=1;i<n;++i){
		aux.pb(vs[i]);
		aux.pb(vs[i]);
	}
	for(int i=0;i<n-1;++i)
		ans+=aux[i];
	cout<<ans<<endl;
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 8212
import numpy as np
n=int(input())
a=[int(j)for j in input().split()]+[10**7]
l=np.zeros(max(a)+1)
a.sort()
r=0
for i,j in zip(a,a[1:]):
    if l[i]==0:
        l[::i]=1
        if i!=j:
            r+=1
print(r)

Measured memory_bytes: 115220
import sys
N = int(input())
array_plus = []
for I in range(N):
    array_plus.append(input())
M = int(input())
array_minus = []
for J in range(M):
    array_minus.append(input())

if not (1 <= N <= 100 and 1 <= M <= 100):
    sys.exit()
for K in range(len(array_plus)):
    if len(array_plus[K]) > 10:
        sys.exit()
    if not array_plus[K].islower():
        sys.exit()
for L in range(len(array_minus)):
    if len(array_minus[L]) > 10:
        sys.exit()
    if not array_minus[L].islower():
        sys.exit()

all = []
all = array_plus+array_minus
all_unique = set(all)
all_unique = list(all_unique)
result = 0
for I in range(len(all_unique)):
    tmp = array_plus.count(all_unique[I]) - array_minus.count(all_unique[I])
    if tmp > result:
        result = tmp
print(result)

Measured memory_bytes: 9188
List = list(map(int, input().split()))

Set0 = List[0]//(List[1]+List[2])
E = List[0] - (List[1]+List[2])*Set0

if E >= List[1]:
    Blue = Set0 * List[1] + List[1]
else:
    Blue = Set0 * List[1] + E

print(Blue)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/algorithm>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

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

/**************************************************************/

	int n;	//The Minkowski’s distance when p = 00
	cin >> n;
	double dbvc[n];	//vcd stands for "difference between vectors components"

	for(int i = 0; i < n; i++)
		cin >> dbvc[i];		//this would be the vector 'x'

	double distance, temp, max_difference = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> temp;	//this would be the vector 'y'
		dbvc[i] = abs(dbvc[i] - temp);
		max_difference = max(max_difference, dbvc[i]);
	}

	for(int j = 0; j < 3; j++)
	{
		distance = 0;
		for(int i = 0; i < n; i++)
			distance+= pow(dbvc[i], j+1);
		cout << pow(distance, 1.0/(j+1)) << endl;
	}
	cout << max_difference << endl;
}



Measured memory_bytes: 3508
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
  string s;
  cin >>s;
  int n=s.size();
  if(n==26){
     int chk=5000;
     for(int i=24;i>=0;i--){
       int a=s.at(i);
       int b=s.at(i+1);
       if(a<b){
         chk=i;
         break;
       }
     }
     if(chk==5000)cout <<-1 << endl;
     else{
       int m=26-chk;
       vector<char> l(m);
       rep(i,m){
         l.at(i)=s.at(chk+i);
       }
       sort(l.begin(),l.end());
       rep(i,chk){
         cout << s.at(i);
       }
       rep(i,m){
         if(l.at(i)==s.at(chk)){
       cout << l.at(i+1) << endl;
         }
       }
     }
  }
  else{
    set<char> l;
    rep(i,n){
      l.insert(s.at(i));
    }
    char ans;
    rep(i,26){
      int k='a'+i;
      if(l.count(char(k))){}
      else{
        ans=char(k);
        break;
      }
    }
    cout << s << ans << endl;
  }
}

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

ll solve() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
        if ( A[i] == 0 ) return 0;
    }
    long double p = 1, m = 1e18;
    for ( int i = 0; i < N; i++ ) {
        p *= A[i];
        if ( p > m ) return -1;
    }
    ll ans = p;
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3932
#include <bits/stdc++.h>
#define FLASH ios_base::sync_with_stdio(0);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";


using namespace std;

ll n,x,k;

int main(){
FLASH;
ll kol;
cin>>n>>x>>k;
if(n%x==0)kol=n/x;
else kol=n/x+1;

cout<<kol*k<<endl;







return 0;
} 


Measured memory_bytes: 3652
#include<iostream>
#include<vector>

using namespace std;

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

int main(){
  int n,y;
  cin>>n>>y;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n-i;j++){
      if(i*10000+j*5000+(n-i-j)*1000==y){
        cout<<i<<" "<<j<<" "<<(n-i-j)<<endl;
        return 0;
      }
    }
  }
  cout<<"-1 "<<"-1 "<<"-1"<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

int main() {
	string in;
	ll k;

	cin >> in >> k;

	rep(i,0,in.size()) {
		if (in[i] == 'a') continue;
		int num = 26 - (in[i] - 'a');
		if (num <= k) {
			k -= num;
			in[i] = 'a';
		}
	}

	k %= 26;
	rep(i,0,k) {
		if(in[in.size()-1] == 'z') in[in.size()-1] = 'a';
		else in[in.size()-1]++;
	}

	cout << in << endl;

	return 0;
}


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

int main()
{
    int p, q, r;
    cin >> p >> q >> r;

    cout << min({p+q, p+r, q+r}) << endl;


    return 0;
}

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

/**************************************
delete????????????????????§???????????°???????°??????????????????¨
????????????delete???solve()???????????£???????????????????????????????????????
*/

struct tree {
	int node;
	tree *right;
	tree *left;
};

void find(tree *trees, int num) {
	while (true) {
		if (trees->node == num) {
			std::cout << "yes" << std::endl;
			return;
		} else {
			if (trees->node < num) {
				if (trees->right == NULL) {
					std::cout << "no" << std::endl;
					return;
				}
				trees = trees->right;
			} else if (trees->node > num) {
				if (trees->left == NULL) {
					std::cout << "no" << std::endl;
					return;
				}
				trees = trees->left;
			}
		}
	}
}

void insert(tree *trees) {
	int num;
	std::cin >> num;
	tree *t = new tree;
	t->node = num;
	t->left = NULL;
	t->right = NULL;
	while (true) {
		if (trees->node > num) {
			if (trees->left != NULL) {
				trees = trees->left;
			} else {
				trees->left = t;
				return;
			}
		} else {
			if (trees->right != NULL) {
				trees = trees->right;
			} else {
				trees->right = t;
				return;
			}
		}
	}
}

void show_in_order(tree *trees) {
	if (trees->left != NULL) show_in_order(trees->left);
	std::cout << " " << trees->node;
	if (trees->right != NULL) show_in_order(trees->right);
}

void show_pre_order(tree *trees) {
	std::cout << " " << trees->node;
	if (trees->left != NULL) show_pre_order(trees->left);
	if (trees->right != NULL) show_pre_order(trees->right);
}

void solve(tree *trees) {
	int num;
	std::cin >> num;
	std::string str;
	std::cin >> str;
	int n;
	std::cin >> n;
	trees->node = n;
	trees->left = NULL; trees->right = NULL;

	for (int i = 0; i < num - 1; i++) {
		std::cin >> str;
		if (str == "insert") {
			insert(trees);
		} else if (str == "print") {
			show_in_order(trees);
			std::cout << std::endl;
			show_pre_order(trees);
			std::cout << std::endl;
		} else if (find) {
			int number;
			std::cin >> number;
			find(trees, number);
		}
	}
}

int main() {
	tree trees;
	solve(&trees);

	return 0;
}

Measured memory_bytes: 13712
#include<stdio.h>
int main(){
int n,x,i,m,minm=1234567890,r;
scanf("%d%d",&n,&x);
r=n;
for(i=0;i<n;i++){
scanf("%d",&m);
x-=m;
if(m<minm){minm=m;}
}
printf("%d\n",r+(x/minm));
return 0;
}

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

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i ,a, b) for (int i = a ; i <= b ; i++)
#define sz(a) int(a.size())
#define cuti(a) cout << a << endl;
#define cutii(a,b) cout << a << " " << b << endl;
#define cutiii(a,b,c) cout << a << " " << b << " " << c << endl;
#define vec(a) vector<int > a;

template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }

typedef long long LL;
typedef pair<int ,int > pii;
typedef pair<string ,int > psi;
typedef pair<string ,string > pss;
typedef pair<LL, LL> pLL;

const long long oo = 1e9 + 7;
const double PI = acos(-1.0);

double DEG_to_RAD(double d) { return d * PI / 180.0; }

int n,k,cnt;
int a[223456];
int check[223456];
vector<int > b;

int main(){
 //   freopen("test.txt","r",stdin);
    cin >> n >> k;
    memset(check,0,sizeof(check));
    for (int i =1 ;i <= n; i++) {
        cin >> a[i];
        if (!check[a[i]]) {
            cnt++;
        }
        check[a[i]]++;
    }
    for (int i = 1 ; i <= 200000; i++) {
        if ( check[i]) {
        //    cout << i << endl;
        //    cout <<check[i] << endl;
            b.push_back(check[i]);
        }
    }
    sort(b.rbegin(),b.rend());
    int ans = 0;
    for (int i =0 ; i < k ; i++) {
        ans += b[i];
        if ( ans == n ) break;
    }
    cout << n - ans << endl;
}


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))

typedef long long ll;

int main(){
    
    string s;
    int K;
    cin>>s>>K;
    
    vector<int> diff(s.size());
    REP(i,s.size())diff[i] = (s[i]=='a') ? 0 : 'z'-s[i]+1;
    
    REP(i,s.size()){
        if(K>=diff[i]){
            s[i]='a';
            K-=diff[i];
        }
    }
    
    if(K>0){
        s[s.size()-1]=(char)('a'+(s[s.size()-1]-'a'+K)%26);
    }
    
    cout<<s<<endl;
    
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <complex>
#include <cctype>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <iomanip>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

const ll INF = 100000000;
const ll MOD = 1000000007;

ll pow_mod(ll a,ll b,ll mod){
    if(a%mod==0){
        return 0;
    }

    ll x = 1;

    while(b>0){
        if(b&1){
            x = (x * a) % mod;
        }
        a = (a * a) % mod;
        b >>= 1;
    }
    return x;
}

int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    //問題文中の添え字が0-indexか1-indexか確認!

    ll k;
    std::cin >> k;
    ll n = 50;
    ll a[50];
    rep(i,0,50){
        a[i] = i + (k / 50);
    }
    rep(i,0,k%50){
        a[i] += n;
        rep(j, 0, n)
        {
            if(i!=j){
                a[j]--;
            }
        }
    }
    std::cout << n << "\n";
    rep(i,0,n){
        std::cout << a[i] << " ";
    }
    return 0;
}

Measured memory_bytes: 256