akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
 
#define  mod 1000000007
#define  N   10005
#define  inf 1e18
 
int a[N];
vector < int > primes;
 
void foo()
{
        for(int i=2;i<N;i++)
        {
                if(!a[i])
                {
                        primes.push_back(i);
                        for(int j=2*i; j<N; j+=i)
                                a[j] = 1;
                }
        }
}
 
int32_t main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
 
        int n;
        cin>>n;
 
        vector < int > a(n);
 
        for(int i=0; i<n; i++)
                cin>>a[i];
 
        foo();
 
        map < int , int > pp;
 
        for(int i=1;i<=100000;i++)
        {
                pp[i*i]=i;
        }
 
 
        map < int , int > me;
        int flag = 0;
        int ans = 0;
 
        vector < pair < int , int > > arr;
 
        for(int i=0;i<n;i++)
        {
                int cur = a[i];
                int opp = 1;
                int red = 1;
                for(int j=0;j<primes.size();j++)
                {
                        int curp = primes[j];
                        int count = 0;
                
                        while(cur%curp==0)
                        {
                                cur/=curp;
                                count++;
                        }
                        count%=3;
                        if(count==1)
                        {
                                opp*=curp*curp;
                                red*=curp;
                        }
                        else if(count==2)
                        {
                                opp*=curp;
                                red*=curp*curp;
                        }
                }
                red*=cur;
                
                
                if(pp.find(cur)!=pp.end())
                {
                        opp*= pp[cur];
                }
                else if(cur <= 100000)
                {
                        opp*= cur*cur;
                }
                else
                {
                        ans++;
                        continue;
                }
                
                me[red]++;
                arr.push_back({red, opp});
                
        }
 
        sort(arr.begin(), arr.end());
        arr.erase( unique( arr.begin(), arr.end() ), arr.end() );
 
 
        for(int i=0; i<arr.size();i++)
        {
                if(arr[i].first==1)
                        ans++;
                else
                        ans+= max(me[arr[i].first], me[arr[i].second]);
                me[arr[i].first] =0;
                me[arr[i].second] =0;
        }       
        cout<<ans<<endl;
 
        return 0;
}
 

Measured memory_bytes: 19184
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	int k;
	int a[] = {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};
	cin >> k;
	cout << a[k - 1] << endl;
	return 0;
}


Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    println!("{}",(read::<usize>()+110)/111*111)
}

Measured memory_bytes: 4352
H, W = map(int, input().split())
ans = min(H, W)
if H % 3 == 0 or W % 3 == 0:
    ans = 0
else:
    for h in range(1, H):
        s1 = h * W
        s2 = (H - h) * (W // 2)
        s3 = (H - h) * ((W + 1)// 2)
        ans = min(ans, max(s1,s2,s3) - min(s1,s2,s3))
    for w in range(1, W):
        s1 = w * H
        s2 = (W - w) * (H // 2)
        s3 = (W - w) * ((H + 1)// 2)
        ans = min(ans, max(s1,s2,s3) - min(s1,s2,s3))
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;

int dp[100005];

int main(){
  int a,b; cin>>a>>b;
  int ans=max({a+b,a-b,a*b});
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;

namespace Math_Functions
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Console.ReadLine().Split(' ');
            var a = double.Parse(x[0]);
            var b = double.Parse(x[1]);
            var c = double.Parse(x[2]);

            var t = c * Math.PI / 180;

            Console.Write("{0:F4}\n{1:F4}\n{2:F4}\n",
            0.5 * a * b * Math.Sin(t),
            a + b + Math.Sqrt(a * a + b * b - 2 * a * b * Math.Cos(t)),
            b * Math.Sin(t));
        }
    }
}

Measured memory_bytes: 9236
#include<bits/stdc++.h>
#define mk make_pair
#define fi first
#define nd second
#define pii pair<int,int>
#define sqr(x) ((x)*(x))
using namespace std; 
typedef long long ll;
inline ll read() {ll x = 0; char ch = getchar(), w = 1;while(ch < '0' || ch > '9') {if(ch == '-') w = -1;
ch = getchar();}while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0';ch = getchar();}return x * w;}
void write(ll x) {if(x < 0) putchar('-'), x = -x;if(x > 9) write(x / 10);putchar(x % 10 + '0');}
inline void writeln(ll x) {write(x);puts("");}
const int N = 2000000;
int n;
struct T {
	int i;
	ll val;
}a[N];
bool cmp(T _x, T _y) {
	if(_x.val != _y.val) return _x.val < _y.val;
	return _x.i < _y.i;
}
ll ans[N];
int main() {
	n = read();
	for(int i = 1; i <= n; ++i) a[i].val = read(), a[i].i = i;
	sort(a + 1, a + 1 + n, cmp);
	int id = n + 1;
	for(int i = n; i;--i) {
		int j = i;
		id = min(id, a[i].i);
		while(j && a[j - 1].val == a[i].val) id = min(id, a[j - 1].i),--j;
		ans[id] += (a[j].val - a[j - 1].val) * (n - j + 1);
		i = j;
	}
	for(int i = 1;  i<= n; ++i)
		writeln(ans[i]);
	return 0;
}

Measured memory_bytes: 6016
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int N, K;
  std::cin >> N >> K;
  std::vector<int> A(N);
  for(int i=0;i<N;i++) scanf("%d", &A[i]);
  std::vector<int> dp(K+1, -1);
  dp[0] = 0;
  for(int i=1;i<=K;i++){
    set<int> gr;
    for(int j=0;j<N;j++) if(i>=A[j] && gr.find(dp[i-A[j]])==gr.end()) gr.insert(dp[i-A[j]]);
    int now = 0;
    while(true){
      if(gr.find(now)!=gr.end()) now++;
      else break;
    }
    dp[i] = now;
  }
  std::cout << (dp[K]==0?"Second":"First") << '\n';
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
 
int main (){
  int i, n, a[10000];
  scanf("%d",&n);
 
  for (i = 0; i < n; i++){
    scanf("%d",&a[i]);
  }
 
  int min = a[0], max = a[0];
  long long int sum = 0;
  for ( i = 0; i < n; i++){
    if ( a[i] < min ){
      min = a[i];
    }else if ( a[i] > max ){
      max = a[i];
    }
    sum += a[i];
  }
 
  printf("%d %d %lld\n",min,max,sum);
 
  return 0;
}

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

int abs(int x) {
  return x >= 0 ? x : (-1)*x;
}

int judge(char *s) {
  int map[3][3];
  for( int i=0; i<9; i++) {
      if(s[i]=='o') map[i%3][i/3] = 1;
      if(s[i]=='x') map[i%3][i/3] = -1;
      if(s[i]=='s') map[i%3][i/3] = 0;
  }

  int sum[8];
  for(int i = 0; i < 8; i++) { sum[i] = 0; }
  for(int i = 0; i < 3; i++) {
    sum[0] += map[i][i];
    sum[1] += map[i][2-i];
    sum[2] += map[0][i];
    sum[3] += map[1][i];
    sum[4] += map[2][i];
    sum[5] += map[i][0];
    sum[6] += map[i][1];
    sum[7] += map[i][2];
  }

  if(abs(sum[0])==3) return sum[0]/3;
  if(abs(sum[1])==3) return sum[1]/3;
  if(abs(sum[2])==3) return sum[2]/3;
  if(abs(sum[3])==3) return sum[3]/3;
  if(abs(sum[4])==3) return sum[4]/3;
  if(abs(sum[5])==3) return sum[5]/3;
  if(abs(sum[6])==3) return sum[6]/3;
  if(abs(sum[7])==3) return sum[7]/3;
  return 0;
}

int main() {
    int res;
    char str[10];
    while(cin >> str) {
        res = judge(str);
        cout << (res != 0 ? ( res > 0 ? "o" : "x" ) : "d") << endl;
    }
    return 0;
}

Measured memory_bytes: 1132
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7

def dfs(c, to, seen, g = []):
    #print(g)
    if not seen[c]:
        g.append(c)
        seen[c] = 1
    for next in to[c]:
        if not seen[next]:
            dfs(next, to, seen, g)
    return g

def run():
    N, M = map(int, sysread().split())
    to = [[] for i in range(N+1)]
    for _ in range(M):
        a,b = map(int, sysread().split())
        to[a].append(b)
        to[b].append(a)
    #print(to)
    groups = {}
    seen = [0] * (N+1)
    max_len = 0
    for i in range(1, N+1):
        #print(i, '---------------------')
        g = dfs(i, to, seen, [])
        if g:
            groups[i] = g
            max_len = max(max_len, len(g))
        #print(i, g)
    print(max_len)


if __name__ == "__main__":
    run()

Measured memory_bytes: 273840
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define ALL(a)			a.begin(), a.end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF				2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)	((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define	MAX_QWORD		((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI			3.14159265358979323846
typedef long long		ll;
typedef pair<ll, ll>	P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	string S;
	cin >> S;
	sort(ALL(S));
	if (S == "abc") {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        sc.close();
        System.out.println(String.format("%d %d %d", c , a, b));
    }
}

Measured memory_bytes: 35700
#include <bits/stdc++.h>
#define LL long long
#define PB push_back
#define MP make_pair
#define FI first
#define SC second
using namespace std;

typedef pair<LL,LL> ii;

LL n,a,b,x,y,z,tot,sum,cnt,C[55][55];
vector<LL> v,ans;
map<LL,LL> mep, mep2;

bool check(LL x){
	if((sum+x)*ans.size() > sum*(ans.size()+1)) return true;
	return false;
}

void precompute(){
	C[0][0] = 1;
	for(int i=1;i<=50;i++){
		C[i][0] = 1;
		for(int j=1;j<=i;j++){
			C[i][j] = C[i-1][j] + C[i-1][j-1];
		}
	}
}

int main() {
	
	precompute();
	
	cin>>n>>a>>b;
	for(int i=0;i<n;i++){
		cin>>x;
		v.PB(x);
		if(mep.find(x)==mep.end()) mep[x] = 1;
		else mep[x]++;
	}
	sort(v.begin(), v.end());
	for(int i=0;i<a;i++){
		sum += v[v.size()-1];
		ans.PB(v[v.size()-1]);
		v.pop_back();
	}
	cnt = b-a;
	for(int i=v.size()-1;i>=0;i--){
		if(check(v[i])){
			cnt--;
			sum+=v[i];
			ans.PB(v[i]);
			if(cnt==0) break;
		}
	}
	double avg = (double)sum/(double)ans.size();
	printf("%.10lf\n", avg);
	bool diff = false;
	for(int i=0;i<ans.size();i++){
		if(i>0 && ans[i]!=ans[i-1]) diff = true;
		if(mep2.find(ans[i])==mep2.end()) mep2[ans[i]] = 1;
		else mep2[ans[i]]++;
	}
	if(!diff){
		x = ans[0];
		for(int i=a;i<=b;i++){
			tot += C[mep[x]][i];
		}
	}
	else{
		tot = 1;
		for(map<LL,LL>::iterator it = mep2.begin();it!=mep2.end();it++){
			x = (*it).FI;
			y = (*it).SC;
			z = mep[x];
			tot *= C[z][y];
		}
	}
	cout<<tot<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(lli i=0, i##_len=(lli)(n); i<i##_len; i++)
#define repf(i, n) for(lli i=1, i##_len=(lli)(n+1); i<i##_len; i++)
#define per(i, n) for(lli i=((lli)(n))-1; i>=0; i--)
#define perf(i, n) for(lli i=((lli)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    lli n, m;
    cin >> n >> m;
    priority_queue<lli> que;
    rep(i, n){
        lli a;
        cin >> a;
        que.push(a);
    }

    rep(i, m){
        lli tmp = que.top();
        que.pop();
        que.push(tmp/2);
    }

    lli sum = 0;
    while(!que.empty()){
        sum += que.top();
        que.pop();
    }

    cout << sum << endl;
}

Measured memory_bytes: 1400
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        n: usize,
        pv: [usize; n],
        qv: [usize; n],
    };

    let mut list = (1..=n).permutations(n).collect::<Vec<_>>();
    list.sort();
    let i = list.iter().position(|x| x == &pv).unwrap() as isize;
    let j = list.iter().position(|x| x == &qv).unwrap() as isize;
    let res = (i - j).abs();
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 5372
#include <bits/stdc++.h>
#include<vector>
#define ll long long
using namespace std;
double dp[3001][3001];
double fun(vector<double>&arr,int n,int x)
{
    //base case
   if(n<x)
   return 0;
    if(x==0)
    return 1;
    if(n==0)
    return 0;

    //look up
    if(dp[n][x]>-0.9)
    return dp[n][x];

    //rec case
    return dp[n][x]=arr[n]*fun(arr,n-1,x-1)+(1-arr[n])*fun(arr,n-1,x);
}
int main()
{
           vector<double>arr;
           int n;
           cin>>n;
            arr.resize(n+1);
           for(int i=1;i<=n;i++)
           cin>>arr[i];
            memset(dp,-1.0,sizeof dp);
            cout<<fixed<<setprecision(10)<<fun(arr,n,(n+2)/2);

   
    return 0;
}

Measured memory_bytes: 74344
#include <iostream>

using namespace std;

int main()
{
	int N;
	int a, b, c;
	int ret;

	cin >> N;

	a = N / 100;
	b = (N - a * 100) / 10;
	c = (N - a * 100 - b * 10);

	if (a > b) ret = a * 111;
	else if (a < b) ret = (a + 1) * 111;
	else if (b >= c) ret = a * 111;
	else ret = (a + 1) * 111;

	cout << ret;

	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int x = Integer.parseInt(in.next());

            int tmp = 0;
            int ans = 0;

            tmp = x / 500;
            ans += tmp * 1000;

            x -= tmp * 500;

            tmp = x / 5;
            ans += tmp * 5;

            // 出力
            out.println(ans);

        }

    }
}



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

using namespace std;

int main(){
  string n;
  cin >> n;
  
  if(n[0] == '7' or n[1] == '7' or n[2] == '7'){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

const int MOD=998244353,N=1e5+100,oo=1e15;


void smain() {

    int n,k;
    cin>>n>>k;
    if(k==1)
        cout<<0;
    else
        cout<<n-k;






}

Measured memory_bytes: 3664
using System;
using System.IO;

class Program
{
    static void Main(string[] args) {
        var scan = new Scanner();
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(Solve(scan));
        Console.Out.Flush();
    }
    static string Solve(Scanner scan) {
        int N = scan.NextInt(), M = scan.NextInt();
        var ac = 0;
        var wa = 0;
        var Q = new (int WAcount, bool isAC)[N];
        for (int i = 0; i < M; i++) {
            var p = scan.NextInt();
            var S = scan.Next();
            if (Q[p - 1].isAC) continue;
            if (S == "AC") {
                Q[p - 1].isAC = true;
                ac++;
                wa += Q[p - 1].WAcount;
            }
            else Q[p - 1].WAcount++;
        }
        return $"{ac} {wa}";
    }
}

class Scanner
{
    string[] s;
    int i;
    public Scanner() {
        s = new string[0];
        i = 0;
    }
    public string Next() {
        if (i < s.Length) return s[i++];
        string str = Console.ReadLine();
        while (str == "") str = Console.ReadLine();
        s = str.Split(' ', StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return Next();
        i = 0;
        return s[i++];
    }
    public int NextInt() => int.Parse(Next());
}

Measured memory_bytes: 22060
#include <cstdio>
#include <algorithm>
#include <map>

typedef long long LL;
const int MN = 20;

int N, A[MN];

LL F(int l, int r, int cl, int cr) {
	if (l > r) return 0;
	LL ans = 0x3f3f3f3f3f3f3f3f;
	for (int i = l; i <= r; ++i)
		ans = std::min(ans, F(l, i - 1, cl, cl + cr) + (LL)A[i] * (cl + cr) + F(i + 1, r, cl + cr, cr));
	return ans;
}

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) scanf("%d", &A[i]);
	N -= 2;
	printf("%lld\n", F(1, N, 1, 1) + A[0] + A[N + 1]);
	return 0;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
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; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long double a, b, h, m;
    cin >> a >> b >> h >> m;
    long double temp = h / 12 + m / 720- m / 60;
    long double sa = 2 * M_PI * temp;
    long double ans = a * a + b * b - 2 * a * b * cosl(sa);
    cout << fixed << setprecision(15);
    cout << sqrtl(ans) << "\n";
}


Measured memory_bytes: 4176
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<iostream>
using namespace std;
typedef long long LL;
const int MaxN = 3e5 + 5;

LL n, a[MaxN];
LL pre[MaxN], tail[MaxN];

int main()
{
	while(~scanf("%lld", &n))
	{
		for(int i = 1; i <= 3 * n; i++) scanf("%lld", &a[i]);
		priority_queue<LL, vector<LL>, greater<LL> > pq1;
		priority_queue<LL, vector<LL>, less<LL> > pq2;
		LL pp = 0, tt = 0;
		for(int i = 1; i <= n; i++) 
		{
			pq1.push(a[i]);
			pp += a[i];
		}
		pre[n] = pp;
		for(int i = 2 * n + 1; i <= 3 * n; i++) 
		{
			pq2.push(a[i]);
			tt += a[i];
		}
		tail[2 * n + 1] = tt;
		for(int i = n + 1; i <= 2 * n; i++)
		{
			pq1.push(a[i]);
			LL x = pq1.top();
			pq1.pop();
			pp -= (x - a[i]);
			pre[i] = pp;
			//printf("%d : %lld\n", i, pre[i]);
		}
		for(int i = 2 * n; i >= n + 1; i--)
		{
			pq2.push(a[i]);
			LL x = pq2.top();
			pq2.pop();
			tt -= (x - a[i]);
			tail[i] = tt;
			//printf("%d: %lld\n", i, tail[i]);
		}
		LL ma = -1e16;
		for(int i = n; i <= 2 * n; i++)
		{
			ma = max(ma, pre[i] - tail[i + 1]);
		}
		printf("%lld\n", ma);
	}	
	return 0;
}

Measured memory_bytes: 7668
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll a;
    ld b;
    cin>>a>>b;
    ll ans=a*b;
    cout<<ans<<endl;
}

Measured memory_bytes: 3732
S = list(input())
X = 0
if S[1] == "R":
    if S[0] == S[1] or S[1] == S[2]:
        if S[0] == "R" and S[2] == "R":
            X = 3
        else:
            X = 2
    else:
        X=1
elif S[0] == "R" or S[2] =="R":
    X = 1
print(X)

Measured memory_bytes: 9004
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 2e5+2;


void solve()
{
    int n;
    scn(n);

    string s;
    cin >> s;

    vi pw(n, 0), sr(n, 0);

    if(s[0] == 'R') {
        pw[0] = 0;
    } else {
        pw[0] = 1;
    }

    rep(i, 1, n) {
        if(s[i] == 'W') {
            pw[i] = 1 + pw[i - 1];
        } else {
            pw[i] = pw[i - 1];
        }
    } 

    if(s[n - 1] == 'R') {
        sr[n - 1] = 1;
    } else {
        sr[n - 1] = 0;
    }


    for(int i = n - 2; i >= 0; -- i) {
        if(s[i] == 'R') {
            sr[i] = 1 + sr[i + 1];
        } else {
            sr[i] = sr[i + 1];
        }
    }

    int cnt = min(pw[n - 1], sr[0]);

    rep(i, 0, n - 1) {
        // .....RW.....
        int cr = sr[i + 1];
        int cw = pw[i];

        int mx = max(cr, cw);

        cnt = min(cnt, mx);
    }

    prin(cnt);
}

int main()
{
    int t = 1;
    // scn(t);
    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 5308
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    ll n;
    cin>>n;
    vi v;
    rep(i,0,n)
    {
        ll x;
        cin>>x;
        v.pb(x);
    }
    ll maxi=v[0];
    ll ans=0;
    rep(i,0,n)
    {
        maxi=max(maxi,v[i]);
        ans+=maxi-v[i];
    }
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 5328
import java.util.*;
//二分探索木の節を表すクラスNode
//Javaプログラマのためのアルゴリズムとデータ構造 p.221参照
class Node{
	Integer data;
	Node left;
	Node right;
	Node(Integer data){
		left = null;
		right = null;
		this.data = data;
	}
}

//二分探索木を表すクラスBinarySearchTree
//Javaプログラマのためのアルゴリズムとデータ構造 p.223参照
public class Main{
	Scanner sc = new Scanner(System.in);
	private static Node root;
	//命令の数m
	int m;
	//命令insert or print
	String order;
	//挿入するデータ
	int[] T;
	public Main() {
		root = null;
	}
	//二分探索木にキーkeyを持つ節を挿入するメソッド
	public Node insert(Integer key) {
		Node p = root;
		//parentは現在注目している節の親
		Node parent = null;
		//pがparentの左の子ならtrue,右の子ならfalseを返す
		boolean isLeftChild = false;
		//注目している節がある限り処理を繰り返す
		while(p != null) {
			int result = key.compareTo(p.data);
			//節とキーを比較し、等しければすでに登録されているためnullを返す
			if(result == 0) {
				return null;
			//キーの方が小さければ左部分木
			}else if(result < 0) {
				parent = p;
				isLeftChild = true;
				p = p.left;
			//キーの方が大きければ右部分木
			}else {
				parent = p;
				isLeftChild = false;
				p = p.right;
			}
		}
		//新しい節を適切な場所に挿入する
		//新しい節を割り当てる
		Node newNode = new Node(key);
		if(parent == null) {
			//新しい節は根となるため、rootに新しい節を代入する
			root = newNode;
		}else if(isLeftChild) {
			//節parentの左の子になる
			parent.left = newNode;
		}else {
			//節parentの右の子になる
			parent.right = newNode;
		}
		return newNode;
	}
	//データを入力するメソッド
	public void input() {
		m = sc.nextInt();
		T = new int[m];
		for(int i=0; i<m; i++) {
			order = sc.next();
			if(order.equals("print")) {
				inorder(root);
				System.out.println();
				preorder(root);
				System.out.println();
			}else {
				T[i] = sc.nextInt();
				insert(T[i]);
			}
		}
	}
	//通りがけ順に出力するメソッド
	//Javaプログラマのためのアルゴリズムとデータ構造 p.242参照
	public void inorder(Node p) {
		if(p == null) {
			return;
		}else {
			inorder(p.left);
			System.out.print(" "+p.data);
			inorder(p.right);
		}
	}
	//行きがけ順に出力するメソッド
	//Javaプログラマのためのアルゴリズムとデータ構造 p.172参照
	public void preorder(Node p) {
		if(p == null) {
			return;
		}else {
			System.out.print(" "+p.data);
			preorder(p.left);
			preorder(p.right);
		}
	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
	}
}



Measured memory_bytes: 338364
#include <iostream>
#include <sstream>

using namespace std;

int main()
{
      string s;
      cin >> s;
      if(s[0] != 'A')
            {cout << "WA";return 0;}
      if((s[1] ) >= 65 &&  (s[1] ) <= 90 )
            {cout << "WA";return 0;}
      if((s[s.size()-1] ) >= 65 &&  (s[s.size()-1] ) <= 90 )
            {cout << "WA";return 0;}

            ///A b    c C d e
            int j = 0;
      for(int i=2 ; i< s.size()-1; i++)
      {
            if(s[i] == 'C')
                  j++;
            if(s[i] >= 65 &&  s[i] <= 90  && s[i] != 'C' )
            {
                  cout << "WA";
                  return 0;
            }
      }
      if(j == 1)
            cout << "AC";
      else
            cout << "WA";



      return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
    int N;
    scanf("%d",&N);
    int A[N];
    for(int i = 0; i < N; i++) {
        scanf("%d",&A[i]);
    }

    bool flag = true;
    int cnt = 0;
    while(flag) {
        cnt++;
        for(int i = 0; i < N; i++) {
            if(A[i]%2 == 0) {
                A[i] = A[i]/2;
            }else{
                flag = false;
                cnt--;
                break;
            }
        }
    }
    printf("%d\n",cnt);
}


Measured memory_bytes: 128
a, b, c, x, y = [int(i) for i in input().split()]

z = min(x, y)
money = 0
if a + b > c * 2:
  money += z * c * 2
  if x > y:
    if a > c * 2:
      money += (x - z) * c * 2
    else:
      money += (x - z) * a
  else:
    if b > c * 2:
      money += (y - z) * c * 2
    else:
      money += (y - z) * b
else:
  money += x * a + y * b
print(money)

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

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

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second

using namespace std;
typedef long long ll;


int main()
{
  ll H, W, N;
  cin >> H >> W >> N;
  vector<pair<ll, ll>> x;
  REP(i, N) {
    ll a, b;
    cin >> a >> b;
    a--; b--;
    x.PB(MP(a, b));
  }

  map<pair<ll, ll>, ll> mp;
  REP(t, N) {
    ll ty = x[t].FI;
    ll tx = x[t].SE;
    for (ll i = -1; i <= 1; i++) {
      if (ty + i < 0 || H <= ty + i) continue;
      for (ll j = -1; j <= 1; j++) {
        if (tx + j < 0 || W <= tx + j) continue;
        mp[MP(ty + i, tx + j)]++;
      }
    }
  }

  ll hist[10] = {(H-2)*(W-2)};
  for (const auto& e : mp) {
    if (1 <= e.FI.FI && e.FI.FI < H-1 &&
        1 <= e.FI.SE && e.FI.SE < W-1) {
      hist[0]--;
      hist[e.SE]++;
    }
  }

  REP(i, 10) cout << hist[i] << endl;

  return 0;
}

Measured memory_bytes: 58096
#include<bits/stdc++.h>
using namespace std;
int n,a[101000],c[101000],tp;
bool chk(){
	for(int i=2;i<=n;++i)if(a[i]<a[i-1])return false;
	return true;
}
void rot(){
	c[++tp]=1;
	int x=a[1];
	for(int i=1;i<n;++i)a[i]=a[i+1];
	a[n]=x;
}
void sp(){
	c[++tp]=n-1;
	swap(a[1],a[n]);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",&a[i]),a[i]++;
	for(int i=1;i<=n;++i){
		while(a[n]!=i)rot();
		while(a[n-1]!=i-1&&i>1)sp(),rot();
	}
	printf("%d\n",tp);
	for(int i=1;i<=tp;++i)printf("%d\n",c[i]);
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U> bool chmax(T &a, U b) { if (a <= b) {a = b; return 1;} return 0; }
template <class T, class U>  bool chmin(T &a, U b) { if (a > b) { a = b; return 1; } return 0; }
template <typename T>  ostream &operator<<(ostream &os, vector<T> &v) { os << "{"; rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); } os << "}"; return os; }

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
    
int main() {
    ll x=0,y=0,z=0,k,n,m,h,w,ans=0,sum=0,Max=-1,Min=1e9+1;
    bool ok = true;
    string t;
    cin >> n >> x;
    VL a(n);
    rep(i,n) cin >> a[i];

    for(ll i=0; i<n-1; i++){
        ll j=i+1;
      if(a[i] + a[j] > x){
          k = a[i]+a[j] - x;
          ans += k;
          if(a[j] < k){
            a[i] = a[i] -(k-a[j]);
            a[j] = 0; 
          }
          else
            a[j] -= k;
      }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    a = int(sys.stdin.readline().strip())
    s = sys.stdin.readline().strip()
    
    if a >= 3200:
        print(s)
    else:
        print("red")


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#ifdef LOCAL
#  define _GLIBCXX_DEBUG
#  define _GLIBCXX_DEBUG_PEDANTIC
#endif

#include "bits/stdc++.h"
#define ff first
#define ss second
#define szof(_x) ((int) (_x).size())
#define TASK_NAME ""

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7;
const ll INFL = 1e18 + 123;
const double PI = atan2(0, -1);
mt19937 tw(960172);
ll rnd(ll x, ll y) { static uniform_int_distribution<ll> d; return d(tw) % (y - x + 1) + x; }


void solve() {
	int n, m;
	cin >> n >> m;
	string s, t;
	cin >> s >> t;
	int tmp = __gcd(n, m);

	ll l = (ll) n * m / tmp;

	map<ll, char> have;
	for (int i = 0; i < n; ++i) {
		have[l / n * i] = s[i];
	}

	for (int j = 0; j < m; ++j) {
		if (have.count(l / m * j) && have[l / m * j] != t[j]) {
			cout << "-1\n";
			return;
		}
	}

	cout << l << "\n";
}


int main() {
	//freopen(TASK_NAME ".in", "r", stdin);
	//freopen(TASK_NAME ".out", "w", stdout);
	cerr << fixed << setprecision(15);
	cout << fixed << setprecision(15);
	ios::sync_with_stdio(false);

	int tests = 1;
	// cin >> tests;
	for (int it = 1; it <= tests; ++it) {
		solve();
	}
	
	#ifdef LOCAL
		cerr << "time: " << clock() << " ms\n";
	#endif
	return 0;
}

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

#define ll unsigned  long long
#define pb push_back
#define MOD   1000000007
#define PI  acos(-1)
#define clr(x) memset(x,-1,sizeof(x))
string s,ss;
map<ll,ll> mp;
set<ll> se,row,colume;
set<ll> :: iterator it;
vector<ll> ve;
pair<ll,ll> pa;
stack<ll> st;
queue<ll> qu;
ll ar[200];
int main()
{
ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll a,b,ans;
    cin>>a>>b;
        ans=(a+b);
    if(ans%2==0){
    cout<<(ans>>1)<<endl;
    }
    else{
        cout<<"IMPOSSIBLE"<<endl;
    }
}



Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
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"

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

int atcoder(){
    int n;
    cin >> n;
    vector<ll> a,b,c;
    REP(i,n){
        ll tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    REP(i,n){
        ll tmp;
        cin >> tmp;
        b.push_back(tmp);
    }
    REP(i,n){
        ll tmp;
        cin >> tmp;
        c.push_back(tmp);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    
    ll ans = 0;
    REP(i,n){
        ans += (ll)(lower_bound(a.begin(),a.end(),b[i])-a.begin()) * (ll)(c.end()-upper_bound(c.begin(),c.end(),b[i]));
    }
    
    cout << ans << ENT;
    return 0;
}

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


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

int main()
{
    string s, x;
    cin >> s;
    for (int i; i < s.length(); i++)
    {
        x = x + 'x';
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)//少数出力
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	string s;
	scans(s);
	auto ite = unique(all(s));
	s.erase(ite, s.end());
	printf("%d\n", s.length() - 1);

}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)

int main() {
  ll n, t; cin >> n >> t;
  ll res = INF;
  rep(i, n) {
    ll c, tmp; cin >> c >> tmp;
    if (tmp <= t) res = min(res, c);
  }
  if (res == INF) cout << "TLE" << endl;
  else cout << res << endl;
}

Measured memory_bytes: 3492
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
map<ll,ll> prime;//素因数分解でそれぞれの素数がいくつ出てきたかを保存するmap

//O(√n)
//整列済み(mapはkeyで自動で整列される)
void prime_factorize(ll n){
    if(n<=1) return;
    ll l=sqrt(n);
    FOR(i,2,l){
        if(n%i==0){
            prime_factorize(i);prime_factorize(ll(n/i));return;
        }
    }
    //mapでは存在しないkeyの場合も自動で構築される
    prime[n]++;return;
}
signed main(){
    long long n;cin>>n;
    prime_factorize(n);
    long long ans=0;
    for(auto p:prime){
        auto x=p.second;
        int k=1;
        while(x>=k){
            x-=k;
            k++;
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3684
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    print sum(p[:k])
    return




n, k = RA()
p = sorted(RA())
solve()


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

using namespace std;

typedef long long llint;

const int MAXN = 300005;
const int MOD = 998244353;

llint n, a, b, k;
llint f[MAXN], inv[MAXN];

llint pot (llint b, llint e) {
    if (e == 0) return 1;
    if (e & 1) {
        return pot(b, e-1) * b % MOD;
    } else {
        llint t = pot(b, e/2);
        return t*t%MOD;
    }
}

void precompute () {
    f[0] = 1;
    inv[0] = 1;
    for (int i=1; i<=n; i++) {
        f[i] = f[i-1] * i % MOD;
        inv[i] = pot(f[i], MOD-2);
    }
}

llint nck (llint x, llint y) {
    return f[x] * inv[y] % MOD * inv[x-y] % MOD;
}

int main () {
    cin >> n >> a >> b >> k;
    llint p = n, c;
    precompute();
    llint sol = 0;
    for (c=0; c<=n; c++) {
        while (c*a + p*b > k && p >= 0) {
            p--;
        }
        p = max(p, 0LL);
        if (c*a + p*b == k) {
            sol = (sol + nck(n, c) * nck(n, p)) % MOD;
        }
    }
    cout << sol;
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int count = 0;
  for (int i = 0; i <= N/7; i++) {
    if ((N-7*i) % 4 == 0) {
      count++;
      break;
    }
  }
  if (count > 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    char a = '0';
    char b = '0';
    
    cin >> a;
    cin >> b;
    
    if(a < b){
        
        cout << "<";
        
    }else if(a > b){
        
        cout << ">";
        
    }else{
        
        cout << "=";
        
    }
    
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: i64 = input();

    let mut x = 1;
    while x * 2 <= n {
        x *= 2;
    }
    println!("{}", x);
}


Measured memory_bytes: 4352