akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, K: int, Q: int, A: "List[int]"):
    # N:参加者, K:初回ポイント, Q:正解数, A:正解者番号
    lastP = K - Q
    lists = []
    for i in range(N):
        lists.append(lastP)
    for n in A:
        lists[n-1] += 1
    # print(lists)
    for n in lists:
        print(YES if n > 0 else NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(Q)]  # type: "List[int]"
    solve(N, K, Q, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10472
"""Quick Sort."""

def partition(A, p, r):
    """Divide list A into A[p:q] whose elements aren't greater than A[q] and
    A[q+1:r] whose elements are greater than A[q].

    Each element of A is a list [x, y].
    x is a character of S, H, C or D (trump suits).
    y is a natural number.
    Sorting is done based on y numbers.
    
    Default value of p is 0.
    The number as a refernce of the division is A[r].
    
    Return the index q.
    """

    x = A[r][1]
    i = p - 1
    for j in range(p, r):
        if A[j][1] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1


def quickSort(A, p, r):
    """Sort list A in ascending order with quick sort algorithm.

    Default value of p is 0 (the start index).
    r is 1 less than the length of A (the last index of A).
    """

    if p < r:
        q = partition(A, p, r)
        quickSort(A, p, q - 1)
        quickSort(A, q + 1, r)


def is_stable(A, B):
    """Check the stability of sorted list A.

    A is a sorted list.
    B is a original list.

    Return True or False.
    """

    cA = list(A)
    for x in B:
        i = cA.index(x)
        if i == 0:
            pass
        elif cA[i - 1][1] == x[1]:
            return False
        del cA[i]
    return True



import sys

r = int(sys.stdin.readline()) - 1

A = []

for x in sys.stdin.readlines():
    suit, num = x.split()
    num = int(num)
    A.append([suit, num])

B = list (A)

quickSort(A, 0, r)

if is_stable(A, B):
    print('Stable')
else:
    print('Not stable')

for x in A:
    print(*x)

Measured memory_bytes: 27852
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ABC
{
    //          int[] split = Console.ReadLine().Split().Select(int.Parse).ToArray();

    public static void Main()
    {
        int N = int.Parse(Console.ReadLine());

        Task[] tasks = new Task[N];
        for (int i = 0; i < N; i++)
        {
            int[] split = Console.ReadLine().Split().Select(int.Parse).ToArray();
            tasks[i] = new Task(split[0], split[1]);
        }
        Array.Sort(tasks, comparer);
        string output = "Yes";
        long elapsedTime = 0;
        for (int i = 0; i < N; i++)
        {
            elapsedTime += tasks[i].A;
            if (elapsedTime > tasks[i].B)
            {

                output = "No";
                break;
            }

        }

        Console.WriteLine(output);

    }
    public static int comparer(Task A, Task B)
    {
        return A.B.CompareTo(B.B);
    }
    

    

}


public class Task
{
    public int A;
    public int B;
    public Task() { }
    public Task(int A, int B)
    {
        this.A = A;
        this.B = B;
    }
}

Measured memory_bytes: 25612
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	dam := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &dam[i])
	}
	yama := make([]int, n)
	yama[0] = 0

	for i := 0; i < n; i++ {
		if i%2 == 0 {
			yama[0] += dam[i]
		} else {
			yama[0] -= dam[i]
		}
	}

	for i := 1; i < n; i++ {
		yama[i] = (dam[i-1] - yama[i-1]/2) * 2
	}

	for i := 0; i < n; i++ {
		fmt.Printf("%d ", yama[i])
	}

	fmt.Println()

}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

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

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

bool
ok (int P, int k, vector<int>&ws) {
  int p = 0;
  for (int w : ws) {
    if (p + w <= P) {
      p += w;
    } else if (k >= 2 && w <= P) {
      --k;
      p = w;
    } else {
      return false;
    }
  }
  return true;
}

int main() {

  int n, k; cin >> n >> k;
  vector<int> ws(n);
  rep (i, n) cin >> ws[i];

  int W = 0;
  for (int w : ws) W += w;
  
  int l = 1; int r = W;
  while (l + 1 < r) {
    int m = (l + r) / 2;
    if (ok(m, k, ws)) r = m;
    else l = m;
  }

  while (!ok(l, k, ws)) ++l;

  cout << l << endl;

  return 0;
}

Measured memory_bytes: 1524
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string YABAI, WAYO;
  char moji;
  int A, B, C, D, E =0;
  
  cin >> A >> B;
  
  vector<int> OOTJNY(A);
  
  for(int YUNI =0; YUNI < A; YUNI++){
    cin >> OOTJNY.at(YUNI);
  }
  
  for(int YUNI =0; YUNI < A; YUNI++){
    for(int OOT =YUNI +1; OOT < A;OOT++){
      if(OOTJNY.at(YUNI) > OOTJNY.at(OOT)){
        D = OOTJNY.at(YUNI);
        OOTJNY.at(YUNI) = OOTJNY.at(OOT);
        OOTJNY.at(OOT) = D;
      }
    }
  }
  
  for(int YUNI =0; YUNI < B; YUNI++){
    E += OOTJNY.at(YUNI);
  }
  
  cout << E << endl;
  
  //for(int YUNI =0; YUNI < A; YUNI++){
  //  cout << OOTJNY.at(YUNI) <<endl;
  //}
  
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))


signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int a,b; cin >> a >> b;
    if(a*b==15) cout << '*' << endl;
    else if(a+b==15) cout << '+' << endl;
    else cout << 'x' << endl;
}


Measured memory_bytes: 3568
n,x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = [0] * (n+1)
for i in range(n):
    s[i+1] = s[i] + a[i]
 
ans = 0
for i in range(n):
    if x >= s[i+1]:
        ans = i+1
if x > s[n]:
    ans -= 1
print(ans)

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

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

  vector<int> vi;
  REP(i, 2, 30001) if (i % 2 == 0 || i % 3 == 0) vi.eb(i);

  random_device rd;
  mt19937 engine(rd());

  while (1) {
    shuffle(all(vi), engine);

    int sum = 0;
    int g = vi[0];
    rep(i, N) {
      sum += vi[i];
      g = __gcd(g, vi[i]);
    }

    if (g != 1) continue;

    bool flg = true;
    rep(i, N) if (__gcd(sum, vi[i]) == 1) flg = false;

    if (!flg) continue;

    rep(i, N) cout << vi[i] << ' ';
    cout << endl;
    return 0;
  }
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>

int main(){
  char str[200];
  int i;
  scanf("%[^\n]",str);
  for(i=0; i<=strlen(str); i++){
    if(str[i]>=97 && str[i]<=122)
      str[i]=str[i]-32;
  }
  printf("%s\n",str);
  return 0;
}


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

int main(){
	double a,b;
	int n;
	while(cin >> n && n){
		pair<double,int> e = make_pair(1e9,1e9);
		for(int i = 0 ; i < n ; i++){
			int a;
			double b;
			double c;
			cin >> a >> b >> c;
			b /= 100;
			double f = fabs(22-c/b/b);
			if( e > make_pair(f,a) ){
				e = make_pair(f,a);
			}
		}
		cout << e.second << endl;
	}
}

Measured memory_bytes: 1228
#include<iostream>
#include<string.h>
using namespace std;
 
int D[6];
void spin(char c)
{
  if(c=='E'){
    swap(D[0],D[3]);swap(D[3],D[5]);swap(D[5],D[2]);
  }
  else if(c=='W'){
    swap(D[0],D[2]);swap(D[2],D[5]);swap(D[5],D[3]);
  }
  else if(c=='S'){
    swap(D[0],D[1]);swap(D[0],D[4]);swap(D[4],D[5]);
  } 
  else if(c=='N'){
    swap(D[0],D[1]);swap(D[1],D[5]);swap(D[5],D[4]);
  }
}
int main()
{
  int q,a,b;
  char SWS[10]={"SSSSWSSSS"};
  for(int i=0;i<6;i++)cin>>D[i];
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>a>>b;
    for(int i=0;i<10;i++){
      if(D[1]==b)break;
      spin(SWS[i]);
    }
    for(int i=0;i<4;i++){
      if(D[0]==a){
    cout<<D[2]<<endl;
    break;
      }
      spin('W');
    }
  } 
  return 0;
}


Measured memory_bytes: 3084
import java.util.*;

public class Main {

  public static void main(String[] args) {
    
     Scanner sc = new Scanner(System.in);
     int N = sc.nextInt();
     int H = sc.nextInt();
     int count = 0;
     for(int i = 0; i < N; i++) {
       int h = sc.nextInt();
       if(h >= H) { count++; }
     }
  	 System.out.println(count);
    
  }
  
}
  

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

typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 2e5;
ll fact[maxn+20], inv[maxn+20];
ll power(ll b, ll e) {
	ll c = 1;
	while(e) {
		if(e&1LL)	c=(c*b)%mod;
		e/=2LL;
		b=(b*b)%mod;
	}
	return c;
}

void pre() {
	ll i ,j;
	fact[0] = inv[0] = 1;
	for(i = 1; i <= maxn; ++i) {
		fact[i] = (i*fact[i-1])%mod;
		inv[i] = power(fact[i], mod - 2);
	}
	return;
}

ll C(int n, int k) {
	if (k > n)	return 0;
	ll ans = fact[n];
	ans = (ans*inv[k])%mod;
	ans = (ans*inv[n-k])%mod;
	return ans;
}

int cnt[maxn+20];

int main() {
	int i, j, n;
	pre();
	// freopen("in.txt", "r", stdin);
	cin >> n;
	int l, r;
	for(i = 1; i <= n+1; ++i) {
		int x;
		cin >> x;
		if(cnt[x]) {
			l = cnt[x];
			r = i;
		}
		else	cnt[x] = i;
	}
	ll ans, z = (n+1-r)+(l-1);
	for(i = 1; i <= n+1; ++i) {
		ans = C(n+1, i);
		ans = (ans - C(z, i-1) + mod)%mod;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 4736
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (a >= b)
		cout << "delicious" << endl;
	else if (b - a <= x)
		cout << "safe" << endl;
	else
		cout << "dangerous" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, m;
vector<ll> x, y, z;
ll dfs(int count, ll h[]){
    if(count==3){
        vector<ll> score;
        for(int i=0;i<n;i++){
            ll sum=0;
            sum+=x[i]*h[0];
            sum+=y[i]*h[1];
            sum+=z[i]*h[2];
            score.push_back(sum);
        }
        sort(ALL(score),greater<ll>());
        ll sum=0;
        for(int i=0;i<m;i++){
            sum+=score[i];
        }
        return sum;
    }
    ll pl=dfs(count+1,h);
    h[count]=-1*h[count];
    ll mi=dfs(count+1,h);
    return max(pl,mi);
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>m;
    ll a, b, c;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c;
        x.push_back(a);
        y.push_back(b);
        z.push_back(c);
    }
    ll h[3]={1,1,1};
    cout << dfs(0,h) << "\n";
}

Measured memory_bytes: 256
N = parse(Int,readline())
A = map(x->parse(Int,x), split(readline()))
#A = parse.(Int, split(readline()))

count = Dict()

for a in A
    count[a] = get(count,a,0) + 1
end

count2 = sort([x for x in count if x.second >= 2],by = x->x.first,rev = true)
count4 = sort([x for x in count if x.second >= 4],by = x->x.first,rev = true)

ans = 0

if length(count2) > 1
    ans = count2[1].first * count2[2].first
end

if length(count4) > 0
    ans = max(ans, count4[1].first * count4[1].first)
end

if length(count2) > 0 && length(count4) > 0
    ans = max(ans, count2[1].first * count4[1].first)
end

println(ans)

Measured memory_bytes: 215008
#include <cstdio>
#include <iostream>

using namespace std;

const int max_n=100;

int a[max_n];

int main()
{
    int n;
    //  数据输入
    scanf("%d",&n);
    for(int i=0;i<n;++i)
    {
        scanf("%d",&a[i]);
    }
    // 插入排序
    int temp;
    // 输出初始数据
    int k;
    for(k=0;k<n-1;++k)
    {
        printf("%d ",a[k]);
    }
    printf("%d\n",a[k]);

    for(int i=1;i<n;++i)
    {
        temp=a[i];
        int j;
        // 此处的大于条件，可以保证算法是稳定的
        for(j=i-1;j>=0 && a[j]>temp;--j)
        {
            a[j+1]=a[j];
        }
        a[j+1]=temp;
        int k;
        // 输出中间过程
        for(k=0;k<n-1;++k)
        {
            printf("%d ",a[k]);
        }
        printf("%d\n",a[k]);
    }
    return 0;
}



Measured memory_bytes: 3200
import javax.swing.plaf.synth.SynthLookAndFeel;
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
    static Scanner sc = new Scanner(System.in);
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()




        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static int lowerBound
    (Integer[] array, int length, int value) {
        int l = 0;
        int r = length;
        while (l < r) {
            int mid = (l + r) / 2;
            if (value < array[mid]) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }
        return l;
    }
    public static long gcd(long a, long b){
        if (b == 0)
            return a;
        else return gcd(b, a % b);
    }
    public static void main(String [] args) {
      //  int T = sc.nextInt();while (T--!=0)
        {
            solve();
        }
    }
    public static void solve(){
///////////////////////////////////////////////////////////////////////////////////////////
          int n = sc.nextInt();
          int k = sc.nextInt();
          int [] arr = new int [n];
        for (int i = 0; i <n ; i++) {
            arr[i] =sc.nextInt();
        }
        Arrays.sort(arr);
        long sum=0;
        for (int i = 0; i <k ; i++) {
            sum+=arr[i];
        }
        System.out.println(sum);
////////////////////////////////////////////////////////////////////////////////////////////
    }

}

Measured memory_bytes: 38976
#include <iostream>
#include <vector>
using namespace std;
int main() {
    //入力
    int ans=0,n,q;
    cin >> n;
    long S[100000];
    for (int i = 0; i < n; i++) cin >> S[i];
    cin >> q;
    long T[50000];
    for (int j = 0; j < q; j++) cin >> T[j];
    //処理
    for (int k = 0; k < q; k++) {
        int left, right,mid;
        left = 0; right = n;
        while (left <= right) {
            mid = (left + right) / 2;
            //cout << left << " " << right << endl;
            if (T[k] == S[mid]) {
                ans++;
                break;
            }
            else if (T[k] < S[mid]) {
                //cout << "L" << endl;
                right = mid - 1;
            }
            else {
                //cout << "R" << endl;
                left = mid + 1;
            }
        }
    }
    //出力
    cout << ans << endl;
}


Measured memory_bytes: 4236
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
#define int long long

void solve() {
	int n; cin >> n;
    vector<int> p(n);
    rep(i, n) {
        cin >> p[i];
    }
    int cnt = 0;
    int mi = INF;
    rep(i, n) {
        if(p[i] < mi) {
            ++cnt;
            mi = p[i];
        }
    }
    cout << cnt << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 1920
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)       for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    string s; cin >> s;
    int i = s.length();
    if(s[i-1] == 's') cout << s + "es" << endl;
    if(s[i-1] != 's') cout << s + "s" << endl;

return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <math.h>
#include <float.h>
typedef long long ll;

int main()
{
    ll n, k;
    double ans = 0;

    scanf("%lld %lld", &n, &k);

    for (ll i = 1; i <= n; i++) {
        ll point = i;
        double r = 1.0 / (double)n;

        while (point < k) {
            point = point * 2;
            r = r / 2.0;
        }

        ans = ans + r;
    }

    printf("%.*lf\n", DBL_DIG, ans);
    
    return 0;
}


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

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

    if ((b + b) > a){
        cout << 0 << endl; 
    }
    else{
        cout << (a - (b + b)); 
    }
    return 0; 
}

Measured memory_bytes: 256
N,M=map(int,input().split())
H=list(map(int,input().split()))
AB=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  A-=1
  B-=1
  AB[A].append(B)
  AB[B].append(A)
ans=0
for i in range(N):
  res=True
  for x in AB[i]:
    if H[i]<=H[x]:      
      res=False
      break
  if res:
    ans+=1
print(ans)

Measured memory_bytes: 29452
#include<stdio.h>

int main(void){

  int x;
  int i;
  int start = 100000;

  scanf("%d",&x);

  for(i=0;i<x;i++){
    int rest;
    rest = start * 0.05;
    start += rest;

    if( start % 1000 != 0){
      start += (1000 - (start % 1000));
    }
  }

  printf("%d\n",start);
  return 0;

}

Measured memory_bytes: 592
/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀
⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀
⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀
⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define REP(i,a,n) for(i=a;i<=n;i++)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,b,a) for(i=b;i>=a;i--)
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const ll mod=1e9+7;
const ll MAXN=100200;
ll i,j,mask,test;
int main()
{
IOS
/*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#endif // ONLINE_JUDGE*/
string s,t;
cin>>s>>t;
ll n=t.length();
ll ans=mod;
for(i=0;i+n-1<s.length();i++)
{
    ll cnt=0;
    for(j=i;j<i+n;j++)
    {
        if(t[j-i]!=s[j])
            cnt++;
    }
    ans=min(ans,cnt);
}
cout<<ans;
return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    int[] a = { 0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    Scanner scan = new Scanner(System.in);
    int S = scan.nextInt();
    System.out.println(a[S]);
  }
}

Measured memory_bytes: 22996
#include <iostream>
using namespace std;
#define MAX 100000
typedef long long llong;
int n, k; llong T[MAX];
int check(llong P) {
	int i=0;
	for(int j=0;j<k;j++){
		llong s = 0;
		while(s+T[i]<=P){
			s += T[i];
			i++;
			if ( i == n ) return n;
		}
	}
	return i;
}

int solve() {
	llong left=0;
	llong right=100000*10000;
	while(right-left>1){
		int mid = (left + right) / 2;
		int v = check(mid);
		if (v>=n) right=mid;
		else left = mid;
	}
	return right;
}

int main() {
cin>>n>>k;
for(int i=0;i<n;i++)cin>>T[i];
llong ans = solve();
cout << ans << endl;
return 0;
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14 100兆
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

struct edge{
  ll to;
};

vector<vector<edge>> graph;
map<ll, pair<ll, ll>> mv;
queue<ll> det;

void bfs(ll x, ll d, ll p){
  if(mv.count(x)){
    return;
  }
  mv[x] = make_pair(d + 1, p);
  det.push(x);
}

int main(){
  ll N, M;
  cin >> N >> M;
  graph.resize(N);
  vector<ll> A(M), B(M);
  rep(i, M){
    cin >> A.at(i) >> B.at(i);
    A.at(i)--;
    B.at(i)--;
    graph.at(A.at(i)).push_back({B.at(i)});
    graph.at(B.at(i)).push_back({A.at(i)});
  }
  mv[0] = make_pair(0, -1);
  det.push(0);
  while(!det.empty()){
    ll x = det.front();
    det.pop();
    for(auto e : graph.at(x)){
      bfs(e.to, mv.at(x).first, x);
    }
  }
  cout << "Yes" << endl;
  rep(i, N-1){
    cout << mv.at(i+1).second + 1 << endl;
  }
}

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


const int mod = 1e9+7;
//ll combi[2001][2000];

/*void calc(ll combi[][],n){
    for(int i = 1; i < n+1; i++){
        if(i == 1){
            combi[1][0] = 1;
            combi[1][1] = 1;
        }
        for(int j = 0; j <= i; j++){
            if(j == 0 || j == i){
                combi[i][j] = 1;
            }
            else{
                combi[i][j] = combi[i-1][j-1] + combi[i-1][j];
            }
        }
    }
}
*/

int main(){
    ll i,n,k;
    cin >> n >> k;
    ll combi[n+5][n+5];

    for(int i = 0; i < n+1; i++){
        for(int j = 0; j <= i; j++){
            if(j == 0 || j == i){
                combi[i][j] = 1;
            }
            else{
                combi[i][j] = (combi[i-1][j-1] + combi[i-1][j]) % mod;
            }
        }
        }

    for(i = 1; i < k+1; i++){
        //ll h1 = kaijou(k-1) % mod;
        //ll h2 = kaijou(i-i) % mod;
        //ll hoge = kaijou(k-1)/(kaijou(k-i) * kaijou(i-1)); 
        //ll huga = kaijou(n-k+1)/ (kaijou(n-k+1-i) * kaijou(i));
        //ll ans = hoge * huga % 1000000007;



        //calc(combi,n);
        ll ans;
        if(n-k+1 < i){
            ans = 0;
        }
        else{
            ans = (combi[n-k+1][i] * combi[k-1][i-1]) % mod;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 31488
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int n = sc.nextInt();
        
        for(int i = 0; i < n; i++){
            String order = sc.next();
            int a = sc.nextInt();
            int b = sc.nextInt();
            
            if(order.equals("print")){
                System.out.println(str.substring(a, b+1));
                
            }else if(order.equals("reverse")){
                String rev = str.substring(a, b+1);
                String temp = str.substring(b+1);
                str = str.substring(0, a);
                for (int index=rev.length()-1; index>=0; index--) {
				str += rev.charAt(index);
			    }
		    	str += temp;

            }else{    
                String p = sc.next();
                str = str.substring(0,a) + p + str.substring(b+1);
            }
        }
        
    }
}


Measured memory_bytes: 61932
#include <stdio.h>
#include <math.h>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <utility>
#include <map>

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)
#define all(c) begin(c),end(c)
#define vmax(c) *max_element(all(c))
#define vmin(c) *min_element(all(c))
 
template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}

template<typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::map<T1, T2>& map)
{
    for (typename std::map<T1, T2>::const_iterator it = map.begin();
         it != map.end();
         ++it)
    {
        out << (*it);
    }
    return out;
}

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

const long long INF = 0x3f3f3f3f3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9; 

// 2次元配列を作る
// vector<vi> my_vector(n, vi(m, 0));

// 多次元配列の dump
// for (auto v : my_vector) {
//     cout << v;
// }

int main(void){
    ll n, w;
    scanf("%lld", &n);
    scanf("%lld", &w);

    vector<pair<ll, ll>> items(n, make_pair(0, 0));
    REP(i, n) {
        ll item_weight, item_value;
        scanf("%lld", &item_weight);
        scanf("%lld", &item_value);
        items[i].first = item_weight;
        items[i].second = item_value;
    }
    std::sort(items.begin(), items.end(), [](pair<ll,ll> a, pair<ll, ll> b){ return a.first > b.first; });

    vll dp(w + 1, 0);
    REP(i, n) {
        // cout << "=====" << endl;
        ll weight = items[i].first;
        ll value = items[i].second;
        vll current_dp(w + 1, 0);
        RREP(j, w + 1) {
            ll newWeight;
            ll newValue;
            newWeight = j - weight;
            newValue = dp[j] + value;
            // cout << j << endl;

            if (newWeight >= 0) {
                ll compareValue = dp[newWeight];
                current_dp[newWeight] = max(newValue, compareValue);
            }
            // cout << "---" << endl;
            // cout << weight << "," << value << endl;
            // cout << newWeight << "," << newValue << endl;
        }
        dp = current_dp;
        // cout << dp << endl;
    }
    ll max_value = *max_element(all(dp));

    printf("%lld", max_value);
    return 0;
}


Measured memory_bytes: 1804
#include<bits/stdc++.h>
const int N=1e3+5;
int n,nn,mm,m,i,j,A,B;
char c[N][N];
int main(){
	scanf("%d%d%d%d",&n,&m,&A,&B);
	for(i=1;i<=n;++i)for(j=1;j<=m;++j)c[i][j]='.';
	nn=n-n%2;mm=m-m%2;
	if(nn<n)for(i=1;i<m && A;i+=2)c[n][i]='<',c[n][i+1]='>',--A;
	if(mm<m)for(i=1;i<n && B;i+=2)c[i][m]='^',c[i+1][m]='v',--B;
	for(i=1;i*2<=nn;++i)for(j=1;j*2<=mm;++j){
		if(A>1 || (A==1 && i*2==nn && j*2==mm)){
			c[i*2-1][j*2-1]='<';c[i*2-1][j*2]='>';--A;
			if(A)c[i*2][j*2-1]='<',c[i*2][j*2]='>',--A;
		}else if(B){
			c[i*2-1][j*2-1]='^';c[i*2][j*2-1]='v';--B;
			if(B)c[i*2-1][j*2]='^',c[i*2][j*2]='v',--B;
		}
	}
	if(!A && B && nn<n && mm<m && c[nn][mm]=='.'){
		c[n][m]='>';c[n][m-1]='<';c[n][m-2]='v';c[n-1][m-2]='^';--B;
	}
	if(A || B)return puts("NO"),0;
	puts("YES");
	for(i=1;i<=n;++i)puts(c[i]+1);
	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N,ans[200005];
signed main(){
	cin>>N;
	rep(i,N-1){
		int a;cin>>a;
		ans[a]++;
	}
	REP(i,N+1){
		cout<<ans[i]<<endl;
	}
}


Measured memory_bytes: 5140
import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
from collections import defaultdict

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

cnt = 0
cnt0 = 0
for i in range(N):
    if (A[i] == 0):
        cnt0 +=1
    if (A[i] < 0):
        cnt +=1

if (cnt%2 == 0 or cnt0>=1):
    print(sum(np.abs(np.array(A))))
else:
    print(sum(np.abs(np.array(A)))-min(np.abs(np.array(A)))*2)

Measured memory_bytes: 25108
from collections import defaultdict

N = int(input())

A = [0]+list(map(int,input().split()))

BIT = defaultdict(int)

ans = 0
start = 0
for i in range(1,N+1):
    a = A[i]
    bit = 0
    before = 0
    
    while(a>0):
        bit += 1
        if a%2==1:
            if BIT[bit]>before:
                before = BIT[bit]
            BIT[bit] = i
        a //= 2

    #print(i,before,start,BIT)
    if before>start:start=before
    ans += i-start
    
print(ans)

Measured memory_bytes: 25096
/*
          , -- 、
        /;;;;;;', 　　　
        i二二二i
      , ' 　    ヽ ???
     i　ﾉﾉﾉﾉﾉﾍ .', 　　
     〉ﾘi' ﾟ ヮﾟﾉﾚく　 WAyon..........
  ○⊂}〈lﾄ--ｲl〉{つ● 　　
      ,ｒ/ー i-ヽヽ 　　　
     ｀｀i_ﾗi_ﾗ
*/

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int INF=(int)1e12;
const int mod=(int)1e9+7;
#define all(a) (a).begin(),(a).end()
typedef vector<vector<int>> graph;

#define pb push_back

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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


signed main() {

    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k<=a)cout <<k<<endl;
    else if(k<=a+b)cout <<a<<endl;
    else cout <<a-(k-(a+b))<<endl;
}


















Measured memory_bytes: 3636
#n = int(input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
s=list(input())
flag='None'
alphabet=list('abcdefghijklmnopqrstuvwxyz')
dic={}
for si in s:
    dic[si]=True

for c in alphabet:
    if dic.get(c,False)==False:
        flag=c
        break
print(flag)

Measured memory_bytes: 9644
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int K; cin>>K;
  vector<int> cnt(K,0);
  int A	= 0;
  for(int i = 1; ; i++) {
    A =	(A * 10 + 7) % K;
    if(A == 0) {
      cout << i	<< endl;
      return 0;
    }
    if(cnt[A]) {
      cout << -1 << endl;
      return 0;
    }
    cnt[A]++;
  }
  return 0;
}


Measured memory_bytes: 6740
#include <iostream>
#define llint long long
#define inf 1e18

using namespace std;

llint n;
llint a[100005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	llint ans = 0;
	a[0] = inf;
	for(int i = 1; i <= n; i++){
		if(a[i] < a[ans]) ans = i;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
#define int long long
//#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

int32_t main()
{
    //FIO;

    double n, x, t;
    cin >> n >> x >> t;
    
    printf("%0.0f",(ceil(n / x) * t));
    
    
}

Measured memory_bytes: 3800
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using static System.Console;

namespace program
{
  class Program
  {
    static void Main()
    {
      var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
      SetOut(sw);

      var n = int.Parse(ReadLine());
      var d = new Dictionary<string, int>();
      int max = 0;
      for(int i=0; i<n; i++){
        var s = ReadLine();
        if(d.ContainsKey(s))
          d[s]++;
        else
          d.Add(s,1);
        if(d[s] > max) max = d[s];
      }
      var res = new List<string>();
      foreach(var h in d){
        if(h.Value == max) 
          res.Add(h.Key);
      }
      var array = res.ToArray();
      Array.Sort(array, StringComparer.OrdinalIgnoreCase);
      foreach(var r in array)
        WriteLine(r);
      Console.Out.Flush();
    }
  }
}


Measured memory_bytes: 41180
#include<bits/stdc++.h>
#define ll long long
#define dbl double
#define forn(i,n,k) for(int i=0;i<n;i=i+k)
#define forpn(p,n,k) for(int i=p;i<n;i+=k)
#define for0(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
using namespace std;

int main()
{   ios::sync_with_stdio(0);
    
    
    cin.tie(0);
    cout.tie(0);
    srand(time(0));
    int n;
    cin>>n;
    int a[n][3];
    
    for0(i,n){
        for0(j,3) cin>>a[i][j];
    }
    int dp[n+1][3];
    memset(dp,0,sizeof(dp));
    
   
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            // dp[i+1]=dp[i]+a[i][j];
            for(int k=0;k<3;k++)
            {
                if(j==k) continue;
                else dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i][k]);
            }
            
        }
        
    }
    
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
    
    
      
    
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <unordered_map> 
using namespace std; 
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI1 3.14159265358979311599796346854418516159057617187500

typedef long long int ll;  
ll MOD = 1e9 + 7;

ll power(ll a , ll n)
{
    unsigned long long int result=1,x=a;
    while(n>0)
    {
        if(n % 2 ==1)
            result = (result * x);
        x = (x * x);
        n=n/2;
    }
    return result;
}

ll GCD(ll a , ll b)
{
    if(b==0)
        return a;
    else
        return GCD(b,a%b);
}

int main() 
{ 
    FIO
    int t;
    t=1;
    while(t--)
    {       
        int n;
        cin >> n;
        int dp[20001]={0};
        
        for(int i=1;i<=100;i++)
        {
            for(int j=1;j<=100;j++)
            {
                for(int k=1;k<=100;k++)
                {
                    ll x=i,y=j,z=k;
                    ll num = x*x + y*y + z*z + x*z + y*z + x*y;
                    if(num < 20000)
                        dp[num]++;
                }
            }
        }

        for(int i=1;i<=n;i++)
            cout << dp[i] << endl;

    }   
    return 0; 
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define loop(i,n) for(int i = 0;i < (n);i++)
#define range(i,a,b) for(int i = (a);i <= (b);i++)
#define all(A) A.begin(),A.end()
#define pb push_back
#define mp make_pair
#define sz(A) ((int)A.size())
#define vi vector<int>
#define vl vector<long long>
#define vd vector<double>
#define vp vector<pair<int,int> >
#define ll long long
#define pi pair<int,int>
#define popcnt(x) __builtin_popcountll(x)
#define LSOne(x) ((x) & (-(x)))
#define xx first
#define yy second
#define PQ priority_queue
#define print(A,t) cerr << #A << ": "; copy(all(A),ostream_iterator<t>(cerr," " )); cerr << endl
#define prp(p) cerr << "(" << (p).first << " ," << (p).second << ")";
#define prArr(A,n,t)  cerr << #A << ": "; copy(A,A + n,ostream_iterator<t>(cerr," " )); cerr << endl
#define PRESTDIO() cin.tie(0),cerr.tie(0),ios_base::sync_with_stdio(0)
#define what_is(x) cerr << #x << " is " << x << endl
#define bit_lg(x) (assert(x > 0),__builtin_ffsll(x) - 1)
const double PI = acos(-1);
using namespace std;

const int MAX = 200*1000 + 10;
string S,out;
int n;
vi IDX[128];
char choice[MAX];
int dp[MAX];

int solve(int pos){
	if(pos == n) {
		choice[pos] = 'a';
		return 1;
	}
	if(dp[pos] != -1) return dp[pos];
	dp[pos] = 1 << 28;
	for(char c = 'a';c <= 'z';c++) {
		auto p = lower_bound(all(IDX[(int)c]),pos);
		if(p == IDX[(int)c].end()) {
			choice[pos] = c;
			dp[pos] = 1;
			break;
		}
		int tmp = min(dp[pos],1 + solve(*p + 1));
		if(tmp < dp[pos]) {
			dp[pos] = tmp;
			choice[pos] = c;
		}
	}
	return dp[pos];
}

void recon(int pos){
	char c = choice[pos];
	putchar(c);
	if(pos == n) return;
	auto p = lower_bound(all(IDX[(int)c]),pos);
	if(p == IDX[(int)c].end()) return;
	recon(*p + 1);
}

int main(){
	#ifdef HOME
		freopen("in.in", "r", stdin);
	#endif
	cin >> S;
	n = sz(S);
	loop(i,n) IDX[(int)S[i]].pb(i);
	memset(dp,-1,sizeof dp);
	solve(0);
	recon(0);

	return 0;
}


Measured memory_bytes: 2692
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for(ll i = a; i < (ll)(b); i++)

#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))

using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using sl = stack<ll>;
using ql = queue<ll>;

const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};


void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

int binary_search(ll x, vl a){
    auto ite = lower_bound(ALL(a), x);
    if(ite != a.end() && *ite == x) {
        return ite - a.begin() ;
    } else {
        return -1;
    }

}

ll modpow(ll a, ll n, ll mod) {
    if(n == 0)
        return 1;
    if(n == 1)
        return a % mod;
    if(n % 2 == 1)
        return (a * modpow(a, n - 1, mod)) % mod;
    ll t = modpow(a, n / 2, mod);
    return (t * t) % mod;
}

int main() {
    ll N, K, ans, ans2;
    cin >> N >> K;
    ans = N % K;
    ans2 = abs(ans - K);
    cout << min(ans, ans2) << endl;
    return 0;
}

Measured memory_bytes: 3604
import scala.io.StdIn.{readInt, readLine};
import scala.annotation.tailrec;
object Main {
    def main(args: Array[String]): Unit = {
        val size = readInt;
        val m = new Array[Array[Int]](size);
        (0 until size).foreach {  i => m(i) = readLine.trim.split(" ").map( a => if (a.toInt == -1) Int.MaxValue else a.toInt)}
        val g = new Graph(size, m);
        println(g.prim.sum);
    }
}
case class Graph(size: Int, matrix: Array[Array[Int]]) {
    val INFINITY = Int.MaxValue
    def prim(): Array[Int] = {
        // WHITE : 未訪問, GRAY: MST候補ノード, BLACK: MST追加済みノード
        val WHITE = 0; val GRAY = 1; val BLACK = 2;
        val color = new Array[Int](size); // 訪問状態リスト(WHITE, GRAY, BLACK)
        val distance = new Array[Int](size).map( e => INFINITY); //  重みリスト
        @tailrec
        def _prim(curr: Int): Unit = {
            // MSTに属する頂点の集合から最も近いノードの index を取得する
            val idx = (0 until size).foldLeft(-1) { (minidx, i) =>
                if (color(i) == BLACK) {
                    // すでにMSTに追加されているノードは評価しない
                    minidx;
                } else { // color(i) == GRAY or WHITE
                    // curr の子ノードをMST候補ノードに追加
                    if (matrix(curr)(i) != -1) color(i) = GRAY;
                    if (color(i) == GRAY) {
                        // すでに登録されている重みよりも curr からの重みのほうが小さい場合は親ノードと重みを更新する
                        if (matrix(curr)(i) < distance(i)) distance(i) = matrix(curr)(i);
                        if (minidx == -1 || distance(i) < distance(minidx)) i else minidx;
                    } else { // color(i) == WHITE
                        // 現時点でMSTに隣接していないノードは評価しない
                        minidx;
                    }
                }
            }
            if (idx != -1){
                // MSTから最も距離の近いノードを追加
                color(idx) = BLACK;
                _prim(idx);
            }
        }
        distance(0) = 0;
        color(0) = BLACK;
        _prim(0);
        distance;
    }
}


Measured memory_bytes: 47600
// う　し　た　ぷ　に　き　あ　く　ん　笑
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

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

    // しゃくとり法

    /* 合計値 */
    long long res = 0;

    /* 区間の左端 left で場合分け */
    int right = 0;      // 毎回 right を使い回すようにする
    long long sum = 0;  // sum も使い回す
    for (int left = 0; left < n; ++left) {
        /* sum に a[right] を加えても大丈夫なら right を動かす */
        while (right < n && (sum ^ a[right]) == (sum + a[right])) {
            sum ^= a[right];
            ++right;
        }

        /* break した状態で right は条件を満たす最大 */
        res += (right - left);

        /* left をインクリメントする準備 */
        if (right == left)
            ++right;  // right が left に重なったら right も動かす
        else
            sum ^= a[left];  // left のみがインクリメントされるので sum から
                             // a[left] を引く
    }

    cout << res << endl;
}


Measured memory_bytes: 4792