akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

const int MOD=1e9+7;
const int N=21;
int dp[N+1][1LL<<N];

int32_t main()
{
   IOS
   memset(dp,0,sizeof(dp));
   dp[0][0]=1;
   int n;cin>>n;
   for(int i=0;i<n;i++)
   {
	   for(int j=0;j<n;j++)
	   {
		   int x;cin>>x;
		   if(!x)continue;
		   for(int k=0;k<(1LL<<n);k++)
		   {
			   if(!((k>>j)&1))
			   {
				   dp[i+1][k|(1LL<<j)]+=dp[i][k];
				   dp[i+1][k|(1LL<<j)]%=MOD;
			   }
		   }
	   }
	   for(int k=0;k<(1LL<<n);k++)
	   {
		   dp[i+1][k]+=dp[i][k];
		   dp[i+1][k]%=MOD;
	   }
   }
   cout<< dp[n][(1LL<<n)-1] << endl;
  
  
}


Measured memory_bytes: 360704
N, M = list(map(lambda x: int(x), input().split(" ")))
H = list(map(lambda h: int(h), input().split(" ")))

dest = [[] for i in range(N)]
for i in range(M):
  tmp = input().split(" ")
  dest[int(tmp[0]) - 1].append(int(tmp[1]) - 1)
  dest[int(tmp[1]) - 1].append(int(tmp[0]) - 1)

good = 0
for i in range(len(dest)):
  d = dest[i]
  if len(list(filter(lambda j: H[i] - H[j] <= 0, d))) == 0:
    good += 1

print(good)

Measured memory_bytes: 29848
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
    for (T &x : vec)
        is >> x;
    return is;
}

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i,N){
        cin >> A[i];
    }

    int ans=A[0];
    REP(i,N){
        if(!i) continue;
        ans = gcd(ans,A[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 500 * i + 100 * j + 50 * k == X:
                ans += 1
print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#define INF 1e9+7
using namespace std;
typedef long long int ll;


int main() {

	int N;
	cin >> N;

	for (int i = 0; 4 * i <= N; i++) {
		if ((N - 4 * i) % 7 == 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int N;
    scanf("%d", &N);
    int ch = 0;
    for(int i = 0; i <= N /4; i++){
        for(int j = 0; j <= N /7; j++){
            if(4*i + 7*j == N){
                ch = 1;
                break;
            }
        }
    }
    if(ch == 1){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
using namespace std;
int min(int a,int b){
	if(a<b)return a;
	return b;
}
int main(){
	int n,k,ans=1;
	scanf("%d%d",&n,&k);
	while(n--){
		ans+=min(ans,k);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
var input=require("fs").readFileSync("/dev/stdin","utf8");

input=input.split(" ");
var a=parseInt(input[0]);
var b=parseInt(input[1]);
var c=parseInt(input[2]);

if(a<b){
    if(b<c){
    console.log("Yes");
    }
    else{
    console.log("No");
}
}
else{
    console.log("No");
}


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

int main(){
  int N;
  cin >> N;
  
  vector<int> B(N-1);
  for(int i=0; i<N-1; i++){
    cin >> B.at(i);
  }
  
  /*
  A[0] = B[0]
  A[i] = min(B[i-1],B[i])
  A[N-1] = B[N-2]
  添え字注意
  */
  int sum=B.at(0)+B.at(N-2);
  for(int i=1; i<N-1; i++){
    sum += min(B.at(i-1),B.at(i));
  }
  cout << sum << endl;
    
  return 0;
}


Measured memory_bytes: 256
import  java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int a = scan.nextInt();
      	long[] L = new long[a+1];
      	L[0] = 2;
      	L[1] = 1;
      		for(int i = 2; i <= a; i++){
        		L[i] = L[i - 1] + L[i - 2];
       	 	}
     	System.out.print(L[a]);
    	
    }
 
}

Measured memory_bytes: 21844
import collections

n = int(input())
a_list = [int(i) for i in input().split()]
mpCnt = collections.Counter(a_list)

count = 0
for k, v in mpCnt.items():
    if k == v:
        continue
    if k > v:
        count +=  v
    else:
        count += v - k       
print(count)


Measured memory_bytes: 18676
#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 7;
int a[maxx];
int n, x;
int d[maxx];

int gcd(int x, int y) {
	if(x % y == 0) return y;
	else return gcd(y, x % y);
}

int main() {
	cin >> n >> x;
	for(int i = 1; i <= n; i++) cin >> a[i];
	a[n + 1] = x;
	sort(a + 1, a + n + 2);
	int t = 0;
	int ans = a[2] - a[1];
	for(int i = 2; i <= n + 1; i++) {
		d[++t] = a[i] - a[i - 1];
		ans = gcd(ans, d[t]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
def bubbleSort(A, N):
    flag = True
    c = 0
    while flag:
        flag = False
        for j in range(N-1,0,-1):
            if A[j] < A[j-1]:
                A[j],A[j-1] = A[j-1],A[j]
                c += 1
                flag = True
    return A,c
num = int(input())
li1 = [int(e) for e in input().split()]
li2 = bubbleSort(li1,num)
print(*li2[0],sep=" ")
print(li2[1])


Measured memory_bytes: 5608
N,K = map(int, input().split())
d = []
man = [0 for i in range(N)]


for k in range(K):
    d=int(input())
    A=list(map(int, input().split()))
    for i in A:
        i-=1
        man[i] +=1
    
print(man.count(0))

Measured memory_bytes: 9132
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define repr(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define all(x) (x).begin(),(x).end()

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

	int fare = (A*N < B) ? (A * N) : B;
	cout << fare << endl;

	return 0;
}

Measured memory_bytes: 256
import operator

def snuke_fest(top_arr, middle_arr, bottom_arr):
    sorted_arrs = list(sorted(arr) for arr in (top_arr, middle_arr, bottom_arr))
    del top_arr
    del middle_arr
    del bottom_arr
    pointers = [0] * 3
    ended = [False] * 3
    min_posi = [None] * len(sorted_arrs[0]) * 3
    min_posi_pointer = 0
    try:
        while not all(ended):
            nums = [0] * 3
            mins = [10**9] * 3
            for i in range(3):
                if not ended[i]:
                    mins[-(i+1)] = sorted_arrs[i][pointers[i]]
            min_index, min_val = min(enumerate(mins), key = operator.itemgetter(1))
            min_index = 2 - min_index
            pointers[min_index] += 1
            min_posi[min_posi_pointer] = min_index
            min_posi_pointer += 1
            if pointers[min_index] == len(sorted_arrs[0]):
                ended[min_index] = True
    except Exception as e:
        return 0
    del sorted_arrs
    del pointers
    count = 0
    count_arr = [0, 0, 0]
    count_one_two = 0
    for i in range(len(min_posi)):
        count_arr[min_posi[-(i+1)]] += 1

        if min_posi[-(i+1)] == 1:
            count_one_two += count_arr[2]
        elif min_posi[-(i+1)] == 0:
            count += count_one_two
    return count


if __name__ == "__main__":
    # run_test(find_even, test_pair)
    _ = input()
    top_arr = [int(i) for i in input().split(" ")]
    middle_arr = [int(i) for i in input().split(" ")]
    bottom_arr = [int(i) for i in input().split(" ")]
    print(snuke_fest(top_arr, middle_arr, bottom_arr))


Measured memory_bytes: 23440
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    vector<int> v(3);
    rep(i, 3) cin >> v[i];

    sort(all(v));
    if(v[0] == v[1] && v[1] != v[2]) cout << "Yes" << endl;
    else if(v[0] != v[1] && v[1] == v[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include <functional>
#include <queue>
#include <regex>

using namespace std;

constexpr int MOD = 1000000007;
constexpr int INF = 1050000000;

int main() {

	int n; cin >> n;
	stack<int> s;

	if (n == 0) { cout << "0" << endl; return 0; }

	while (n) {
		int f = abs(n % (-2));
		s.push(f);
		n = (n - f) / (-2);
	}

	while (!s.empty()) {
		cout<<s.top();
		s.pop();
	}

	cout << endl;










}

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

int main() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int h[222222];
vi adj[222222];

void dfs(int u, int p=-1)
{
	for(int v:adj[u])
	{
		if(v==p) continue;
		h[v]=h[u]+1;
		dfs(v,u);
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i=0;i<n-1;i++)
	{
		int u,v; cin>>u>>v; u--; v--;
		adj[u].pb(v); adj[v].pb(u);
	}
	dfs(0);
	int r=-1; int mx=-1;
	for(int i=0;i<n;i++)
	{
		if(h[i]>mx)
		{
			mx=h[i]; r=i;
		}
	}
	h[r]=0;
	dfs(r);
	r=-1;mx=-1;
	for(int i=0;i<n;i++)
	{
		if(h[i]>mx)
		{
			mx=h[i]; r=i;
		}
	}
	if(mx<=2)
	{
		cout<<(mx%2==0?"First":"Second")<<'\n';
	}
	else
	{
		cout<<(mx%3!=1?"First":"Second")<<'\n';
	}
}


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

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
const int INF = 1e9+1;
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;}

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

int main() {
    int N;
    cin >> N;
    vector<ll> T(N);
    for (int i = 0; i < N; i++) cin >> T[i];


    ll res = T[0];
    for (int i = 1; i < N; i++) {
        res = (res / gcd(res,T[i])) * T[i];
    }
    cout << res << endl;
}

Measured memory_bytes: 256
from collections import defaultdict

d = defaultdict(int)

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

for key in D:
	d[key] += 1

M = int(input())
T = list(map(int, input().split()))

judge = "YES"
for key in T:
	if d[key] >= 1:
		d[key] -= 1
	else:
		judge = "NO"
		break

print(judge)

Measured memory_bytes: 46560
from itertools import accumulate

n, k = map(int, input().split())
k2 = k * 2
req_b = [[0] * k for _ in range(k)]
req_w = [[0] * k for _ in range(k)]
bc, wc = 0, 0
for i in range(n):
    x, y, c = input().split()
    x, y = int(x), int(y)
    rx, ry = x % k2, y % k2
    b = c == 'B'
    if rx >= k:
        rx -= k
        if ry >= k:
            ry -= k
        else:
            b = not b
    elif ry >= k:
        ry -= k
        b = not b
    if b:
        req_b[rx][ry] += 1
        bc += 1
    else:
        req_w[rx][ry] += 1
        wc += 1

req_b = [list(accumulate(req)) for req in req_b]
req_w = [list(accumulate(req)) for req in req_w]
req_b = [list(accumulate(req)) for req in zip(*req_b)]
req_w = [list(accumulate(req)) for req in zip(*req_w)]

ans = 0
kb, kw = req_b[-1], req_w[-1]
for dx, (dx_b, dx_w) in enumerate(zip(req_b, req_w)):
    dxk_b = dx_b[-1]
    dxk_w = dx_w[-1]
    for b1, w1, kyb, kyw in zip(dx_b, dx_w, kb, kw):
        b = bc - kyb - dxk_b + b1 * 2
        w = wc - kyw - dxk_w + w1 * 2
        a = b + wc - w
        ans = max(ans, a, n - a)
print(ans)


Measured memory_bytes: 91508
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
  int n;
  cin >> n;
  int ans = 0;
  if(n <= 9)ans = n;
  else if(n <= 99)ans = 9;
  else if(n <= 999)ans = 9 + n - 99;
  else if(n <= 9999)ans = 909;
  else if(n <= 99999)ans = 909 + n -9999;
  else ans = 90909;
  cout << ans << endl;
}
  

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, ans=0;
    cin >> N;
    vector<int> a(N);
    
    for(int i=0; i<N; i++){
	cin >>a[i];
    }
    sort(a.rbegin(), a.rend());
    for(int i=0; i<N; i++){
	if(i%2==0)
	    ans+=a[i];
	else
	    ans-=a[i];
    }

    cout << ans << endl;    
}



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

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      for(int i=0; i<n; i++)
        seq[i] = Integer.parseInt(br.readLine());

      System.out.println( shellSort(seq, n) );

      StringBuilder str = new StringBuilder(n*5);
      for (int i : seq)
        str.append(i).append("\n");
      str.setLength(str.length()-1);
      System.out.println(str);
    }
  }

  public static int shellSort(int a[], int n) {
    int cnt=0;
    int m = 0;
    int[] aG = new int[100];
    for (int g=1,max=n+1; g < max; g=(g*3+1)) {
      aG[m++] = g;
    }
    StringBuilder str = new StringBuilder(m*5);
    str.append(m).append("\n");

    for(int i=(m-1); i>-1; i--){
      cnt += insertionSort(a, n,aG[i]);
      str.append(aG[i]).append(" ");
    }

    str.setLength(str.length()-1);
    System.out.println(str);

    return cnt;
  }
  
  public static int insertionSort(int a[], int max, int g) {
    int cnt=0;

    for (int i=g,j=0,v=0; i < max; i++) {
      for( j=(i-g), v=a[i]; j>=0 && a[j]>v; j-=g ) {
        a[j+g] = a[j];
        cnt++;
      }
      a[j+g] = v;
    }

    return cnt;
  }
}


Measured memory_bytes: 88036
import java.util.*;
import java.math.*;

public class Main {

  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    BigDecimal[] A = new BigDecimal[N+1];
    BigDecimal a = new BigDecimal(1);
    BigDecimal b = new BigDecimal(Math.pow(10,18));
    BigDecimal c = new BigDecimal(0);
    int check =0;
    for (int i =1; i<=N; i++) {
      A[i] = sc.nextBigDecimal();
      if (A[i].compareTo(c) == 0) {
        a = new BigDecimal(0);
        break;
      }
    }
    if (a.compareTo(c) != 0) {
      for (int i =1; i<=N; i++) {
        a = a.multiply(A[i]);
        if (a.compareTo(b) >0) {
          a = new BigDecimal(1);
          check++;
        }
      }
    }
    if (a.compareTo(c) == 0) {
      System.out.println(0);
    } else if (check != 0) {
      System.out.println(-1);
    } else {
      System.out.println(a);
    }
  }
}

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

mod = int(1e9+7)

A = []
for _ in range(N):
  A.append([int(input()),1])
for _ in range(N):
  A.append([int(input()),2])
A.sort()

ans = 1
ca,cb = 0,0
for a in A:
  if a[1] == 1:
    if cb == 0:
      ca += 1
    else:
      ans = ans * cb % mod
      cb -= 1      
  else:
    if ca == 0:
      cb += 1
    else:
      ans = ans * ca % mod
      ca -= 1
    
print(ans)

Measured memory_bytes: 78936
from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

#0:中央 1:南 2:東 3:西 4:北 5:裏側
class Dice():

    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
        self.order = 'NNNNWNNNWNNNENNNENNNWNNN'

    def setNumber(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5


    def roll(self,loc):
        for i in range(6):
            self.work[i] = self.number[i]

        if loc == 'E':
            self.setNumber(self.work[3],self.work[1],self.work[0],self.work[5],self.work[4],self.work[2])
        elif loc == 'N':
            self.setNumber(self.work[1],self.work[5],self.work[2],self.work[3],self.work[0],self.work[4])
        elif loc == 'S':
            self.setNumber(self.work[4],self.work[0],self.work[2],self.work[3],self.work[5],self.work[1])
        elif loc == 'W':
            self.setNumber(self.work[2],self.work[1],self.work[5],self.work[0],self.work[4],self.work[3])


    def get_Top(self):
        return self.number[0]
        
    def query(self, top_num, front_num):
        self.save_data = [i for i in range(6)]
        for i in range(6):
            self.save_data[i] = self.number[i]
            
        ret = -1
        
        for i in range(len(self.order)):
            self.roll(self.order[i])
            if self.number[0] == top_num and self.number[1] == front_num:
                ret = self.number[2]
                break
            
        for i in range(6):
            self.number[i] = self.save_data[i]
            
        return ret
        
    def equals(self, another):
        for i in range(len(self.order)):
            self.roll(self.order[i])
            FLG = True
            for k in range(6):
                if self.number[k] != another.number[k]:
                    FLG = False
                    break
            if FLG == True:
                return True

        return False

diceA = Dice()
diceB = Dice()
table = list(map(int,input().split()))
diceA.setNumber(table[0], table[1], table[2], table[3], table[4], table[5])
table = list(map(int,input().split()))
diceB.setNumber(table[0], table[1], table[2], table[3], table[4], table[5])

if diceA.equals(diceB):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 6396
//P.C.2.0.
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ul unsigned long int
#define mod 1000007
#define endl "\n"
////fast power
ll power(ll a,ll b){
    if(b==0)return 1;
    ll smallans=power(a,b/2);
    smallans=smallans*smallans;
    if(b%2==0)return smallans;
    else return a*smallans;}
////
int main(){
    ////
    speed
    ////
    int arr[33]={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};
    // for(int i=1;i<33;i++){
    //     cin>>arr[i];
    // }
    int temp;
    cin>>temp;
    cout<<arr[temp];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;
	cin>>n>>k;
	vector<int> x(n), y(n);
	for(int i = 0; i<n; i++)
	{
		cin>>x[i];
		cin>>y[i];
	}
	vector<int> x3(x),y3(y);
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	ll l1,r1,l2,r2,ans = (ll)1e20;
	for(int lx = 0; lx<n; lx++)
		for(int rx = lx+1;rx<n; rx++)
			for(int ly = 0; ly<n; ly++)
				for(int ry = ly+1; ry<n; ry++)
				{
					l1 = x[lx];
					l2 = x[rx];
					r1 = y[ly];
					r2 = y[ry];
					int num = 0;
					for(int i = 0; i<n; i++)
					{
						if(l1<=x3[i] and l2>=x3[i] and r1<=y3[i] and r2>=y3[i])
							num++;
					}
					if(num>=k) ans = min(ans,(l2-l1)*(r2-r1));
				}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()

MOD = 1000000007

def mod(n):         
  return n % MOD

MAX = 200000           #適当な数を入力
fac, finv, inv = [[0]*MAX for i in range(3)]
def combinit():     #MAXまでの下準備
  fac[0] = fac[1] = 1
  finv[0] = finv[1] = 1
  inv[1] = 1
  for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

def modcomb(n, k):      #mod(nCk)を計算、ただしn<MAX
  if (n < k):
    return 0
  if (n < 0 or k < 0):
    return 0
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
combinit()          #下準備の実行 O(MAX)

lst = [0]
for i in range(n):
  lst.append(lst[i]+l[i])

ans = 0
for i in range(n-k+1):
  ans += mod(lst[n] - lst[i+k-1] - lst[n-k-i+1])*modcomb(k+i-2, k-2) % MOD
  
print(mod(ans))

Measured memory_bytes: 35032
#include <bits/stdc++.h>
#define pb emplace_back
#define mp make_pair
#define int long long

using namespace std;

int32_t main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.precision(10);
	int n; cin >> n;
	int m; cin >> m;
	string a; cin >> a;
	string b; cin >> b;
	int g = __gcd(n, m);
	int l = (m * n) / g;
	int n1 = n / g;
	int m1 = m / g;
	bool b1 = true;
	for (int i = 0, j = 0; i < n; i += n1, j += m1)
		if (a[i] != b[j])
			b1 = false;
	if (b1)
		cout << l;
	else
		cout << -1;
}

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

int main() {
    int k;
    while ( cin >> k && k ) {
        int res = 0;
        for ( int i = 0; i < k * (k - 1) / 2; ++ i ) {
            int d;
            cin >> d;
            res += d;
        }
        res /= k - 1;
        cout << res << endl;
    }
	return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        //int N = sc.nextInt();
        int L = str.length();
        char[] c1 = new char[L];
        boolean test = true;
        
        for(int i=0; i<L; i++){
            c1[i] = str.charAt(i);
        }
        
        for(int i=0; i<(L-1)/2; i++){
            if(c1[i] != c1[L-(i+1)]){
                test = false;
            }
            if(c1[i] != c1[((L-1)/2)-(i+1)]){
                test = false;
            }
        }
        
        if(test){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        //System.out.println(ans);
    }
}

Measured memory_bytes: 35580
import java.util.Scanner;

public class Main {
	void run(){
		Scanner s = new Scanner(System.in);
		while(true){
			int a = s.nextInt();
			String op = s.next();
			int b = s.nextInt();
			if(op.equals("+")){
				System.out.println((a + b));
			}
			else if(op.equals("-")){
				System.out.println((a - b));
			}
			else if(op.equals("*")){
				System.out.println(a * b);
			}
			else if(op.equals("/")){
				System.out.println(a / b);
			}
			else if(op.equals ("?")){
				break;
			}
		}
	}
	public static void main(String[] args) {
		/* 
		 * Main x;
		 * x = new Main();
		 * x.run();
		 * ??¨????????????
		 */
		new Main().run();
		
	}
}

Measured memory_bytes: 26108
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		int a,b,s=0;
		String op="+";
		Scanner scan = new Scanner(System.in);
		while(true)
		{
			a=scan.nextInt();

			op=scan.next();
			b=scan.nextInt();
			if(op.equals("?"))
				break;
			
			switch (op){
			  case "+":
				  s=a+b;
				  break;
			  case "-":
				  s=a-b;
				  break;
			  case "*":
				  s=a*b;
				  break;
			  case "/":
				  s=a/b;
				  break;
				    default :
				    break;
			}
		System.out.println(s);
		
		}
		
	}
	}

Measured memory_bytes: 26160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc068_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  int ans = 0;
  int cnt = 0;
  rep(i, N + 1) {
    int t = i;
    int c = 0;
    while (t > 0) {
      if (t % 2 == 0) {
        t /= 2;
        c++;
      } else {
        break;
      }
    }
    if (c > cnt) {
      ans = i;
      cnt = c;
    }
  }
  if (ans == 0) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m,y,z;
    cin>>x>>y>>z;
    cout<<y/z-(x-1)/z;    

    return 0;
}

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

#define endl "\n"

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;


void solveBruteForce()
{

}

void solveOptimized()
{
	bool a[101] = {0};
	int x, n;
	cin >> x >> n;
	int t;
	for (int i = 0; i < n; i++)
	{
		cin >> t;
		a[t] = 1;
	}

	int i = x, j = x;

	while (true)
	{
		if (!a[i])
		{
			cout << i;
			return;
		}
		if (!a[j])
		{
			cout << j;
			return;
		}
		i--;
		j++;
		
	}
	cout << i;
}

void solve()
{
	// solveBruteForce();
	solveOptimized();
}

int main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);

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

	return 0;
}




Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
#define rep(i,s,n) for(ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(),a.end()
#define mod 1000000007
using namespace std;
using graph =vector<vector<ll>>;
/*階乗*/
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

/* ユークリッドの互除法 最大公約数*/
ll gcd(ll a, ll b) {
	ll r;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}



/*最小公倍数*/

ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}


/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/

//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    ll h,w,count=0,t;
    cin>>h>>w;
    if(h==1||w==1){
        cout<<1<<endl;
    }
    else{
        cout<<(h*w+2-1)/2<<endl;
        
    }
    
    


    
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
void solve(){
	int n = read.to!int;
	long[] as;
	foreach(i; 0 .. n) as ~= read.to!long;
	
	long[] ans = new long[](n);
	foreach(i; 0 .. n){
		if(i == 0) ans[i] = 0;
		else ans[i] = as[i - 1] * 2 - ans[i - 1];
	}
	log("temp:", ans);
	
	long b = as[n - 1] - ans[n - 1] / 2; // 整数になるはず
	log("b:", b);
	
	foreach(i; 0 .. n){
		if(i % 2) ans[i] -= b;
		else ans[i] += b;
	}
	log("ans:", ans);
	
	ans.map!(to!string).join(" ").writeln;
	
	
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

Node treeMinimum(Node x){
  while( x->left!=NULL ) x=x->left;
  return x;
}

Node treeMaximum(Node x){
 while( x->right!=NULL ) x=x->right;
 return x;
}

Node treeSearch(Node u, int k){
  if( u!=NULL && k!=u->key )
  {
    if( k<u->key )
       u=u->left;
    else 
       u=u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  if( x->right!=NULL ) 
    return treeMinimum(x->right);
  Node y=x->parent;
  while( y!=NULL && x==y->right )
  {
    x=y;
    y=y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y;
  Node x;

  if( z->left==NULL || z->right==NULL  )
    y=z;
  else 
    y=treeSuccessor(z);

  if( y->left!=NULL )
  {
    x=y->left;
  }
  else 
    x=y->right;

  if( x!=NULL )
  {
    x->parent=y->parent;
  }
  if( y->parent==NULL )
    root=x;
  else
  {
    if( y==y->parent->left )
    y->parent->left=x;
    else y->parent->right=x;
  }
  if( y!=z )
    z->key=y->key;
  free(y);
}

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

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

  while( x!=NULL ){
    y=x;
    if(z->key<x->key)
        x=x->left;
    else 
         x=x->right;
  }
  z->parent=y;
  if(y==NULL)
    root=z;
  else
  {
    if(z->key<y->key)
        y->left=z;
    else 
        y->right=z;
  }
}

void inorder(Node u){
  if( u==NULL )
    return;
  inorder(u->left );
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node u){
  if( u==NULL )
    return;
  printf(" %d",u->key);
  preorder( u->left);
  preorder(u->right);
}

Node find(Node u,int k){
  while( u!=NULL && k!=u->key )
  {
    if( k<u->key )
        u=u->left;
    else 
        u=u->right;
  }
  return u;
}

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

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

  return 0;
}





Measured memory_bytes: 20452
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=500010,mod=998244353;
int n,m;
long long ans;
long long jc[N<<1],jcni[N<<1];
inline long long po(long long x,long long y)
{
    long long u=1ll;
    while(y)
    {
        if(y&1) (u*=x)%=mod;
        (x*=x)%=mod;
        y>>=1;
    }
    return u;
}
inline long long c(long long x,long long y)
{
    return jc[x]*jcni[y]%mod*jcni[x-y]%mod;
}
int main()
{
    scanf("%d%d",&n,&m);
    if(n>m) swap(n,m);
    ans=m;
    jc[0]=1;
    for(int k=1;k<=n+m;k++)
        jc[k]=jc[k-1]*k%mod;
    jcni[0]=1;
    jcni[n+m]=po(jc[n+m],mod-2);
    for(int k=n+m-1;k>0;k--)
        jcni[k]=jcni[k+1]*(k+1)%mod;
    long long all=po(c(n+m,n),mod-2);
    for(int k=1;k<=n;k++)
        (ans+=c(k*2,k)*c(n-k+m-k,n-k)%mod*all%mod*po(2,mod-2)%mod)%=mod;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

/*************** using variables **************/
string a, b;
/**********************************************/

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

    cin >> a >> b;
    string s = a+b;
    int x = atoi(s.c_str());
    double xx = sqrt(x);
    if((int)(xx) == xx) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    ll N,K;
    cin>>N>>K;
    ll a=N%K;
    cout<<min(a,K-a)<<endl;
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, k, n) for (int i = k; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

bool check_palindrome(string &S) {
    rep(i, S.size() / 2) {
        if (S[i] != S[S.size() - i - 1] && S[S.size() - i - 1] != '?') return false;
    }
    
    return true;
}

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    int shift = 0, ans = n;
    for (int i = 0; i < n; ++i) {
        bool ok = true;
        for (int j = 0; j < n - i; ++j) {
            if (t[j] != s[j + i]) {
                ok = false;
                break;
            }
        }

        if (ok) {
            cout << ans << endl;
            return 0;
        }
        
        ++ans;
    }

    cout << ans << endl;

    return 0;
}

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

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

  bool c1 = N[0] == N[1] && N[1] == N[2];
  bool c2 = N[1] == N[2] && N[2] == N[3];
  if (c1 || c2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 15:39:14 2020

@author: liang
"""

N = int(input())
A = [int(x) for x in input().split()]
d = [0]*N
ans = 0
for a in A:
    if a > N :
        ans += 1
    else:
        d[a-1] += 1

for i in range(N):
    if d[i] > 0:
        if d[i] > i+1:
            ans += d[i] - (i+1)
        if d[i] < i+1:
            ans += d[i]
#print(d)
print(ans)

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORE(i, a, b) for (int i = (a); i <= (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SP cout << fixed << setprecision(10)
typedef pair<int, int> P;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

    int n, a, b;
    cin >> n >> a >> b;

    cout << min(a * n, b) << endl;

    return 0;
}

Measured memory_bytes: 892
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
using P = pair<int,int>;

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    string S; cin >> S;
    int N = S.length();
    // cout << N << endl;

    bool ok = true;

    for(int i=0; i<(N/4); i++){
        if(S[i] != S[N/2-1-i]) ok = false;
        if(S[N/2+1+i] != S[N-1-i]) ok = false;
    }
    for(int i=0; i<N/2; i++){
        if(S[i] != S[N-1-i]) ok = false;
    }
    

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

Measured memory_bytes: 3604
n = int(input())
ary = sorted([j-(i+1) for i,j in enumerate(map(int,input().split()))])
if len(ary) % 2 == 0:
    a = (ary[len(ary)//2]+ary[len(ary)//2-1])//2
    ans = 0
    for i in ary:
        ans += abs(i - a)
else:
    a = ary[len(ary)//2]
    ans = 0
    for i in ary:
        ans += abs(i - a)
print(ans)

Measured memory_bytes: 26020
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
const int LIMIT = 1e9 + 7;
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

int main(){
	int n,x,t;cin>>n>>x>>t;
  cout<<((n+x-1)/x)*t<<endl;
}

Measured memory_bytes: 3620
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**5
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = NI()
    A = LI()
    A.sort(reverse=True)
    p = []
    for i in range(1,len(A)-1):
        if A[i] < 0: break
        p.append((A[-1],A[i]))
        A[-1] -= A[i]
        A[i] = INF
    for a in A[1:]:
        if a < INF:
            p.append((A[0],a))
            A[0] -= a
    print(A[0])
    for a in p:
        print(a[0],a[1])


if __name__ == '__main__':
    main()

Measured memory_bytes: 62332
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  srand((unsigned)time(NULL));
  ll N;
  cin >> N;
  vll a(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  ll counter = 0;
  for(int i = 0; i < N; i+=2){
    if(a.at(i) % 2 != 0) counter++;
  }
  cout << counter << endl;
}

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

#define ll long long int
#define ull unsigned long long int
#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


using namespace std;

const int INF = 1e9 + 7;
const int N = 1e5+5;

int main() {

	IO;

	int d, t, s;
	cin >> d >> t >> s;
	
	int fn = t*s;
	if (fn >= d) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	
}
/*
	int tt;
	cin >> tt;
	while (tt--){
		
	}	
*/


Measured memory_bytes: 3608
a=int(input())
if a < 105:
    print("0")
else:
    count=1
    for i in range(107, a+1, 2):
        now=i
        count8=0
        for j in range(1, 200):
            if now % j == 0:
                count8+=1
        if count8==8:
            count+=1
    print(count)


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

typedef long long ll;
ll mod = 1e9+7;

const int maxn = 2e5+5;
int a[maxn];
int sum[maxn];

bool ok(int n){
    for(int i=1;i<=n;i++){
        for(int j=i;j<=n;j+=i){

        }
    }
    return 0;
}

int main()
{
    int n;
    while(cin>>n){
        memset(sum, 0, sizeof(sum));
        for(int i=1;i<=n;i++){
            cin>>a[i];
        }
        for(int i=n;i>=1;i--){
            for(int j=i+i;j<=n;j+=i){
                sum[i] = sum[i] + sum[j];
            }
            sum[i] = (sum[i] + a[i]) % 2;
        }
        vector<int> ans;
        for(int i=1;i<=n;i++){
            if(sum[i]){
                ans.push_back(i);
            }
        }
        cout<<ans.size()<<endl;
        for(int i=0;i<(int)ans.size();i++){
            cout<<ans[i];
            if(i==(int)ans.size()-1) cout<<endl;
            else cout<<" ";
        }
    }
    return 0;
}


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

int main(){
    ll N,M,ans=1;cin>>N>>M;
    if(N<M)swap(N,M);
    if(N==M){
        while(N>=1){
            ans*=N;
            ans%=1000000007;
            N--;
        }
        while(M>=1){
            ans*=M;
            ans%=1000000007;
            M--;
        }
        ans=ans*2%1000000007;
    }
    else if(N==M+1){
        while(N>=1){
            ans*=N;
            ans%=1000000007;
            N--;
        }
        while(M>=1){
            ans*=M;
            ans%=1000000007;
            M--;
        }
    }
    else ans=0;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  while(cin >> s){
    while(s.find("@")!=-1){
      int x=s.find("@");
      string y;
      for(int i=0;i<s[x+1]-'0';i++) y+=s[x+2];
      s.replace(x,3,y);
    }
    cout << s << endl;
  }
}


Measured memory_bytes: 3140
#include<stdio.h>

int main(){

    int r;
    int D;
    int x[11];

    scanf("%d", &r);
    scanf("%d", &D);
    scanf("%d", &x[0]);

    for (int i = 0; i < 10; i++){
        x[i + 1] = r * x[i] - D;
    }

    for (int i = 1; i < 11; i++){
        printf("%d\n", x[i]);
    }

    return 0;
}

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

int main()
{
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	for (int i = 0; i < (tx-sx); ++i)
		cout << 'R';
	for (int i = 0; i < (ty-sy); ++i)
		cout << 'U';
	for (int i = 0; i < (tx-sx); ++i)
		cout << 'L';
	for (int i = 0; i < (ty-sy); ++i)
		cout << 'D';
	cout << 'L';
	for (int i = 0; i < (ty-sy)+1; ++i)
		cout << 'U';
	for (int i = 0; i < (tx-sx)+1; ++i)
		cout << 'R';
	cout << 'D';
	cout << 'R';
	for (int i = 0; i < (ty-sy)+1; ++i)
		cout << 'D';
	for (int i = 0; i < (tx-sx)+1; ++i)
		cout << 'L';
	cout << 'U';
	cout << endl;
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;++i)cin>>a[i];
  bool color[8]={false};
  int fre=0,res=0;
  for(int i=0;i<n;++i){
    if(a[i]<400)color[0]=true;
    else if(a[i]<800)color[1]=true;
    else if(a[i]<1200)color[2]=true;
    else if(a[i]<1600)color[3]=true;
    else if(a[i]<2000)color[4]=true;
    else if(a[i]<2400)color[5]=true;
    else if(a[i]<2800)color[6]=true;
    else if(a[i]<3200)color[7]=true;
    else if(a[i]>=3200)fre++;
  }
  for(int i=0;i<8;++i)if(color[i])res++;
  cout<<max(1,res)<<" ";
  cout<<(res+fre)<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val a = sc.nextInt
  val b = sc.nextInt
  val c = sc.nextInt

  val l = List(a,c,b)

  val res = if(l == l.sorted || l == l.sorted.reverse) "Yes" else "No"

  println(res)
}


Measured memory_bytes: 25916
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n)
using namespace std;
int main()
{
	MaRiaMa;
	set<int> p;
	int n;
	cin >> n;
	if (n == 1 || n == 2 || n == 3)
		cout << "1";
	else
	{
		for (int i = 2; i < n; i++)
		{
			int k = 2;
			while (1)
			{
				int u = pow(i, k);
				if (u > n)
				{
					break;
				}
				p.emplace(u);
				k++;
			}
		}
		auto it = p.rbegin();
		cout << *it;
	}
	//**11**11**//	
}

Measured memory_bytes: 4072
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int ans = 700;
        for (int i = 0; i < s.length; i++) {
            if(s[i] == 'o') ans += 100;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35540