akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;
  ll e1 = x2-x1; ll e2 = y2-y1;
  ll f1 = -e2; ll f2 = e1;
  
  cout << x2+f1 << " " << y2+f2 << " ";
  cout << x2+f1-e1 << " " << y2+f2-e2 << endl;
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int toi(string s){
    int ret = 0;
    for(int i=0; i < s.size(); i++){
        string n = s.substr(i, 1);
        if("0" <= n && n <= "9"){ret += stoi(n);}
        if(i != s.size()-1) ret*=10;
    }
    return ret;
}

int tox(string s){
    int ret = 0;
    for(int i=0; i < s.size(); i++){
        if(s[i] == 'X')ret++;
        if(i != s.size()-1) ret*=10;
    }
    return ret;
}

bool judge(string s){
    return 1<s.size() && s[0]=='X';
}

int main(){
    string s;
    while(cin >> s){
        string p, q, r;
        int t;
        for(int i=0; i<s.size(); i++){
            if(s[i] == '+'){p = s.substr(0, i); t = i;}
            else if(s[i] == '='){q = s.substr(t+1, i-t-1); r = s.substr(i+1);}
        }
        int a=toi(p), b=toi(q), c=toi(r);
        int d=tox(p), e=tox(q), f=tox(r);
        bool exist_zero = !(judge(p)||judge(q)||judge(r));
        bool exist = false;
        for(int i=0; i <= 9; i++){
            if(!exist_zero&&!i) continue;
            if(a+b+(d+e)*i==c+f*i){cout << i << endl; exist = true;}
        }
        if(!exist) cout << "NA" << endl;
    }
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  cout << 800*n - 200*(n/15) << "\n";
  return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define dd double
#define fi first
#define se second
#define reverse(x) reverse(x.begin(),x.end())
#define sortsi(x) sort(x.begin(),x.end())
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
int MAX = 1e9 + 7; 

template <class T>
void print(vector<T>&v){
    for(int i=0;i<v.size();i++){
        cout<<v[i]<<" ";
    }
    cout<<endl;
}
 
template <class T>
void print(vector<vector<T>>&v){
    for(int i=0;i<v.size();i++){
       for(int j=0;j<v[i].size();j++)cout<<v[i][j]<<" ";
       cout<<endl;
    }
    cout<<endl;
}
 
template <class T>
void read(vector<T>&v,int total){
    for(int i=0;i<total;i++){
        T x;
        cin>>x;
        v.push_back(x);
    }
}
 
template <class T>
void read(vector<vector<T>>&v,int row,int col){
    for(int i=0;i<row;i++){
        vector<T> m;
        for(int j=0;j<col;j++){
            T x;
            cin>>x;
            m.push_back(x);
        }
        v.push_back(m);
    }
}
 


 

void solve(){
    string s,t;
    cin>>s>>t;

    int minv = INT_MAX;
    for(int i=0;i<=(int)s.size()-(int)t.size();i++){
        int c = 0;
        for(int j=i;j<i+(int)t.size();j++){
            if(s[j]!=t[j-i])c++;
        }
        minv = min(minv,c);
    }
    cout<<minv<<endl;
}

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


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r
using namespace std;
typedef long long ll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T>
void read(T &res) {
  int f = 1; res = 0;
  char c = getchar();
  while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar(); }
  while(c >= '0' && c <= '9') { res = res * 10 + c - '0'; c = getchar(); }
  res *= f;
}
const int N = 2005;
int a[N];
int main() {
  int n; read(n);
  for(int i = 0; i < n; ++i) {
    read(a[i]);
  }
  sort(a, a+n);
  int res1, res2;
  ll ans = 0;
  for(int i = 0; i < n; ++i) {
    for(int j = i + 1; j < n; ++j) {
      res1 = upper_bound(a, a+n, a[j]-a[i]) - a;
      res2 = lower_bound(a, a+n, a[j]+a[i]) - a;
      ans += res2 - res1;
      if(i >= res1 && i <= res2) ans--;
      if(j >= res1 && j <= res2) ans--;
    }
  }
  cout << max(ans/3, 0ll) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 25

int FindTop();
void Preorder(int, int);
void Inorder(int, int);
void Postorder(int, int);

struct node
{
  int p;
  int l, r;
} typedef node;

node N[MAX];

int main()
{
    int i, j;
    int n, id, top;

    scanf("%d", &n);
    
    for(i = 0; i < n; i++)
    {
        N[i].p = -1;
    }
    
    for(i = 0; i < n; i++)
    {
        scanf("%d", &id);
        scanf("%d %d", &N[id].l, &N[id].r);
        if(N[id].l != -1) N[N[id].l].p = id;
        if(N[id].r != -1) N[N[id].r].p = id;
    }
    
	top = FindTop();

	printf("Preorder\n");
	Preorder(top, n);
	printf("Inorder\n");
	Inorder(top, n);
	printf("Postorder\n");
	Postorder(top, n);
	    
    return 0;
}

int FindTop()
{
	int top = 0;
	while(N[top].p != -1)
	{
		top = N[top].p;
	}
	
	return top;
}

void Preorder(int id, int n)
{
	static int count = 0;
	
	if(id == -1) return;
	
	count++;
	if(count != n) printf(" %d", id);
	else printf(" %d\n", id);
	
	Preorder(N[id].l, n);
	Preorder(N[id].r, n);
}

void Inorder(int id, int n)
{
	static int count = 0;
	
	if(id == -1) return;
	
	 Inorder(N[id].l, n);
	
	count++;
	if(count != n) printf(" %d", id);
	else printf(" %d\n", id);
	
	Inorder(N[id].r, n);
}

void Postorder(int id, int n)
{
	static int count = 0;
	
	if(id == -1) return;
	
	Postorder(N[id].l, n);
	Postorder(N[id].r, n);
	
	count++;
	if(count != n) printf(" %d", id);
	else printf(" %d\n", id);
}

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

int main(int argc, char const *argv[])
{
	int k,x;
	cin>>k>>x;
	cout<<x-k+1;
	for (int i = 2-k; i < k; ++i)
	{
		cout<<" "<<x+i;
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
def nibu_A(list,item):
    high=len(list)
    low=-1
    while abs(high-low) > 1:
        mid=(high+low)//2

        if list[mid] < item:
            low= mid
        else:
            high=mid
    return (low+1)
def nibu_c(list,item):
    high= len(list)
    low=-1
    while abs(high-low)>1:
        mid=(high+low)//2
        if list[mid]>item:
             high = mid
        else:
            low=mid
    return len(list)-high


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

ans=0
for i in range(n):
    data=B[i]
    ans+=(nibu_A(A,data)*nibu_c(C,data))
print(ans)


Measured memory_bytes: 24052
x, y = map(int, input().split())

ans = 0
if x == 3:
    ans += 100000
elif x == 2:
    ans += 200000
elif x == 1:
    ans += 300000

if y == 3:
    ans += 100000
elif y == 2:
    ans += 200000
elif y == 1:
    ans += 300000

if x == 1 and y == 1:
    ans += 400000

print(ans) 




Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    string S;
    cin >> S;
    
    cout << "2018";
    
    for ( int i = 4; i < S.length(); i++ ) {
        cout << S[i];
    }
    cout << endl;
    
    
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		
		String w = sc.next();
		int[] alphabet = new int[26];
		int n;
		
		sc.close();
		
		for (int i = 0; i < w.length(); i++) {
			n = (int) (w.charAt(i) - 'a');
			alphabet[n]++;
		}
		
		for (int alpha: alphabet) {
			if (alpha%2 != 0) {
				System.out.println("No");
				System.exit(0);
			}
		}
		
		System.out.println("Yes");
	}
	
}

Measured memory_bytes: 9556
from math import floor

cache = {}


def number_to_kill(h):
    if h == 1:
        return 1

    if h in cache:
        return cache[h]

    new_health = h // 2
    half_number = number_to_kill(new_health)
    res = 2 * half_number + 1
    cache[h] = res
    return res


h = int(input())
print(number_to_kill(h))


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


using namespace std;

int main()
{
    unsigned long long int n,mw,w,v,dp[100001]={};
    cin>>n>>mw;
    for(int i=0;i<n;i++)
    {
        cin>>w>>v;
        for(int j=100000;j>=w;j--)
        {
            dp[j]=max(dp[j],dp[j-w]+v);
        }
    }
    cout<<dp[mw];
    return 0;
}


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

typedef long long ll;

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> a(N), b(M);
    rep(i, N) cin >> a[i];
    rep(i, M) cin >> b[i];
    auto c = convolution<998244353>(a, b);
    rep(i, N + M - 1) {
        cout << c[i];
        if (i == N + M - 2) cout << "\n";
        else cout << " ";
    }
}

Measured memory_bytes: 27240
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
typedef long long ll;
const int INF = 1001001001;
const int mod = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    vector<int> b(N), c(N);

    int ans_b = b[0] = a[0], ans_c = c[0] = a[N - 1];

    //前方からの最大公約数と後方からの最大公約数のリストを作成する。
    for (int i = 1; i < N; i++)
    {
        ans_b = __gcd(ans_b, a[i]);
        ans_c = __gcd(ans_c, a[N - 1 - i]);
        b[i] = ans_b;
        c[i] = ans_c;
    }
    // cout << "b[]: ";
    // for (int x : b)
    //     cout << x << " ";
    // cout << endl;

    // cout << "c[]: ";
    // for (int x : c)
    //     cout << x << " ";
    // cout << endl;

    int maxi = c[N - 2];

    for (int i = 0; i < N - 1; i++)
    {
        maxi = max(maxi, __gcd(b[i], c[N - i - 3]));
    }

    cout << maxi << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int i,j,n;
  cin >> n;
  vector<int> a(n);
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  vector<int> x(2010,0);
  // bit全探索をする
  for(i=0;i<(1<<n);i++){
    int sum=0;
    for(j=0;j<n;j++){
      if(i&(1<<j)){
        sum+=a[j];
      }
    }
    if(sum<=2000){
      x[sum]=1; //いくつかの要素を足し合わせて作れる数を配列xで記録する。
      //x[i]=1ならiについてyes、x[i]=0ならiについてno
    }
  }
  // bit全探索終わり(前処理終了)
  int q,m;
  cin >> q;
  for(i=0;i<q;i++){
    cin >> m;
    if(x[m]==1){
      cout << "yes" << endl;
    }
    else{
      cout << "no" << endl;
    }
  }
}


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

typedef pair<int,int> pii;

int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  
  set <pii> s;
  int t=0;

  for(;;){
    int r = t*(a+b)/60;
    if( s.count( pii( (t*(a+b))%60 , ((t+1)*a)%60 ) ) ){
      puts("-1");
      break;
    }
    s.insert( pii( (t*(a+b))%60,((t+1)*a)%60 ) );

    if ( t*(a+b) <= 60*r+c && 60*r+c <= t*(a+b)+a ){
      printf("%d\n",r*60+c);
      break;
    }
    t++;
  }
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long n;
  cin >> n;
  long long cnt=0;
  for(int i=1; i<n; i++) {
    cnt+=(n-1-((n-1)%i))/i;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3628
var
  i:longint;
  s,c:ansistring;
  t:char;
begin
  readln(s);
  c:=s;
  for i:=1 to length(c) div 2 do
   begin
     t:=c[i];
     c[i]:=c[length(c)-i+1];
     c[length(c)-i+1]:=t;
   end;
  for i:=1 to length(c) do
   begin
     if c[i]='b' then begin c[i]:='d';continue; end;
     if c[i]='d' then begin c[i]:='b';continue; end;
     if c[i]='p' then begin c[i]:='q';continue; end;
     if c[i]='q' then begin c[i]:='p';continue; end;
   end;
  if s=c then writeln('Yes')
         else writeln('No');
end.

Measured memory_bytes: 384
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int num[3][3];
    for(int i = 0;i < 3;i++){
        cin >> num[i][0] >> num[i][1] >> num[i][2];
    }
    while(true){
        int mini = INF;
        int minx,miny;
        for(int i = 0;i < 3;i++)for(int j = 0;j < 3;j++){
            if(num[i][j] == 0)continue;
            if(mini > num[i][j]){
                mini = num[i][j];
                minx = j,miny = i;
            }
        }
        if(mini == INF){
            cout << "Yes" << endl;
            return 0;
        }

        int xflag = 1,yflag = 1;
        for(int i = 0;i < 3;i++)if(num[i][minx] == 0)xflag = 0;
        for(int j = 0;j < 3;j++)if(num[miny][j] == 0)yflag = 0;

        if(!xflag && !yflag){
            cout << "No" << endl;
            return 0;
        }
        if(xflag){
            for(int i = 0;i < 3;i++)num[i][minx] -= mini;
            continue;
        }
        if(yflag){
            for(int j = 0;j < 3;j++)num[miny][j] -= mini;
            continue;
        }

    }
    /*

    最小の値(!=0)を探す
    0が最小　なら終わり
    最小の値を同じ行または同じ列から引く
    同じ行または同じ列の値が0未満になったらやり直し

    どうしようもなくなったら失敗
    */
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, a, b = LI()
A = LI()
ret = 0
for i in range(n-1):
    if (A[i+1] - A[i]) * a < b:
        ret += (A[i+1] - A[i]) * a
    else:
        ret += b


print(ret)


Measured memory_bytes: 60272
#include "stdio.h"

int main(int argc, char const *argv[]) {
  long n,max,min,i;
  scanf("%ld",&n );
  long a[n];

  for(i=0;i<n;i++){
    scanf("%ld",&a[i]);
  }
  min=a[0],max=a[0];
  for(i=1; i<n; i++){
    if(a[i]<min) min=a[i];
    else if (a[i]>max) max=a[i];
  }

  printf("%ld",max-min );


  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
typedef long long ll;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

int main(){
    int n,m;
    cin >> n >> m;
    if(n>=m){
        cout << 0 << endl;
        return 0;
    }
    vector<int> x(m);
    rep(i,m){
        cin >> x[i];
    }
    sort(x.begin(),x.end());
    int res = x[m-1]-x[0];
    vector<int> dec;
    for(int i=1;i<m;i++){
        dec.push_back(x[i]-x[i-1]);
    }
    sort(dec.begin(),dec.end());
    reverse(dec.begin(),dec.end());
    int d = 0;
    rep(i,n-1){
        d+=dec[i];
    }
    cout << res-d << endl;

    return 0;
}

Measured memory_bytes: 1276
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007
using namespace std;
int main(){
    int a,b;    char c;
    vector<int> ans;
    while(true){
        cin>>a>>c>>b;
        if(c=='?') break;
        if(c=='+') ans.push_back(a+b);
        if(c=='-')ans.push_back(a-b);
        if(c=='*')ans.push_back(a*b);
        if(c=='/')ans.push_back(a/b);
    }
    rep(i,ans.size()){
        cout<<ans[i]<<endl;
    }
}


Measured memory_bytes: 3148
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        a: [i64; n + 1],
        b: [i64; n],
    }
    let mut tot = 0;
    let mut a = a;
    let b = b;
    let mut rem = 0;
    for i in 0..n + 1 {
        let r = min(a[i], rem);
        a[i] -= r;
        tot += r;
        if i < n {
            let r = min(a[i], b[i]);
            a[i] -= r;
            rem = b[i] - r;
            tot += r;
        }
    }
    puts!("{}\n", tot);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 10620
#include <iostream>
using namespace std;
int main(){
    int A,B,C;
    cin>>A>>B>>C;
    if((A<B && C<B && A<C) || (A>B && A>C && C>B))
    cout<<"Yes"<<endl;
    else 
    cout<<"No"<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
using ll = long long;

const ll MOD = 998244353;
ll mod(ll x) {
    return x % MOD;
}
ll pow_mod(ll x, ll p) {
    ll v = 1;
    while (p) {
        if (p & 1) {
            v = mod(v * x);
        }
        x = mod(x * x);
        p >>= 1;
    }
    return v;
}

ll N;

struct Point {
    ll x, y;
    friend Point operator-(const Point& a, const Point& b) {
        return {a.x - b.x, a.y - b.y};
    }
    friend ll operator*(const Point& a, const Point& b) {
        return a.x*b.y - a.y*b.x;
    }
    friend bool are_aligned(const Point& a, const Point& b, const Point& c) {
        return (a-c)*(b-c) == 0;
    }
    friend bool in(const Point& a, const Point& b, const Point& c) {
        auto s = a-c, t = b-c;
        return s.x * t.x <= 0 and s.y * t.y <= 0;
    }
};
vector<Point> points;

void input() {
    cin >> N;
    points.resize(N);
    for (auto& p : points)
        cin >> p.x >> p.y;
}

void solve() {
    ll sum = 0;
    for (ll i = 0; i < N; i++) {
        for (ll j = i + 1; j < N; j++) {
            ll num_aligned_points = 2;
            bool skip = false;
            for (ll k = 0; k < N; k++) {
                if (k == i or k == j) continue;
                if (are_aligned(points[i], points[j], points[k])) {
                    if (not in(points[i], points[j], points[k])) {
                        skip = true;
                        break;
                    }
                    ++num_aligned_points;
                }
            }
            if (skip) continue;
            sum = mod(sum + (pow_mod(2, num_aligned_points) - num_aligned_points - 1));
        }
    }
    ll ans = mod(pow_mod(2, N) - sum - N - 1);
    cout << ans << endl;
}


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



Measured memory_bytes: 256
using System;

namespace py
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] p = new string[N];
            p = Console.ReadLine().Split(' ');
            int ans = 0;
            int min = int.Parse(p[0]);
            for(int i = 0; i < N; i++)
            {
                if (int.Parse(p[i]) <= min)
                {
                    ans++;
                    min = int.Parse(p[i]);
                }
            }
            Console.WriteLine(ans);
        }
    }
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int n; ll k;cin>>n>>k;
  vector<ll>a(n);
  rep(i, n)cin>>a[i];

  ll min=0, max=INF, mid;
  while(max-min>1){
    mid = (max+min)/2;
    ll ck = k;
    for(auto ca:a){
      if(ca<mid || ck<0)continue;
      ck -= ((ca+mid-1)/mid - 1);
    }
    if(ck<0)min = mid;
    else max=mid;
 }

  cout<<max<<endl;

//  cout<<max<<' '<<mid<<' '<<min<<endl;

  return 0;
}


Measured memory_bytes: 4764
import sys
sys.setrecursionlimit(10 ** 6)
import sys
N,Q = map(int,input().split())
graph = [[] for _ in range(N)]
#グラフをリストで表現
for _ in range(N-1):
    a,b = map(int,input().split())
    graph[a-1].append(b-1)#リストの番号で頂点を表示するため-1
    graph[b-1].append(a-1)
point = [0]*N
for _ in range(Q):
    a,b = map(int,input().split())
    point[a-1] += b#根にあたる部分にだけコストをプラス


#再帰定義
def dfs(now, prev = -1):#prev,now,nextの三段階を扱う
    for next in graph[now]:#今見ている頂点に連結されているものを見る
        if next == prev:#親だったら飛ばす
            continue
        point[next] += point[now]#子の得点をプラス
        dfs(next,now)#nextが親だけになると自分を呼ぶ前に飛ばされて終わる

dfs(0)#根頂点を指定してスタート
print(*point)

Measured memory_bytes: 283092
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;

int main()
{
    //input
    int q;
    cin >> q;

    //search brothers of 2017

    int max_r = 1e5 + 1;
    
    //素数かどうかの判定表
    vector<bool> Prime(max_r, 1);
    //１からiまでの2017に似てる素数の個数を保存（累積和）
    vector<int> Sum(max_r, 0);

    //１．素数かどうか判定表を作成
    //2.それを用いて、NとN+1/2が素数な数字の個数を数える

    //１．素数かどうか判定表を作成
    Prime[0] = false;
    Prime[1] = false;

    //合成数（素数ではない）を見つけていく
    for (int i = 2; i * i <= max_r; i++)
    {
        //iの倍数を消す
        for (int j = 2 * i; j <= max_r; j += i)
        {
            Prime[j] = false;
        }
    }

    //2.Primeを用いて、NとN+1/2が素数な数字の個数を数える
    REP(i, max_r)
    {
        int a = (i + 1) / 2;
        if (Prime[i] && Prime[a])
            Sum[i + 1] = Sum[i] + 1;
        else
        {
            Sum[i + 1] = Sum[i];
        }
    }

    //output
    for (int i = 0; i < q; i++)
    {
        int l, r;
        cin >> l >> r;
        cout << Sum[r + 1] - Sum[l] << endl;
    }
}


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

int main(){
    int k , x;
    cin >> k >> x;
    if(500*k >= x) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

vs v;
map<int, int> mp[52];
int len[52];
int num(string s, int p);

void init()
{
	v.clear();
	REP(i, 52)
	{
		mp[i].clear();
		len[i] = -1;
	}
}

int index(char c)
{
	if (islower(c)) return c - 'a';
	else return c - 'A' + 26;
}

pair<char, int> ary(string s, int p = 0)
{
	char c = s[p];
	p += 2;
	int n = num(s, p);
	return make_pair(c, n);
}

int num(string s, int p = 0)
{
	if (isdigit(s[p]))
	{
		int res = 0;
		while (isdigit(s[p]))
		{
			res *= 10;
			res += s[p] - '0';
			p++;
		}
		return res;
	}
	else
	{
		auto tmp = ary(s, p);
		int a = index(tmp.first), b = tmp.second;
		if (len[a] <= b || b == -1 || mp[a].find(b) == mp[a].end()) return -1;
		else return mp[a][b];
	}
}

bool solve(string s)
{
	if (s.find('=') == string::npos)
	{
		auto tmp = ary(s);
		int a = index(tmp.first);
		if (len[a] != -1) return false;
		else
		{
			len[a] = tmp.second;
			return true;
		}
	}
	else
	{
		string left = s.substr(0, s.find('='));
		string right = s.substr(s.find('=')+1);
		auto l = ary(left);
		int a = index(l.first), b = l.second;
		if (len[a] <= b) return false;
		int r = num(right);
		if (r == -1) return false;
		mp[a][b] = r;
		return true;
	}
}

int main()
{
	init();
	string s;
	while (cin >> s)
	{
		if (s != ".")
		{
			v.push_back(s);
			continue;
		}
		else if (v.size() == 0) break;
		bool f = true;
		REP(i, v.size())
		{
			if (!solve(v[i]))
			{
				cout << i + 1 << endl;
				f = false;
				break;
			}
		}
		if (f) puts("0");
		init();
	}
	return 0;
}

Measured memory_bytes: 3196
#include<stdio.h>
#define MAX 500000
int H,A[MAX+1];

void maxHeapify(int );
int main()
{
  int i;
  
  scanf("%d",&H);
  for(i=1;i<=H;i++)
    {
      scanf("%d",&A[i]);
    }
  for(i=H/2;i>=1;i--)maxHeapify(i);

  for(i=1;i<=H;i++)printf(" %d",A[i]);
  printf("\n");

 
  return 0;
}

void maxHeapify(int i)
{
  int l,r,largest,x;

  l=2*i;
  r=2*i+1;
  if(l<=H && A[l]>A[i])largest=l;
  else largest=i;
  if(r<=H && A[r]>A[largest])largest=r;

  if(largest!=i)
    {
      x=A[i];
      A[i]=A[largest];
      A[largest]=x;
      maxHeapify(largest);
    }
  
}



Measured memory_bytes: 3648
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n;
    string s;
    std::cin>>n>>s;
    for(int i=0;i<s.size();i++){
        std::cout<<char((s[i]-65+n)%26+65);
    }
    std::cout<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll H,W,K;
  cin>>H>>W>>K;
  vector<string>G(H);
  vector<string>G2(H);
  for(ll i=0;i<H;i++)cin>>G[i];
  ll black=0;
  G2=G;
  ll ans=0;
  for(ll bit=0;bit<(1<<H);bit++){
    for(ll bit2=0;bit2<(1<<W);bit2++){
      for(ll i=0;i<H;i++){
        for(ll j=0;j<W;j++){
          if((bit&(1<<i))||(bit2&(1<<j))){
            G[i][j]='.';
          }
        }
      }
      for(ll i=0;i<H;i++){
        for(ll j=0;j<W;j++){
          if(G[i][j]=='#'){
            black++;
          }
        }
      }
      if(black==K)ans++;
      black=0;
      G=G2;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3604
object Main extends App {
    var res = 0L
    def msort(arr: Array[Int]): Array[Int] = {
        if (arr.size > 1) {
            val a = msort(arr.take(arr.size/2))
            val b = msort(arr.drop(arr.size/2))
            var i, j, k = 0
            var f = true
            while (f)
                if (i == a.size && j == b.size) f = false
                else if (j == b.size || (i != a.size && a(i) < b(j))) {arr(k) = a(i); i += 1; k += 1}
                else {arr(k) = b(j); j += 1; k += 1; if (i != a.size) res += (a.size-i)}
        }
        arr
    }
    val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))
    in.next
    msort(in.next)
    println(res)
}

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

using namespace std;
int main() {
  int n,m,maxl,all,sw;
  int v;
  
  vector<int> x,y;
  
  int i,flag=1;
  
  cin >> m;
  cin >> n;
  
  if(n<=m){
    cout << 0 << endl;
    return 0;
  }
  
  for(i=0;i<n;i++){cin >> v; x.push_back(v);}
  std::sort(x.begin(), x.end());
  
  /*for(;flag>0;){
    flag=0;
    for(i=1;i<n;i++){
      if(x[i-1]>x[i]){
        sw=x[i-1];
        x[i-1]=x[i];
        x[i]=sw;
        flag++;
      }
    }
  }*/
  
  for(i=1;i<n;i++){y.push_back(x[i]-x[i-1]); }
  std::sort(y.begin(), y.end() ,std::greater<int>());
 
  /*flag=1;
  for(;flag>0;){
    flag=0;
    for(i=2;i<n;i++){
      if(y[i-1]<y[i]){
        sw=y[i-1];
        y[i-1]=y[i];
        y[i]=sw;
        flag++;
      }
    }
  }*/
  
  all=0;
  for(i=m-1;i<n-1;i++){all+=y[i];}
  
  cout << all << endl;

  return 0;
}

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

int main() {
    string s;
    cin >> s;
    ll ans = 0;
    ll w = 0;
    for (ll i = s.size() - 1;i >= 0;--i) {
        if (s[i] == 'W')++w;
        else ans += w;
    }
    cout << ans << endl;
}

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

int main(){
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  ll x = 0;
  for(int i = 0; i < n; i++){
    if(i % 2 == 0) x += a[i];
    else x -= a[i];
  }
  vector<int> ans(n);
  ans[0] = x/2;
  for(int i = 1; i < n; i++){
    ans[i] = a[i-1] - ans[i-1];
  }
  for(int i = 0; i < n; i++) ans[i] *= 2;
  for(int i = 0; i < n; i++){
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 2048
# N=n**2となるnが最も移動が少なくて住む点
import math
N=int(input())
int_root_N=int(math.sqrt(N))
for i in range(int_root_N,0,-1):
    if N%i==0:
        min_n=i
        break

print(min_n-1+N//min_n-1)



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

using namespace std;

map< long long, int > prime_factor(long long n) {
	map< long long, int > ret;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

int main() {

	int n, p;
	cin >> n >> p;
	vector<int> a(n);
	int oddcount=0, evencount=0;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] % 2 == 0) {
			evencount++;
		}
		else {
			oddcount++;
		}
	}

	if (p == 0) {
		if (oddcount == 0) { cout << (long long)pow(2, n) << endl; }
		else {
			cout << (long long)pow(2, evencount)*(long long)pow(2, oddcount) / 2 << endl;;
		}
	}
	else {
		if (oddcount == 0 ) { cout << 0 << endl; }
		else {
			cout << (long long)pow(2, evencount)*(long long)pow(2, oddcount) / 2 << endl;;
		}
	}
	return 0;

}

Measured memory_bytes: 3956
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>

using namespace std;
int main() {
  uint64_t h;
  cin >> h;

  uint64_t n = 0, p = 0;
  while(h > 0) {
    uint64_t temp = 1;
    temp = temp << p;
    n += temp;
    p++;
    h = h >> 1;
  }

  cout << n << endl;

  return 0;
}

Measured memory_bytes: 384
N = int(input())
S = input()
N = [[0 for _ in range(2)] for _  in  range(len(S))]

B,W = 0,1
# 左から.W 右へ#B
for idx,s in enumerate(S):
  if s is "#":
    N[idx][B] = N[idx-1][B] + 1
    N[idx][W] = N[idx-1][W]
  else:
    N[idx][B] = N[idx-1][B]
    N[idx][W] = N[idx-1][W] + 1

print(int(min([N[i][B]+N[-1][W]-N[i][W] for i in range(len(S)-1)]+[N[-1][W],N[-1][B]]   )))


Measured memory_bytes: 42928
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int K, X;
	cin >> K >> X;
	auto isFirst = true;
	for (auto i = X - K + 1; i < X + K; ++i)
	{
		if (!isFirst)
		{
			cout << " ";
		}
		cout << i;
		isFirst = false;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
use std::io::Read;
use std::cmp;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut t = String::new();
    std::io::stdin().read_line(&mut t).unwrap();

    let mut cnt_hit: usize = 0;

    for i in 0..3 {
        if s.chars().nth(i).unwrap() == t.chars().nth(i).unwrap() {
            cnt_hit += 1;
        }
    }

    println!("{}", cnt_hit);

}

Measured memory_bytes: 4352
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(int i=0;i<p;i++)
#define ll long long

using namespace std;

int main(){

 ll int x[5];
 rep(i,5){
	 cin >> x[i];
	 if( x[i]==0){
		 cout << i+1;
		 return 0;
	 }
 }

 










	return 0;

}



Measured memory_bytes: 3588
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main(){
	string a;
	cin >> a;
	long long int c[26];
	long long int ans = 1;
	memset(c, 0, sizeof(c));
	int n = a.size();
	for(int i=0;i < n;i++){
		c[a[i] - 'a']++;
	}
	for(int i=0;i < 25;i++){
		for(int j = i + 1;j < 26;j++){
			ans += (c[i] * c[j]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

#define MAX_N 2000005
ll inv[MAX_N], fac[MAX_N], finv[MAX_N];
void make() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i=2; i<MAX_N; i++) {
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    fac[i] = fac[i-1] * (ll)i % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}
ll perm(ll n, ll r) {
  if(n < 0)       return 0;
  else if(n < r)  return 0;
  else            return (fac[n] * finv[n-r]) % mod;
}
ll comb(ll n, ll r) {
  ll ans = 1;
  ans = perm(n, r);
  ans = (ans * finv[r]) % mod;
  return ans;
}
ll modpow(ll a, ll N) {
  ll ans = 1;
  ll tmp = a;
  while(N > 0) {
    if(N % 2 == 1) (ans *= tmp) %= mod;
    (tmp *= tmp) %= mod;
    N /= 2;
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  make();
  ll k; cin >> k;
  string s; cin >> s;
  int n = s.size();
  ll ans = 0;
  rep(i, k+1) {
    (ans += comb(k-i+n-1, n-1) * modpow(25, k-i) % mod * modpow(26, i) % mod) %= mod;
  }
  cout << ans << "\n";
  return 0;
}


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

static const int SIZE=3;
static const int MAX_A=100;
static const int MAX_N=10;

struct bingo{
    int val;
    bool flag;
};

int get_input( bingo A[SIZE][SIZE],int *N,int *b){
    int i=0,j=0,k=-1;
    int val;

    while(cin >> val){
        if(i<SIZE){
            A[i][j]={val,false};
            if(j<2){
                j++;
            }else{
                i++;
                j=0;
            }
            continue;
        }else if(k==-1){
            *N=val;
            k++;
        }else{
            b[k]=val;
            k++;
            if(k>MAX_N) return -1;
        }
    }
    
    return 0;
}

int chk_num( bingo A[SIZE][SIZE],int num){
    int i,j;
    
    for(i=0;i<SIZE;i++){
        for(j=0;j<SIZE;j++){
            if(A[i][j].val==num){
                A[i][j].flag=true;
                return 0;
            }
        }
    }
    return -1;
}

void set_flag( bingo A[SIZE][SIZE],int N,int *b){
    int i;

    for(i=0;i<N;i++){
        chk_num(A,b[i]);
    }
}

int chk_bingo(bingo A[SIZE][SIZE]){
    int i,j;
    
    // よこ
    for(i=0;i<SIZE;i++){
        for(j=0;j<SIZE;j++){
            if(A[i][j].flag == false) break;
        }
        if(j==SIZE) return 0; // ビンゴ
    }
    
    // たて
    for(i=0;i<SIZE;i++){
        for(j=0;j<SIZE;j++){
            if(A[j][i].flag == false) break;
        }
        if(j==SIZE) return 0; // ビンゴ
    }
    
    //ななめ
    for(i=0;i<SIZE;i++){
        if(A[i][i].flag == false) break;
    }
    if(i==SIZE) return 0; // ビンゴ
    for(i=0;i<SIZE;i++){
        if(A[i][SIZE-i-1].flag == false) break;
    }
    if(i==SIZE) return 0; // ビンゴ
    
    return -1; //ビンゴではない
}

void disp( bingo A[SIZE][SIZE],int N,int *b){
    int i,j;
    
    for(i=0;i<SIZE;i++){
        for(j=0;j<SIZE;j++){
            printf("A[%d][%d]=(%d,%d) ",i,j,A[i][j].val,A[i][j].flag);
        }
        printf("\n");
    }
    
    printf("N=%d\n",N);
    
    for(i=0;i<N;i++){
        printf("%d\n",b[i]);
    }
}

int main(void){
    bingo A[SIZE][SIZE];
    int N;
    int b[MAX_N];
    int rtn;
    
    rtn=get_input(A,&N,b);
    if(rtn==-1){
        std::cout << "NG : get_input" << endl;
        return -1;
    }

//    disp(A,N,b);
    set_flag(A,N,b);
//printf("=================\n");
//    disp(A,N,b);

    rtn=chk_bingo(A);
    if(rtn==0) printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define zahyoutype double
typedef struct Point{zahyoutype x,y;}P;
typedef struct line{P p1,p2;}L;
int sgn(zahyoutype x){return x<0?-1:x>0;}
zahyoutype crossproduct(P p,P q,P o){return (p.x-o.x)*(q.y-o.y)-(p.y-o.y)*(q.x-o.x);}

P crosspoint(L s,L t){
	zahyoutype x=1;if(x/2==0){puts("type error");exit(0);}
	double deno=(s.p1.x-s.p2.x)*(t.p1.y-t.p2.y)-(t.p1.x-t.p2.x)*(s.p1.y-s.p2.y);
	zahyoutype xnume=  s.p1.x*t.p1.x*(s.p2.y-t.p2.y)-s.p1.x*t.p2.x*(s.p2.y-t.p1.y)-s.p2.x*t.p1.x*(s.p1.y-t.p2.y)+s.p2.x*t.p2.x*(s.p1.y-t.p1.y);
	zahyoutype ynume=-(s.p1.y*t.p1.y*(s.p2.x-t.p2.x)-s.p1.y*t.p2.y*(s.p2.x-t.p1.x)-s.p2.y*t.p1.y*(s.p1.x-t.p2.x)+s.p2.y*t.p2.y*(s.p1.x-t.p1.x));
	P p={xnume/deno,ynume/deno};
	return p;
}

double area(P*p,int n){
	double s=0;
	for(int i=2;i<n;i++)s+=crossproduct(p[i-1],p[i],p[0]);
	return fabs(s/2.0);
}

void readpoint(P*p){zahyoutype x=1;scanf(x/2?"%lf%lf":"%ld%ld",&p->x,&p->y);}
void printpoint(P p){zahyoutype x=1;printf(x/2?"%.9lf %.9lf\n":"%ld %ld\n",p.x,p.y);}

P p[110];
P t[110];
zahyoutype c[110];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)readpoint(p+i);

	int q;
	scanf("%d",&q);
	while(q--){
		int flag[3]={};
		L s;
		readpoint(&s.p1);
		readpoint(&s.p2);
		for(int i=0;i<n;i++){
			c[i]=crossproduct(s.p2,p[i],s.p1);
			flag[sgn(c[i])+1]++;
		}
		if(flag[0]==0)printf("%.9f\n",area(p,n));
		else if(flag[2]==0)puts("0");
		else{
			int cnt=0;
			int i=0;
			while(c[i%=n]>=0)i++;
			while(c[i%=n]< 0)i++;
			if(c[i]>0){
				L ss;
				ss.p1=p[(i+n-1)%n];
				ss.p2=p[i];
				t[cnt]=crosspoint(s,ss);
				cnt++;
			}
			while(c[i%=n]>=0)t[cnt++]=p[i++];
			if(c[(i+n-1)%n]>0){
				L ss;
				ss.p1=p[(i+n-1)%n];
				ss.p2=p[i];
				t[cnt]=crosspoint(s,ss);
				cnt++;
			}
			printf("%.9f\n",area(t,cnt));
		}
	}
}


Measured memory_bytes: 2148
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<cwctype>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define sz(a) int((a).size())

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ll ans=0;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		if(!(i%3==0||i%5==0))
			ans+=i;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3660
#include <stdio.h>

char s[12];
bool a = true;

int main() {

	scanf("%s", &s);

	if (s[0] != 'A') a = false;

	int l = 0;
	int i = 0;
	while (s[i] != 0) {
		l++; i++;
	}

	int hit = 0;
	for (i = 2; i < l - 1; i++) {
		if (s[i] == 'C') {
			hit++;
		}
	}
	if (hit != 1 && a) {
		a = false;
	}


	for (i = 1; i < l; i++) {
		if (s[i] == 'C' && i != l-1) continue;
		if ((int)s[i] < 97 || (int)s[i] > 124) {
			a = false;
			break;
		}
	}

	
	
	

	if (a)
		printf("AC\n");
	else
		printf("WA\n");

	return 0;

}

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

#define sint(a) scanf("%d", &a)
#define sint2(a, b) scanf("%d %d", &a, &b)
#define sll(a) scanf("%lld", &a)
#define sll2(a, b) scanf("%lld %lld", &a, &b)
#define mem(a, i) memset(a, i, sizeof(a))
#define pb push_back
#define int long long
#define ll long long
#define lson node << 1
#define rson (node << 1) + 1
#define endl "\n"

const int maxn = 5e5 + 10;
const int mod = 998244353;
const double pi = acos(-1);

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

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

int qpow(int a, int n)
{
  int b = 1;
  while (n)
  {
    if (n & 1)
      b = a * b % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return b;
}

class Prime_Number
{
public:
  int prime[maxn], s, v[maxn];
  void prime_init(int n)
  {
    for (int i = 2; i <= n; i++)
    {
      if (!v[i])
      {
        prime[s++] = i;
        for (int j = 1; j * i <= n; j++)
          v[i * j] = 1;
      }
    }
  }
};

//**************************

void solve()
{
  int n,x,l;
  cin>>n>>x>>l;
  if(n%x)
    cout<<(n/x+1)*l;
    else 
      cout<<n/x*l;
}
signed main()
{
  solve();
  return 0;
}


Measured memory_bytes: 3620
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int A, B;
	cin >> A >> B;

	int kotae = 0;
	if (A == 1) kotae += 300000;
	if (A == 2) kotae += 200000;
	if (A == 3) kotae += 100000;
	if (B == 1) kotae += 300000;
	if (B == 2) kotae += 200000;
	if (B == 3) kotae += 100000;
	if (A == 1 && B == 1) kotae += 400000;

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

int main(){
    ll N; cin>>N;
    vec d(N);
    rep(i,N) cin>>d.at(i);
    sort(ALL(d));
    vec s(N+1,0);
    rep(i,N) s.at(i+1)=d.at(i)+s.at(i);
    ll AKAN=1;
    for(int i=N; i>1; i--) {
        if(s.at(i)>s.at(i-1)*3) {AKAN=i; break;}
    }
    cout<<N-AKAN+1<<endl;

}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
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; }
typedef long long ll;
int main()
{
  ll n; cin >> n;
  if(n % 2 == 1) {
    cout << 0 << "\n";
    return 0;
  }
  ll res = 0;
  ll x = 10;
  while(1) {
    res += n / x;
    if(x > n/5) break;
    x *= 5;
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
/*
  AOJ 1356
  Title:Decimal Sequences
  @kankichi573
*/
#include <stdio.h>
#include <string.h>
int table[1000];

main()
{
  int N,i,ret,d,d1,d2;

  d1=d2=0;
  memset(table,0,sizeof(table));
  scanf("%d",&N);
  for(i=0;i<N;i++)
    {
      scanf("%d",&d);
      table[d]=1;
      table[d+10*d1]=1;
      table[d+10*d1+100*d2]=1;
      d2=d1;
      d1=d;
    }

    for(i=0;i<1000;i++)
      if(table[i]==0)
	{
	  printf("%d\n",i);
	  break;
	}
    
  return(0);
}

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

using namespace std;

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

	vector<int> l(m), r(m);
	for (int i = 0; i < m; ++i) {
		cin >> l[i] >> r[i];
	}

	int res = 0;
	int lmax = *max_element(l.begin(), l.end());
	int rmin = *min_element(r.begin(), r.end());
	for (int id = 1; id <= n; ++id) {
		if (lmax <= id && id <= rmin) {
			res++;
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main(void){
    
    int i;
    char b[101],a[101];
    
    scanf("%s%s",a,b);
    
    if(strlen(a)>strlen(b)){
        printf("GREATER\n");
        return 0;
    }
    else if(strlen(b)>strlen(a)){
        printf("LESS\n\n");
        return 0;
    }
    else if(strlen(b)==strlen(a)){
        for(i=0;i<strlen(a);i++){
            if(a[i]>b[i]){
                printf("GREATER\n");
                return 0;
            }
            else if(a[i]<b[i]){
                printf("LESS\n");
                return 0;
            }
        }
    }
    printf("EQUAL\n");
    return 0;
}

Measured memory_bytes: 1644
from collections import Counter
N = int(input())
A_list = list(map(int, input().split()))
counter = Counter(A_list)
counter = sorted(counter.items(), key=lambda x: -x[0])

long_side = 0
short_side = 0
choice = 0

for k, v in counter:
    if v >= 4 and choice == 0:
        long_side = k
        short_side = k
        choice = 4

    elif v >= 2:
        if choice == 2:
            short_side = k
            choice = 4
        else:
            long_side = k
            choice = 2

    if choice == 4:
        print(long_side*short_side)
        exit()
print(0)

Measured memory_bytes: 25508
#include<stdio.h>
 int main(void){
 int a,b,c,count=0,i;
 scanf("%d %d %d",&a,&b,&c);
  for(i=a;i<=b;i++){
 if(c%i==0) count++;
 }
  printf("%d\n",count);
  return 0;
 }

  

Measured memory_bytes: 596