akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include <string.h>
#include<math.h>

int main(){
	int a,b,c,i,n;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d %d",&a,&b,&c);
		
		if(a*a==b*b+c*c || b*b==c*c+a*a || c*c==a*a+b*b){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
string s;
int t;
int main()
{
	cin>>s;
	t=s.find('C');
	if(t==-1)
	{
		cout<<"No"<<endl;
		return 0;
	}
	else
	{
		for(int i=t+1;i<s.size();i++)
		{
			if(s[i]=='F')
		    {
			  cout<<"Yes"<<endl;
			  return 0;
		    }
		}
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
<?php

$A = [];
$b = [];
$c = [];
fscanf(STDIN, "%d %d", $row, $col);
for ($i = 0; $i < $row; $i++) {
  $A[$i] = explode(" ", trim(fgets(STDIN)));  
}
for ($i = 0; $i < $col; $i++) {
  fscanf(STDIN, "%d", $b[$i]);
}
for ($i = 0; $i < $row; $i++) {
  $c[$i] = 0;
  for ($j = 0; $j < $col; $j++) {
    $c[$i] += $A[$i][$j] * $b[$j];
  }
  echo $c[$i]."\n";
}


Measured memory_bytes: 10964
n=int(input())
s=[]
for i in range(n):
    s.append(input())
m=int(input())
t=[]
for i in range(m):
    t.append(input())
array=[]
for i in range(n):
    array.append(s.count(s[i])-t.count(s[i]))
if max(array)<0:
    print(0)
else:
    print(max(array))


Measured memory_bytes: 3060
#define ll     long long int
#define db     double
#include<bits/stdc++.h>
using namespace std ;
int main()
{
     ll n,m,i;
     cin>>n>>m;
     ll a[n],sum=0;
     for(i=0;i<m;i++)
     {
         cin>>a[i];
         sum+=a[i];
     }
    if(n>=sum)
        cout<<n-sum<<endl;
    else cout<<"-1"<<endl;
}


Measured memory_bytes: 3672
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int mod = (int)1e9+7;
const int nax = 405;
const ll INF = 1e18+5;
ll dp[405][405];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	int n;
	cin>>n;
	vector<ll> a(n);
	for(ll &x : a){
		cin>>x;
	}
	vector<ll> p(n);
	for(int i=0;i<n;i++){
		p[i] = a[i]+(i?p[i-1]:0);
	}
	auto sum = [&](int i,int j){
		if(i>0)
			return p[j]-p[i-1];
		else return p[j];	
	};
	for(int l=n-1;l>=0;l--){
		for(int r=l;r<n;r++){
			if(l==r){
				dp[l][r] = 0;
			}
			else{
				dp[l][r] = INF;
				for(int k=l;k<r;k++){
					dp[l][r] = min(dp[l][r],dp[l][k]+dp[k+1][r]+sum(l,r));
				}
			}
		}
	}
	cout<<dp[0][n-1];
    return 0;
}









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

int main() {
  int A , B , C , X;
 cin >> A >> B >> C >> X;
  int res = 0;
  for (int a = 0; a <= A; ++a) {
    for (int b = 0; b <= B; ++b) {
      for (int c = 0; c <= C; ++c) {
        int total = 500*a + 100*b + 50*c; // 合計金額
        if (total == X) ++res; // 合計金額が X に一致したら答えをインクリメント
      }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# 小さい方からまとめていく

N = int(input())
V = [int(x) for x in input().split()]

answer = 0
V.sort(reverse = True)
while len(V) > 1:
    x = V.pop()
    y = V.pop()
    V.append((x+y)/2)
answer = V[0]
print(answer)

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

#define iosx ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(20)
#define hell 1000000007LL
#define INF 100000000000000000LL
#define hmap unordered_map
#define hset unordered_set
#define PQ priority_queue
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define lld long double
#define ll int
#define all(C) begin(C),end(C)
#define rep(i,a,b) for(ll i = (a); i < (b); ++(i))
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define pii pair<ll,ll>
#define len(C) (ll)(C).size()
#define lexcmp lexicographical_compare
#define whats(C,n) 	rep(i,0,n) cout<<(C)[i]<<" \n"[i+1==n];
#define what(V) cout<<V<<'\n';

void solve(int tm){
	ll n,k;
	string s;
	cin>>n>>k>>s;

	s[k-1]=char(s[k-1]+32);
	cout<<s;
}


	// rep(i,0,n)
		// cout<<a[i]<<" \n"[i+1==n];

// g++.exe -static -DONLINE_JUDGE -lm -s -x c++ -Wl,--stack=268435456 -O2 -std=c++14 sol.cpp & a.exe & del a.exe
// vim cli: !g++ -static -lm -s -x c++ -O2 -std=c++14 sol.cpp -o out; ./out; 
int main(){ 
	iosx; 
	int t=1;
    // cin >> t;

	for(int i=1; i<=t; ++i)
        solve(i);

	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;

struct Edge{
    int to, cost;
};

using Graph = vector<vector<Edge>>;

Graph g;
const ll INF = 1e18;
const int mx = 2500;
const int mx2 = 50;

int f(int vertex, int money){
    if(money > mx) money = mx;
    return mx2 * money + vertex;    
}

void Dijkstra(Graph &G, int s, vll &dis){
    int N = G.size();
    dis.resize(N, INF);
    
    // pq には (仮の最短距離, 頂点) の組が小さい順に入る
    priority_queue<Pll, vector<Pll>, greater<Pll>> pq;
    
    dis[s] = 0;
    pq.emplace(dis[s], s);
    
    while(!pq.empty()){
        Pll p = pq.top(); pq.pop();
        int v = p.se;
        if(dis[v] < p.fi) continue;
        for(auto &e : G[v]){
            int u = e.to;
            if(dis[u] > dis[v] + e.cost){
                dis[u] = dis[v] + e.cost;
                pq.emplace(dis[u], u);
            }
        }
    }
}

void Main() {
    int n, m, s; cin >> n >> m >> s;
    g.resize(mx * mx2);
  
    rep(i, m){
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        rep3(co, a, mx){
            g[f(u, co)].eb(Edge{f(v, co-a), b});
            g[f(v, co)].eb(Edge{f(u, co-a), b});
        }
    }
    rep(i, n){
        int c, d;
        cin >> c >> d;
        rep(co, mx) {
            g[f(i, co)].eb(Edge{f(i, co+c), d});
        }
    }

    // Dijkstra
    vll dist;
    
    Dijkstra(g, f(0, s), dist);
    rep3(i, 1, n-1){
        ll ans = INF;
        rep(co, mx){
            ans = min(ans, dist[f(i, co)]);
        }
        cout << ans << endl;
    }

    return;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 17508
#include<bits/stdc++.h>
            #define ll long long
            #define f   first
            #define s   second
            #define pb          push_back
            #define mod        1000000007
            #define mod1       1000000009
            #define hell        998244353
            #define inf         1000000000000000000LL
            #define pi          3.14159265358979323
            //#define N           100005 
            const int N=1000005;
            using namespace std;
            ll n,k,sum,q,res,m,val,ans;
            ll x,y;
            double p;
            ll xx[]={1,0,-1,0};
            ll yy[]={0,1,0,-1};
            void solve()    
            {   
                cin>>n>>m;
                k=n+m;
                if(k>9) cout<<"error";
                else cout<<k;
            }
            int main()  
            {   ios_base::sync_with_stdio(false);
                cin.tie(0);cout.tie(0);
                ll t=1;  
                //cin>>t;
                 for(ll i=1;i<=t;i++)
                    solve();
                

            }            

Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;

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 (a>b) { a=b; return 1; } return 0; }

int main() {
    int N; cin>>N;
    vector<pair<int,int>> tonari[100010]; //隣ノード番号とエッジ番号
    int a,b;
    for (int i = 0; i < N-1; ++i) {
        cin>>a>>b; --a; --b;
        tonari[a].push_back(make_pair(b,i));
        tonari[b].push_back(make_pair(a,i));
    }

    vector<bool> visit(N,false);
    vector<int> ans(N,-1);

    queue<int> q;
    q.push(0);
    int K=0;
    //cout<<"OK"<<endl;
    while(!q.empty()){
        int node=q.front();
        //cout<<node<<endl;
        q.pop();
        visit[node]=true;
        set<int> uc;
        for(auto tsugi:tonari[node]){
            if(ans[tsugi.second]>=0){
                uc.insert(ans[tsugi.second]);
            }
        }
        int itr=0;
        for(auto tsugi:tonari[node]){
            if(visit[tsugi.first]) continue;
            //cout<<"OKa"<<endl;
            while(uc.find(itr)!=uc.end()){
                ++itr;
            }
            ans[tsugi.second]=itr;
            K=max(K,itr+1);
            ++itr;
            q.push(tsugi.first);
        }
    }

    cout<<K<<endl;
    for (int i = 0; i < N - 1; ++i) {
        cout<<ans[i]+1<<endl;
    }

    return 0;
}


Measured memory_bytes: 7040
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	fastio;
	int n,m;
	cin>>n>>m;
	cout<<(n+m)*(n+m-1)/2-n*m<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int a = ni();
		int b = ni();

		String s = n();

		boolean flg = true;

		for (int i = 0; i < a + b; i++) {
			if (i == a) {
				if (!(s.charAt(i) == '-')) {
					flg = false;
				}

			} else {
				if (s.charAt(i) == '-') {
					flg = false;
				}
			}

		}

		if (flg) {
			out(Y);
		} else {
			out(N);
		}

	}

	/*
	 * 以下メソッド集
	 */

	static int abcount(String str) {
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if ("AB".equals(str.substring(i, i + 2))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static double min(double d, double e) {
		return Math.min(d, e);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 22740
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
int n;
int main()
{
	scanf("%d", &n);
	if (n & (n - 1))
	{
		puts("Yes");
		if (n % 4 == 3)
		{
			for (int i = 1; i < 2 * n; i++)
				printf("%d %d\n", i, i + 1);
			return 0;
		}
		if (n % 4 == 2)
		{
			printf("%d %d\n", n, n - 2);
			printf("%d %d\n", n - 2, 2);
			printf("%d %d\n", 2, n + n);
			printf("%d %d\n", n + n, n + n - 2);
			printf("%d %d\n", n + n - 2, n + 2);
			printf("%d %d\n", 2, 1);
			printf("%d %d\n", 1, n - 1);
			printf("%d %d\n", n + n, n + n - 1);
			printf("%d %d\n", n + n - 1, n + 1);
			for (int i = 3; i <= n - 3; i++)
			{
				printf("%d %d\n", i, i - 1);
				if (i != n - 3)
					printf("%d %d\n", n + i, n + i + 1);
			}
			printf("%d %d\n", n + n - 3, 1);
		}
		if (n % 4 == 1)
		{
			printf("%d %d\n", n, n - 1);
			printf("%d %d\n", n - 1, 1);
			printf("%d %d\n", 1, n + n);
			printf("%d %d\n", n + n, n + n - 1);
			printf("%d %d\n", n + n - 1, n + 1);
			for (int i = 2; i <= n - 2; i++)
			{
				printf("%d %d\n", i, i - 1);
				if (i != n - 2)
					printf("%d %d\n", n + i, n + i + 1);
			}
			printf("%d %d\n", n + n - 2, 1);
		}
		if (n % 4 == 0)
		{
			int v = n ^ (n - 1);
			printf("%d %d\n", n, n - 1);
			printf("%d %d\n", n - 1, v);
			printf("%d %d\n", v, n + n);
			printf("%d %d\n", n + n, n + n - 1);
			printf("%d %d\n", n + n - 1, n + v);
			int lst = v;
			for (int i = 1; i <= n - 2; i++)
			{
				if (i == v)continue;
				printf("%d %d\n", i, lst);
				if (lst != v)
					printf("%d %d\n", n + lst, n + i);
				lst = i;
			}
			printf("%d %d\n", n + lst, n - 1);
		}
	}
	else
		puts("No");
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	static const ULL INF = 0xffffffffffffffff;

	void Solve() {
		UL N; cin >> N;
		vector<UL> A(N), B(N);
		rep(i, N) cin >> A[i];
		rep(i, N) cin >> B[i];
		ULL P = 0;
		while (true) {
			ULL MCos = 0;
			vector<ULL> dp;
			rep(n, N) {
				dp.assign(51, INF);
				dp[A[n]] = 0;
				for (int i = 50; i > 0; i--) {
					if (P & (1ull << i)) {
						rep(j, 51) dp[j % i] = min(dp[j % i], dp[j]);
					}
					else {
						rep(j, 51) dp[j % i] = min(dp[j % i], dp[j] | (1ull << i));
					}
				}
				MCos |= dp[B[n]];
			}
			if (MCos == INF) { cout << -1 << endl; return; }
			if (MCos == 0) { cout << P << endl; return; }
			ULL p = 1; while (p <= MCos) p <<= 1; p >>= 1;
			P |= p;
		}
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

Measured memory_bytes: 256
#define  _USE_MATH_DEFINES

#define  rep(i, n) for(int i = 0; i < n; i++)
#define  repx(i, a, n) for(int i = a; i < n; i++)
#define  loop while(1)
#define  lli long long int
#define  aryout(ary) rep(i, ary.size()) cout << ary[i] << (i < ary.size() - 1 ? " " : "\n");
#define  arysort(v) sort(v.begin(), v.end())
#define  aryreverse(v) reverse(v.begin(),v.end())
#define  arysum(v) accumulate(v.begin(), v.end(), 0)

#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <utility>
#include <set>

using namespace std;

long long int knapsack(int n, int w, vector<pair<int, int>> trs) {

  int varmax = n+1;
  int hormax = n*1e3+1;

  vector<vector<lli>> dp(varmax, vector<lli>(hormax, n*1e9+10));
  rep (i, varmax) dp[i][0] = 0;

  repx (var, 1, varmax) {
    repx (hor, 1, hormax) {
      if (trs[var-1].second > hor)
        dp[var][hor] = dp[var-1][hor];
      else 
        dp[var][hor] = min(dp[var-1][hor - (trs[var-1].second)] + (lli)trs[var-1].first, dp[var-1][hor]);
    }
  }

  for (int i = hormax-1; i >= 0; i--)
    if (dp[varmax-1][i] <= w) return i;

  return 0;
}

int main() {

  int n, w;
  cin >> n >> w;

  vector<pair<int, int>> treasure(n); //{weight, value}
  rep (i, n) {
    pair<int, int> tmp;
    cin >> tmp.first >> tmp.second;
    treasure[i] = tmp;
  }
  cout << knapsack(n, w, treasure) << endl;

  return 0;
}


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

int main()
{
    int n, h, w;
    std::cin >> n >> h >> w;

    int count = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        std::cin >> a >> b;

        if (a >= h && b >= w) {
            count++;
        }
    }

    std::cout << count << std::endl;
}


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

using namespace std;

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

    string s1=s.substr(0,(s.length()-1)/2);
    string s2=s.substr((3+s.length()-1)/2);
    string rev=s;
    string rev1=s1;
    string rev2=s2;
    reverse(rev.begin(), rev.end());
    reverse(rev1.begin(), rev1.end());
    reverse(rev2.begin(), rev2.end());
    if(s==rev && s1==rev1 && s2==rev2) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
t = 0
S = 0
for Ai in A:
    S=S+Ai

for Ai in A:
    if Ai >= S/(4*M):
        t = t+1

if t >= M:
    print('Yes')
else:
    print('No')









Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string t;
  int i,n=0,s=0,e=0,w=0;
  cin>>t;
  for(i=0;i<t.length();i++){
    if(t[i]=='N'){
      n++;
    }
    if(t[i]=='S'){
      s++;
    }
    if(t[i]=='E'){
      e++;
    }
    if(t[i]=='W'){
      w++;
    }
  }
  if(((n==0&&s==0)||(n>0&&s>0))&&((e==0&&w==0)||(e>0&&w>0))){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;

int main() {
  int T;
  cin >> T;
  while (T--) {
    int N, ans = 0;
    cin >> N;
    vi A(N), B(0);
    for (int i = 0; i < N; i++) cin >> A[i];
    string S;
    cin >> S;
    for (int i = N - 1; i >= 0; i--) {
      for (ll b : B) A[i] = min(A[i], A[i] ^ b);
      if (A[i] == 0) continue;
      if (S[i] == '0') B.push_back(A[i]);
      else ans = 1;
    }
    cout << ans << endl;
  }
}


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

constexpr int nax = 1e5;

int n, tab[nax];

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

    cin >> n;

    for (int i = 0; i < n; ++i)
        cin >> tab[i];
    
    ll sum = 0;
    for (int i = 0; i < n; ++i)
        sum += tab[i];

    ll q = (ll)(n + 1) * n / 2;

    if (sum % q)
        return cout << "NO" << '\n', 0;

    ll r = sum / q;

    int s = 0;

    for (int i = 0; i < n; ++i)
    {
        int d = tab[i] - (i == n - 1? tab[0] : tab[i + 1]);
        if (((r + d) % n) or r + d < 0)
            return cout << "NO" << '\n', 0;
        s += (r + d) / n;
    }

    if (s != r)
        return cout << "NO" << '\n', 0;

    cout << "YES" << '\n';
}

Measured memory_bytes: 640
use std::io;
use std::cmp::Ordering;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let vec: Vec<i32> = s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
    let (a, b, c) = (vec[0], vec[1], vec[2]);

    let mut cnt: i32 = 0;

    for i in (a..b+1) {
        cnt = cnt + match c % i {
            0 => 1,
            _ => 0,
        }
    }
    println!("{}", cnt);
}



Measured memory_bytes: 5032
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine

addlist :: Num a => [a] -> [a] -> [a]
addlist xs [] = xs
addlist [] ys = ys
addlist (x:xs) (y:ys) = (x + y) : addlist xs ys

calc :: Num a => [a] -> [[a]] -> [a]
calc _ [] = []
calc [] _ = []
calc (c:cs) (xs:xss) = addlist (map (*c) xs) (calc cs xss) 

main = do
  [n, m, x] <- getIntList
  cs <- getIntNList n
  let ps = replicateM (fromIntegral n) [0, 1]
  let results = filter (\t -> all (>=x) (tail t)) [calc p cs| p <- ps]
  if results == [] then
  	putStrLn $ "-1"
  else
    putStrLn $ show $ minimum (map head results)
    

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

using namespace std;

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

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

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


signed main(void) {
    int h,a,b;
    cin >> h >> a >> b;
    int ans = 0;
    loop(i,a,b+1)if(h%i == 0)ans++;
    cout << ans << endl;
}



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

typedef long long ll;

int main()
{
	ll n,m;
    while ( ~scanf("%lld %lld", &n, &m) ) {
        if ( n > m/2 )
        {
            printf("%lld\n", m/2);
        }
        else{
            ll cnt = n;
            m = m - 2*n;
            cnt = cnt + m/4;
            printf("%lld\n", cnt);
        }
    }
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    vector<pair<int,int> > p(0);
    int tmp;
    rep(i,5){
        cin >> tmp;
        p.push_back(make_pair((130-tmp)%10,tmp));
    }
    sort(p.begin(),p.end());
    tmp=0;
    rep(i,4){
        tmp+=p.at(i).second+p.at(i).first;
    }
    cout << tmp+p.at(4).second << endl;
}

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

int main(){

    int n;
    cin >> n;
    int initialseat, finalseat;
    int total = 0;
    for (int i = 0; i < n; i++) {
        cin >> initialseat >> finalseat;
        total += finalseat - initialseat + 1;
    }
    cout << total << endl;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long double pi=acos(-1);
#define x  first
#define y  second
#define read(n,a) for(int i=0;i<n;i++)cin>>a[i];
#define rep(i,z,n)for(int i=z;i<n;i++)
#define all(v)    v.begin(),v.end()

//int a[200002]={};
//ll b[200002]={};
ll n,m;
ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll si[1000002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
        cin>>n;
        si[1]=1;
        for(ll i=2;i<=1000000;i++)
        {
            ll j=i;
            si[j]++;
            while(j<=1000000)
            {
                si[j]++;
                j+=i;
            }
        }
        ll ans=0;
        rep(i,1,n)ans+=si[i];
        cout<<ans;
    }
    return 0;
}


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

using namespace std;
long long int n, arr[100003][4],f[100003][4];

int main()
{
    long long int result=0;
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for( int i= 1;i<= n ;i++)
    {
        cin>>arr[i][1]>>arr[i][2]>>arr[i][3];
    }
    f[1][1] = arr[1][1];
    f[1][2] = arr[1][2];
    f[1][3] = arr[1][3];
    for(int i = 2; i<= n;i++)
    {
        f[i][1] = max(f[i-1][2] , f[i-1][3]) + arr[i][1];
        f[i][2] = max(f[i-1][1] , f[i-1][3]) + arr[i][2];
        f[i][3] = max(f[i-1][2] , f[i-1][1]) + arr[i][3];
    }
    result = max(result, max(f[n][1] ,max(f[n][2] , f[n][3]) ) );
    cout<<result;
    return 0;
}


Measured memory_bytes: 6528
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))
S = sum(s)

if S % 10 != 0:
    print(S)
    exit()
for a in sorted(s):
    if a % 10 != 0:
        print(S-a)
        exit()
else:
    print(0)

Measured memory_bytes: 3060
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()
const int INF = 1e9;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef long long ll;
//typedef pair<int, int> P;

/* struct P {
	int x, y, n;
	P(int n, int x, int y):n(n), x(x), y(y){}
	P(){}
}; */


/** 幾何ライブラリ **/
// to do : 1183

#include <complex>

#define X real()
#define Y imag()

const double EPS = 1e-11;

typedef double D;
typedef complex<D> P; // Point

struct L { // Line
	P a, b;
	L(){}
	L(P aa, P bb) : a(aa), b(bb){}
};

// 共役複素数 conj(a);

// 符号
int sig(D a, D b=0) { return a < b - EPS ? -1 : (a > b + EPS ? 1 : 0); }

// 内積
D dot(P a, P b) { return (conj(a)*b).real(); }

// 外積
D cross(P a, P b) { return (conj(a)*b).imag(); }

// 線分abに対する点cの位置
enum CCW{LEFT=1, RIGHT=-1, BACK=2, FRONT=-2, ON=0};
int ccw(P a, P b, P c)
{
	b -= a, c -= a;
	D s = sig(cross(b, c));
	if (s) return s>0 ? LEFT : RIGHT;
	if (sig(dot(b, c))<0) return BACK;
	if (sig(abs(c), abs(b))>0) return FRONT;
	return ON;
}

// 直線abと点cの距離
D distLP(L l, P c)
{
	return abs(cross(l.b-l.a, c-l.a))/abs(l.b-l.a);
}

// 線分abと点cの距離
D distSP(L l, P c)
{
	if (sig(dot(l.b-l.a, c-l.a))<0) return abs(c-l.a);
	if (sig(dot(l.a-l.b, c-l.b))<0) return abs(c-l.b);
	return abs(cross(l.b-l.a, c-l.a))/abs(l.b-l.a);
}

// 線分と線分の交差判定
bool iSS(L s, L t)
{
	return (ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0)
			&& (ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0);
}

// 線分と線分の距離
D distSS(L s, L t)
{
	if (iSS(s, t)) return 0;
	return min(min(distSP(t, s.a), distSP(t, s.b)), min(distSP(s, t.a), distSP(s, t.b)));
}

// 線分と線分の交点 (公差していることが前提)
P cSS(L s, L t)
{
	D d1 = distLP(t, s.a);
	D d2 = distLP(t, s.b);
	D tmp = d1 / (d1 + d2);
	return s.a + (s.b-s.a)*tmp;
}

// 直線と直線の交差判定
bool iLL(L s, L t)
{
	return sig(cross(s.b-s.a, t.b-t.a))!=0;
}

/** Problem CGL_2-D : Distance **/
int main()
{
	L s, t;
	int q; cin>>q;
	rep(i, q) {
		cin>>s.a.X>>s.a.Y>>s.b.X>>s.b.Y;
		cin>>t.a.X>>t.a.Y>>t.b.X>>t.b.Y;
		
		cout << fixed << setprecision(15);
		cout << distSS(s, t) << endl;
	}
}

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

int main(){
    int a[3][3];
    for (int i=0; i<3; i++){
        for (int j=0; j<3; j++){
            cin >> a[i][j];
        }
    }
    int n;
    cin >> n;
    for (int i=0; i<n; i++){
        int b;
        cin >> b;
        for (int i=0; i<3; i++){
            for (int j=0; j<3; j++){
                if (b == a[i][j]) a[i][j] = 0;
            }
        }
    }
    bool ans= false;
    if(a[0][0] == 0 && a[0][1] == 0 && a[0][2] == 0){
        ans = true;
    }
    if(a[1][0] == 0 && a[1][1] == 0 && a[1][2] == 0){
        ans = true;
    }
    if(a[2][0] == 0 && a[2][1] == 0 && a[2][2] == 0){
        ans = true;
    }
    if(a[0][0] == 0 && a[1][0] == 0 && a[2][0] == 0){
        ans = true;
    }
    if(a[0][1] == 0 && a[1][1] == 0 && a[2][1] == 0){
        ans = true;
    }
    if(a[0][2] == 0 && a[1][2] == 0 && a[2][2] == 0){
        ans = true;
    }
    if(a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0){
        ans = true;
    }
    if(a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0){
        ans = true;
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    int N, X, prev = 0;
    cin >> N >> X;
    lint ret = 0;
    FOR(i, 0, N) {
        int a;
        cin >> a;
        int mx = X - prev;
        if (a > mx) {
            prev = mx;
            ret += a - mx;
        } else {
            prev = a;
        }
    }
    cout << ret << endl;
    return 0;
};


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

// nが10進数表記で何桁か
ll dig(ll n){
  ll digit = 0;
  while(n>0){
    digit++;
    n /= 10;
  }
  return digit;
}

int main() {
  ll n; cin >>n;
  ll ans = 11;
  ll buf;
  ll i = 1;
  while(i*i<=n){
    if (n%i==0){
      buf = max(dig(i),dig(n/i));
      ans = min(ans,buf);
    }
    i++;
  }
  cout <<ans <<endl;
}


Measured memory_bytes: 256
/* You lost the game. */
 
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>
#include <numeric>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <vector>
//#include <pthread.h>
 
#define fin(i,n) for (int i = (L) 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626
#define EXP1 2.718281828459045
 
#define si(n) scanf("%d", &n)
#define sii(n,m) scanf("%d %d", &n, &m)
#define siii(n,m,k) scanf("%d %d %d", &n, &m, &k)
#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf("%c", &c)
#define ss(s) scanf("%s", s)
#define sai(t,n) fin(i,n) { scanf("%d", &i); }
#define sal(t,n) fin(i,n) { scanf("%lld", &i); }
#define sad(t,n) fin(i,n) { scanf("%lf", &i); }
 
#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pi(n) printf("%d\n", n)
#define pii(n,m) printf("%d %d\n", n, m)
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define plll(n,m,k) printf("%lld %lld %lld\n", n, m, k)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pai(t,n) fin(i,n) { printf("%d ", i); } printf("\n")
#define pal(t,n) fin(i,n) { printf("%lld ", i); } printf("\n")
#define pad(t,n) fin(i,n) { printf("%lf ", i); } printf("\n")

#define OK ps("OK")
#define OK1 ps("OK1")
#define OK2 ps("OK2")
 
#define L long long int
#define D double
//#define C char
#define PII pair<int, int>
#define VPII vector<PII>
#define VL vector<L>
#define VI vector<int>
#define VVI vector<VI>
#define VD vector<D>
#define VVD vector<VD>
#define VVPII vector<VPII>
#define VC vector<C>
 
using namespace std;

int main() {
    int n;
    char s[100000];
    ss(s);
    n = strlen(s);
    fin(i, n-1) {
        if (s[i] == 'A' && s[i+1] == 'C') { ps("Yes"); return 0; }
    }
    ps("No");
    return 0;
}

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

int main () {
  int W, a, b;
  cin >> W >> a >> b;
  if (0 < b-a-W) cout << b-a-W << endl;
  else if (0 < a-b-W) cout << a-b-W << endl;
  else cout << 0 << endl;
}

    

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

//global variables
int N;
char S[300100];

void solve();

//input
int main() {
	scanf("%d%s", &N, &S);
	solve();
	return 0;
}

//output
void solve() {
	int e[300010], w[300010], i, num, min;
	e[0] = w[0] = 0;
	for (i = 0; i < N; i++) {
		if (S[i] == 'E') {
			e[i + 1] = e[i] + 1;
			w[i + 1] = w[i];
		}
		else {
			w[i + 1] = w[i] + 1;
			e[i + 1] = e[i];
		}
	}
	for (i = 0; i < N; i++) {
		num = w[i] + e[N] - e[i + 1];
		if (i == 0) {
			min = num;
			continue;
		}
		if (min > num) min = num;
	}
	printf("%d", min);
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
string x;
int main() {
	cin>>x;
	if(x[0]>='A'&&x[0]<='Z') {
		cout<<'A'<<endl;
	} if(x[0]>='a'&&x[0]<='z') {
		cout<<'a'<<endl;
	}
}


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

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

int main() {
  int a, b;
  cin >> a >> b;
  vector<int> arr;
  for (int i = 0; i < (2 * a - 1); ++i) {
    arr.push_back(b - a + 1 + i);
  }
  print(arr);
}

Measured memory_bytes: 256
import java.util.*

fun <T> permutationList(sortedList: Array<T>): List<List<T>> {
    val queue = ArrayDeque<List<T>>()
    queue.addLast(listOf())
    val permutations = mutableListOf<List<T>>()
    while (queue.isNotEmpty()) {
        val p = queue.removeLast()

        if (p.size == sortedList.size) {
            permutations.add(p)
        } else {
            sortedList.filterNot { p.contains(it) }
                .forEach { queue.addLast(p + it) }
        }
    }

    return permutations
}

fun main(args: Array<String>) {
    val n = readInteger()
    val p = readIntegerList()
    val q = readIntegerList()

    val per = permutationList((1..n).toList().toTypedArray())
    Math.abs(per.indexOf(p) - per.indexOf(q)).let(::println)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 47160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;

#define MAX_SIZE 100010

struct City {
  int index;
  int year;

  City(int i, int y) : index(i), year(y) {}

  bool operator <(const City &other) const {
    return year < other.year;
  }
};

int count_digit(int n) {
  int digit = 0;
  while (n > 0) {
    ++digit;
    n /= 10;
  }
  return digit;
}

string format(int p, int n) {
  stringstream ss;
  for (int i = 0; i < 6 - count_digit(p); ++i) {
    ss << 0;
  }
  ss << p;
  for (int i = 0; i < 6 - count_digit(n); ++i) {
    ss << 0;
  }
  ss << n;
  return ss.str();
}

int main() {
  int N, M;
  vector<City> P[MAX_SIZE];
  string A[MAX_SIZE];

  cin >> N >> M;
  for (int i = 0; i < M; ++i) {
    int p, y;
    cin >> p >> y;
    P[p].push_back(City(i, y));
  }

  for (int i = 1; i <= N; ++i) {
    sort(P[i].begin(), P[i].end());
  }

  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j < P[i].size(); ++j) {
      A[P[i][j].index] = format(i, j + 1);
    }
  }

  for (int i = 0; i < M; ++i) {
    cout << A[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 12416
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    def make_divisors(n):
             divisors = []
             for i in range(1, int(n**0.5)+1):
                 if n % i == 0:
                     # 約数の片割れをリストに
                     divisors.append(i)
                     # 平方数じゃなければ片割れの相方をリストに
                     if i != n // i:
                         divisors.append(n//i)
             # divisors.sort() # sort必要なかったらコメントアウト
             return len(divisors)
    ans=0
    for i in range(1,n+1,2):
        if make_divisors(i)==8:
            ans+=1
    print(ans)

resolve()

Measured memory_bytes: 38384
#import<bits/stdc++.h>
using namespace std;long long int N,M,m=1000000007,a[64],k=1,l,c,i,o=1;main(){cin>>N;M=((++N)^(N/2));for(i=64;i;++c){if(M&(o<<--i)){swap(k,l);l=(l+k*c)%m;c=0;}a[i]=(N&(o<<i))?l:(m-l);}for(k=0,l=1;i<64;++i){k=(k+a[i]*l)%m;l=(l*3)%m;}cout<<k<<endl;}

Measured memory_bytes: 256
#include <iostream>

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

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
class Simple {
    int N, K;
    long[] x, y;
    void Solve() {
        //input
        N = io.Int;
        K = io.Int;
        x = new long[N];
        y = new long[N];
        for (int i = 0; i < N;++i){
            x[i] = io.Long;
            y[i] = io.Long;
        }
        //cal
        var ans = long.MaxValue;
        var cand_x = x.OrderBy(v => v).Distinct().ToArray();
        var cand_y = y.OrderBy(v => v).Distinct().ToArray();
        var grid = new Tuple<long, long>[N];
        long top, bot, lef, rig;
        //lef
        for (int i = 0; i < cand_x.Length;++i){
            lef = cand_x[i];
            //rig
            for (int j = 0; j < cand_x.Length-i;++j){
                rig = cand_x[cand_x.Length - 1 - j];
                //bot
                for (int k = 0; k < cand_y.Length;++k){
                    bot = cand_y[k];
                    //top
                    for (int l = 0; l < cand_y.Length-k;++l){
                        top = cand_y[cand_y.Length - 1 - l];
                        //検証
                        var cnt = 0;
                        for (int m = 0; m < N;++m){
                            if(lef<=x[m]&&x[m]<=rig&&bot<=y[m]&&y[m]<=top){
                                cnt++;
                            }
                        }
                        if(cnt>=K){
                            ans = Math.Min(ans,(rig - lef) * (top - bot));
                        }
                    }
                }
            }
        }
        //ret
        Console.WriteLine(ans);
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length)
            return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while (st == "")
            st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


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

using namespace std;

const int N = 1234567;

int ans[42];
pair <int, int> a[N], b[N];

int main() {
  int h, w, n;
  scanf("%d %d %d", &h, &w, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i].first, &a[i].second);
    for (int dx = 0; dx < 3; dx++) {
      for (int dy = 0; dy < 3; dy++) {
        b[i * 9 + dx * 3 + dy].first = a[i].first - dx;
        b[i * 9 + dx * 3 + dy].second = a[i].second - dy;
      }
    }
  }
  sort(a, a + n);
  sort(b, b + n * 9);
  long long total = (h - 2) * 1LL * (w - 2);
  for (int i = 0; i < n * 9; i++) {
    int x = b[i].first;
    int y = b[i].second;
    if (i > 0 && x == b[i - 1].first && y == b[i - 1].second) {
      continue;
    }
    if (x < 1 || y < 1 || x > h - 2 || y > w - 2) {
      continue;
    }
    int cnt = 0;
    for (int dx = 0; dx < 3; dx++) {
      for (int dy = 0; dy < 3; dy++) {
        pair <int, int> p = make_pair(x + dx, y + dy);
        int pos = lower_bound(a, a + n, p) - a;
        if (pos < n && a[pos] == p) {
          cnt++;
        }
      }
    }
    ans[cnt]++;
    total--;
  }
  cout << total << endl;
  for (int j = 1; j <= 9; j++) {
    cout << ans[j] << endl;
  }
  return 0;
}


Measured memory_bytes: 8064
N=int(input())
B=list(map(int,input().split()))

B.sort()

def gcd(a,b):
    Y=max(a,b)
    X=min(a,b)
    while Y%X!=0:
        X,Y=Y%X,X
    return X

dp=[[0,0,0]for i in range(N)]
dp[0][0]=B[0]
dp[1][0]=gcd(B[0],B[1])
dp[1][1]=B[0]
dp[1][2]=B[1]

for i in range(2,N):
    dp[i][0]=gcd(dp[i-1][0],B[i])
    dp[i][1]=dp[i-1][0]
    dp[i][2]=max(gcd(dp[i-1][1],B[i]),gcd(dp[i-1][2],B[i]))
print(max(dp[N-1]))
#print(dp)

Measured memory_bytes: 17660
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
struct edge { ll s, t, x; };
typedef pair<ll, ll> P;
typedef pair<ll,P> event;
#define MOD 1000000007
const int MAX = 510000;
//この設定だとn<10^7が限界。maxの０を一個増やせば100msかかるが一桁増やせる。
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
  COMinit();
  ll N,K;
  cin>>N>>K;
  vector<ll>A(N);
  rep(i,N){cin>>A[i];}
  sort(A.begin(),A.end());
  ll maxsum=0ll;
  ll minsum=0ll;
  ll ans=0ll;
  rep(i,N){
    minsum+=(A[i]*COM(N-i-1,K-1));
    minsum%=MOD;
    maxsum+=A[i]*COM(i,K-1);
    maxsum%=MOD;
  }
  ans=maxsum-minsum+MOD;
  ans%=MOD;
  cout<<ans;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i <(int)n; i++)
#define vec vector

int main(void)
{
	int n;
	cin >> n;
	vec<int> p(n), q(n);
	rep(i, n) {
		cin >> p[i];
		q[p[i] - 1] = i;
	}

	int ret = 1;
	int cur = 1;
	rep(i, n - 1) {
		if (q[i] < q[i + 1]) {
			cur++;
		} else {
			if (ret < cur) ret = cur;
			cur = 1;
		}
	}
	if (ret < cur) ret = cur;

	cout << n - ret << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<stdbool.h>
using namespace std;
bool check(int K, int A, int B){
    int a;
    a = 1;
    for(int i = 0; i<(B-A+1); i++){
    a = min(a,(A+i)%K);
    }
    if(a==0) return true;
    else return false;
}

int main(){
    int K,A,B;
    cin >> K >> A >> B;
    if(check(K,A,B)){
        cout << "OK";
    }
    else{
        cout << "NG";
    }
}

Measured memory_bytes: 3596
/************************************************************/
//
//1????????´??°x????????????????????????????????¨?????????????????°??????
//
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_B&lang=jp
/************************************************************/

#include<stdio.h>

#define MAX 10000
#define MIN 1

int main()
{
	int a;
	char c;
	
	for(int i=0; i<MAX; i++)
	{
		if( scanf("%d%c", &a, &c)==2 )
		{
			if(a==0)
			{
				break;
			}
			else
			{
				printf("Case %d: %d\n", i+1, a);
			}
		}
		else
		{
			/* ERROR */
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1740
#include <iostream>
#include <vector>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> CP;
int main(void){
  int h,w,i,j,a[500][500],e=0,ni,nj,end=0;
  int di[4]={1,0,-1,0},dj[4]={0,1,0,-1};
  bool done[500][500]={false};
  vector <CP> way;
  cin >> h >> w;
  for (i=0;i<h;i++) for (j=0;j<w;j++) cin >> a[i][j];
  i=0;  j=0;
  while (1){
    ni=i+di[e];
    nj=j+dj[e];
    end=0;
    while ((done[ni][nj]||ni==-1||ni==h||nj==-1||nj==w)&&end!=4){
      e=(e+1)%4;
      ni=i+di[e];
      nj=j+dj[e];
      end++;
    }
    if (end==4) break;
    if (a[i][j]%2){
      way.push_back(CP(P(i+1,j+1),P(ni+1,nj+1)));
      a[i][j]--;
      a[ni][nj]++;
    }
    done[i][j]=true;
    i=ni;
    j=nj;
  }
  cout << way.size() << endl;
  for (i=0;i<way.size();i++) cout << way[i].first.first << ' ' << way[i].first.second << ' ' << way[i].second.first << ' ' << way[i].second.second << endl;
  return 0;
}

Measured memory_bytes: 5360
import sys
def ope(a,op,b):
	if op == '+': ret = a + b
	if op == '-': ret = a - b
	if op == '/': ret = int(a / b)
	if op == '*': ret = a * b
	if op == r'?': ret = 'end'
	return ret

while True:
	a,op,b = sys.stdin.readline().split()
	ret = ope(int(a) , op , int(b))
	if ret == 'end': break
	else: print(ret)

Measured memory_bytes: 7732
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int H, A;
  cin >> H >> A;

  int ret = 0;
  while(true){
    ret++;
    H -= A;
    if(H <= 0) break;
  }

  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 256