akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
//typedef tuple<ll,ll,ll,ll> tp;
//typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	while(cin>>n,n){
		int co=0;
		loop(i,1,n)loop(j,i+1,n+1)if((i+j)*(j-i+1)/2==n)co++;
		cout<<co<<endl;
	}
}

Measured memory_bytes: 3040
R,G,B,N=map(int,input().split())
count=0
for r in range(0,N//R+1):
  remain_GB=N-R*r
  for g in range(0,remain_GB//G+1):
    remain_B=remain_GB-G*g
    if remain_B%B==0:
      count+=1
print(count)



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

bool isPrime(int a){
    if (a == 1) return false;
    if (a == 2) return true;
    if (a % 2 == 0) return false;
    int sqrta = static_cast<int>(sqrt(a));
    for (int i=3; i<=sqrta; i+=2){
        if (a % i == 0) return false;
    }
    return true;
}

int main()
{
    int N = 0;
    cin >> N;
    int counter = 0;
    for (int i = 0; i != N; ++i){
        int a = 0;
        cin >> a;
        if (isPrime(a)) ++counter;
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 3092
import sys
from collections import namedtuple


sys.setrecursionlimit(10**5)

Edge = namedtuple('Edge', 'to cost')

N = int(input())

# index と頂点の番号を合わせたいのでサイズを N + 1 に
colors = [0] * (N + 1)
vertexes = [[] for _ in range(N + 1)]

for _ in range(N - 1):
  u, v, w = map(int, input().split())
  # 無向グラフなので双方向にリンクする
  vertexes[u].append(Edge(v, w))
  vertexes[v].append(Edge(u, w))


def dfs(id, color):
  colors[id] = color
  for edge in vertexes[id]:
    if edge.cost % 2 != 0:
      if colors[edge.to] == color:
        return False
      if colors[edge.to] == 0 and not dfs(edge.to, -color):
        return False
    elif colors[edge.to] == 0:
      dfs(edge.to, color)
  return True

if dfs(1, 1):
  for color in colors[1:]:
    print(1 if color == 1 else 0)


Measured memory_bytes: 81220
import java.io.*;
import java.lang.*;

class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str1 = br.readLine();
    String[] str2 = str1.split(" ");
    double r = Double.parseDouble(str2[0]);


    double S = Math.PI * r * r;
    double l = 2 * Math.PI * r;

    System.out.println(String.format("%.6f", S) + " " + String.format("%.6f", l));
    }
}

Measured memory_bytes: 24648
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main() {
	ll X;
	cin >> X;
	ll turn = X/11, q = X%11;
	if (q > 6) turn = 2*turn + 2;
	else if (q) turn = 2*turn+1;
	else turn = 2*turn;
	cout << turn << endl;
	return 0;
}


Measured memory_bytes: 256
"""
author : halo2halo
date : 24,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

n, a = map(int, readline().rstrip().split())


ans = int((n+a+1)/2)

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n);i>0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+5  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
//ll const mod=998244353;
ll const mod=1e9+7;
const ll MAX=1000005;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}

ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
//////////////////////////////////////
int main(){
    ll n,m;
    
    cin>>n>>m;
    if(n==1&&m==1){
        cout<<1<<endl;
        return 0;
    }
    ll cor=min(4LL,n*m);
    ll ye=min(6LL,3*m);
    ll xe=min(6LL,3*n);
    ll ans=0;
    
    if(cor%2==1)ans+=min(4LL,n*m);
    if(ye%2==1)ans+=max(0LL,n-2);
    if(xe%2==1)ans+=max(0LL,m-2);
    ans+=max(0LL,n*m-(2*n+2*m-4));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3588
import java.util.Scanner;

class Dice3{
	int a[] = new int[6];
	int temp;
	Dice3(int face[]){
		for(int i = 0; i < 6; i++) {
			a[i] = face[i];
		}
	}

	void roll(char c) {
		switch(c) {
		case 'E':
			temp = a[5];
			a[5] = a[2];
			a[2] = a[0];
			a[0] = a[3];
			a[3] = temp;
			break;
		case 'N':
			temp = a[5];
			a[5] = a[4];
			a[4] = a[0];
			a[0] = a[1];
			a[1] = temp;
			break;
		case 'S':
			temp = a[5];
			a[5] = a[1];
			a[1] = a[0];
			a[0] = a[4];
			a[4] = temp;
			break;
		case 'W':
			temp = a[5];
			a[5] = a[3];
			a[3] = a[0];
			a[0] = a[2];
			a[2] = temp;
			break;
		}
	}
	void rota() {  //横方向の回転をさせるメソッド
		temp = a[1];
		a[1] = a[2];
		a[2] = a[4];
		a[4] = a[3];
		a[3] = temp;
	}
}

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int face1[] = new int[6];  //1つめのサイコロ
		int face2[] = new int[6];  //2つめのサイコロ
		for(int i = 0; i < 6; i++) {
			face1[i] = sc.nextInt();
		}
		for(int i = 0; i < 6; i++) {
			face2[i] = sc.nextInt();
		}

		char com[] = new char[] {'E', 'E', 'E', 'N', 'N', 'N', 'N'};

		//2つめのサイコロをDiceクラスのインスタンスとして考える
		Dice3 d3 = new Dice3(face2);
		boolean frag = false;  //判定が終了したらtrueにする

		for(int i = 0; i < 7; i++) {  //rollのループ //なぜ7回の操作が必要なのか？
			for(int j = 0; j < 4; j++) {  //rotaのループ
				if(d3.a[0] == face1[0] && d3.a[1] == face1[1] && d3.a[2] == face1[2] && d3.a[3] == face1[3] && d3.a[4] == face1[4] && d3.a[5] == face1[5]) {
					System.out.println("Yes");
					frag = true;
					break;
				}
				if(frag == true) break;
				d3.rota();
			}
			d3.roll(com[i]);
		}
		if(frag == false) System.out.println("No");
	}
}


Measured memory_bytes: 26280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, k, q, a;
  cin >> n >> k >> q;
  vector<ll> c(n, 0);
  rep(i, q){
    cin >> a;
    a--;
    c[a]++;
  }
  rep(i, n){
    if(k - q + c[i] > 0)
      cout << "Yes";
    else
      cout << "No";
    memi;
  }
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		char[] s = S.toCharArray();
		int ans = 0;

		boolean marubatsu = true;
		char work = s[0];
		for(int i = 1; i < N; i++) {
			if(marubatsu) {
				if(s[i] == changeMaruBatsu(work)) {
					ans++;
					marubatsu = false;
				}
			}else {
				work = s[i];
				marubatsu = true;
			}
		}

		System.out.println(ans);
		sc.close();
	}

	public static char changeMaruBatsu(char c) {
		if(c == 'O') {
			return 'X';
		}
		return 'O';
	}
}


Measured memory_bytes: 29892
#define TEST_MODE true
 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= b; --i)
#define range(i, a, b, c) for (int i = a;		\
                               c > 0 ? i < b : i > b;	\
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long
 
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x)
#define dump_l(x) dump(x) << endl
#else
const bool test = false;
#define dump(x)
#define dump_l(x)
#endif
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
 
//.....................
const int MAX = (int)2e5 + 5;
 
vector<string> split(const string &str, char sep)
{
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep))
    {
      v.push_back(buffer);
    }
  return v;
}

string reverse_str(string input) {
  string res = input;
  reverse(all(res));
  return res;
}
 
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
  return accumulate(begin, end, 0ll);
}

int H = 20, W = 30;

bool ng(int y, int x) {
  return y < 0 || H <= y || x < 0 || W <= x;
}

void solve();

class Solver {
public:
  int a, b;

  void solve() {
    cin >> a >> b;
    int c = a + b;
    int d = c / 2 + c % 2;
    cout << d << endl;
  }
};
 
signed main()
{
  cout << fixed << setprecision(20);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  // while (true) {
  //   auto ptr = new Solver();
  //   ptr->solve();
  //   delete ptr;
  // }
  return 0;
}
 
// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'
 


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

int main() {
  long l, r;
  cin >> l >> r;
  
  int min = 2019;
  for(long i=l; i<=r-1 && i<=l+2019; i++) {
    for(long j=i+1; j<=r && j<=i+2019; j++) {
      if((i*j)%2019 < min) {
        min = (i*j)%2019;
      }
    }
  }

  cout << min;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<int>w0,w1,w2,w3;
signed main(){
	int n,w;
	cin>>n>>w;
	
		w0.push_back(0);
		w1.push_back(0);
		w2.push_back(0);
		w3.push_back(0);
		
	int wa,v;
	cin>>wa>>v;
	w0.push_back(v);
	int W=wa;
	for(int i=1;i<n;i++){
		cin>>wa>>v;
		if(wa-W==0){
			w0.push_back(v);
			}
		else if(wa-W==1){
			w1.push_back(v);
			}	
		else if(wa-W==2){
			w2.push_back(v);
			}	
		else{
			w3.push_back(v);
			}	
		}
		sort(w0.begin()+1,w0.end());
		reverse(w0.begin()+1,w0.end());
		sort(w1.begin()+1,w1.end());
		reverse(w1.begin()+1,w1.end());
		sort(w2.begin()+1,w2.end());
		reverse(w2.begin()+1,w2.end());
		sort(w3.begin()+1,w3.end());
		reverse(w3.begin()+1,w3.end());
		for(int i=1;i<w0.size();i++){
			w0[i]+=w0[i-1];
			}
		for(int i=1;i<w1.size();i++)w1[i]+=w1[i-1];
		for(int i=1;i<w2.size();i++)w2[i]+=w2[i-1];
		for(int i=1;i<w3.size();i++)w3[i]+=w3[i-1];
		
		int ans=0;
		for(int i=0;i<w0.size();i++){
			for(int j=0;j<w1.size();j++){
				for(int k=0;k<w2.size();k++){
					for(int l=0;l<w3.size();l++){
						int kati=w0[i]+w1[j]+w2[k]+w3[l];
						int omosa=W*i+(W+1)*j+(W+2)*k+(W+3)*l;
						if(omosa<=w)ans=max(ans,kati);
						}
					}
				}
			}
			cout<<ans<<endl;
			return 0;
	}


Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
int main() {
#define int long long
	int n;
	cin >> n;
	vector<pair<int, int>> input;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		input.push_back(make_pair(a, b));
	}
	REP(i, n) {
		if ((LONG_INF + input[i].first + input[i].second) % 2 != (LONG_INF + input[0].first + input[0].second) % 2) {
			cout << -1 << endl;
			return 0;
		}
	}
	int gogo = input[0].first + input[0].second + LONG_INF;
	gogo %= 2;
	if (gogo == 0) {
		cout << "32" << endl;
		cout << "1 ";
	}
	else {
		cout << "31" << endl;
	}
	for (long long i = 0; i < 31; ++i) {
		cout << (1LL << i) << " ";
	}
	cout << endl;
	for (int i = 0; i < n; ++i) {
		if (gogo == 0) {
			cout << "L";
			input[i].first += 1LL;
		}
		int x = input[i].first + input[i].second;
		int y = input[i].first - input[i].second;
		x += (1LL << 31LL) - 1LL;
		y += (1LL << 31LL) - 1LL;
		x /= 2LL;
		y /= 2LL;
		for (int i = 0; i < 31; ++i) {
			if (x % 2 == 0) {
				//go -
				if (y % 2 == 0) {
					cout << "L";
				}
				else {
					cout << "D";
				}
			}
			else {
				if (y % 2 == 0) {
					cout << "U";
				}
				else {
					cout << "R";
				}
			}
			x /= 2;
			y /= 2;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(ReadLine());
        }

        public static long[] Reads()
        {
            return ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x,long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }

        public static long C(long n,long k)
        {
            long x=1;
            for (long i = 1; i <=k; i++)
            {
                x *= n - i + 1;
                x /= i;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var q = Reads();
            var n = q[0];
            var a = q[1];
            var b = q[2];
            var c = q[3];
            var d = q[4];
            var s = ReadLine().ToArray();
            var f = true;
            if ((a > b && c < d) || (a < b && c > d))
            {
                var count = 0;
                var memo = 0;
                for (long i = Math.Max(a,b)-2; i < Math.Min(c,d)+1; i++)
                {
                    if (s[i] == '#')
                    {
                        count = Math.Max(count, memo);
                        memo = 0;
                    }
                    else
                    {
                        memo++;
                    }
                    count = Math.Max(count, memo);
                }
                if (count < 3) f = false;
            }
            for (long i = Math.Min(a, b); i < Math.Max(c, d)-1; i++)
            {
                if (s[i] == s[i + 1] && s[i] == '#') f = false;
            }
            
            WriteLine(f ? "Yes" : "No");
            


            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 19932
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a = [i-1 for i in a]
ans = b[a[0]]

for i in range(1,n):
  ans += b[a[i]]
  if a[i] == a[i-1] + 1:
    ans += c[a[i-1]]

print(ans)

Measured memory_bytes: 3064
# 累積和
from bisect import bisect_right

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

for x in [A, B, C]:
    x.sort()

t = [0] * (N + 1)  # 中部のパーツのサイズが Bi 以上のときの B と C の組み合わせの数
j = 0
for i in range(N):
    while j < N and C[j] <= B[i]:
        j += 1
    t[i] = N - j
for i in range(N - 1, -1, -1):
    t[i] += t[i + 1]

result = 0
i = 0
for a in A:
    while i < N and B[i] <= a:
        i += 1
    result += t[i]
print(result)


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

long long n, A, B;
long long h[100005];

bool judge(long long x){
    long long sum = 0;
    for(int i=0; i<n; i++){
        if(h[i] >= B*x){
            if( (h[i] - B*x) % (A-B) == 0){
                sum += (h[i] - B*x) / (A-B);
            }else{
                sum += ((h[i] - B*x) / (A-B)) + 1;
            }
        }
    }
    return sum <= x;
}

int main(void){
    cin >> n >> A >> B;
    
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    long long left = 0;
    long long right = 1000000009;
    while(right - left > 1){
        long long mid = (left+right)/2;
        if( judge(mid) ){
            right = mid;
        }else{
            left = mid;
        }
    }
    cout << right << endl;
    return 0;
}

Measured memory_bytes: 1024
import math
def is_753(s) :
	
	if ("0" in s) :
		return False
	elif ("1" in s) :
		return False
	elif ("2" in s) :
		return False
	elif ("4" in s) :
		return False
	elif ("6" in s) :
		return False
	elif ("8" in s) :
		return False
	elif ("9" in s) :
		return False
	
	if ("7" in s and "5" in s and "3" in s) :
		return True
	
	return False

def hoge(s) :
	for i in range(len(s)) :
		if (s[i] != "3" and s[i] != "5" and s[i] != "7") :
			return int(math.pow(10, len(s) - (i+1)))

	return 0

def main() :
	N = int(input())
	count = 0
	index = 356
	
	if (N < 357) :
		print("0")
		return

	while index <= N :
		s = str(index)
		a = hoge(s)
		if (a != 0) :
			index += a
			continue		
		
		if (is_753(s)) :
			count += 1
		
		index += 1
	
	print(count)


main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
long long M = 1e9+7;
long long power(long long a, long long p)
    {
        if(p==0) return 1;
        long long ans= power(a,p/2);
        ans =(ans * ans) % M;
        if(p%2) ans = (ans*a) % M;
        return ans;
    }

    bool isPrime(long long n)
    {
        if (n <= 1)
            return false;
        for (long long i = 2; i < n; i++)
            if (n % i == 0)
                return false;
        return true;
    }
    long long SieveOfEratosthenes(long long n, long long a)
    {
        bool prime[n+1];
        memset(prime, true, sizeof(prime));
        for (long long p=2; p*p<=n; p++)
        {
            if (prime[p] == true)
            {
                for (long long i=p*p; i<=n; i += p)
                    prime[i] = false;
            }
        }
        for (long long p=2; p<=n; p++)
           if (prime[p])
           {
               if(a%p==0)
               {
                   return (a-p);
               }
           }
    }
    long long nCr(int n, int r)
    {
        if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
        long long ans = 1;
        int i;
        for(i = 1; i <= r; i++) {
            ans *= n - r + i;
            ans /= i;
        }
        return ans;
    }
int main()
{
    IOS;
    long long a,b,c,d,e,h,k,l,n,t,f,m,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100001]={0},sum=0,sum1=0,ma=0,ma1=0,mi=1000000000000000001;
    long long g,co3=0,co4=0,co5=0,co6=0,co7=0,co8=0,mul=1,sum2=0,sum3=0,mu=1,mu1=1;
    long long a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,b6,c1;
    double pi=2 * acos (0.0);
    string str,str1,str2,str3,str4,str5,str6;
    char ch,ch1;
    //vector<long long>v; //vector<long long> v(n+1);
    //vector<long long>v1;
    // vector<string>vs;
    // vector<string>vs1;
    vector<char>vc;
    //map<long long,long long>mp;
    map<char,int>mp1;
    //set<long long>s;
    set<long long>s1;
    queue<long long> q;
    //stack<long long> stk;
    //vector< pair<long long,long long> >v3;
    //map<long long,long long>::iterator it;
    //map<string,string>::iterator it;
    // vector<pair<char, pair<int,int> > > v3;
    //vector< pair<char,int > > v1;
    int x[]={1,1,1,0,0,-1,-1,-1};
    int y[]={0,1,-1,1,-1,1,-1,0};
    cin>>a>>b;
    if(a<b)
    {
        cout<<min(a,abs(a-b))<<endl;
    }
    else
    {
        c=a%b;
        cout<<min(c,abs(c-b))<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main  () {
  int a, b;
  cin >> a >> b;
  
  if ( a >= 13 ){
    cout << b << endl;
  }
  
  else if ( 12 >= a && a >= 6 ) {
    cout << b / 2 << endl;
  }
  
  else {
    cout << 0 << endl;
  }
}
  
  

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define CEIL(n, m) ceil(n/pow(10.0, m))*pow(10.0, m)
#define FLOOR(n, m) floor(n/pow(10.0, m))*pow(10.0, m)
#define ROUND(n, m) round(n/pow(10.0, m))*pow(10.0, m)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define llong long long
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

void solve()
{
  string s, t;
  cin >> s >> t;
  int len = s.length();
  s+=s;
  for (int i=0; i<len; i++) {
    if (s.substr(i,len)==t) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main()
{
  solve();
  return 0;
}


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

static const int N = 10000;
static const int MIN = 2;
static const int MAX = 10*10*10*10*10*10*10*10;

int main(){
  int n, i,j,count=0,flag,a=0;
  int A[N+1];

  scanf("%d", &n);

  if(MIN > n || n > MAX){
    printf("不正な数です。");
    exit(1);
  }
  
  for ( i = 1; i <= n; i++ ){
    scanf("%d", &A[i]);
    if(1 > A[i] && A[i] > N){
      exit(1);
    }
  }

  for(i = 1; i <= n; i++){
    if(A[i] == 2){
      a = 1;
    }
    if(A[i]%2 == 1){
      flag = 0;
      for(j = 3; j <= sqrt(A[i]); j+=2){
	if(A[i] % j==0){
	  flag = 1;
	  break;
	}
      }    
      if(flag == 0){
	count++;
      }
    }
  }
  if(a == 1){
    count++;
  }
  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 632
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end


a,b = gi

puts (a+b) % 3 == 0 || a % 3 == 0 || b % 3 == 0  ? 'Possible' : 'Impossible'

Measured memory_bytes: 2428
# 初期入力
import sys
#input = sys.stdin.readline

X = int(input())
start =100
riritu =1
risi =0
i=0
syojikin =start
while X >= syojikin:
    i +=1
    risi =int(syojikin *riritu/100)
    syojikin +=risi
    if X <=syojikin:
        #print(i)
        break

print(i)

Measured memory_bytes: 9172
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
int n,x;
cin>>n>>x;

cout<<n-x+1<<endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

    int i;
    int data;
    int check = 1;
    int count = 0;
    for(i = 0; i < n; i++)
    {
    	cin >> data;
    	if(data == check)
    	{
    		count ++;
    		check ++;
    	}
    }
    if(count == 0)
    	cout << "-1" << endl;
    else
    	cout << n - count << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> arr(n);
  priority_queue<int> pq;
  for(int i=0;i<n;i++){
    cin>>arr[i];
    pq.push(-arr[i]);
  }
  int ans=0;
  while(k-- && !pq.empty()){
      ans-=pq.top();
      pq.pop();
  }
  cout<<ans<<endl;
}
 

Measured memory_bytes: 3640
import java.lang.Math.sqrt

fun area(a: Double, b: Double, c: Double): Double {
    val s = (a + b + c) / 2
    return sqrt(s * (s - a) * (s - b) * (s - c))
}
fun main(args: Array<String>?): Unit {
    while (true) {
        readLine()?.let {
            val (a, l, x) = it.split(' ').map(String::toDouble)
            println(String.format("%.15f", area(a, l, l) + area(l, (l + x) / 2, (l + x) / 2) * 2))
        } ?: break
    }
}


Measured memory_bytes: 40160
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

vector<vector<ll>> dp1, dp2;

void solve(const string &S, const int slen, const int K) {
    for (int i = 0; i < slen; i++) {
        for (int j = 0; j < 110; j++) {
            int d = S[i + 1] - '0';

            // dp1
            {
                if (d == 0) {
                    dp1[i + 1][j] += dp1[i][j];
                } else {
                    dp1[i + 1][j + 1] += dp1[i][j];
                }

                for (int k = 0; k < d; k++) {
                    if (k == 0) {
                        dp2[i + 1][j] += dp1[i][j];
                    } else {
                        dp2[i + 1][j + 1] += dp1[i][j];
                    }
                }

            }

            // dp2
            {
                for (int k = 0; k < 10; k++) {
                    if (k == 0) {
                        dp2[i + 1][j] += dp2[i][j];
                    } else {
                        dp2[i + 1][j + 1] += dp2[i][j];
                    }
                }
            }
        }
    }
}

int main(void) {
    string S;
    int K;
    cin >> S >> K;
    int slen = (int) S.size();
    S = " " + S;

    dp1.resize(slen + 1, vector<ll>(110));
    dp2.resize(slen + 1, vector<ll>(110));
    dp1[0][0] = 1;

    solve(S, slen, K);

    // printf("dp1: \n");
    // for (int i = 0; i <= slen; i++) {
    //     for (int j = 0; j <= 3; j++) {
    //         cout << dp1[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    // printf("dp2: \n");
    // for (int i = 0; i <= slen; i++) {
    //     for (int j = 0; j <= 3; j++) {
    //         cout << dp2[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    cout << dp1[slen][K] + dp2[slen][K] << endl;

    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#include <iostream>

using namespace std;

int main() {

    int N, M;
    cin >> N >> M;

    vector<long> xs;

    for (int i = 0; i < M; i++) {
        long x;
        cin >> x;
        xs.push_back(x);
    }

    if (N >= M) {
        cout << 0 << "\n";
        return 0;
    }

    sort(xs.begin(), xs.end());

    vector<long> diff;

    for (int i = 1; i <= M - 1; i++) {
        diff.push_back(xs[i] - xs[i - 1]);
    }

    sort(diff.rbegin(), diff.rend());

    long result = xs[M-1] - xs[0];

    for (int i = 0; i < N - 1; i++) {
        result -= diff[i];
    }

    cout << result << "\n";

    return 0;
}

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

int main(){
  string a,b;
  cin>>a>>b;
  if(a.at(0)==b.at(2)&&a.at(2)==b.at(0)&&a.at(1)==b.at(1)){
    cout<<"YES";
      }
  else cout<<"NO";
  cout<<endl;
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[300005];
ll A[300005],B[300005];
void prll(multiset<ll>st)
{
    for(auto it=st.begin();it!=st.end();it++)
        cout<<*it<<" ";
    cout<<endl;
}
#define inf -1000000000000000
int main()
{
    ll n;cin>>n;
    for(ll i=0;i<3*n;i++)cin>>ara[i];
    multiset<ll>st;
    multiset<ll,greater<ll>>ss;
    multiset<ll,greater<ll>>::iterator ii;
    multiset<ll>::iterator it;
    ll sum=0;
    for(ll i=0;i<n;i++)
    {
        sum+=ara[i];
        st.insert(ara[i]);
    }
    A[n-1]=sum;
    for(ll i=n;i<2*n;i++)
    {
        it=st.begin();
        if(*it<ara[i]){

//            cout<<"eraseing "<<endl;
            sum=sum+ara[i]-*it;
            st.erase(it);
            st.insert(ara[i]);
//            prll(st);
        }
        A[i]=sum;
    }
//    for(ll i=n-1;i<=2*n;i++)cout<<A[i]<<" ";cout<<endl;
    sum=0;
    for(ll i=3*n-1;i>=2*n;i--)
    {
        sum+=ara[i];
        ss.insert(ara[i]);
    }
    B[2*n]=sum;
    for(ll i=2*n-1;i>=n;i--)
    {
        ii=ss.begin();
        if(*ii>ara[i])
        {
//            cout<<"i = "<<i<<
            sum=sum+ara[i]-*ii;
            ss.erase(ii);
            ss.insert(ara[i]);
        }
        B[i]=sum;
    }
    ll ans=inf;
    for(ll i=n-1;i<2*n;i++)
    {
        ll temp=A[i]-B[i+1];
        ans=max(ans,temp);
    }
    cout<<ans<<endl;
}


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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define DEBUG(x) ;
#define DEBUG(x) std::cerr << #x << " : " << (x) << std::endl;

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


int main(int argc, char **argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll N, X, t; cin >> N >> X >> t;
	std::cout << ((N + X - 1) / X) * t << std::endl;
	
	return 0;
}








Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

vector<int> G[100010];
int d[100010][3];

void bfs(int s)
{
    queue<P> que;
    que.push(P(s, 0));
    while (!que.empty())
    {
        P p = que.front();
        que.pop();
        int nxt = (p.second + 1) % 3;
        int pos = p.first;
        for (int i = 0; i < G[pos].size(); i++)
        {
            if (d[G[pos][i]][nxt] == INF)
            {
                d[G[pos][i]][nxt] = d[pos][p.second] + 1;
                que.push(P(G[pos][i], nxt));
            }
        }
    }
}

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

    int n, m;
    cin >> n >> m;
    rep(i, m)
    {
        int u, v;
        cin >> u >> v;
        u--, v--;
        G[u].push_back(v);
    }
    int s, g;
    cin >> s >> g;
    s--, g--;
    rep(i, 100010) rep(j, 3) d[i][j] = INF;
    d[s][0] = 0;
    bfs(s);
    int ans = d[g][0];
    if (ans == INF)
        cout << -1 << endl;
    else
        cout << d[g][0] / 3 << endl;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> P(N);
  for(int i = 0; i < N; i++){
    cin >> P.at(i);
  }
  
  sort(P.begin(), P.end());
  
  int price = 0;
  
  for(int i = 0; i < K; i++){
    price += P.at(i);
  }
  
  cout << price << endl;
    
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

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

int main(){
    ll K;
    cin >> K;

    ll ans = 0;
    REPi(i,1,K+1){
        REPi(j,1,K+1){
            REPi(k,1,K+1){
                ans += gcd(i, gcd(j, k));
            }
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    int n; cin >> n;
    int p[n];
    int sum=0,p_max=0;
    for (int i=0;i<n;i++) {
        cin >> p[i];
        sum += p[i];
        if (i>=1) p_max = max(p_max, p[i]);
    }
    cout << sum - p_max/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    int N;
    //bool b = true;
    cin >> N;
    
    for(int i = 0; i < N; i++){
        int A;
        cin >> A;
        if(A % 2 == 0){
            if(A % 5 != 0 && A % 3 != 0){
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    
    cout << "APPROVED" << endl;
    
    
    
}


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

using namespace std;

bool check(const string& s, const string& t){
	int n = s.size(), m = t.size();
	for(int i=0;i<m;i++){
		for(int j=1; ;j++){
			if(i+(n-1)*j >= m) break;
			bool ok = true;
			for(int k=0,idx=i;k<n;k++,idx+=j){
				if(s[k] != t[idx]){ ok = false; break; }
			}
			if(ok) return true;
		}
	}
	return false;
}

int main(){
	int n;
	while(cin >> n){
		string s; cin >> s;
		int res = 0;
		for(int i=0;i<n;i++){
			string t; cin >> t;
			res += check(s, t);
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
  int n;
  cin>>n;
  if(n%1000==0)
  cout<<"0"<<endl;
  else
  {
  	int x=1000-n%1000;
  	cout<<x<<endl;
  }
  return 0;
}



Measured memory_bytes: 3560
let readCharArray _ = stdin.ReadLine().ToCharArray()

let rec solve str =
    let len = str |> Array.length
    if len % 2 = 0
       && str.[0..(len / 2 - 1)] = str.[(len / 2)..(len - 1)] then
        len
    else
        str |> Array.tail |> solve

()
|> readCharArray
|> Array.rev
|> Array.tail
|> solve
|> printfn "%d"


Measured memory_bytes: 32672
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vii = vector<ii>;

const int mod = 1e9+7;
const int oo = 1e8+7;

int main() {
    
    int r, c;
    scanf("%d%d",&r,&c);
    string line;
    getline(cin, line);
    
    vector<vector<char>> grid(r);
    vector<vector<int>> dp(r);
    
    for(int i = 0; i < r; ++i) {
        grid[i].resize(c);
        dp[i].assign(c, 0);
        
        getline(cin, line);
        
        for(int j = 0; j < c; ++j) {
            grid[i][j] = line[j];
        }
    }
    
    dp[0][0] = 1;
    for(int i = 0; i < r; ++i) {
        for(int j = 0; j < c; ++j) {
            if(grid[i][j] == '#') continue;
            
            if(i+1 < r) {
                dp[i+1][j] += dp[i][j];
                dp[i+1][j] %= mod;
            } 
            
            if(j+1 < c) {
                dp[i][j+1] += dp[i][j];
                dp[i][j+1] %= mod;
            }
        }
    }
    
    cout << dp[r-1][c-1] << endl;
    
    return 0;
}




Measured memory_bytes: 5248
# H 行 W 列の白色のマス目があります。
# あなたは h 個の行と w 個の列を選び、
# 選んだ行または列に含まれるマス目を全て黒色で塗りつぶします。
# 白色のマス目はいくつ残るでしょうか。
# なお、残る白色のマス目の数は行や列の選び方によらないことが証明できます。

input_line_1 = gets.chomp.split
H = input_line_1[0].to_i
W = input_line_1[1].to_i

input_line_2 = gets.chomp.split
h = input_line_2[0].to_i
w = input_line_2[1].to_i

puts (H * W) - ((h * W) + (w * (H - h)))

Measured memory_bytes: 3836
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    // let s: String = "????C?????B??????A???????".to_string();
    let s: String = read();
    let s = s.chars().collect::<Vec<char>>();
    let mut dp: Vec<Vec<i64>> = vec![vec![0; 4]; s.len() + 1];
    let big_num: i64 = 1000_000_000 + 7;
    dp[0][0] = 1;
    for i in 0..s.len() {
        for j in 0..4 {
            if s[i] == '?' {
                dp[i + 1][j] = (dp[i + 1][j] + 3 * dp[i][j]) % big_num;
            } else {
                dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % big_num;
            }
            if (s[i] == 'A' && j == 0)
                || (s[i] == 'B' && j == 1)
                || (s[i] == 'C' && j == 2)
                || (s[i] == '?')
            {
                if j != 3 {
                    dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % big_num;
                }
            }
        }
    }
    // println!("{:?}", dp);
    println!("{:?}", dp[s.len()][3]);
}


Measured memory_bytes: 10492
M = 100
N = 9
S = 1000

dp = Array.new(M+1){ Array.new(N+1) {Array.new(S+1) {0}}}
dp[0][0][0] = 1
for i in 0..M do
  dp[i+1] = Marshal.load(Marshal.dump(dp[i]))
  for j in 0...N do
    for k in 0...S-i do
      dp[i+1][j+1][k+i] += dp[i][j][k]
    end
  end
end

while (n, s = gets.split.map(&:to_i)).inject(:+) != 0 do
  p dp[M+1][n][s]
end

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//main code

int main(int argc, char const* argv[])
{
	int n,k;
	cin >> n >> k;
	VL x(n), y(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	LL ans = INT64_MAX;
	for (int l = 0; l < n; l++) {
		for (int r = 0; r < n; r++) {
			for (int d = 0; d < n; d++) {
				for (int u = 0; u < n; u++) {
					LL s = (x[r] - x[l]) * (y[u] - y[d]);
					if (s <= 0) {
						continue;
					}
					int num = 0;
					for (int c = 0; c < n; c++) {
						if (x[c] >= x[l] and x[c] <= x[r] and y[c] >= y[d] and y[c] <= y[u]) {
							num++;
						}
					}
					if (num >= k) {
						ans = min(ans, s);
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
    int n,k,x[101];
    int sum = 0;

    cin >> n >> k;

    for(int i = 1;i <= n;++i){
        cin >> x[i];
    }

    for(int i = 1;i <= n;++i){
        int a = abs(x[i]);
        int b = abs(k - x[i]); 
        sum += min(a,b) * 2; 
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
// 2???????????¢????±???????????????°??????
// x1,x2,y1,y2????????????????????§????????????
// sample input 0 0 1 1
// sample output 1.41421356

#include <iostream>
#include <cmath>

using namespace std;

int main(){
    
    double x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    
    cout << fixed << sqrt(pow(x2 - x1,2) + pow(y2 - y1,2)) << endl;
    return 0;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    cout << (n-1) * (m-1);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=200010,O=1000000007;
inline int fpow(int x,int n){
	int a=1;
	for(;n;n>>=1,x=(lint)x*x%O){
		if(n&1){
			a=(lint)a*x%O;
		}
	}
	return a;
}
inline int inv(int x){
	return fpow(x,O-2);
}
int nlst[N],ns,ecnt;
int fac[N],invfac[N];
inline void gmath(int n){
	fac[0]=1;
	for(int i=1;i<=n;i++){
		fac[i]=(lint)fac[i-1]*i%O;
	}
	invfac[n]=inv(fac[n]);
	for(int i=n;i>=1;i--){
		invfac[i-1]=(lint)invfac[i]*i%O;
	}
}
namespace G{
	const int E=N<<1;
	int to[E],bro[E],head[N],e=0;
	int size[N],ringe;
	int edg[N];
	inline void init(){
		memset(head,-1,sizeof(head));
	}
	inline void ae(int u,int v){
		to[e]=v,bro[e]=head[u],head[u]=e++;
	}
	inline void add(int u,int v){
		ae(u,v),ae(v,u);
	}
	void getring(int x){
		nlst[++ns]=x;
		for(int i=head[x],v;~i;i=bro[i]){
			ecnt++;
			if((v=to[i])!=edg[x]){
				if(edg[v]){
					if(ringe==-1){
						ringe=i;
					}else if(to[ringe]!=x){
						ringe=-2;
					}
				}else{
					edg[v]=x;
					getring(v);
				}
			}
		}
	}
	int dfs(int x){
		size[x]=1;
		lint ans=1;
		for(int i=head[x],v;~i;i=bro[i]){
			if((v=to[i])<edg[x]){
				ans=ans*dfs(v)%O;
				ans=ans*invfac[size[v]]%O;
				size[x]+=size[v];
			}
		}
		return ans*fac[size[x]-1]%O;
	}
}
int deg[N];
inline int work2(){
	using namespace G;
	for(int i=1;i<=ns;i++){
		int x=nlst[i];
		deg[x]=0;
	}
	for(int t=1;t<=ns;t++){
		int x=nlst[t];
		for(int i=head[x],v;~i;i=bro[i]){
			if((v=to[i])<edg[x]){
				deg[v]++;
			}
		}
	}
	lint ans=fac[ns];
	for(int t=1;t<=ns;t++){
		int x=nlst[t];
		if(deg[x]==0){
			ans=ans*dfs(x)%O;
			ans=ans*invfac[size[x]]%O;
		}
	}
	return ans;
}
inline int work(int x){//kind*invfac[n]
	using namespace G;
	ns=0,ecnt=0;
	ringe=-1;
	edg[x]=-1;
	getring(x);
	if((ecnt>>1)!=ns)return 0;
	assert(ringe>=0);
	for(int p=to[ringe],q=to[ringe^1];~p;swap(edg[p],q),swap(p,q));
	int ans=work2();
	for(int p=to[ringe^1],q=to[ringe],tp=p;swap(edg[p],q),swap(p,q),p!=tp;);
	return (lint)invfac[ns]*(ans+work2())%O;
}
inline int Main(){
	int n=ni,n2=n<<1;
	G::init();
	for(int i=1;i<=n2;i++){
		G::add(ni,n+ni);
	}
	gmath(n<<1);
	lint ans=fac[n<<1];
	memset(G::edg,0,sizeof(G::edg));
	memset(G::size,0,sizeof(G::size));
	for(int i=1;i<=n2;i++){
		if(G::edg[i]==0){
			(ans*=work(i))%=O;
			if(ans==0)return 0;
		}
	}
	return ans;
}
int main(){
	printf("%d\n",Main());
	return 0;
}

Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	ll n,m; cin>>n>>m;
	ll ans=0;
	ans += ( n*(n-1) )/2;
	ans += ( m*(m-1) )/2;
	cout<<ans;
	
	
	return 0;
}


Measured memory_bytes: 256