akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

a = int(input())
b = list(map(int,input().split()))

def solve(l):
    ret = 0
    if len(l)==1:
        return l[0]
    elif 0 in l:
        part_l = []
        for i in l:
            if i != 0:
                part_l.append(i)
            else:
                if len(part_l)>0:
                    ret+=solve(part_l)
                    part_l = []
        if len(part_l)>0:
            ret+=solve(part_l)
        return ret
    else:
        min_l = min(l)
        ret+=min_l
        l = list(map(lambda x:x-min_l,l))
        return ret + solve(l)

print(solve(b))


Measured memory_bytes: 3188
#include<iostream>
#include<cmath>
using namespace std;
int h, w;
pair<int, int>solve() {
	int sq = h*h + w*w;
	for (int i = h + 1; i <= sqrt(sq); i++) {
		double d = sqrt(sq - i*i);
		int it = sqrt(sq - i*i);
		if ((double)i >= it)break;
		if (d - it <= 0.000001) {
			return make_pair(i, it);
		}
	}
	while (true) {
		sq++;
		for (int i = 1; i <= sqrt(sq); i++) {
			double d = sqrt(sq - i*i);
			int it = sqrt(sq - i*i);
			if ((double)i >= it)break;
			if (d - it <= 0.000001) {
				return make_pair(i, it);
			}
		}
	}
}
int main() {
	while (cin >> h >> w, h, w) {
		pair<int, int>ans = solve();
		cout << ans.first << ' ' << ans.second << '\n';
	}
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>  
#define PI acos(-1.0)  
#define pb push_back  
#define F first  
#define S second  
using namespace std;  
typedef long long ll;  
const int N=1e5+5;  
//ll a[N],sum[N];  
struct node{  
    ll a,b,c;  
}p[N];  
int n,m,i,j,k;  
bool cmp(node x,node y){  
    return x.a*i+x.b*j+x.c*k>y.a*i+y.b*j+y.c*k;  
}  
int main(void){  
    ios::sync_with_stdio(false);  
    cin.tie(0);cout.tie(0);  
    cin >> n>>m;  
    ll ans=0;  
    for(int i=1;i<=n;i++)   cin >>p[i].a>>p[i].b >>p[i].c;  
    for( i=-1;i<=1;i+=2){
        for( j=-1;j<=1;j+=2){  
            for( k=-1;k<=1;k+=2){  
                sort(p+1,p+1+n,cmp);  
                ll t[4]={0};  
                for(int te=1;te<=m;te++)    t[1]+=p[te].a,t[2]+=p[te].b,t[3]+=p[te].c;  
                ans=max(ans,t[1]*i+t[2]*j+t[3]*k);  
            }  
        }  
    }  
    cout << ans << endl;  
  
    return 0;  
}  

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int[] arr = new int[N];
        long sum=0;
        for(int i=0;i<N;i++){
            arr[i]=sc.nextInt();
            sum+=arr[i];
        }
        Arrays.sort(arr);
        System.out.printf("%d %d %d\n",arr[0],arr[N-1],sum);
    }     
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll ans=0;
    rep(i,n){
        if(s[i]=='R'){
            ans++;
        }else{
            ans--;
        }
    }
    Yes(ans>0);
    return  0;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){

  while(x->left != NIL)
    x = x->left;
  return x;

}

Node treeMaximum(Node x){

  while(x->right != NIL)
    x = x->right;
  return x;

}

Node treeSearch(Node u, int k){

   if(u == NIL && k == u->key)return u;
  if(k < u->key)return treeSearch(u->left, k);
  if(k > u->key)return treeSearch(u->right, k);

}

Node treeSuccessor(Node x){
    

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}



void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

   if(x==NIL) root=z;
   else
     {
       while(x != NIL)
         {
           if(x->key >= k) y= x->left;

           else y= x->right;

      if(y!=NIL) y->parent=x;
      else
        {
          if(x->key >=k) x->left = z;
          else x->right = z;
        }
      x=y;  
             
         }
     }


}

void inorder(Node u){


if(u == NIL)return;

inorder(u->left);
printf(" %d",u->key);
inorder(u->right);

}
void preorder(Node u){


if(u == NIL)return;
      
  printf(" %d",u->key);
preorder(u->left);
preorder(u->right);


}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
            else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}


Measured memory_bytes: 25144
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int A, B, C;
  while (cin >> A >> B >> C) {
    int res = max({A, B, C}) - min({A, B, C});
    cout << res << endl;
  }
  return 0;
}


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

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

class Point{
    public:
    double x,y;
    Point(double x=0,double y=0):x(x),y(y){}
    Point operator+(const Point &p){
        return Point(x+p.x,y+p.y);
    }
    Point operator-(const Point &p){
        return Point(x-p.x,y-p.y);
    }
    Point operator*(const double &a){
        return Point(a*x,a*y);
    }
    Point operator/(const double &a){
        return Point(x/a,y/a);
    }
    double abs(){
        return sqrt(norm());
    }
    double norm(){
        return x*x+y*y;
    }
    bool operator<(const Point &p){
        return x!=p.x?x<p.x:y<p.y;
    }
    bool operator==(const Point &p){
        return fabs(x-p.x)<EPS&&fabs(y-p.y)<EPS;
    }
};
typedef Point Vector;
struct Segment{
    Point p1,p2;
    Segment(){}
    Segment(Point p1,Point p2):p1(p1),p2(p2){}
};

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

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

bool isOrthogonal(Segment s1,Segment s2){
    return equals(dot(s1.p2-s1.p1,s2.p2-s2.p1),0.0);
}

bool isParallel(Segment s1,Segment s2){
    return equals(cross(s1.p2-s1.p1,s2.p2-s2.p1),0.0);
}

Point project(Segment s,Point p){
    Vector base=s.p2-s.p1;
    double r=dot(p-s.p1,base)/base.norm();
    return s.p1+base*r;   
}

Point reflect(Segment s,Point p){
    return p+(project(s,p)-p)*2;
}

int main(){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d;
    Point p1(a,b),p2(c,d),p3;
    Segment s(p1,p2);
    int q;
    cin>>q;
    for(int i=0;i<q;i++){
        cin>>e>>f;
        Point p(e,f);
        p3=reflect(s,p);
        printf("%.10lf %.10lf\n",p3.x,p3.y);
    }
}


Measured memory_bytes: 3220
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
if a == 1:
    a += 13
if b == 1:
    b += 13
if a == b:
    print('Draw')
elif a < b:
    print('Bob')
else:
    print('Alice')

Measured memory_bytes: 68496
n = int(input())
blue = [input() for _ in range(n)]
m = int(input())
red = [input() for _ in range(m)]

result = 0

for i in set(blue):
    x = blue.count(i) - red.count(i)
    if x > 0 and x > result:
        result = x

print(result)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  string S;
  int AB = 0, frob = 0, baca = 0, dob = 0;
  for(int i = 0; i < N; i++){
    cin >> S;
    if(S.at(0) == 'B' && S.at(S.size() - 1) == 'A'){
      dob++;
      frob++;
      baca++;
    } else if(S.at(0) == 'B'){
      frob++;
    } else if(S.at(S.size() - 1) == 'A'){
      baca++;
    }
    for(int j = 0; j < S.size() - 1; j++){
      if(S.substr(j, 2) == "AB")AB++;
    }
  }
  int count = 0;
  if(dob == 0)count = min(frob, baca);
  else{
    if(frob > dob && baca > dob) {
      count += dob + 1;
      baca -= dob + 1;
      frob -= dob + 1;
      count += min(frob, baca);
    } else if(frob == dob && baca == dob){
      count += dob - 1;
      
    } else {
      count += dob;
    }
  }
  cout << AB + count << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	map<string,int>mp;
	mp["AC"]=0;mp["WA"]=1;mp["TLE"]=2;mp["RE"]=3;
	int cnt[4]={0,0,0,0};
	int n;cin>>n;for(int i=0;i<n;i++){
		string s;cin>>s;cnt[mp[s]]++;
	}
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d",cnt[0],cnt[1],cnt[2],cnt[3]);
}

Measured memory_bytes: 3736
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

/**
 * Lesson7B 1 から n までの数の中から、重複無しで３つの数を
 * 選びそれらの合計が x となる組み合わせ の数を求めるプログラム
 * 例えば、1 から * 5 までの数から３つを選んで
 * それらの合計が 9 となる組み合わせは、
 * ?1 + 3 + 5 = 9
 * ?2 + 3 + 4 = 9
 * の２通りがあります。
 *
 * @author Internship
 *
 */
public class Main{

	/**
	 * プログラムのエントリポイント
	 *
	 * @param args
	 */
	public static void main(String[] args) {

		// 答え
		ArrayList<Integer> intAryAnswer = new ArrayList<Integer>();

//		int intAnswerCount = 0;

		// 1列づつ読み込む
		try {
			BufferedReader insBR = new BufferedReader(
					new InputStreamReader(System.in));

			//２つの値が決まった時、残りの3つ目を初期化
			int intThird = 0;

			int intAnswer = 0;

			while (true) {
				String strLine = insBR.readLine();

				//終了条件
				if(strLine.equals("0 0")) {
					break;
				}
				// ばらけさせる
				String[] strAryLine = strLine.split(" ");

				//nの値
				int intN = Integer.parseInt(strAryLine[0]);

				//xの値
				int intX = Integer.parseInt(strAryLine[1]);

				//3
				//12 13 23
				//4
				//12 13 14 23 34

				for(int i = intN; i > 0 ; i--) {
					for(int j = i - 1; j > 0; j--) {
						intThird = intX - i - j;
						if(intThird <= intN &&
								intThird != i &&
								intThird != j &&
								0 < intThird &&
								intThird < j
								) {
							intAnswer++;
						}
					}
				}

				intAryAnswer.add(intAnswer);
				intAnswer = 0;
//				intAnswerCount++;

			}

			//出力
			int intsize = intAryAnswer.size();
			for(int i = 0; i < intsize; i++) {
				System.out.println(intAryAnswer.get(i));
			}

		} catch (IOException e) {
			System.out.println(e);
		} catch(NumberFormatException e) {
			System.out.println("数字で入力して下さい");
		}
	}
}

Measured memory_bytes: 18956
#include "bits/stdc++.h"
using namespace std;
//#define int long long
typedef long long ll;
#define endl '\n'
int mod=1e9+7;

int main(){
  int n,m;
  cin>>n>>m;
  int p[100000];
  int y[100000];
  vector<int> yd[100001];
  for(int i=0;i<m;i++){
    cin>>p[i]>>y[i];
    yd[p[i]].push_back(y[i]);
  }
  for(int i=0;i<n;i++)sort(yd[i+1].begin(),yd[i+1].end());
  for(int i=0;i<m;i++)printf("%012lld\n",ll(p[i])*1000000+int(lower_bound(yd[p[i]].begin(),yd[p[i]].end(),y[i])-yd[p[i]].begin())+1);
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> p2;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    cout<<ll(log(n)/log(k))+1;
}


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

#define f(i, a, b, c) for(int i = a ; i < b ; i += c)
#define fr(i, a, b, c) for(int i = a ; i >= b ; i -= c)
#define fit(it, v) for(auto it = v.begin() ; it != v.end() ; ++it)
#define frit(it, v) for(auto it = v.rbegin() ; it != v.rend() ; ++it)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define eb emplace_back
#define pb push_back
#define lli long long int
#define modn 998244353
#define NL '\n'

using namespace std;

typedef vector< int > vi;
typedef vector< char > vc;
typedef vector< bool > vb;
typedef vector< lli > vli;
typedef vector< vector< char > > vvc;
typedef vector< vector< int > > vvi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef pair< lli, int> pli;
typedef pair< lli, lli> pll;
typedef set< int > si;
typedef set< ii > sii;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	#ifdef LOCAL_TEST
		clock_t z = clock();
    	ifstream h("in");
	    ofstream g("out");
	#else
	    #define h cin
	    #define g cout
	#endif // LOCAL_TEST
	
	int a, b;
	h >> a >> b;
	string s(a, b + '0');
	string t(b, a + '0');
	g << (s <= t ? s : t);
	
	#ifdef LOCAL_TEST
		cerr << "Time taken is: " << double(clock() - z) / CLOCKS_PER_SEC << NL;
		h.close();
		g.close();
	#endif // LOCAL_TEST
}



Measured memory_bytes: 256
n, m = gets.chomp.split(" ").map(&:to_i)
mod = 10 ** 9 + 7 #大きい場合あまりを求める。
#犬は、n匹
#さるは、m匹
sa = n - m
ans = 1
ans_min = 1
ans_max = 1
if sa == 0
    while true
        ans *= n
        ans %= mod
        if n == 1
            break
        end
        n -= 1
    end
    all = ((ans * ans) % mod) * 2
    all %= mod
elsif sa.abs == 1
    min = [n,m].min
    max = [n,m].max
    # p min
    # p max
    while true
        ans_min *= min
        ans_min %= mod
        if min == 1
            break
        end
        min -= 1
    end
    while true
        ans_max *= max
        ans_max %= mod
        if max == 1
            break
        end
        max -= 1
    end
    # p ans_max
    # p ans_min
    all = (ans_max * ans_min) % mod    
else
    all = 0
end
puts all

Measured memory_bytes: 14212
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int n;
  cin>>n;
  int a[n];
  REP(i,n)cin>>a[i];
  lint ans1=0;
  lint ans2=0;
  int sign=1;
  lint sum=0;
  REP(i,n){
    if(sign*(sum+a[i])<0)sum+=a[i];
    else{
      ans1+=1+sign*(sum+a[i]);
      sum=-sign;
    }
    sign*=-1;
  }
  sign=-1;
  sum=0;
  REP(i,n){
    if(sign*(sum+a[i])<0)sum+=a[i];
    else{
      ans2+=1+sign*(sum+a[i]);
      sum=-sign;
    }
    sign*=-1;
  }
  cout<<min(ans1,ans2)<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  REP(i,n) cin >> s[i];

  pair<string, int> poll[200005];

  sort(ALL(s));

  poll[0].first = s[0];
  int cnt = 0;
  int maxp = 0;

  for(int i = 0; i < n - 1 ; ++i){

    if(s[i] == s[i+1]) {
      ++poll[cnt].second;
      maxp = max(poll[cnt].second, maxp);
    }
    else{
      ++cnt;
      poll[cnt].first = s[i+1];
    }
  }

  REP(i,200005){
    if(poll[i].second == maxp) cout << poll[i].first << endl;
  }

  return 0;
}

Measured memory_bytes: 17256
import           Control.Monad
import           Control.Applicative
import           Data.IORef
import           Data.List.Split
import           Data.Maybe
import           Data.List

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  sts <- replicateM n $ map read . words <$> getLine
  pts <- replicateM m $ map read . words <$> getLine

  forM_ sts $ \(sx:sy:_) -> do
    let ds = map (\(x:y:_) -> abs (sx - x) + abs (sy - y)) pts
    print $ 1 + (head . elemIndices (minimum ds)) ds

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    int len; cin >> len;
    string s; cin >> s;
    
    REP(i, len-2)
    {
        if(s[i] == 'A'&& s[i+1] == 'B' && s[i+2] == 'C') result++;
    }
    

    cout << result << endl;
    return 0;
}

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

const int N = 2e5 + 10;
const int mod = 1e9 + 7;

int a[N], ac;
int b[N], bc;

int main (void) {
	int k, n;
	scanf("%d%d", &n, &k);
	for (int i = 1, x; i <= n; i ++) {
		scanf("%d", &x);
		if (x < 0)
			a[++ ac] = -x;
		else 
			b[++ bc] = x;
	}
	sort(a + 1, a + ac + 1);
	sort(b + 1, b + bc + 1);
	if (n == k) {
		long long res = 1;
		for (int i = 1; i <= ac; i ++)
			res = res * a[i] % mod;
		for (int i = 1; i <= bc; i ++)
			res = res * b[i] % mod;
		if (ac & 1) {
			res = - res;
			if (res < 0)
				res += mod;
		}
		printf("%lld\n", res);
	} else if ((k & 1) && bc == 0) {
		long long res = 1;
		for (int i = 1; i <= k; i ++)
			res = res * a[i] % mod;
		res = - res;
		if (res < 0)
			res += mod;
		printf("%lld\n", res);
	} else {
		long long res = 1;
		if (k & 1) {
			k --;
			res = res * b[bc --] % mod;
		}
		while (k > 0) {
			if ((ac >= 2 && bc >= 2 && 1ll * a[ac] * a[ac - 1] >= 1ll * b[bc] * b[bc - 1])
				|| (ac >= 2 && bc < 2)) {
				res = res * a[ac --] % mod;
				res = res * a[ac --] % mod;
			} else {
				res = res * b[bc --] % mod;
				res = res * b[bc --] % mod;
			}
			k -= 2;
		}	
		printf("%lld\n", res);
	}
}

Measured memory_bytes: 4600
#include<bits/stdc++.h>
#define CLR(a)              memset(a, 0, sizeof(a))
#define SET(a, x)           memset(a, x, sizeof(a))
#define SORT(v)             sort(v.begin(), v.end())
#define REV(v)              reverse(v.begin(), v.end())
#define FOR(i, n)           for (int i=0; i<n; i++)
#define FOR1(i, n)          for (int i=1; i<=n; i++)
#define ROF(i, n)           for (int i=n-1; i>=0; i--)
#define ROF1(i, n)          for (int i=n; i>=1; i--)
#define LOOP(i, x, n)       for (int i=x; i<=n; i++)
#define READ(x)             freopen(x, "r", stdin);
#define WRITE(x)            freopen(x, "w", stdout);
#define fastIO()            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI                  acos(-1.0)
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define all(v)              v.begin(), v.end()

using namespace std;

typedef long long              ll;
typedef unsigned long long     ull;
typedef vector<int>            vi;
typedef pair<int, int>         pii;
typedef pair<string, int>      psi;
typedef pair<char, int>        pci;

const double eps = 1e-9;

int fx[] = {-1, 1, 0, 0, -1, -1, 1, 1};
int fy[] = {0, 0, -1, 1, -1, 1, -1, 1};

int kx[] = {1, 1, 2, 2, -1, -1, -2, -2};
int ky[] = {2, -2, 1, -1, 2, -2, 1, -1};

int main()
{
    string s; cin >> s;
    bool a = false, b = false;
    for (char x : s){
        if (x == 'A') a = true;
        if (x == 'B') b = true;
    }
    puts(a && b ? "Yes" : "No");
    return 0;
}




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

int main() {
    int a, b;
    cin >> a >> b;
    if(a <= 0 && b >= 0) cout << "Zero" << '\n';
    else if(a > 0) cout << "Positive" << '\n';
    else {
        if((b-a)%2 == 0) cout << "Negative" << '\n';
        else cout << "Positive" << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
int main(){
int n,m;
cin>>n>>m;
priority_queue<P,vector<P>,greater<P>> pq;
for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    pq.push(P(a,b));
}
int l=0,r=0,cnt=0;
while(!pq.empty()){
    P p=pq.top();
    pq.pop();
    if(l==0&&r==0){l=p.fi;r=p.se;}
    else if(r<=p.fi){
          cnt++;l=p.fi;r=p.se;
    }
    else if(l<p.fi||p.se<r){
        if(l<p.fi)l=p.fi;
        if(p.se<r)r=p.se;
      }
    while(!pq.empty()){
       P q=pq.top();
       if(q.fi==l)pq.pop();
       else break;
    }
    if(r-l==1){cnt++;l=0;r=0;}
}
if(l!=0&&r!=0&&r-l!=1){cnt++;}
cout<<cnt<<endl;
}




Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define each(i, c) for (auto& (i) : (c))

using namespace std;
typedef long long int lli;
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }

int main() {
    string s;
    cin >> s;
    lli i = 0, a = 0, cnt = 0;
    while (i < s.size()) {
        lli bc = 0;
        if (s[i] == 'A') {
            while (s[i] == 'A') {
                a++;
                i++;
            }
            if (i >= s.size()) break;
            while (s.substr(i,2) == "BC") {
                bc++;
                i += 2;
            }
            cnt += a*bc;
            if (i >= s.size() || s[i] != 'A') {
                a = 0;
            }
        } else {
            i++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	String str;
	int p;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		str = sc.next()+"z";
		cat();
		System.out.println( (str.charAt(p)=='z'? "Cat": "Rabbit" ) );
	}
	
	void cat() {
		if(str.charAt(p) != 'm') {
			return;
		}
		p++;
		cat();
		if(str.charAt(p) != 'e') {
			return;
		}
		p++;
		cat();
		if(str.charAt(p) != 'w') {
			return;
		}
		p++;
		return;
	}

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

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int n, k, c;
string s;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	cin >> n >> k >> c;
	cin >> s;
	debug(s);
	vector<int> next(n + 1, -1);
	for (int i = n - 1; i >= 0; --i) {
		if (i != n - 1) {
			next[i] = next[i + 1];
		}
		if (s[i] == 'o') {
			next[i] = i;
		}
	}
	vector<int> dp(n);
	for (int i = n - 1; i >= 0; --i) {
		if (i != n - 1) {
			dp[i] = dp[i + 1];
		}
		int right = 0;
		if (i + c + 1 < n) {
			right = dp[i + c + 1];
		}
		if (s[i] == 'o') {
			dp[i] = max(dp[i], 1 + right);
		}
	}
	int cur = next[0];
	vector<int> vec;
	while (cur != -1) {
		vec.push_back(cur);
		if (cur + c + 1 >= n) {
			break;
		}
		cur = next[cur + c + 1];
	}
	if ((int) vec.size() != k) {
		return 0;
	}
	for (int i = 0; i < k; ++i) {
		int curr = vec[i];
		int right = next[curr + 1];
		int ans1 = 0;
		if (right != -1) {
			ans1 = dp[right];
		} 
		if (i + ans1 < k) {
			cout << curr + 1 << '\n';
		}
	}
		
 	return 0;
}


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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define int ll
#define tcase int t; cin>> t; for( ; t; --t)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const double DEG = 180/PI;
const int MOD = 1e9+7;
int mod(int x, int m){ if(x >= 0) return x % m; if(-x < m) return m-(-x); return mod(x%m, m);}
int gcd (int a, int b) {while(b){a = mod(a, b); swap(a, b);} return a;}
int lcm (int a, int b) {return a / gcd(a, b) * b;}
int fexp(int base, int exp, int m){
	int total = 1;
	while(exp > 0){
		if(exp % 2 == 1){
			total = mod(((mod(total, m)) * (mod(base, m))), m);
			exp--;
		}
		base= mod((mod(base, m) * mod(base, m)), m);
		exp /= 2;
	}
	return mod(total, m);
}

int n;

int32_t main(){
	fastio;
	cin>> n;
	set<int> nums;
	bool flag = 1;
	for(int i = 0; i<n; ++i){
		int aux;
		cin>> aux;
		if(nums.find(aux) == nums.end()){
			nums.insert(aux);
		}
		else flag = 0;
	}
	cout<< (flag == 1? "YES\n": "NO\n");
	return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[233322];
    cin>>s;
    int a=strlen(s);string a1;
    for(int i=0;i<a;i++)
    {
    if(s[i]!='B')
    a1+=s[i];
    else
    {
        int k=a1.length();
        if(k==0) continue;
        else a1= a1.substr(0, a1.length() - 1);
    }
    }
    
    cout<<a1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> V;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;


int main() {
    int l,r,d;
    cin >> l;
    int ans = 0;
    rep(i,l){
         cin >> r;
         if(i%2==0&&r%2==1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3588
#include<iostream>

using namespace std;

int main() {
	char c[3][3];

	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}

	cout << c[0][0] << c[1][1] << c[2][2] << endl;
}


Measured memory_bytes: 256
def gcd(a,b):
    if b>a:
        a,b = b,a
    if b==0:
        return a
    else:
        return gcd(b,a%b)

N,K = map(int,input().split())
A = list(map(int,input().split()))

mm = A[0]

for i in range(1,N):
    mm = gcd(mm,A[i])

for i in range(N):
    if A[i]-K>=0 and (A[i]-K)%mm==0:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")





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

int main(){
	int d;
	while(cin>>d){
		if(d==25)cout<<"Christmas\n";
		else if(d==24)cout<<"Christmas Eve\n";
		else if(d==23)cout<<"Christmas Eve Eve\n";
		else cout<<"Christmas Eve Eve Eve\n";
	}
} 

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

int main() {
	size_t n, x;
	std::vector<size_t> v;

	std::cin >> n >> x;
	v.reserve(n);
	for (size_t i = 0; i < n; ++i) {
		size_t a;
		std::cin >> a;
		v.emplace_back(a);
	}

	size_t c = 0;
	for (size_t i = 0; i < n - 1; ++i) {
		unsigned long& a = v[i];
		unsigned long& b = v[i + 1];
		size_t s = a + b;
		if (s > x) {
			size_t d = s - x;
			c += d;
			if (d > b) {
				d -= b;
				b = 0;
				a -= b;
			} else {
				b -= d;
			};
		}
	}
	std::cout << c << std::endl;
}


Measured memory_bytes: 1024
N, *P = map(int, open(0).read().split())

R = [0] * N
for i, p in enumerate(P, 1):
    R[p - 1] = i

A = [30000 * i for i in range(1, N + 1)]
B = [30000 * (N - i) + r for i, r in enumerate(R, 1)]

print(*A)
print(*B)

Measured memory_bytes: 7104
#include <stdio.h>

#define N_MAX 100

int main(void)
{
  int N;
  int K;
  int K_count;
  int i;
  int j;
  int l;
  int Treat_count;
  int Trick_count;
  int Treat_Num;
  
  int Trick_flg[N_MAX];
  int di[N_MAX];
  int Treat[N_MAX][N_MAX];
  
  scanf("%d %d",&N,&K);
  
  if(N >= 1 && N <= 100 && K >= 1 && K <= 100)
  {
    for(K_count = 0; K_count < K; K_count++)
    {
      scanf("%d",&di[K_count]);
      
      for(i = 0; i < di[K_count]; i++)
      {
        scanf("%d",&Treat[K_count][i]);
        Treat_Num = Treat[K_count][i] -1;
        Trick_flg[Treat_Num] = 1;
      }
      
    }
    for(j = 0; j < N;j++)
    {
      Treat_count += Trick_flg[j];
    }
    Trick_count = N - Treat_count;
    printf("%d",Trick_count);
  }
  return 0;
}

Measured memory_bytes: 1748
// +build ignore
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []byte {
	return []byte(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

func run(input io.Reader, output io.Writer) int {
	sc := NewScanner()
	N := sc.nextInt()

	sum := 0
	for i := 1; i <= N; i++ {
		if i%3 == 0 || i%5 == 0 {
			continue
		}
		sum += i
	}

	fmt.Println(sum)
	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 1756
//Moh_K_Imar .......
//29/08/2020  ... 5,20.
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    ll x=b/a;
    if(x<=c)cout<<x<<endl;
    else cout<<c<<endl;


    return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
constexpr lnt INF = 2e18;
/*-*/

struct S
{
	int a,b,c,d;
	S(int a, int b, int c, int d) : a(a),b(b),c(c),d(d) {}
};

int main() {
	lnt n,m,q;
	std::cin >> n >> m >> q;
	std::vector<S> v;
	rep(i,q) {
		lnt a,b,c,d;
		std::cin >> a >> b >> c >> d;
		v.emplace_back(a,b,c,d);
	}
	lnt max=0;
	std::vector<lnt> a;
	auto calc = [&]()->lnt{
		lnt sum=0;
		for(auto e:v) {
			if(a[e.b]-a[e.a]==e.c) sum+=e.d;
		}
		return sum;
	};
	auto dfs = [&] (auto f, lnt i, lnt d) -> void {
		a.emplace_back(i);
		if(d==n) {
			max=std::max(max,calc());
			a.pop_back();
			return;
		}
		for(int to=i;to<=m;to++) {
			f(f,to,d+1);
		}
		a.pop_back();
	};
	dfs(dfs,1,0);
	print(max);
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int ans=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    while(a%2==0){
      a/=2;
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
	for( int i = 0; i < 3000; ++i ) {
		int x, y;
		cin >> x >> y;

		if( x == 0 && y == 0 ) {
			break;
		}

		if( x > y ) {
			int t = x;
			x = y;
			y = t;
		}

		cout << x << ' ' << y << endl;
	}
}



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

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;

ll sum(ll l, ll r) {
  return (l + r) * (r - l + 1) / 2;
}

int main() {
  int N, K;
  cin >> N >> K;
  ll ans = 0;
  for (int i = K; i <= N + 1; i++) {
    ll l = sum(0, i - 1);
    ll r = sum(N - i + 1, N);
    ans = (ans + (r - l + 1)) % mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(){

        double r;

        cin >> r;

        double area = pow(r,2) * M_PI;
        double circle = (r + r) * M_PI;
        cout << fixed << setprecision(6) << area << " "  <<circle << "\n";


        return 0;
}

Measured memory_bytes: 1288
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(void){
	uint32_t n, k;
	scanf("%"PRIu32"%"PRIu32, &n, &k);
	uint64_t ans=1;
	for(uint32_t i=k; i<=n; i++){
		ans+=(uint64_t)i*(n-i+1)+1;
		ans%=1000000007;
	}
	printf("%"PRIu64"\n", ans);
}



Measured memory_bytes: 1724
#include<stdio.h>
int main(){
	int i,j,h,w;
	while(1){
		scanf("%d%d",&h,&w);
		if(h==0&&w==0)break;
		/* line 1*/
		for(i=0;i<w;i++){
			printf("#");
		}
		printf("\n");
		/* line 2-(h-1)*/
		for(j=1;j<h-1;j++){
			printf("#");
			for(i=1;i<w-1;i++){
				printf(".");
			}
			printf("#\n");
		}
		/* line h*/
		for(i=0;i<w;i++){
			printf("#");
		}
		printf("\n\n");
	}
	return 0;
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
using namespace std;
 
 #define ll long long
int main()
{
	ll num1, num3, num2, num4;
	cin >> num1 >> num3 >> num2 >> num4;
	num2=min(4*num1, num2);
	num2=min(2*num3, num2);
 
	ll amount;
	cin >> amount;
 
	if(amount%2==0)
	    cout << min(amount*num2, (amount/2)*num4) << endl;
	else{
		cout << min(amount*num2, (amount/2)*num4+num2) << endl;
	}
 
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>




int main()
{
	int N=0;
	
	scanf("%d",&N);
	
	int x = N % 10;
	
	if(x == 3){
		printf("bon");
	}
	else if(x==0||x==1||x==6||x==8){
		printf("pon");
	}
	else{
		printf("hon");
	}

	return 0;
}


Measured memory_bytes: 1724
A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
bingos = [(A11, A12, A13), (A21, A22, A23), (A31, A32, A33), (A11, A21, A31), (A12, A22, A32), (A13, A23, A33), (A11, A22, A33), (A13, A22, A31)]
bingo_cnt = [0,0,0,0,0,0,0,0]
N = int(input())
for i in range(N):
  b_temp = int(input())
  for j in range(len(bingos)):
    if b_temp in bingos[j]:
      bingo_cnt[j] += 1
if max(bingo_cnt) == 3:
  print('Yes')
else:
  print('No')

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

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

  if (C==0) {
    cout << A * 2 << endl;
  }
  else if (C > 0) {
    cout << B * 2 - 1 << endl;
  }
    else if (C < 0 ) {
    cout << A * 2 - 1 << endl;
  }
}


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

int main() {
    int n, k;
    cin >> n >> k;
    int ans = INT_MAX, x[n], one = INT_MAX;
    rep(i, n) {
        cin >> x[i];
        one = min(one, abs(x[i]));
    }
    /*
    if (k == 1) ans = one;
    else {
        */
        rep(i, n - k + 1) {
            int l = x[i], r = x[k+i-1];
            int num = r - l + min(abs(l), abs(r));
            ans = min(ans, num);
        }
    //}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let x: usize = sc.read();
    let t: usize = sc.read();

    let ans = t * (n as f64 / x as f64).ceil() as usize;
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 2680
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGoodDistance solver = new BGoodDistance();
        solver.solve(1, in, out);
        out.close();
    }

    static class BGoodDistance {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int d = in.nextInt();
            int a[][] = new int[n][d];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < d; j++) {
                    a[i][j] = in.nextInt();
                }
            }
            int count = 0;
            long sum = 0;
            for (int i = 0; i < n; i++) {

                for (int j = i + 1; j < n; j++) {
                    sum = 0;
                    for (int k = 0; k < d; k++) {
                        sum += (a[j][k] - a[i][k]) * (a[j][k] - a[i][k]);
                    }
                    long x = (long) Math.sqrt((double) sum);
                    if (x * x == sum) {
                        count++;
                    }
                }
            }
            out.println(count);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 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());
        }

    }
}



Measured memory_bytes: 21332
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
using namespace std;
using namespace __gnu_pbds;
auto random_address = [] { char *p = new char; delete p; return uint64_t(p); };
const uint64_t SEED = chrono::steady_clock::now().time_since_epoch().count() * (random_address() | 1);
mt19937_64 rng(SEED);
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll arb[3000001],x,n,k,answer;
void update(int nod,int st,int dr,int poz,int val)
{
    if(poz<st||poz>dr)
        return;
    if(poz>=st&&poz<=dr)
        arb[nod]=val;
    if(st!=dr)
    {
        int mij=(st+dr)/2;
        if(poz<=mij)
            update(nod*2,st,mij,poz,val);
        if(poz>mij)
            update(nod*2+1,mij+1,dr,poz,val);
        arb[nod]=max(arb[2*nod],arb[2*nod+1]);
    }
}
int query(int nod, int st, int dr, int a, int b)
{
    if(a<=st&&b>=dr)
        return arb[nod];
    else
    {
        int mij=(st+dr)/2;
        int ans=0;
        if(a<=mij)
            ans=max(ans,query(nod*2,st,mij,a,b));
        if(b>mij)
            ans=max(ans,query(nod*2+1,mij+1,dr,a,b));
        return ans;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        ll l=max(0LL,x-k);
        ll r=min(300000LL,x+k);
        ll val=query(1,0,300000,l,r)+1;
        update(1,0,300000,x,val);
        answer=max(answer,val);
    }
    cout<<answer;
    return 0;
}


Measured memory_bytes: 11848
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_6_B
{
    public class Program

    {
        public static string[] MarksStr = new string[] { "S", "H", "C", "D" };

        public static void Main(string[] args)
        {
            string[] line;
            bool[,] cards = new bool[4,13];
            int n = ReadInt();

            for (int cnt = 0; cnt < n; cnt++)
            {
                line = ReadStAr();
                for (int i = 0; i < MarksStr.Length; i++)
                {
                    if (line[0].Equals(MarksStr[i]))
                    {
                        cards[i, int.Parse(line[1]) - 1] = true;
                        break;
                    }
                }
            } 

            for(int i = 0;i < cards.GetLength(0);i++)
            { 
                for (int j = 0; j < cards.GetLength(1); j++)
                {
                    if (!cards[i,j]) Console.WriteLine("{0} {1}", MarksStr[i], j + 1);
                }
            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 15908
<?php

	$n = trim(fgets(STDIN));
	$f = true;
	if($n[0] != '1') $f = false;
	for($i=1; $i<strlen($n); $i++){
	    if($n[$i] != '0') $f = false;
	}
	if($f) echo 10;
	else{
	    $ans = 0;
	    for($i=0; $i<strlen($n); $i++){
	        $ans += (int)$n[$i];
	    }
	    echo $ans;
	}
?>

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

int main(){
    int N,M;
    cin>>N>>M;
    vector<ll> A(N);
    vector<P> CB(M);
    for(int i=0; i<N; i++)cin>>A[i];
    for(int i=0; i<M; i++)cin>>CB[i].second>>CB[i].first;
    sort(A.begin(),A.end());
    sort(CB.begin(),CB.end());
    reverse(CB.begin(),CB.end());
    vector<ll> D(N,-1);
    ll j=0,k=0;
    while(j<N&&k<M){
        D[j]=CB[k].first;
        CB[k].second--;
        if(CB[k].second==0)k++;
        j++;
    }
    ll ans=0;
    for(int i=0; i<N; i++){
        if(A[i]<D[i]) ans+=D[i];
        else ans+=A[i];
    }
    cout<<ans;
    return 0;
}

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

int main(void){
    int h,w,n;
    cin >> h >> w >> n;
    cout << ceil((double)n/max(h,w)) << endl;
}

Measured memory_bytes: 256