akhauriyash/Code-Regression huggingface dataset:
s=input()
t=input()
s_dic={}
t_dic={}
flag=0
for i, c in enumerate(s):
  if c in s_dic:
    if s_dic[c]!=t[i]:
      flag=1
      break
  else:
  	s_dic[c]=t[i]
for i, c in enumerate(t):
  if c in t_dic:
    if t_dic[c]!=s[i]:
      flag=1
      break
  else:
  	t_dic[c]=s[i]
if flag==1:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3632
input1 = list(map(int,input().split()))
A = input1[0]
B = input1[1]
if A == B:
  print("Draw")
elif A == 1:
  print("Alice")
elif B == 1:
  print("Bob")
elif A > B:
  print("Alice")
elif A < B:
  print("Bob")

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

void solve() {
	vector<int>A(3);
	IN(A);
	cout << A[0] * A[1] / 2 << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  vector<string> S(H);
  for (int i=0;i<H;i++){
    cin >> S[i];
  }
  vector<vector<int>> W1(H,vector<int>(W,-1));
  vector<vector<int>> W2(H,vector<int>(W,-1));
  vector<vector<int>> H1(H,vector<int>(W,-1));
  vector<vector<int>> H2(H,vector<int>(W,-1));
  for (int i=0;i<H;i++){
    for (int j=0;j<W;j++){
      if (S[i][j]=='.'&&j!=0){
        W1[i][j]=W1[i][j-1]+1;
      }
      else if (S[i][j]=='.'&&j==0){
        W1[i][j]=0;
      }
      if (S[i][W-1-j]=='.'&&j!=0){
        W2[i][W-1-j]=W2[i][W-j]+1;
      }
      else if (S[i][W-1-j]=='.'&&j==0){
        W2[i][W-1-j]=0;
      }
    }
  }
  for (int j=0;j<W;j++){
    for (int i=0;i<H;i++){
      if (S[i][j]=='.'&&i!=0){
        H1[i][j]=H1[i-1][j]+1;
      }
      else if (S[i][j]=='.'&&i==0){
        H1[i][j]=0;
      }
      if (S[H-1-i][j]=='.'&&i!=0){
        H2[H-1-i][j]=H2[H-i][j]+1;
      }
      else if (S[H-1-i][j]=='.'&&i==0){
        H2[H-1-i][j]=0;
      }
    }
  }
  int ans=0;
  for (int i=0;i<H;i++){
    for (int j=0;j<W;j++){
      if (S[i][j]=='.'){
        ans=max(ans,W1[i][j]+W2[i][j]+H1[i][j]+H2[i][j]+1);
      }
    }
  }
  cout << ans << endl; 
}

Measured memory_bytes: 67200
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;

int N;
vector<long long> A;
int main() {
    while (cin >> N) {
        A.resize(N*3); for (int i = 0; i < N*3; ++i) cin >> A[i];
        sort(A.begin(), A.end(), greater<long long>());
        long long res = 0;
        for (int i = 1, j = 0; j < N; i += 2, ++j) res += A[i];
        cout << res << endl;
    }
}

Measured memory_bytes: 2560
import java.io.*;
import java.util.StringTokenizer;
import java.util.ArrayList;

public class Main {
        public static void main(String[] args) {
                BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
                ArrayList<String> res = new ArrayList<>();
                try {
                        outside: while (true) {
                                String line = reader.readLine();
                                StringTokenizer tokenizer = new StringTokenizer(line);
                                int a = Integer.parseInt(tokenizer.nextToken());
                                String op = tokenizer.nextToken();
                                int b = Integer.parseInt(tokenizer.nextToken());
                                switch (op) {
                                case "?":
                                        break outside;
                                case "+":
                                        res.add(String.valueOf(a + b));
                                        break;
                                case "-":
                                        res.add(String.valueOf(a - b));
                                        break;
                                case "*":
                                        res.add(String.valueOf(a * b));
                                        break;
                                case "/":
                                        res.add(String.valueOf(a / b));
                                        break;
                                default:
                                        return;
                                }
                        }
                } catch (Exception e) {
                        e.printStackTrace();
                }
                System.out.println(String.join("\n", res));
        }
}



Measured memory_bytes: 24392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 1e18+7;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

int n;
vector<int> a;

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

bool check(int mid){
  
  return false;
}

ll serch(ll ok,ll ng){
	while (abs(ok-ng) > 1) {
		ll mid = (ok + ng) / 2;
		if (check(mid))ok = mid;
		else ng = mid;
	}
	return ok;
}

int main(){
  cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);
  int h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  cout<<max((h2-h1)*60+m2-m1-k,0);
  return 0;
}


Measured memory_bytes: 3612
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
// #pragma GCC optimize("unroll-loops")



#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include <ext/rope>
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define Find order_of_key
// #define at find_by_order
#define x first
#define y second
#define ll long long
#define lll __int128
#define ull unsigned long long
#define ulll unsigned __int128
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define gu getchar_unlocked()
#define pu putchar_unlocked()
#define all(x) x.begin(),x.end()
#define endl '\n'

const int mx=100010;
ll arr[mx];
int n;
int main()
{
	memset(arr,5,sizeof arr);
	cin>>n;
	for(int i=1;i<n;i++){
		ll a;
		cin>>a;
		arr[i-1]=min(arr[i-1],a);
		arr[i]=min(arr[i],a);
	}
	ll s=0;
	for(int i=0;i<n;i++)s+=arr[i];
		cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define inf (int)(1e9+7)
#define eb emplace_back
#define mod (ll)(1e9+7)
//dp[i][j]
//saw top i digits
//a + b is equal to L(j = 0) or less than L(j = 1)
//j = 0, top i digits are the same as L
//j = 1, if saw 0, the fact that the number is less than L is decided

int dp[100005][2];
//*2 don't cause overflow
//int_max is 2147483647
int main() {
    string L; cin >> L;
    int n = (int)L.size();
    dp[0][0] = 1;
    rep(i, n) {
        //look dp[i][0] and dp[i][1] transition in 4 cases
        //if a + b's digit i is 0
        if (L[i] == '0') { //a[i] = 0, b[i] = 0
            dp[i + 1][0] = dp[i][0];
            dp[i + 1][1] = dp[i][1];
        } else {
            //i桁まで一致しててL[i] = 1でa + bが0ならa + bがL未満であることが確定する
            dp[i + 1][1] = (dp[i][0] + dp[i][1]) % inf;
        }
        //a + b's digit i is 1
        //(a[i], b[i]) = (1, 0), (0, 1)
        if (L[i] == '0') {
            //i桁まで一致しててL[i] = 0なのにa + bが1ならout
            (dp[i + 1][1] += dp[i][1] * 2 % inf) %= inf;
            //+=, look 2 a + b's digit i case
        } else {
            (dp[i + 1][0] += dp[i][0] * 2 % inf) %= inf;
            (dp[i + 1][1] += dp[i][1] * 2 % inf) %= inf;
        }
    }
    //ans is L or less
    int ans = (dp[n][0] + dp[n][1]) % inf;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1280
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main () {
    let n = read::<usize>();
    let mut h = vec![0; n];
    let mut v = vec![0; n];
    for i in 0..n {
        h[i] = read::<usize>();
        if i > 0 && h[i] <= h[i-1] {
            v[i] = v[i-1] + 1;
        }
    }

    v.sort();
    println!("{}", v[n-1])

}

Measured memory_bytes: 4352
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	char a, b;
	cin >> a >> b;
	if (a == 'H')
	{
		print(b);
	}
	else
	{
		if (b == 'H')
			print('D');
		else
			print('H');
	}
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<' ';
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n; cin>>n;
    vector<pair<pair<string,int>,int>> r(n);
    rep(i,n){
        cin>>r[i].first.first>>r[i].first.second;
        r[i].first.second *= -1;
        r[i].second = i+1;
    }
    sort(r.begin(),r.end());
    for(auto c : r) cout<<c.second<<endl; return 0;
}

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

int main(){
	int N,M;
	string S;
	cin >> N >> M >> S;
	
	reverse(S.begin(),S.end());
	
	vector<int> ans;
	
	for(int p=0;p<N;){
		for(int m=M;m>0;m--){
			if(p+m>N)m=N-p;
			if(S[p+m]=='0'){
				ans.push_back(m);
				p+=m;
				break;
			}
			if(m==1){
				cout << "-1" << endl;
				return 0;
			}
		}
	}
	
	reverse(ans.begin(),ans.end());
	
	for(int i=0;i<ans.size();i++){
		cout << ((i==0)?(""):(" ")) << ans[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1144
#include<cstdio>
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

const int CMax = 102;

int W, H, n, sk, B[CMax][CMax], cx = 0, cy = -1, k;

int main(){
    scanf("%d %d", &H, &W);
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d", &sk);
        for (int j = 0; j < sk; j++){
            if (k == 0){
                ++cy;
                if (cy >= W){
                    ++cx;
                    k = 1;
                    cy = W-1;
                    B[cx][cy] = i+1;
                }
            } else {
                --cy;
                if (cy < 0){
                    ++cx;
                    k = 0;
                    cy = 0;
                    B[cx][cy] = i+1;
                }
            }
            B[cx][cy] = i+1;
        }
    }
    for (int i = 0; i < H; i++){
        for (int j = 0; j <  W; j++){
            printf("%d", B[i][j]);
            if (j < W-1) printf(" ");
        }
        printf("\n");
    }
}


Measured memory_bytes: 384
def gcd(a, b):
    if b == 0:
        return a
    
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

N = int(input())
T = []

for i in range(N):
    t = int(input())
    T.append(t)
    
ans = 1
for i in range(N):
    ans = lcm(ans, T[i])
    
print(ans)

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

int main(){
  long long a,b,c,d;
  
  cin >> a >> b >> c >> d;
  long long x = max(max(a*c,a*d),max(b*c,b*d));
  
  cout << x << endl;
  
  return 0;
}

Measured memory_bytes: 3640
package main

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

const MaxInt = int(^uint(0) >> 1)
const MinInt = -MaxInt - 1

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)

	k := nextInt()
	x := nextInt()

	for i := x - k + 1; i < x+k; i++ {
		fmt.Printf("%d ", i)
	}
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
import numpy as np

def main():
    # # 整数の入力
    # a = int(input())
    # # スペース区切りの整数の入力
    # b, c = map(int, input().split())
    # # 文字列の入力
    # s = input()
    # # 出力
    # print("{} {}".format(a+b+c, s))
    N = int(input())
    cnt = 0
    for i in range(1,N+1):
        if get_keta(i) % 2 != 0:
            cnt += 1
    print(cnt)

def get_keta(N):
    return len(str(N))

if __name__=='__main__':
    main()


Measured memory_bytes: 12496
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl '\n'
#define maxl __LONG_LONG_MAX__
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define rep(i, n) for(int i = 0; i < n; i++)
#define rev(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i=1; i < n; i++)
#define rev1(i, n) for(int i=n ; i > 0; i--)
#define FOR(i, a, b) for(int i=a ; i < b; i++)
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define n_ones(x) __builtin_popcountll(x)
#define n_trailzero(x) __builtin_ctzll(x)
#define n_leadingzero(x) __builtin_clz(x)
#define sz(a) (ll)(a.size())

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vector<ll>> vvll;
typedef stack<ll> stk;
typedef queue<ll> que;

typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_setll;
typedef tree<char,null_type,less<char>,rb_tree_tag,
tree_order_statistics_node_update> indexed_setc;

ll max(int a,ll b){ return max((ll)a,b);}
ll min(int a,ll b){ return min((ll)a,b);} 
ll min(ll a,int b){ return min(a,(ll)b);}
ll max(ll a,int b){ return max(a,(ll)b);}

ll mod = 1e9 + 7;
void solve()
{
	ll h, w;
	cin>>h>>w;
	char a[1005][1005];
	rep1(i, h+1)
			cin>>a[i]+1;
	
	ll dp[1005][1005] = {0};
	rep1(i, h+1)
	{
		rep1(j, w+1)
		{
			if(a[i][j] == '#')
				continue;
			if(i == 1 && j == 1)
				dp[i][j] = 1;
			else
				dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod;
		}
	}
	cout<<dp[h][w]<<endl;
	return;
}

int main()
{
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
	ll t = 1;
	//cin>>t;
	rep(i, t)
		solve();
	return 0;
	
}

Measured memory_bytes: 9088
//  s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま
//  s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま
//s配列に格納した単語を、辞書順にソートする
//getline(cin, s);
//  sort(s.begin(), s.end());
//  string t = "keyence";//で文字列入力ができる
//s.empty() //emptyなら1を出力 入っていれば0を出力
/*//ABC018-B 部分的にreverseをかける解法
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) cin>>a.at(i)>>b.at(i);
  rep(i,n)a.at(i)--;
  rep(i,n)b.at(i)--;
  string t;
  rep(i,n){
    t = s;
    for(int k=0;k<=b.at(i)-a.at(i);k++){
      t.at(a.at(i)+k) = s.at(b.at(i)-k);
    }
    s = t;
  }
  cout << s << endl;
}
*///ABC018-B
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int kan_hyaku(int n){
  int kurai = 0;
  for(int i=0;i<3;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ju(int n){
  int kurai = 0;
  for(int i=0;i<2;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ichi(int n){
  int kurai = 0;
  for(int i=0;i<1;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int main() {
  int n;
  cin >> n;
  vector<ll>a(n);
  vector<ll>b(n);
  rep(i,n) cin>> a.at(i) >> b.at(i);
  ll sum = 0;
  for(int k=n-1;k>=0;k--){
//    ll k = n - i - 1;
    ll num = b.at(k) - (a.at(k) + sum ) % b.at(k);
    if(num != b.at(k)){
      sum += num;
    }
  }
  cout << sum << endl;
}

/*
for(int k=n-1;k>=0;k--){
//    ll k = n - i - 1;
    ll num = b.at(k) - (a.at(k) + sum ) % b.at(k);
    if(num < b.at(k)){
      sum += num;
    }
  }
  cout << sum << endl;
}
*/

/*
  for(int i=n-1;i>=0;i--){
    if(a.at(i)+sum <= b.at(i) ){
      sum += b.at(i) - sum - a.at(i);
    }
    else{
      ll num = (a.at(i)+sum) % b.at(i);
      if(num != 0){
        sum += b.at(i) - num;
      }
    }
  }
  cout << sum << endl;
}
*/

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

int main() {
  long long l, r;
  cin >> l >> r;
  
  long long ans = 4000;
  for(long long i = l; i < r; i++){
    for(long long j = i + 1; j <= r; j++){
      ans = min(ans, i * j % 2019);
      if(ans == 0) break;
    }
    if(ans == 0) break;
  }
  
  cout << ans << endl;
}

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

int main(){
int n;
cin >> n;
 vector<int> a(n),b(3),c(3);
 for(int i=0;i<n;i++){
     cin >> a.at(i);
 }
int ans =0;
for(int i=0;i<n-2;i++){
    b.at(0)=a.at(i);b.at(1) =a.at(i+1);b.at(2)=a.at(i+2);
    c.at(0)=b.at(0);c.at(1)=b.at(1);c.at(2)=b.at(2);
    sort(b.begin(),b.end());
    for(int j=0;j<3;j++){
        if(b.at(1)==c.at(j)&&j==1){
            ans++;
            break;
        }
    }
}
    cout << ans << endl;
}

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

int main(void){
  int x, y;

  while(1){
    cin >> x >> y;

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

    }
    if(x < y){
      cout << x << " " << y << "\n";

    } else {
      cout << y << " " << x << "\n";

    }

  }

  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())

typedef long long ll;
typedef tuple<int,int,bool> Tb;


int atcoder(){
    //入力
    ll x;
    cin >> x;
    ll ans;
    ll dp[1000000];
    dp[0]=0;
    
    //処理
    for(ll i=0 ;dp[i]<x ;++i){
        dp[i+1] = dp[i] + i+1;
        ans = i+1;
    }
    //出力
    
    cout << ans << ENT;
    return 0;
}

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


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int K;
    char s[101];

    scanf("%d", &K);
    scanf("%s", s);

    int len = strlen(s);

    if (len <= K)
        printf("%s", s);
    else {
        for (int i = 0; i < K; i++) {
            printf("%c", s[i]);
        }
        printf("...");
    }

    return 0;
}


Measured memory_bytes: 2136
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#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 ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 998244353;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
//combination(Nが小さい時はこれを使う
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

// 二項係数計算
long long COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight(int n) {
	int ans = 1;
	while (n >= 10) {
		n /= 10;
		ans++;
	}
	return ans;
}
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
int n, m, x;
int c[15], a[15][15];
signed main() {
	cin >> n >> m >> x;
	rep(i, n) {
		cin >> c[i];
		rep(j, m)cin >> a[i][j];
	}
	int ans = inf;
	rep(i, 1 << n) {
		int f[15];
		rep(i, 15)f[i] = 0;
		int cnt = 0;
		rep(j, n) {
			if ((i >> j) & 1) {
				cnt += c[j];
				rep(k, m)f[k] += a[j][k];
			}
		}
		bool p = true;
		rep(j, m) {
			if (f[j] < x)p = false;
		}
		if (p == true)ans = min(ans, cnt);
	}
	if (ans == inf)puts("-1");
	else cout << ans << endl;
	ggr
}


Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

int prime(int n) {
	int primes;
	for (int i = 2; n >= i * i; ++i) {
		if(!(n % i))return 0;
		
	}
  return 1;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n,k;cin>>n>>k;
  int r,s,p;cin>>r>>s>>p;
  string t;cin>>t;
  // ll ans = 0;
  rep(i,n){
    if(t[i] != '.'){
      if(i+k < n && t[i] == t[i+k]){
        t[i+k] = '.';
      }
    }
  }
  ll ans = 0;
  rep(i,n){
    if(t[i] == '.')continue;
    if(t[i] == 'r'){
      ans += p;
    }else if(t[i] == 's'){
      ans += r;
    }else if(t[i] == 'p'){
      ans += s;
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back
#define fi first
#define be begin()
#define en end()
#define se second

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  int R,G;
  cin>>R>>G;
  cout << G + (G-R) << endl;
  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main() {
  int A, K, a, ans;
  scanf("%d%d", &A, &K);
  if (A < K) {
    a = (K + A) % 2;
    ans = (K + A) / 2;
  } else {
    a = (K + A) % 2;
    ans = (K + A) / 2;
  }
  
  if (a == 0) {
    printf("%d\n", ans);
  } else {
    printf("IMPOSSIBLE");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 0;i < 26;i++){
        for(int j = 0;j < 15;j++){
            if(4 * i + 7 * j == N){
                ans = 1;
                break;
            }
        }
    }
    if (ans){
        cout << "Yes";
    }
    else cout << "No";
    return 0;
}

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

#define int long long int

using namespace std;

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

    const int mod = 1E9 + 7;
    int n, res = 0;
    cin >> n;
    vector<int> c(n);
    for (int i = 0; i < n; i++)
        cin >> c[i];
    sort(c.rbegin(), c.rend());

    int pow_4 = 1;
    for (int i = 0; i < n - 1; i++)
    {
        pow_4 *= 4;
        pow_4 %= mod;
    }

    for (int i = 0; i < n; i++)
    {
        long long add = (c[i] * (i + 2)) % mod;
        add = (add * pow_4) % mod;
        res = (res + add) % mod;
    }

    cout << res << "\n";

    return 0;
}


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

int N;

void solve(){
    vector<string> S(N);
    for(int i=0;i<N;i++) cin>>S[i];

    int num[26]={};
    int cnt=1;
    map<char,int> mp;
    for(int i=0;i<N;i++){
        for(int j=0;j<S[i].size();j++){
            if(num[S[i][j]-'A']) continue;
            num[S[i][j]-'A']=cnt++;
        }
    }

    for(int i=0;i<N;i++){
        for(int j=0;j<S[i].size();j++){
            S[i][j]=num[S[i][j]-'A']-1;
        }
    }

    vector<int> v;
    for(int i=0;i<10;i++)v.push_back(i);

    ll ans=0;
    do{
        ll sum=0;
        ll res=0;
        bool ok=true;
        for(int i=0;i<N;i++){
            if(S[i].size()>1&&v[S[i][0]]==0){
                ok=false;
                break;
            }
        }
        if(ok==false) continue;

        for(int i=0;i<N-1;i++){
            int tmp=0;
            for(int j=0;j<S[i].size();j++){
                int n=v[S[i][j]];
                tmp=tmp*10+n;
            }
            sum+=tmp;
        }

        for(int j=0;j<S[N-1].size();j++){
            int n=v[S[N-1][j]];
            res=res*10+n;
        }
        if(sum==res) ans++;
    }while(next_permutation(v.begin(),v.end()));

    for(int i=1;i<=10-(cnt-1);i++) ans/=i;
    cout<<ans<<endl;
}

int main(){
  while(1){
      cin>>N;
      if(N==0) break;
      solve();
  }

  return 0;
}



Measured memory_bytes: 3020
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String[] words = new String[a];
        for (int i = 0; i < a; i++) {
            words[i] = sc.next();
        }
        Arrays.sort(words);
        String result = "";
        for (String tmp : words) {
            result += tmp;
        }
        System.out.println(result);
    }
}


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

int main() {
    int P, Q, R;
    std::cin >> P >> Q >> R;
    std::vector<int> distance {P, Q, R};
    std::sort(distance.begin(), distance.end());
    std::cout << distance[0] + distance[1] << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

	void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		int n = 0;
		for(int i=0; i<3; i++)
			if(s.charAt(i) == 'o') n++;
		
		System.out.println(700+100*n);
	}
}

Measured memory_bytes: 21844
while n = gets.to_i do
    if n==0 then
        break
    end
    x=Array.new(4000,0)
    bool =false
    for i in 1..n do
        line = gets
        a,b,c = line.split.map(&:to_i)
        x[a]+=b*c
        if x[a]>=1000000 then
            puts a
            x[a]=-1000000
            bool=true
        end
    end
    if bool==false then
        puts 'NA'
    end
end

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

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

  int ans = 0;
  for (int j = 1; j < n - 1; j++) {
    int tmp = 0;
    for (int i = 0; i + j < n; i++) {
      if(s[i] == s[i + j]) {
        tmp++;
        tmp = min(tmp, j);
        ans = max(ans, tmp);
      }
      else tmp = 0;
    }
  }
  cout << ans << '\n';
}

Measured memory_bytes: 256
N = int(input())
AB = [[int(i) for i in input().split()] for _ in range(N)]

A, B = map(list, zip(*AB))
A.sort()
B.sort()

if N % 2 == 0 :
  print(B[N//2] + B[N//2-1] - A[N//2] - A[N//2-1] + 1)
else :
  print(B[N//2] - A[N//2] + 1)

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

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

    int n;
    string s;
    cin >> n >> s;
    
    int a = 0, b = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') a++;
    }

    int ans = max(a, b);
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') a--;
        else b++;
        int now = max(a, b);
        ans = min(ans, now);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3756
#include <iostream>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
int main(){
    int A,B,C,K;
    cin>>A>>B>>C>>K;
    rep(i, K){
        if(A<B&&C<B)
            B*=2;
        else if(A<C&&B<C)
            C*=2;
        else
            A*=2;
    }
    cout<<A+B+C<<endl;
}

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

#define int long long
#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 REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
    
    
    int n,x,t;
    cin>>n>>x>>t;
    cout<<ceil(n,x)*t<<endl;
    
    
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp
./a.out

*/

Measured memory_bytes: 7760
#include <stdio.h>

using namespace std;

int main(){
	int n,m,l;
	scanf("%d %d %d",&n,&m,&l);
	int A[n][m],B[m][l];
	long long int C[n][l];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			C[i][j] = 0;
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			scanf("%d",&A[i][j]);
		}
	}
	for(int i = 0; i < m; i++){
		for(int j = 0; j < l; j++){
			scanf("%d",&B[i][j]);
		}
	}

	for(int i = 0; i < n; i++){
		for(int k = 0; k < l; k++){
			for(int j = 0; j < m; j++){
				C[i][k] += A[i][j]*B[j][k];
			}
		}
	}

	for(int i = 0; i < n; i++){
		for(int j = 0; j < l-1; j++){
			printf("%lld ",C[i][j]);
		}
		printf("%lld\n",C[i][l-1]);
	}
}


Measured memory_bytes: 2760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 10;
ll n, k, a[N];
vector<ll>v1,v2,v0;
bool check(ll val)
{
	ll cnt = 0;
	for (int i = 1; i <= n; i++)
	{
		if (a[i] == 0)
		{
			if (val >= 0)
			cnt += n - 1;
		}
		else if (a[i] > 0)
		{
			if (val >= 0)
			{
				ll l = -1e9 - 10;
				ll r = val / a[i];
				int pos1 = lower_bound(a + 1, a + n + 1, l) - a;
				int pos2 = upper_bound(a + 1, a + n + 1, r) - a;
				pos2--;
				cnt += pos2 - pos1 + 1;
				if (l <= a[i] && a[i] <= r)
				cnt--;
			}
			else 
			{
				ll l = -1e9 - 10;
				ll r = val / a[i];
				if (val % a[i] != 0)
				r--;
				int pos1 = lower_bound(a + 1, a + n + 1, l) - a;
				int pos2 = upper_bound(a + 1, a + n + 1, r) - a;
				pos2--;
				cnt += pos2 - pos1 + 1;
				if (l <= a[i] && a[i] <= r)
				cnt--;
			}
		}
		else if (a[i] < 0)
		{
			if (val >= 0)
			{
				ll l = val / a[i];
				ll r = 1e9 + 10;
				int pos1 = lower_bound(a + 1, a + n + 1, l) - a;
				int pos2 = upper_bound(a + 1, a + n + 1, r) - a;
				pos2--;
				cnt += pos2 - pos1 + 1;
				if (l <= a[i] && a[i] <= r)
				cnt--;
			}
			else
			{
				ll l = val / a[i];
				ll r = 1e9 + 10;
				if (val % a[i] != 0)
				l++;
				int pos1 = lower_bound(a + 1, a + n + 1, l) - a;
				int pos2 = upper_bound(a + 1, a + n + 1, r) - a;
				pos2--;
				cnt += pos2 - pos1 + 1;
				if (l <= a[i] && a[i] <= r)
				cnt--;
			}
		}
	}
	cnt /= 2;
	return cnt >= k;
}
int main()
{
//	cout<<(-9)/(-4)<<endl;
	scanf("%lld%lld", &n, &k);
	for (int i = 1; i <= n; i++)
	{
		scanf("%lld", &a[i]);
		if (a[i] == 0)
		v0.push_back(a[i]);
		else if (a[i] > 0)
		v1.push_back(a[i]);
		else
		v2.push_back(a[i]);
	}
	sort(a + 1, a + n + 1);
	ll l = -1e18 - 10, r= 1e18 + 10;
	while (l < r)
	{
		ll mid = (l + r) >> 1;
		bool flag = check(mid);
		if (flag)
		r = mid;
		else
		l = mid + 1;
	}
	printf("%lld\n", r);
}

Measured memory_bytes: 3700
// Code by Nguyen Huu Lam
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;

typedef int LL;

#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Slient_voice

#define ordered_set tree<LL, null_type, less<LL>, rb_tree_tag, tree_order_statistics_node_update>
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}

template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}

const LL MaxN = 81, INF = MaxN * MaxN * 2 + 1;

LL n, a[MaxN][MaxN], m, b[MaxN][MaxN], kq = 1e9;
bitset<MaxN * MaxN * 4 + 3> d[MaxN][MaxN];

void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}

int main(){
    // InOut();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for(int i = 1 ; i <= n ; ++i)
    for(int j = 1 ; j <= m ; ++j) cin >> a[i][j];
    for(int i = 1 ; i <= n ; ++i)
    for(int j = 1 ; j <= m ; ++j) cin >> b[i][j];
    d[1][1].set(a[1][1] - b[1][1] + INF, 1);
    d[1][1].set(b[1][1] - a[1][1] + INF, 1);
    for(int i = 1 ; i <= n ; ++i)
    for(int j = 1 ; j <= m ; ++j){
        if(i == 1 && j == 1) continue;
        LL temp = abs(a[i][j] - b[i][j]);
        d[i][j] = (d[i - 1][j] << temp) | (d[i - 1][j] >> temp) | (d[i][j - 1] << temp) | (d[i][j - 1] >> temp);
    }
    for(int i = 0 ; i <= INF * 2 ; ++i)
    if(d[n][m][i]) kq = min(kq, abs(i - INF));
    cout << kq << endl;

    return 0;
}

Measured memory_bytes: 21120
#include<bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v) cerr<<#v":[ ";for (auto macro_vi:v){cerr<<macro_vi<< " ";}cerr<<"]"<<endl;
#define ddump(v) cerr<<#v":"<<endl;for(auto macro_row:v) {cerr<<"["; for (auto macro__vi:macro_row){cerr<<macro__vi<< " ";}cerr<<"]"<<endl;}
#define damp(m) for(auto macro_pair:m){cerr<< macro_pair.first<<":"<<macro_pair.second<<endl;}
#define dpair(p) cerr << #p":"<<"(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(v) v.begin(), v.end()
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pair<int,int>> V(n);
    rep(i,n) cin >> V[i].first,V[i].second=i;
    map<int,int> ans;
    sort(all(V));
    for(int i=0; i<(n+1)/2; i++){
        ans[V[i].second] = V[(n+1)/2].first;        
    }    
    for(int i=(n+1)/2; i<n; i++){

        ans[V[i].second] = V[(n+1)/2-1].first;        
    }
    for(int i=0; i<n; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 13184
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int r;
    cin >> r;
    cout << 3 * r * r << endl;
    return 0;
}

Measured memory_bytes: 3592
def func(li,b) :
    sum = 0
    for i in range(len(li)) :
        sum+= abs(li[i] - b - i - 1)
    return sum
def binary_search(li) :
    left = -1000000001
    right = 1000000001
    while right - left > 1 :
        med = (right + left) // 2
        x = func(li,med)
        mdx = func(li,med-1)
        pdx = func(li,med+1)
        if mdx > x and pdx < x :
            left = med
            continue
        elif mdx < x and pdx > x :
            right = med
            continue
        elif mdx >= x and pdx >= x :
            return x
    else :
        return -1
N = int(input())
A =[int(i) for i in input().split()]
print(binary_search(A))

Measured memory_bytes: 86612
#include<bits/stdc++.h>
using namespace std;
#define ll long
ll MOD = 1e9 + 7;
ll a[100005];
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll n;
	cin >> n;

	ll flag = 1;
	ll ans = 1;

	if (n % 2 == 0) {

		for (ll i = 0; i < n; i++) {
			ll x;
			cin >> x;
			a[x]++;

			if (x >= n || x % 2 == 0 || a[x] > 2) {
				flag = 0;
				cout << "0" << endl;
				break;
			}


			if (a[x] == 1)
				ans = ans * 2 % MOD;
		}
	}

	else {

		for (ll i = 0; i < n; i++) {
			ll x;
			cin >> x;
			a[x]++;
			if (x >= n || x % 2 == 1 || a[0] > 1 || a[x] > 2) {
				flag = 0;
				cout << "0" << endl;
				break;
			}


			if (x != 0 && a[x] == 1)
				ans = ans * 2 % MOD;
		}
	}

	if (flag)
		cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4312
import java.util.*;
class Main
{
  public static void main(String [] args)
  {
    Scanner s = new Scanner(System.in);
    int a = s.nextInt();
    int l = s.nextInt();
    
    if((l - 2 * a)%2 == 0)
    {
      int t = (l - 2 * a)/2;
      int c = a - t;
      
      if(t >= 0 && c >= 0)
        System.out.println("Yes");
      else
        System.out.println("No");
    }
       else
        System.out.println("No");
                          
  }
}

Measured memory_bytes: 35776
#include<stdio.h>

int main(){
  int i,j,n,ie,sum;
  
  do{
    scanf("%d",&n);
    if(!n) break;
    if(n==1){
      printf("deficient number\n");
      continue;
    }
    for(sum=1,i=2,j=n;i<j;i++){
      if(n%i==0){
	j=n/i;
	if(i!=j)
	  sum+=i+j;
	else
	  sum+=i;
      }
    }
    printf("%s\n",sum==n?"perfect number":
	   sum<n?"deficient number":"abundant number");
  }while(1);
  return 0;
}

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

int main() {
    while (1) {
        int z, ans = 0;
        cin >> z;
        if (z == 0) break;
        for (int x = 1; x < z; x++) {
            for (int y = 1; y < z; y++) {
                if (x * x * x + y * y * y >= z * z * z) break;
                ans = max(ans, x * x * x + y * y * y);
            }
        }
        cout << z * z * z - ans << endl;
    }
    return 0;
}

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

using namespace std;

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

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

int main(void) {
  int i,j;
  string s;
  cin>>s;
  vi v(3,0);
  rep(i,s.size()){
    if(s[i]=='a')v[0]++;
    if(s[i]=='b')v[1]++;
    if(s[i]=='c')v[2]++;
  }
  sort(all(v));
  if(v[2]-v[0]<=1)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 512