akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > A(N);
	rep(i, N) cin >> A[i];
	int ans = 0;
	rep(i, N) {
		if (i % 2 == 0 && A[i] % 2 == 1)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 998244353;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;
const LD pi = acosl(-1.0);

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL A, B, H, M;
	cin >> A >> B >> H >> M;
	LD rad1 = (LD)(60*H+M) /2;
	rad1 *= pi / 180;
	LD rad2 = (LD)6 * (LD)M;
	rad2 *= pi / 180;
	LD del = rad1 - rad2;
	if (del > pi)del = 2*pi-del;
	LD xx = A * A + B * B - (LD)(2 * A * B) * cosl(rad1-rad2);
	cout << setprecision(12) << sqrtl(xx) << "\n";
	return 0;
}

Measured memory_bytes: 3640
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
import math
print(math.ceil(I()/2))


Measured memory_bytes: 10408
#include <bits/stdc++.h>
using namespace std;
const double INF = 3e3;
const double EPS = 1e-11;

struct P3{
  double x,y,z;
  double vx,vy,vz;
  double r,vr;
  P3(double x=0, double y=0, double z=0):x(x),y(y),z(z){}
  P3 operator + (const P3 &a) const{ return P3(x+a.x, y+a.y, z+a.z); }
  P3 operator - (const P3 &a) const{ return P3(x-a.x, y-a.y, z-a.z); }
  P3 operator * (const double &c) const{ return P3(x*c, y*c, z*c); }
  void input(){scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x,&y,&z,&vx,&vy,&vz,&r,&vr);};
  P3 v ()const{return P3(vx,vy,vz);}
};
P3 operator * (double c, const P3 &a){ return P3(c * a.x, c * a.y, c * a.z); }


double norm(const P3 &a){ return a.x*a.x + a.y*a.y + a.z*a.z; }
double abs(const P3 &a){ return sqrt(norm(a)); }

typedef pair<int,int> P;
typedef pair<double,P> PP;

double calc(const P3 &A,const P3 &B,double t){
  if((A.r-t*A.vr)<0|| (B.r-t*B.vr)<0) return -1;
  return abs((A+t*A.v())-(B+t*B.v())) - ((A.r-t*A.vr) + (B.r-t*B.vr));
}

double calc(const P3 &A,const P3 &B){
  double L=0,R=INF,cnt = 65;
  while(cnt--){
    double M = (L+R)/2;
    double y1 = calc(A,B,M);
    double y2 = calc(A,B,M+EPS);
    if(y1<0||y1-y2<0) R = M;
    else L = M+EPS;
  }
  return L-EPS;
}

int main(){
  int n;
  while(cin>>n,n){
    vector<P3>A(n);
    for(int i=0;i<n;i++) A[i].input();

    priority_queue<PP,vector<PP>,greater<PP> >Q;
    for(int i=0;i<n;i++)
      for(int j=i+1;j<n;j++){
	double t = calc(A[i],A[j]);
	if(abs(calc(A[i],A[j],t))<2e-8)Q.push(PP(t,P(i,j)));
      }

    vector<double> ans(n,INF);
    while(!Q.empty()){
      PP t = Q.top();Q.pop();
      double c = t.first;
      int a = t.second.first;
      int b = t.second.second;
      if(ans[a]<INF||ans[b]<INF)continue;
      ans[a] = ans[b] = c;
    }

    for(int i=0;i<n;i++){
      ans[i] = min(ans[i],A[i].r / A[i].vr);
      printf("%.10lf\n",ans[i]);
    }    
    
  }
  return 0;    
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    rep(i,m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i,n) {
        cout << (int)g[i].size() << endl; 
    }

    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  cout << N/2 + N%2 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String [] args){
    
    	Scanner sc=new Scanner(System.in);
      	String a=sc.next();
      String b=sc.next();
      char str1[]=a.toCharArray();
      char str2[]=b.toCharArray();
      
      String res=lcs(str1,str2,a.length(),b.length());
      //@todo find lcs
      System.out.println(res);
    }
  
  	static
  	 String lcs(char a[], char b[], int l1, int l2){
    
    	int l[][]=new int[ l1+1 ][ l2+1 ];
      	for(int i=0;i<=l1;i++){
        	for(int j=0;j<=l2;j++){
            	
              if(i==0 || j==0)
                l[i][j]=0;
              else if( a[i-1] == b[j-1])
                l[i][j]=l[i-1][j-1]+1;
              else 
                l[i][j]=Math.max(l[i-1][j],l[i][j-1]);
            }
        }
      	
      	int i=l1;
      	int j=l2;
      String res="";
      	while(i !=0 && j!=0){
        	
          int temp=l[i][j];
          if(temp == l[i-1][j])
            i--;
           else if(temp == l[i][j-1])
             j--;
             else
             {
             	res=a[i-1]+res;
               i--;
               j--;
             }
        }
      
      return res;
      
    } 
}

Measured memory_bytes: 89164
#include<stdio.h>

main(){
  int a, b, c;
  int i, j;

  while(scanf("%d %d", &a, &b) != EOF){
    c = a + b;
    i = 1;
    j = 0;
    while(1){
      if(i > c){
	break;
      }
      i *= 10;
      j++;
    } 
    printf("%d\n", j);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#include "string"
#define endl '\n'
#define pi pair<int,int>
#define ff first
#define ss second
#define int long long 
#define boost ios_base::sync_with_stdio(false);cin.tie(nullptr)

const int N=1e5+5;
const int inf = 1e10;

int dp[101][N];
int n,w;
int a[101],v[101];

int solve(int id,int val){
    if(val==0)
        return 0;
    if(id>n or val<0)
        return inf;
    //cout<<id<<" "<<val<<endl;
    int &tmp = dp[id][val];
    if(tmp != -1)
        return tmp;
    tmp = solve(id+1,val);
    tmp = min(tmp,solve(id+1,val-v[id])+a[id]);
    return tmp;
}
int32_t main() { 
    boost;
    cin>>n>>w;
    int sum=0;
    for(int i=1;i<=n;i++){
    	cin>>a[i]>>v[i];
        sum+=v[i];
    }
    memset(dp,-1,sizeof dp);
    for(int i=sum;i>=0;i--){
        if(solve(1,i)<=w){
            cout<<i<<endl;
            return 0;
        }
    }
}           





Measured memory_bytes: 79232
def max(a,b); a > b ? a : b; end

N, C = gets.split.map(&:to_i)
I = N.times.map{gets.split.map(&:to_i)}

# L[n] : 時計回りにn個食べることができる移動範囲での最大ポイント(累積max)
L = Array.new(N + 1, 0).tap do |dp|
  (1 .. N).inject(0) do |sum, n|
    x, v = I[n - 1]
    dp[n] = max(sum + v - x, dp[n - 1])
    sum + v
  end
end

# R[n] : 反時計回りにn個食べることができる移動範囲での最大ポイント(累積max)
R = Array.new(N + 1, 0).tap do |dp|
  (1 .. N).inject(0) do |sum, n|
    x, v = I[N - n]
    dp[n] = max(sum + v - (C - x), dp[n - 1])
    sum + v
  end
end

puts [  L[N], # 反転なし時計回りの最大
        R[N], # 反転なし反時計回りの最大
        
        # 時計回りにn個以下、反転して、反時計回りにN - n個以下を取る場合の最大
        (1 .. N).map{|n| L[n] - I[n - 1][0] + R[N - n]}.max, 
        # 反時計回りにn個以下、反転して、時計回りにN - n個以下を取る場合の最大
        (1 .. N).map{|n| R[n] - (C - I[N - n][0]) + L[N - n] }.max
        
        # L[n], R[n]は累積maxなので、不安になるけど、
        # i <= n の範囲に L[i] == L[n]である最小の i が存在し、
        # L[i] - I[i - 1][0] + R[N - i] >= L[n] - I[n - 1][0] + R[N - n]
        # が成り立つ。 
        # (1 .. N)の範囲に対して、map, maxを取るので、
        # L[n - 1] == L[n]であるような n には、必ずそれ以上のものが存在する。

      ].max


Measured memory_bytes: 14844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

ll mod(ll a) {
	if (a > 0) return a % MOD;
	if (a % MOD == 0) return 0;
	ll x = -a / MOD + 1;
	a += x * MOD;
	return a % MOD;
}

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
// int dx[4]    = {1, 0, -1, 0};
// int dy[4]    = {0, 1, 0, -1};
// ll pas[5001][5002];

bool unko[114514] = {};
#define UNKO                                                                   \
	cout << 0 << endl;                                                         \
	return 0;

int main() {
	IOS();
	ll n;
	cin >> n;
	vector<ll> a(n), t(n);
	for (int i = 0; i < n; ++i) { cin >> t[i]; }
	for (int i = 0; i < n; ++i) { cin >> a[i]; }
	if (a[0] != t[n - 1]) { UNKO }
	unko[0] = unko[n - 1] = true;
	for (int i = 1; i < n; ++i) {
		if (t[i] > t[i - 1]) {
			unko[i] = true;
			if (t[i] > a[i]) { UNKO }
		} else if (t[i] < t[i - 1]) {
			UNKO
		}
	}
	for (int i = n - 2; i >= 0; --i) {
		if (a[i] > a[i + 1]) {
			unko[i] = true;
			if (a[i] > t[i]) { UNKO }
		} else if (a[i] < a[i + 1]) {
			UNKO
		}
	}
	ll ans = 1;
	for (int i = 0; i < n; ++i) {
		if (unko[i]) continue;
		ans *= min(a[i], t[i]);
		ans %= MOD;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1920
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	string S;
	cin >> S;
	int Z = S.size();
	int c = -1;
	int f = -1;
	rep(i, Z) {
		if (S[i] == 'C') {
			c = i;
			break;
		}
	}
	rep(i, Z) {
		if (S[i] == 'F') {
			f = i;
		}
	}
	if (c != -1 && c < f) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#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++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;
int64 kaijoyo(int a){
  int64 ans=1;
  rep(i,a){
    ans*=(i+1);
    ans%=yokuwaruprime;
  }
  return ans;
}

int main(){
  int64 n,m,ans;
  cin>>n>>m;
  if(abs(n-m)>1){
    ans=0;
  }else if(abs(n-m)==1){
    ans=kaijoyo(n)*kaijoyo(m)%yokuwaruprime;
  }else{
    ans=2*kaijoyo(n)*kaijoyo(n)%yokuwaruprime;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include  <cstdlib>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <vector>
#include <string>
using namespace std;
 
#define rep(i,n) for(int i=0;i<(int)n;i++)
typedef long long lint;
#define SZ(x) ((int)(x).size())
int main()
{
	int n;
	int dig=0;
	int num;
	int ans;
	cin >> num;
	ans = num;
	int c=num;
 
	while(c!=0) {
		c /= 10;
		dig++;
	}
	
 
	int sum = 0;
	while (num) {
		dig = num % 10;
		sum+=dig;
		num /= 10;
		
	}
	if (ans%sum == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  map<ll, ll> mp;
  rep(i, n) {
    cin >> a[i];
    mp[a[i]]++;
  }
  ll q;
  cin >> q;
  ll sum = 0;
  for (auto value : mp) {
    sum += value.first * value.second;
  }

  rep(i, q) {
    ll b, c;
    cin >> b >> c;
    ll tmp = mp[b];
    sum -= mp[b] * b;
    sum += mp[b] * c;
    mp[b] = 0;
    mp[c] += tmp;
    cout << sum << endl;
  }

}

Measured memory_bytes: 10056
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int N;
int a[100],b[100];
int main(){
	cin>>N;
	rep(i,N) cin>>a[i];
	rep(i,N) cin>>b[i];
	int ans = 0;
	rep(k,N){
		int s = 0;
		rep(i,N){
			if(i<=k) s += a[i];
			if(k<=i) s += b[i];
		}
		chmax(ans,s);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 100005
using namespace std;
 
int main(){
  int n;
  long long c, x[MAX], v[MAX], u[2] = {0, 0}, w[2] = {0, 0};
  scanf("%d%lld", &n, &c);
  v[0] = x[0] = 0;
  for(int i = 1; i <= n; i++){
    scanf("%lld%lld", &x[i], &v[i]);
    v[i] += v[i-1];
  }
  v[n+1] = v[n], x[n+1] = c;
  for(int i = 1; i <= n+1; i++){
    w[0] = max(w[0], (v[n] - v[i-1]) - (c - x[i])*2 + u[0]);
    u[0] = max(u[0], (v[i] - x[i]));
    w[1] = max(w[1], (v[n] - v[i-1]) - (c - x[i]) + u[1]);
    u[1] = max(u[1], (v[i] - x[i]*2));
  }
  printf("%lld\n", max(w[0],w[1]));
}

Measured memory_bytes: 1792
N=int(input())
l=[]
for i in range(min(N//6,2500)):
    l+=[i*12+2,i*12+3,i*12+4,i*12+8,i*12+9,i*12+10]
for i in range(N-min(N//6,2500)*6):
    l.append(i*6+6)
if N<6:
    if N==3:
        l=[2,5,63]
    elif N==4:
        l=[2,5,20,63]
    else:
        l=[2,5,20,63,30]
print(*l)

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

int n;

bool Read() {
  cin >> n;
  if (cin.eof())
    return 0;


  return 1;
}

void Process() {
  string s;
  map<string, int> freq;
  for (int i = 0; i < n; i++) {
    cin >> s;
    freq[s]++;
  }
  cout << "AC x " << freq["AC"] << "\n";
  cout << "WA x " << freq["WA"] << "\n";
  cout << "TLE x " << freq["TLE"] << "\n";
  cout << "RE x " << freq["RE"] << "\n";
}

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

  while (Read())
    Process();

  return 0;
}

Measured memory_bytes: 3688
import math

n = int(input())

point = [(0, 0), (100, 0)]

for i in range(n):
    len_point = len(point)
    tmp = []
    for j in range(len_point - 1):
        x1, y1 = point[j]
        x2, y2 = point[j+1]
        sx, sy = (2 * x1 + x2) / 3, (2 * y1 + y2) / 3
        tx, ty = (x1 + 2 * x2) / 3, (y1 + 2 * y2) / 3
        ux = (tx - sx) * math.cos(math.pi / 3) - (ty - sy) * math.sin(math.pi / 3) + sx
        uy = (tx - sx) * math.sin(math.pi / 3) + (ty - sy) * math.cos(math.pi / 3) + sy
        tmp.append((x1, y1))
        tmp.append((sx, sy))
        tmp.append((ux, uy))
        tmp.append((tx, ty)) 
    tmp.append((100, 0))
    point = tmp

for x, y in point:
    print(f"{x:.8f} {y:.8f}")


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

int main() {
  long long N;
  long long ansP = 0;
  long long ansQ = 0;
  cin >> N;
  vector<long long> P(N),Q(N),termP(N-1,0),termQ(N-1,0);
  for (int i=0; i<N; i++) {
    cin >> P[i];
  }
  for (int i=0; i<N; i++) {
    cin >> Q[i];
  }
  
  for (int i=0; i<N-1; i++) {
    for (int j=i+1; j<N; j++) {
      if (P[i] > P[j]) {
        termP[i]++;
      }
      if (Q[i] > Q[j]) {
        termQ[i]++;
      }
    }
  }
  
  long long val = 1;
  for (int i=1; i<N; i++) {
    val *= i;
    ansP += termP[N-1-i] * val;
    ansQ += termQ[N-1-i] * val;
  }
  cout << abs(ansP-ansQ) << endl;
} 

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<utility>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cctype>
#include<cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define pq priority_queue
#define rep(i,n) for (int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define INF 200000009
#define init(x) memset(x,0,sizeof(x))
int a,b; 
string s;
int main()
{
    ios::sync_with_stdio(false);
    cin>>a>>b;
    cin>>s;
    for (int i=0;i<s.size();++i){
    	if (i<a){
    		if (s[i]=='-'){
    			cout<<"No";
    			return 0;
			}
			continue;
		}
		else if (i==a){
			if (s[i]!='-'){
				cout<<"No";
				return 0;
			}
		}
		else{
			if (s[i]=='-'){
				cout<<"No";
				return 0;
			}
		}
	}
	cout<<"Yes";
    return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<iomanip>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>

i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

i64 cup(i64 xxx, i64 yyy) {//切り上げ
	return (xxx + yyy - 1) / yyy;
}

//メモリ置き場
string s;

//inputします
void input() {
	cin >> s;
}

//ライブラリ置き場



//main
int main() {
	input();
	int ans = 0;
	ff(i, 0, s.size()) {
		if ((s[i] - '0') != i % 2) {
			ans++;
		}
	}
	int a = s.size();
	ans = min(ans, a - ans);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;


vector<map<int,int>> edge;
vec used;
vec eN;

void dfs(int v, int par)
{
	used[v] = 1;
	
	for (auto & cld : edge[v])
	{
		if (used[cld.first])continue;
		dfs(cld.first, v);
	}

	//cout << v+1 << " "<< eN[v] <<endl;

	int check = 0;

	if (eN[v] % 2 == 1)
	{
		edge[v][par] = 0;
		eN[v]--;
	}

	for (auto & u : edge[v])
	{
		if (edge[v][u.first] == 0)continue;
		edge[u.first][v] = 0;
		eN[u.first]--;
		check++;
	}

	if(check%2==1)
	{
		cout << -1 << endl;
		exit(0);
	}
}


int main()
{
	int N, M;
	cin >> N >> M;
	
	edge = vector<map<int, int>>(N);
	used = vec(N, 0);
	eN = vec(N, 0);

	for (int i = 0; i < M; ++i)
	{
		int A, B;
		cin >> A >> B;
		--A; --B;
		edge[A][B] = 1;
		edge[B][A] = 1;
		eN[A]++;
		eN[B]++;
	}

	dfs(0, 0);

	for (int v=0;v<N;++v)for (auto u : edge[v])
	{
		if(u.second)
		{
			cout << v+1 << " " << u.first+1 << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 27392
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
int n;
vector<int> par;
vector<int> size;
struct gg{
	long long x,y;
	int id;
}a[100005];
bool cmp1(const gg &q,const gg &w){
    return q.x<w.x;
}
bool cmp2(const gg &q,const gg &w){
    return q.y<w.y;
}
void init(int n){
	size.assign(n+1,1);
	par.assign(n+1,0);
	for(int i=0;i<=n;i++){
		par[i]=i;
	}
}
int find(int x){
	if(par[x]==x) return par[x];
	par[x]=find(par[x]);
	return par[x];
}
bool issameset(int x,int y){
	return find(x)==find(y);
}
void Union(int x,int y){
	if(!issameset(x,y)){
		size[find(y)]+=size[find(x)];
		par[find(x)]=find(y);
	}
}
int main(){
	cin>>n;
	init(n);
	for(int i=0;i<n;i++){
		cin>>a[i].x>>a[i].y;
		a[i].id=i;
	}
	vector<pair<long long,ii> > edgelist;
	sort(a,a+n,cmp1);
	for(int i=1;i<n;i++){
		edgelist.push_back(make_pair(a[i].x-a[i-1].x,ii(a[i].id,a[i-1].id)));
	}
	sort(a,a+n,cmp2);
	for(int i=1;i<n;i++){
		edgelist.push_back(make_pair(a[i].y-a[i-1].y,ii(a[i].id,a[i-1].id)));
	}
	sort(edgelist.begin(),edgelist.end());
	long long mst=0;
	for(int i=0;i<edgelist.size();i++){
		pair<long long,ii> front=edgelist[i];
		if(!issameset(front.second.first,front.second.second)){
			Union(front.second.first,front.second.second);
			mst+=front.first;
		}
	}
	cout<<mst;
}

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

double eps = 1e-10;

class Point {
public:
	double x, y;
	
	Point(double x = 0, double y = 0) : x(x), y(y) {}
	
	Point operator + (const Point& p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator - (const Point& p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator * (const double& a) {
		return Point(x * a, y * a);
	}
	Point operator / (const double& a) {
		return Point(x / a, y / a);
	}
	
	bool operator < (const Point& p) const {
		return x != p.x ? x < p.x : y < p.y;
	}
	bool operator == (const Point &p) const {
		return fabs(x - p.x) < eps && fabs(y - p.y) < eps;
	}
	
	double abs() {
		return sqrt(norm());
	}
	double norm() {
		return x * x + y * y;
	}
	
};

typedef Point Vector;

bool equals(const double& a, const double& b) {
	return fabs(a - b) < eps;
}

double dot(const Vector& a, const Vector& b){
	return a.x * b.x + a.y * b.y;	
}

double cross(const Vector& a, const Vector& b){
	return a.x * b.y - a.y * b.x;
}

class Triangle {
public:
	Point p1, p2, p3; // ??????
	Vector v1, v2, v3; // ??????????????????
	double e1, e2, e3; // ????????§??????
	double a1, a2, a3; // ?§????(????????¢???)
	
	Triangle(Point a, Point b, Point c) : p1(a), p2(b), p3(c) {
		v1 = p3 - p2; v2 = p3 - p1; v3 = p2 - p1;
		e1 = v1.abs(); e2 = v2.abs(); e3 = v3.abs();
		a1 = law_of_cosines(e1, e2, e3); a2 = law_of_cosines(e2, e1, e3);
		a3 = law_of_cosines(e3, e2, e1);
	}
	
	// ????????????(?????????:?§????)
	double law_of_cosines(const double& a, const double& b, const double& c) { 
		return acos((b * b + c * c - a * a) / (2.0 * b * c));
	}
	
	double calc_radius_circumcenter() {
		return e1 / (2.0 * sin(a1));
	}
	// ?????????????????????
	Vector calc_vec_circumcenter() {
		return (v1 * sin(2.0 * a1) + v2 * sin(2.0 * a2) + v3 * sin(2.0 * a3))
		       / (sin(2.0 * a1) + sin(2.0 * a2) + sin(2.0 * a3));
	}
	
	// ???????????§?¨?
	Point calc_p_circumcenter() {
		return Point((p1.x * sin(2.0 * a1) + p2.x * sin(2.0 * a2) + p3.x * sin(2.0 * a3))
		             / (sin(2.0 * a1) + sin(2.0 * a2) + sin(2.0 * a3)),
		             (p1.y * sin(2.0 * a1) + p2.y * sin(2.0 * a2) + p3.y * sin(2.0 * a3))
		             / (sin(2.0 * a1) + sin(2.0 * a2) + sin(2.0 * a3)));
	}
};

int main() {
	int n;
	cin >> n;
	double x1, x2, x3, y1, y2, y3;
	for(int i = 0; i < n; ++i){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		Triangle t = Triangle(Point(x1, y1), Point(x2, y2), Point(x3, y3));
		Point p = t.calc_p_circumcenter();
		printf("%.3f %.3f %.3f\n", p.x, p.y, t.calc_radius_circumcenter());
	}
	return 0;
}

Measured memory_bytes: 1320
#include <iostream>
#include <algorithm>
#include <fstream>
#include <utility>
#include <iomanip>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#define IO ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;

using namespace std;
const ll INF = 1e18;
const int mod = 1e4, N = 1e5 + 5, inf = 1e9;

int main()
{
    IO
    int n, k, arr[N], mn = inf;
    ll ans = 0;
    vector<int> vec;
    cin >> n >> k;
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
        if(arr[i] < mn)
        {
            mn = arr[i];
            vec.clear();
            vec.push_back(i);
        }
        else if(arr[i] == mn)
            vec.push_back(i);
    }
    if(vec[0] + 1 < k)
        vec[0] = k - 1, ans++;
    else
    {
        ans += ceil((double) (vec[0]) / (k - 1));
        if((int)(ceil((double) (vec[0]) / (k - 1)) + 1) % k == 0)
            vec[0] = ceil((double) (vec[0]) / (k - 1)) * (k - 1) + 1;
    }
    if(vec.size() > 1)
    {
        if((n - vec.back() - 1) < k && n - k > vec[vec.size() - 2])
            vec.back() = n - k;
    }
    for (int i = 0; i < vec.size() - 1; i++)
    {
        ans += ceil(((double)vec[i + 1] - vec[i] - 1) / (k - 1));
        if(ceil(((double)vec[i + 1] - vec[i] - 1) / (k - 1)) != 0)
            vec[i + 1] = vec[i] + ceil(((double)vec[i + 1] - vec[i] - 1) / (k - 1)) * (k - 1);
    }
    ans += ceil(((double)n - vec.back() - 1) / (k - 1));
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 4024
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var n int
	sum := 0
	fmt.Sscan(getNextLine(scanner), &n)
	aaa := getIntList(scanner)
	for i := 0; i < n; i++ {
		sum += aaa[i] - 1
	}
	fmt.Println(sum)
}


Measured memory_bytes: 768
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

int main(void)
{
    int n, r;

    cin >> n >> r;

    if (n < 10)
    {
        cout << r + 100 * (10 - n) << endl;
    }
    else
    {
        cout << r << endl;
    }
}

Measured memory_bytes: 256
num = [int(i) for i in input().split(' ')]

if num[0] == 1 and num[1] == 1:
  print(1)
elif num[0] == 1 or num[1] == 1:
  print(1)
else:
  A = num[0] * num[1]
  if(A % 2 == 0):
    print(int(num[0] * num[1] / 2))
  else:
    print(int((A-1) / 2 + 1))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{

public static void sort(int W, int H, int x, int y, int r) {
int solved = 1;
if ((x + r > W) || ((x -r) < 0)) {
solved = 0;
}if ((y + r > H) || ((y -r) < 0)) {
solved = 0;
} if (solved == 0) {
System.out.println("No");
} else {
System.out.println("Yes");
}


} 
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int b = scan.nextInt();
int c = scan.nextInt();
int d = scan.nextInt();
int e = scan.nextInt();

sort(a, b, c, d, e);
}
}


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

using namespace std;

int main()
{
    long long n, k;

    cin >> n >> k;

    if(n < k)
    {
        cout << min(n, k - n) << endl;
//main();
        return 0;
    }

    if(n % k == 0)
        cout << 0 << endl;
    else
    {
        long long x = n % k;

        if(x < k)
        {
            cout << min(x, k - x) << endl;
        }
    }
 //main();
    return 0;
}


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


struct vertex {
  vector<int> w;
  vector<int> e;
  bool f = false;
  int v;
};

vector<struct vertex> G;

bool dfs(int i) {
  for(int j=0; j<G[i].e.size(); j++) {
    int v = G[i].e[j];
    if(G[v].f == false) {
      G[v].f = true;
      G[v].v = G[i].v + G[i].w[j];
      if(!dfs(v)) return false;
    } else {
      if(G[v].v - G[i].v != G[i].w[j]) return false;
    }
  }
  return true;
}

int main() {
  int n, m; cin >> n >> m;
  G.resize(n+1);
  for(int i=1; i<=m; i++) {
    int l, r, d;
    cin >> l >> r >> d;
    G[l].e.push_back(r);
    G[l].w.push_back(d);
    G[r].e.push_back(l);
    G[r].w.push_back(-d);
  }
  for(int i=1; i<=n; i++) {
    if(G[i].f == false) {
      G[i].f = true;
      G[i].v = 0;
      if(!dfs(i)) { cout << "No" << endl; return 0; }
    }
  }
  
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <map>
#include <cmath>
#include <vector>

using namespace std;
int n, wynik;

const long long int duzo = 10000000000LL;
typedef long long int LL;

const int stala = 100007, stala_2 = 2160;
struct licz {
	LL wys;
	LL co;
};
bool zajete[stala_2];
licz pom;
vector<LL> hasz;
vector<LL> hasz_uzup;
vector<LL> liczbyPierwsze;
map<LL, LL> mapa;
map<LL, LL>::iterator it;
map<LL, LL>::iterator it_2;
LL liczba;
bool czy_jest_cube, same_cube = 1;

void sito() {
	for(int i = 2; i < stala_2; i++) {
		if(!zajete[i]) {
			liczbyPierwsze.push_back(i);
			for(int j = i*i; j < stala_2; j += i) zajete[j] = 1;
		}
	}
}

LL znajdz_pierwiastek(LL co) {
	LL a = 1, b = 2155, sr;
	
	while(a != b) {
		sr = (a+b)/2;
		if(sr*sr*sr == co) return sr;
		if(sr*sr*sr > co) {
			b = sr;
		} else a = sr+1;
	}
	return a;
}

bool czy_szescian(LL co) {
	LL gdzie = znajdz_pierwiastek(co);
	if(gdzie*gdzie*gdzie == co) return 1;
	return 0;
}

void rozloz() {
	LL do_dod = 1, odw_dod = 1;
	for(int i = 0; i < liczbyPierwsze.size() && liczba > 1; i++) {
		pom.co = liczbyPierwsze[i];
		pom.wys = 0;
		while(liczba%pom.co == 0) {
			pom.wys = (pom.wys+1)%3;
			liczba /= pom.co;
		}
		if(pom.wys > 0) {
			do_dod *= pom.co;
			odw_dod *= pom.co;
			if(pom.wys == 2) do_dod *= pom.co;
			else odw_dod *= pom.co;
		}
	}
	if(liczba > 1) {
		LL sq = sqrt(liczba);
		if(sq*sq == liczba) {
			do_dod *= liczba;
			odw_dod *= sq;
		} else {
			if(liczba > 100000) {
				wynik++;
				return;
			}
			do_dod *= liczba;
			odw_dod *= liczba*liczba;
		}
	}
	if(odw_dod > duzo) wynik++;
	else {
		hasz.push_back(do_dod);
		hasz_uzup.push_back(odw_dod);
		mapa[do_dod]++;
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	
	sito();
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> liczba;
		
		if(czy_szescian(liczba)) {
			czy_jest_cube = 1;
		} else {
			same_cube = 0;
			rozloz();
		}
	}
	if(same_cube) {
		cout << 1 << "\n";
		return 0;
	}
	if(czy_jest_cube) wynik++;
	
	for(int i = 0; i < hasz.size(); i++) {
		it = mapa.find(hasz_uzup[i]);
		it_2 = mapa.find(hasz[i]);
		if(it == mapa.end()) {
			wynik += it_2->second;
			it_2->second = 0;
		} else {
			wynik += max(it_2->second, it->second);
			it_2->second = 0;
			it->second = 0;
		}
	}
	
	cout << wynik << "\n";
	
	return 0;
}


Measured memory_bytes: 7016
#include<iostream>
using namespace std;
int a[100];
int main()
{int n,i,j,sum=0;
cin >> n;
for(i=1;i<=n;i++)
cin >> a[i];
for(i=1;i<=n-1;i++)
 for(j=i+1;j<=n;j++)
  sum+=a[i]*a[j];
cout << sum;
return 0;



}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){

	//配列の要素数
	Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

	//配列の要素
	int A[] = new int[n];	
	for(int i=0;i<A.length;i++){
	    A[i]= scanner.nextInt();
	}
	bubbleSort(A,n);
    }
    //並べ替え
    private static void bubbleSort(int A[],int N){
	int flag = 1;
	int count = 0;

	while(flag != 0){
	    flag = 0;
	    for(int j=N-1; j > 0; j--){
		if(A[j] < A[j-1]){
		    int v = A[j];
		    int w = A[j-1];
		    A[j] = w;
		    A[j-1] = v;
		    flag = 1;
		    count++;
		}	
	    }
	}
	Print(A,N);
	System.out.println(count);
    }
    //表示
    private static void Print(int A[], int n){
	for(int k=0;k<A.length;k++){
	    System.out.print(A[k]);
	    if(k < (n-1)){
		System.out.print(" ");
	    }
	}
	System.out.println();
    }
}




Measured memory_bytes: 26260
import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

const INF = long.max / 4;

int N, M, Q;

struct Edge {
    int from, to;
    long cost;
}

Edge[][] G;

long[] dijkstra(int v) {
    struct State {
        int v; long cost;
    }
    BinaryHeap!(Array!State, "a.cost > b.cost") PQ;
    PQ.insert(State(v, 0));
    auto d = new long[N];
    d[] = INF;
    d[v] = 0;
    while (!PQ.empty) {
        auto s = PQ.front; PQ.removeFront;
        foreach (e; G[s.v]) {
            if (d[e.to] <= s.cost + e.cost) continue;
            d[e.to] = s.cost + e.cost;
            PQ.insert(State(e.to, d[e.to]));
        }
    }
    return d;
}

struct Point {
    long x, y;
}

class Node {
    Node parent;
    Node left, right;
    long left_x, right_x;
    long[] ys;
    override string toString() const {
        return format("%s -> ys: %s", [left_x, right_x], ys);
    }
}
Node construct(in Point[] ps) {
    auto n = new Node;
    n.left_x = ps.front.x;
    n.right_x = ps.back.x;
    if (ps.length == 1) {
        n.ys = [ ps[0].y ];
        return n;
    }
    Node l = construct(ps[0 .. $ / 2]),
         r = construct(ps[$ / 2 .. $]);
    l.parent = n;
    r.parent = n;
    n.left = l;
    n.right = r;
    size_t li = 0, ri = 0;
    long[] ys;
    while (true) {
        if (li >= l.ys.length && ri >= r.ys.length) break;
        if (li >= l.ys.length) ys ~= r.ys[ri++];
        else if (ri >= r.ys.length) ys ~= l.ys[li++];
        else {
            ys ~= (l.ys[li] < r.ys[ri] ? l.ys[li++] : r.ys[ri++]);
        }
    }
    n.ys = ys;
    return n;
}
/* (sx <= x <= gx && sy <= y <= gy)なる点(x, y)の個数を返す */
long query(Node root, long sx, long gx, long sy, long gy) {
    if (gx < root.left_x || root.right_x < sx) {
        return 0;
    } else if (sx <= root.left_x && root.right_x <= gx) {
        auto ys = assumeSorted(root.ys);
        return ys.upperBound(sy - 1).lowerBound(gy + 1).length;
    } else {
        return query(root.left, sx, gx, sy, gy) + query(root.right, sx, gx, sy, gy);
    }
}

void main() {
    scanf("%d %d\n", &N, &M);
    G = new Edge[][N];
    foreach (i; 0 .. M) {
        int a, b, c;
        scanf("%d %d %d\n", &a, &b, &c);
        G[a] ~= Edge(a, b, c);
        G[b] ~= Edge(b, a, c);
    }
    auto ds = dijkstra(0),     // distance from start
         dg = dijkstra(N - 1); // distance from goal
    auto ps = new Point[N];
    foreach (i; 0 .. N) {
        ps[i].x = ds[i];
        ps[i].y = dg[i];
    }
    ps.sort!"a.x < b.x";
    Node segtree = construct(ps);
    /*
    void dump(Node t, int level = 0) {
        if (t is null) return;
        writeln(t);
        dump(t.left);
        dump(t.right);
    }
    dump(segtree);
    */
    scanf("%d\n", &Q);
    foreach (i; 0 .. Q) {
        long fs, fg;
        scanf("%lld %lld\n", &fs, &fg);
        writeln(query(segtree, 0, fs, fg, INF));
    }
}

Measured memory_bytes: 62500
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <utility>

std::vector<size_t> nya(size_t s, size_t t, std::vector<std::vector<size_t>> const& via) {
  if (s == t) return {s};
  size_t k = via[s][t];
  if (k == s) return {s, t};

  auto former = nya(s, k, via);
  auto latter = nya(k, t, via);
  if (former.back() == latter[0])
    former.pop_back();

  former.insert(former.end(), latter.begin(), latter.end());
  return former;
}

int testcase_ends() {
  size_t n;
  scanf("%zu", &n);
  if (n == 0) return 1;

  double inf = 1e9;
  std::vector<std::vector<double>> g(n, std::vector<double>(n, inf));
  for (size_t i = 0; i < n; ++i) g[i][i] = 0;

  std::vector<double> x(n), y(n);
  for (size_t i = 0; i < n; ++i) {
    size_t b;
    scanf("%zu", &b);
    --b;
    scanf("%lf %lf", &x[b], &y[b]);
  }
  for (size_t i = 0; i < n; ++i) {
    for (size_t j = 0; j < n; ++j) {
      double dx = x[i]-x[j];
      double dy = y[i]-y[j];
      if (dx*dx + dy*dy > 50*50) continue;
      g[i][j] = g[j][i] = hypot(dx, dy);
    }
  }

  std::vector<std::vector<size_t>> via(n, std::vector<size_t>(n));
  for (size_t i = 0; i < n; ++i)
    for (size_t j = 0; j < n; ++j)
      via[i][j] = i;

  for (size_t k = 0; k < n; ++k)
    for (size_t i = 0; i < n; ++i)
      for (size_t j = 0; j < n; ++j) {
        if (g[i][j] > g[i][k] + g[k][j]) {
          g[i][j] = g[i][k] + g[k][j];
          via[i][j] = k;
        }
      }

  size_t m;
  scanf("%zu", &m);

  for (size_t i = 0; i < m; ++i) {
    size_t s, t;
    scanf("%zu %zu", &s, &t);
    --s;
    --t;
    if (g[s][t] >= inf) {
      puts("NA");
      continue;
    }
    std::vector<size_t> res = nya(s, t, via);
    for (size_t j = 0; j < res.size(); ++j)
      printf("%zu%c", res[j]+1, j+1<res.size()? ' ':'\n');
  }
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2940
import fractions
from functools import reduce

N = int(input())
T = [int(input()) for _ in range(N)]

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(L):
    return reduce(lcm_base, L, 1)

print(lcm(T))

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

int main() {
    int n, f = 0, m = 0;
    cin >> n;
    int a[n];
    long long int ans = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] == 0) {
            f = 1;
        } else if(a[i] < 0) {
            m++;
        }
    }
    for(int i = 0; i < n; ++i) {
        a[i] = abs(a[i]);
    }
    if(f == 0 && m%2) {
        sort(a, a+n);
        ans -= 2*a[0];
    }
    for(int i = 0; i < n; ++i) {
        ans += abs(a[i]);
    }
    cout << ans << '\n';
}

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

#define REP(i,n) for(int i = 0;i < n;i++)
#define REPR(i,n) for(int i = n-1;i >= 0;i--)
#define FOR(i,m,n) for(int i = m;i < n;i++)
#define PRINT(s) cout<<s
#define PRINTS(s) cout<<s<<' '
#define PRINTL(s) cout<<s<<endl
#define INF 2e9
#define ALL(v) v.begin(),v.end()
#define ll long long
#define GREATER greater<int>()

using namespace std;

string pop_back(string s){
    string t = s.substr(0,s.size()-1);
    return t;
}

int gcd(int max,int min){
    
    if(max<min){
        int tmp=max;
        max=min;
        min=tmp;
    }

    if(max%min==0)return min;
    else return gcd(min,max%min);

}

int main(void){

    int a,b;
    cin>>a>>b;
    int ans=0;
    for(int i=a;i<=b;i++){
        int c=i/10000;
        int d=i/1000%10;
        int e=i%100/10;
        int f=i%10;
        if(c==f&&d==e)ans++;
    }
    cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 256
from itertools import product
n = int(input())
for _ in range(n):
    s = input()
    for alpha,beta in product([1,3,5,7,9,11,15,17,19,21,23,25],range(26)):
        g = "".join(chr((alpha*(ord(e)-ord("a"))+beta)%26+ord("a")) if not e == " " else " "  for e in s)
        if "that" in g or "this" in g: print(g); break


Measured memory_bytes: 5640
import java.io.*;

class Main{
	public static void main(String[] args){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			String line = reader.readLine();
			int n = Integer.parseInt(line);
			String s = reader.readLine();
			char[] c = s.toCharArray();
			char x = 'Z';

			for(int i = 0; i < c.length; i++){
				if(((c[i] + n) - x) > 0){
					c[i] = ((char)(c[i] + n - 26));
				}else{
					c[i] = ((char)(c[i] + n));
				}
				System.out.print(c[i]);
			}
			System.out.println("");
		} catch(IOException e) {
			System.out.println(e);
		} catch(NumberFormatException e){
			System.out.println(e);
		}
	}
}

Measured memory_bytes: 23508
import java.util.Scanner;

public class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		int ans = 0;

		for (int i = 0; i< 1000000000; i++ ) {
			if (X >= 500) {
			X = X - 500;
			ans =ans+ 1000;
			}
		}

		for (int i = 0; i< 1000000000; i++ ) {
			if (X >= 5) {
			X = X - 5;
			ans =ans+ 5;
			}
		}
		System.out.print(ans);
			}

	}








Measured memory_bytes: 23636
def b(u,x):
 c[u]=x
 return all((c[u]!=c[v])&(c[v]or b(v,-x))for v in X if d[u][v]==1)
N=int(input())
X=range(N)
S=[input()for _ in X]
d=[[1 if S[i][j]=='1'else(N if i^j else 0)for j in X]for i in X]
for k in X:
 for i in X:
  for j in X:d[i][j]=min(d[i][j],d[i][k]+d[k][j])
c=[0]*N
print(max(max(e)for e in d)+1 if b(0,1)else-1)

Measured memory_bytes: 54236
#include <iostream>

using namespace std;

int main()
{
	// YYには，00～99までの数字が入るが，01～12までの数字なら月の可能性がある．
	// MMには，00～99までの数字が入るが，01～12以外の数字なら月の可能性がある．
	// パターン
	// Fが00～99
	//   Fが00と13以上
	//   Fが01～12以下


	int S;
	cin >> S;

	int F = S / 100;
	int B = S - F * 100;
	
	if(F < 1 || 12 < F)
	{
		// F は MM ではない
		if(1 <= B && B <= 12)
		{
			// B は MM かもしれない
			cout << "YYMM" << endl;
		}
		else
		{
			// B は MM ではない
			cout << "NA" << endl;
		}
	}
	else
	{
		// F は MM かもしれない
		if(1 <= B && B <= 12)
		{
			// B は MM かもしれない
			cout << "AMBIGUOUS" << endl;
		}
		else
		{
			// B は MM ではない
			cout << "MMYY" << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 10000007
#define PI acos(-1)
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
#define debug(x) cout<<x<<endl;
#define endl "\n"
#define MEM(a,x) memset(a,x,sizeof(a))

using namespace std;
typedef long long ll ;
const int inf= 1e9+7;
const int nmax = 1e5+10;

//priority_queue<int,vector<int>,greater<int>>pq; //ascending

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<long long,null_type,less<long long>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
*/
/*
bool sortbysec(const pair<int,int>&a, const pair<int,int>&b)
{
    return (a.second<b.second);
}
*/
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.tie(NULL);
    ll x,y;
    cin>>x>>y;
    int ans=0;

    while(x<=y)
    {
        x*=2;
        ans++;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll  long long 
#define INF 10000000000000000LL
#define pll pair<long long , long long>
const int MAX=1e7+9;
const ll MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
int main() 
{

	  ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    string s;
    int n , m , k;
    cin>>n>>m>>k;
    int r[n+1];
    int col[m+1];
    memset(r, 0 , sizeof(r));
    memset(col, 0 , sizeof(col));
    int tot=0;
    int ans=0;
    int mat[n+1][m+1];
    memset(mat,0, sizeof(mat));
    for(int i=0;i<n;i++){
      string s;
      cin>>s;
      for(int j=0;j<s.size();j++){
        if(s[j]=='#'){
          mat[i][j]=1;
          r[i]=r[i]+1;
          col[j]=col[j]+1;
          tot=tot+1;
        }
      }
    }
    for(int mr=0 ;mr<(1<<n);mr++){
      for(int mc=0;mc<(1<<m);mc++){
        int now=tot;
        for(int i=0;i<n;i++)
          if(mr&(1<<i))now=now-r[i];
        for(int j=0;j<m;j++)
          if(mc&(1<<j))now=now-col[j];
        for(int i=0;i<n;i++){
          for(int j=0;j<m;j++){
            if((mr&(1<<i)) && (mc&(1<<j))){
              now=now+mat[i][j];
            }
          }
        }
    //    cout<<now<<endl;
        if(now==k)
          ans=ans+1;
      }
    }
    cout<<ans;
  
}

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

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

#define ll long long
#define vl vector<ll>
#define vll vector<vl>

const int INF = 1e9;

int main() {
	int m, d;
	cin >> m >> d;
	int ans=0;
	rep(i, m) rep(j, d)
	{
		int a=i+1;
		int b=j+1;
		if(a==(b%10)*(b/10) && (b%10)>1 && (b/10)>1) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

using namespace std;
using ll = long long;

/**
 * main
 */
int main () {
  string S; cin >> S;

  if (S.at(2) == S.at(3) && S.at(4) == S.at(5)) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int N, max = 0, H, prevH = 0, cnt = 0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> H;
        if (H <= prevH) cnt++;
        else {
            if (cnt > max) max = cnt;
            cnt = 0;
        }
        prevH = H;
    }
    if (cnt > max) max = cnt;
    cout << max << endl;
}

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

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

    if (n % 2 != 0) cout << 0 << endl;
    else {
        ll res = 0;

        n /= 2;
        while(n) {
            res += n / 5;
            n /= 5;
        }
        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 256