akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<long long> X(N), Y(N);
    for (int i=0; i<N; i++)
        cin>>X[i]>>Y[i];

    long long answer = 0;

    for (int i=0; i<N*10; i++)
    {
        long long tx = X[i];
        long long ty = Y[i];
        for (int j=0; j<N; j++)
        {
            long long sx = 0;
            long long sy = 0;
            for (int k=0; k<N; k++)
                if (tx*X[k]+ty*Y[k] >= 0)
                    sx += X[k],
                    sy += Y[k];
            tx = sx;
            ty = sy;
        }
        answer = max(answer, tx*tx+ty*ty);
    }
    printf("%.16f\n", sqrt((double)answer));
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll k;
ll n = 50;
ll a[55];

int main()
{
    cin>>k;
    for(ll i = 0; i < n; i++)
    {
        a[i] = n - 1 + ((k + n - 1) / n);
    }
    ll cnt = (k + n - 1) / n * n - k;
    for(ll i = 0; i < cnt; i++)
    {
        a[i] -= n + 1;
    }
    cout<<n<<endl;
    for(ll i = 0; i < n; i++)
    {
        cout<<a[i] + cnt<<' ';
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)); //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

LL N;
LL cnt = 0;

LL dfs(LL n, LL three, LL five, LL seven, LL digit)
{
    if(n > N){
        return 0;
    }

    cnt += three + five + seven == digit and three and five and seven ? 1 : 0;

    dfs(n * 10 + 7, three, five, seven + 1, digit + 1);
    dfs(n * 10 + 5, three, five + 1, seven, digit + 1);
    dfs(n * 10 + 3, three + 1, five, seven, digit + 1);
}

int main(void)
{
    cin >> N;

    dfs(0, 0, 0, 0, 0);
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] grid = new char[h+2][w+2];
		for(int i = 0; i < h; i++){
		    String s = sc.next();
		    for(int j = 0; j < w; j++){
		        grid[i+1][j+1] = s.charAt(j);
		    }
		}

		// 計算
		String result = "Yes";
		for(int i = 1; i <= h; i++){
		    for(int j = 1; j <= w; j++){
		        if(grid[i][j] != '#') continue;
		        if(grid[i-1][j] == '#') continue;
		        if(grid[i][j-1] == '#') continue;
		        if(grid[i][j+1] == '#') continue;
		        if(grid[i+1][j] == '#') continue;
		        result = "No";
		    }
		}
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 21844
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

int main(){
	
	int a[5];
	for(int i=0;i<5;i++){
		cin>>a[i];
	}	
	int dis;
	cin>>dis;

	sort(a,a+5);

	for(int i=0;i<5;i++){
		for(int j=i+1;j<5;j++){
			if(a[j]- a[i]>dis){
				cout<<":("<<endl;
				return 0;
			}
		}
	}


cout<<"Yay!"<<endl;

	

	return 0;
}

Measured memory_bytes: 3640
import java.util.*;
import java.io.*;

class Main {
	static long [][] c = new long [2002][2002];
	static long [] fac = new long [2002]; 
	static final int mod = 924844033;
	static long [][] dp = new long [2][6002];
	
	public static void main (String[] args) {
		Reader in = new Reader();
		int n = in.nextInt();
		int k = in.nextInt();
		
		fac[0] = 1;
		for(int i = 1; i <= n; i++) {
			fac[i] = fac[i - 1] * i;
			fac[i] %= mod;
		}
		for(int i = 0; i <= n; i++) {
			c[i][0] = 1;
			for(int j = 1; j <= i; j++) {
				c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
				c[i][j] %= mod;
			}
		}
		ArrayList <Integer> chain = new ArrayList <> ();
		for(int i = 1; i <= k; i++) {
			int sz = 0;
			int cur = i;
			while(cur <= n) {
				++sz;
				cur += k;
			}
			chain.add(sz);
			chain.add(sz);
		}
		dp[0][0] = 1;
		int row = 0;
		for(int i = 1; i <= chain.size(); i++) {
			int sz = chain.get(i - 1);
			row ^= 1;
			for(int j = 0; j <= n; j++) {
				dp[row][j] = 0;
				for(int x = 0; x <= Math.min(j, sz); x++) {
					dp[row][j] += dp[row ^ 1][j - x] * c[sz - x][x];
					dp[row][j] %= mod;
				}
			}
		}
		
		long ans = 0;
		for(int i = 0; i <= n; i++) {
			if(i % 2 == 1) {
				ans -= fac[n - i] * dp[row][i];
			} else {
				ans += fac[n - i] * dp[row][i];
			}
			ans %= mod;
		}
		if(ans < 0) ans += mod;
		System.out.println(ans);
	}
	static class Reader {
		private BufferedReader a;
		private StringTokenizer b;
		Reader() {
			a = new BufferedReader (new InputStreamReader (System.in));
		} 
		public String next () {
			while(b == null || !b.hasMoreTokens()) {
				try {
					 b = new StringTokenizer (a.readLine());
				 } catch (IOException e) {
					 e.printStackTrace();
				 }
			 }
			 return b.nextToken();
		}
		public int nextInt () {
		     return Integer.parseInt(next());
		}
		public long nextLong () {
			return Long.parseLong(next());
		}
		public double nextDouble () {
			return Double.parseDouble(next());
		}
		public String nextLine () {
		 	try {
		 		return a.readLine();
		 	} catch (IOException e) {
		 		e.printStackTrace ();
		 	}
		 	return "##";
		}
	}
}


Measured memory_bytes: 88804
//
// Created by yamunaku on 2019/11/05.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    CST(10);
    const double pi = 3.1415926535;
    double a, b, x;
    cin >> a >> b >> x;
    x /= a;
    if(x <= a * b / 2){
        cout << 90 - 180 / pi * atan2(2 * x / b, b) << endl;
    }else{
        cout << 90 - 180 / pi * atan2(a, 2 * (a * b - x) / a) << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    ll a[n],pre[n];
    ifr(i,0,n) cin>>a[i];
    pre[0]=a[0];
    ifr(i,1,n) pre[i]=pre[i-1]+a[i];
    ll dp[n][n];
    ifr(i,0,n) ifr(j,0,n) dp[i][j] = inf;
    ifr(i,0,n) dp[i][i]=0;
    for(int i=n-2;i>=0;i--) {
        for(int j=i+1;j<n;j++) {
            for(int k=i;k<j;k++) {
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+pre[j]-(i-1>=0?pre[i-1]:0));
            }
        }
    }
    cout<<dp[0][n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1536
n,k = map(int,input().split())
p = list(map(int,input().split()))

tmp = sum(p[0:k])
#print(tmp)
ans = tmp

for i in range(k,n):
   tmp -= p[i-k]
   tmp += p[i]
   ans = max(tmp,ans)

print(0.5*k+ans/2)

Measured memory_bytes: 24804
#include <stdio.h>
#include <stdlib.h>

int main(){
	int N, i, j;
	char S[101];
	scanf("%s", S);
	for(N = 0; S[N] != '\0'; N++);
	char keyence[] = "keyence";
	for(i = 0; i < 7 && S[i] == keyence[i]; i++);
	for(j = 0; j < 7 && S[N - 1 - j] == keyence[6 - j]; j++);
//	printf("(i, j) = (%d, %d)\n", i, j);
	if(i + j >= 7){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int k = int.Parse(Console.ReadLine());
        int[] x = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        int ans = 0;
        for (int i = 0; i < x.Length; i++)
        {
            ans += Math.Min(x[i], k - x[i]) * 2;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
let () = Scanf.scanf "%d %d %d %d %d" @@ fun a b c x y ->
  Array.init (max x y + 1) (fun i ->
    a * (max 0 (x - i)) + b * (max 0 (y - i)) + 2 * c * i)
  |> Array.fold_left min max_int
  |> Printf.printf "%d\n"


Measured memory_bytes: 2944
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		int[,]A = new int[N,2];
		int[][]B = new int[N*2][];
		for(var i=0;i<N;i++){
			string[] str = Console.ReadLine().Split();
			A[i,0] = int.Parse(str[0]);
			A[i,1] = int.Parse(str[1]);
			B[i*2] = new int[3];
			B[i*2][0] = A[i,0];
			B[i*2][1] = i;
			B[i*2][2] = 0;
			B[i*2+1] = new int[3];
			B[i*2+1][0] = A[i,1];
			B[i*2+1][1] = i;
			B[i*2+1][2] = 1;
		}
		Array.Sort(B, (x,y) => x[0] - y[0]);
		int[,]C = new int[N,2];
		int cta = 0;
		int ctb = 0;
		long ct = 0;
		for(var i=0;i<N;i++){
			ct += B[i][0];
			C[B[i][1],B[i][2]] += 1;
			if(B[i][2] == 0){
				cta += 1;
			} else {
				ctb += 1;
			}
		}
		if(cta < N && ctb < N){
			int fct = 0;
			for(var i=0;i<N;i++){
				if(C[i,0] == 1 && C[i,1] == 1){
					fct += 1;
				}
			}
			if(fct == 0){
				ct -= B[N-1][0];
				ct += B[N][0];
				if(B[N-1][1] == B[N][1]){
					long ct1 = ct;
					ct1 -= B[N][0];
					ct1 += B[N+1][0];
					long ct2 = ct;
					ct2 -= B[N-2][0];
					ct2 += B[N-1][0];
					ct = Math.Min(ct1,ct2);
				}
			}
		}
		Console.WriteLine(ct);
	}
}

Measured memory_bytes: 31164
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
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

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ll tmp[200001];
void pakuri_sort(int N, ll A[]) {
	const int b = 8;
	for (int k = 4; k < 8; k++) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	const int m = (1 << 20) - 1;
	int N = getint(), K = getint();
	ll A[200001];
	A[0] = 0;
	rep(i, N) {
		ll kari = (A[i] >> 32) + (getint() - 1) % K;
		if (kari >= K) kari -= K;
		A[i + 1] = (kari << 32) + i + 1;
	}

	pakuri_sort(N + 1, A);
	int kazu = 0;
	int mae = A[0] >> 32;
	rep(i, N + 1) {
		if (mae != A[i] >> 32) {
			kazu++;
			mae = A[i] >> 32;
		}
		tmp[A[i] & m] = kazu;
	}
	rep(i, N + 1) A[i] = 0;

	ll kotae = 0;
	rep(i, min(N + 1, K - 1)) {
		kotae += A[tmp[i]];
		A[tmp[i]]++;
	}
	for (int i = K - 1; i <= N; i++) {
		kotae += A[tmp[i]];
		A[tmp[i]]++;
		A[tmp[i - K + 1]]--;
	}

	printf("%lld", kotae);

	Would you please return 0;
}

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

int main(void){
  string S;
  cin >> S;
  int ans = 700;
  if(S[0] == 'o') ans +=100;
  if(S[1] == 'o') ans +=100;
  if(S[2] == 'o') ans +=100;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x,y,lcm;
    double ans,sum;
    cin>>x;
    for(int i=1;i<=x;i++)
    {
        cin>>y;
        sum=sum+1/(double)y;
    }
    printf("%lf",1/(double)sum);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    string S;
    cin >> S;
    int n = S.length();
    vector<int> a(n);
    REP(i, n){
        if(S[i] == 'B') a[i] += 1;
        if(i>0) a[i] += a[i-1];
    }

    ll ans = 0;
    REP(i, n){
        if(S[i] == 'W') ans += a[i];
    }

    pr(ans);
}

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

int n;
long long a[114514];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	sort(a, a + n);
	for (int i = n - 1; i >= 1; i--) {
		if (a[i] == a[i - 1]) {
			for (int j = i - 2; j >= 1; j--) {
				if (a[j] == a[j - 1]) {
					cout << a[i] * a[j] << endl;
					return 0;
				}
				if (j == 1) {
					cout << 0 << endl;
					return 0;
				}
			}
		}
		if (i == 1) {
			cout << 0 << endl;
			return 0;
		}
	}
}

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

int main(){
	int i,j,a[100][100],b[100],n,m,sum;
	char input[5002],*p=NULL;
	
	fgets(input,sizeof input,stdin);
	sscanf(input,"%d %d",&n,&m);
	
	for(i=0;i<n;i++){
		fgets(input,sizeof input,stdin);
		p=strtok(input," ");
		a[i][0]=atoi(p);
		
		for(j=1;j<m;j++){
			p=strtok(NULL," ");
			a[i][j]=atoi(p);
		}
		
	}
	
	for(i=0;i<m;i++){
		fgets(input,sizeof input,stdin);
		sscanf(input,"%d",&b[i]);
	}
	
	for(i=0;i<n;i++){
		sum=0;
		for(j=0;j<m;j++){
			sum+=a[i][j]*b[j];
		}
		printf("%d\n",sum);
		
	}
	
	return 0;
}

Measured memory_bytes: 644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int a,b,k;
  cin >> a >> b >> k;
  if(b-a+1<k*2){
      for(int j=a;j<=b;j++){
      cout << j << endl;
      }
  }else{
      for(int i=a;i<a+k;i++){
          cout << i << endl;
      }
      for(int i=b-k+1;i<=b;i++){
          cout << i << endl;
      }
  }
}

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

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

    static class Aupdown {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int[] ar = new int[s.length() + 1];
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) == '<') ar[i + 1] = Math.max(ar[i + 1], ar[i] + 1);
            }
            for (int i = s.length() - 1; i >= 0; i--) {
                if (s.charAt(i) == '>') ar[i] = Math.max(ar[i], ar[i + 1] + 1);
            }
            long res = 0;
            for (int i = 0; i < ar.length; i++) {
                res += (long) ar[i];
            }
            out.println(res);
        }

    }
}



Measured memory_bytes: 31832
#include<bits/stdc++.h>
using namespace std;
struct Point{
    long long x,y;
    Point():x(0),y(0){}
    Point(long long _x,long long _y):x(_x),y(_y){}
    bool operator<(Point other)const{
        if(x==other.x)return y<other.y;
        return x<other.x;
    }
};
struct Vector{
    long long x,y;
    Vector(long long _x,long long _y):x(_x),y(_y){}
};
Vector to_vector(Point a,Point b){
    return Vector(b.x-a.x,b.y-a.y);
}
long long cross(Vector a,Vector b){
    return (a.x*b.y)-(a.y*b.x);
}
bool ccw(Point a,Point b,Point c){
    return cross(to_vector(a,b),to_vector(a,c))>0;
}
bool collinear(Point a,Point b,Point c){
    return cross(to_vector(a,b),to_vector(a,c))==0;
}
vector<Point> convex_hull(vector<Point> point){
    vector<Point> hull;
    sort(point.begin(),point.end());
    for(int i=0;i<2;i++){
        int start=hull.size();
        for(auto p:point){
            while(hull.size()>=2
                &&!ccw(hull[hull.size()-2],hull[hull.size()-1],p)
                &&!collinear(hull[hull.size()-2],hull[hull.size()-1],p))hull.pop_back();
            hull.push_back(p);
        }
        hull.pop_back();
        reverse(point.begin(),point.end());
    }
    return hull;
}
int n;
int main(){
    scanf("%d",&n);
    assert(n>=3);
    vector<Point> point;
    for(int i=0;i<n;i++){
        long long x,y;
        scanf("%lld %lld",&x,&y);
        point.push_back(Point(x,y));
    }
    vector<Point> hull=convex_hull(point);
    int start=0;
    for(int i=1;i<hull.size();i++){
        if(hull[i].y<hull[start].y||(hull[i].y==hull[start].y&&hull[i].x<hull[start].x))start=i;
    }
    printf("%d\n",hull.size());
    for(int i=start;i<hull.size();i++){
        printf("%lld %lld\n",hull[i].x,hull[i].y);
    }
    for(int i=0;i<start;i++){
        printf("%lld %lld\n",hull[i].x,hull[i].y);
    }
    return 0;
}

Measured memory_bytes: 8268
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;

int dsc(const void *a, const void *b)
{
  return *(int *)b - *(int *)a;
}

int
main(int argc, char *argv[])
{
  int n, a[100000];
  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);

  qsort(a, n, sizeof(int), dsc);

  int cnt; int temp; int j = 0; int ans = 0;
  while(j < n){
    cnt = 1;
    temp = a[j];
    while(j + 1 < n && a[j + 1] == a[j]){
      cnt++; j++;
    }
    ans += (cnt & 1);
    j++;
  }
  printf("%d\n", ans);

  return 0;
}
    
			       
 


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a<c&&c<b){
		Yes(1);
	}else if(b<c&&c<a){
		Yes(1);
	}else{
		Yes(0);
	}
	return 0;
}


Measured memory_bytes: 256
def main():
    N, Q = map(int, input().split())
    S = input()
    cumsum = [0] * N
    for i in range(1, N):
        cumsum[i] = cumsum[i-1]
        if S[i-1] == "A" and S[i] == "C":
            cumsum[i] += 1
    for i in range(Q):
        l, r = map(int, input().split())
        print(cumsum[r-1] - cumsum[l-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 50776
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
//469
//ar[1] = 4 , ar[2] = 6 , ar[3] = 9
int ar[10005];
lli dp[10005][200][2];

lli getSum(int pos , int n , lli d, lli sum , bool flag)
{
//	cout<<"Hari";
	if(pos > n) {
		if(sum==d) return 1;
		return 0;
	}
	
	if(dp[pos][sum][flag] != -1) return dp[pos][sum][flag];
	
	int limit = 9;
	if(!flag) limit = ar[pos];
	
	lli res = 0;
	for(int i=0;i<=limit;i++)
	{
		if(flag || i != limit)
		res +=getSum(pos + 1 , n ,d, (sum + !(!i)) , true);
		else
		res+=getSum(pos + 1 , n ,d, (sum + !(!i)) , false);
//		if(pos ==1 ) cout<<res<<" ";
	}
	return dp[pos][sum][flag] = res;
}

int digitSum(string num)
{
	int res = 0;
	for(char digit : num)
	res += digit - '0';
	
	return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string a;
	lli d=0,ans=0;
		cin>>a;
		cin>>d;
		//if(a == "-1") break;
		
		lli L;
		
		//for L
		for(int i=0;i<a.size();i++)
		ar[i+1] = a[i] - '0';
		
		memset(dp , -1 , sizeof dp);
		L = getSum(1 , a.size() , d, 0 , 0);
		cout<<L<<endl;
}


Measured memory_bytes: 34904
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;
 
int main() {
    fast();
    // ll t;
    // cin>>t;
    // while(t--)
    // {
       
    // }
    double r;
    cin>>r;
    double pi=3.141592653;
    double ans=pi*r*2;
    cout<<ans;
    
}


Measured memory_bytes: 3820
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctype.h>
using namespace std;

int main ()
{
   int N, K;
   scanf("%d%d",&N, &K);
    double win = 0;
    for(int i = 1;i<=N;i++)
    {
        double win1 = 1.0/N;
        int a = i;
        while(a<K)
        {
            a*=2;
            win1 /=2;
        }
        win+=win1;
    }
    //if(N>K-1)
   // win+=(double)(N-K+1)/(double)N;


   printf("%.12f\n", win);
        return 0;
}


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

signed main(void)
{
	int n, ans;
	cin >> n;
	int p[n];
	bool flag[n];

	rep(i, n) flag[i] = false;
	rep(i, n) 
	{
		cin >> p[i];
		p[i]--;
		if (p[i] == i)
			flag[i] = true;
	}
	ans = 0;
	for(int i = 0; i < n; i++)
	{
		if (flag[i])
		{
			if (i != n - 1)
			{
				swap(p[i], p[i + 1]);
				flag[i + 1] = false;
			}
			else
				swap(p[i], p[i - 1]);
			ans++;
			flag[i] = false;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 768
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);

    int N = s.nextInt();
    int X = s.nextInt();
    int D = 0;
    int[] L = new int[N];
    int count = 1;
    for(int i = 0;i < N; i++){
      L[i] = s.nextInt();
    }
    for(int i = 0;i < N; i++){
      D = D + L[i];
      if(D <= X)count++;
    }
    System.out.println(count);
  }
}


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

int main()
{
    int N = 3;
    vector<int> Task(N);
    for(int i = 0; i < N; i++)
    {
        cin >> Task[i];
    }
    sort(Task.begin(), Task.end());
    cout << Task[1] - Task[0] + Task[2] - Task[1] << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] l = br.readLine().split(" ");
        int n = Integer.parseInt(l[0]);
        int q = Integer.parseInt(l[1]);
        Queue<Process> queue = new LinkedList<>();

        for (int i = 0; i < n; i++) {
            l = br.readLine().split(" ");
            String name = l[0];
            int time = Integer.parseInt(l[1]);
            Process process = new Process(name, time);
            queue.offer(process);
        }

        int allTime = 0;

        while (queue.size() > 0) {
            Process process = queue.poll();
            int time = process.getTime();
            if (time <= q) {
                allTime += time;
                System.out.println(process.getName() + " " + allTime);
            } else {
                allTime += q;
                process.reduceTime(q);
                queue.offer(process);
            }
        }
    }
}

class Process {

    private String name;

    private int time;

    public Process(String name, int time) {
        this.name = name;
        this.time = time;
    }

    public String getName() {
        return name;
    }

    public int getTime() {
        return time;
    }

    public void reduceTime(int dt) {
        time -= dt;
    }
}

Measured memory_bytes: 63440
/*
 * a.cc:
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
#include<iomanip>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main(){
  int N,sum=0;
  cin>>N;

  vector<int> vec(N);
  for (int i=0;i<N;i++){
    cin>>vec.at(i);
  }

  for (int j=0;j<N;j++){
    for (int k=0;k<N;k++){
      if(j!=k)
      sum+=vec.at(j)*vec.at(k);

    }
  }

  cout<<sum/2<<endl;
  return 0;

}


Measured memory_bytes: 3584
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;
using ll  = long long;
template <typename T> T In() {
    T t;
    cin >> t;
    return t;
}
template <typename T> vector<T> ReadVec1(int N) {
    vector<T> vec(N);
    for(int i = 0; i < N; i++)
        vec[i] = In<T>();
    return move(vec);
}
template <typename T> vector<vector<T>> Vec2(int i, int j, T ini = 0) {
    vector<vector<T>> vec(i, vector<T>(j, ini));
    return move(vec);
}
template <typename T> vector<vector<vector<T>>> Vec3(int i, int j, int k, T ini = 0) {
    vector<vector<vector<T>>> vec(i, vector<vector<T>>(j, vector<T>(k, ini)));
    return move(vec);
}

bool check(const vector<int> &v1, const vector<int> &v2) {
    int r2 = 0;
    for(int d = 0; d < v1.size(); d++) {
        r2 += (v1[d] - v2[d]) * (v1[d] - v2[d]);
    }

    for(int r = 1; r < sqrt(r2 + 1); r++){
        if(r*r == r2)
            return true;
    }
    return false;
}

int main() {
    int L = In<int>(), R = In<int>();
    if(L/2019 != R/2019){
        cout << 0 << endl;
    }
    else if(L%2019==0 || R%2019 == 0){
        cout << 0 << endl;
    } else {
        ll ans = 2019;
        for(ll i = L; i < R; i++){
            for(ll j = i + 1; j <= R; j++) {
                ans = min(ans, (i * j) % 2019);
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
from math import gcd

def init(init_val):
    for i in range(N):
        seg[i+num-1] = init_val[i]
    for i in range(num-2, -1, -1):
        seg[i] = gcd(seg[2*i+1], seg[2*i+2])

def update(k, x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = gcd(seg[k*2+1, seg[k*2+2]])

def query(p, q):
    if q <= p:
        return ide_ele
    p += num-1
    q += num-2
    res = ide_ele
    while q-p > 1:
        if p&1 == 0:
            res = gcd(res, seg[p])
        if q&1 == 1:
            res = gcd(res, seg[q])
            q -= 1
        p //= 2
        q = (q-1)//2
    if p == q:
        res = gcd(res, seg[p])
    else:
        res = gcd(gcd(res, seg[p]), seg[q])
    return res

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

ide_ele = 0
num = 2**(N-1).bit_length()
seg = [ide_ele]*2*num

init(A)
ans = -1
for i in range(N):
    ans = max(ans, gcd(query(0, i), query(i+1, N)))
print(ans)

Measured memory_bytes: 21200
#include<bits/stdc++.h>                               
using namespace std;
 
#define PI acos(-1)
#define fi first 
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define all(c) (c).begin(), (c).end()
#define TIMESTAMP fprintf(stderr, "Execution time: %.3lf s.\n", 1.0*clock()/CLOCKS_PER_SEC)
 
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair <int, int> pii;
typedef vector <vi> vvi;
typedef vector <pii> vpii;
typedef vector<string> vs;
 
const int INF = 100500;
const int MAXN = 1e5 + 9;
const int MOD = 1e9 + 7;
 
bool used[MAXN];
int dd[MAXN], dist[MAXN];
int n, k;
vi gg[MAXN];
int aa[MAXN], bb[MAXN];
 
void dfs(int v) {	
	used[v] = 1;
	for(int i = 0; i < sz(gg[v]); i++) {
		int to = gg[v][i];
		if(!used[to]) {
			dd[to] = dd[v] + 1;
			dfs(to);
		}
	}	
}
 
void input() {                  
	cin >> n >> k;
	for(int i = 0; i < n - 1; i++) {
		cin >> aa[i] >> bb[i];
		aa[i]--, bb[i]--;
		gg[aa[i]].pb(bb[i]);
		gg[bb[i]].pb(aa[i]);
	}                       
}
 
void solve() {          
	int ans = INT_MAX;
	if(k % 2 == 0) {
		for(int i = 0; i < n; i++) {
			dfs(i);
			int cnt = 0;          
			for(int j = 0; j < n; j++) {	
				if(dd[j] > k / 2) cnt++;
				dd[j] = 0;
				used[j] = 0;
			}
			ans = min(ans, cnt);
		}
	}
	else {
		k--;
		for(int i = 0; i < n - 1; i++) {
			dfs(aa[i]);
			for(int j = 0; j < n; j++) {
				dist[j] = dd[j];
				dd[j] = 0;
				used[j] = 0;
			}
			dfs(bb[i]);
			int cnt = 0;
			//for(int j = 0; j < n; j++) cerr << dd[j] << ' ' << dist[j] << endl;
			for(int j = 0; j < n; j++) {
				if(dd[j] > k / 2 && dist[j] > k / 2) cnt++;
				dd[j] = dist[j] = 0;
				used[j] = 0;
			}                                                                        
			//cerr << aa[i] << " : " << bb[i] << " ::::: " << cnt << endl;
			ans = min(ans, cnt);				
		}	
	}
	cout << ans << endl;
}
 
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);     
#ifdef LOCAL
	freopen("xxx.in", "r", stdin);
	freopen("xxx.out", "w", stdout);
#else
	//freopen("xxx.in", "r", stdin);
	//freopen("xxx.out", "w", stdout);
#endif	
	input();
	solve();
	return 0;
}


Measured memory_bytes: 2816
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
	static int [] nums;
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] array = br.readLine().split(" ");
		nums = new int[array.length];
		for(int i=0;i<nums.length;i++) nums[i]=Integer.parseInt(array[i]);
		qsort(nums, 0, nums.length-1);
    	System.out.println(nums[0]+" "+nums[1]+" "+nums[2]);
    }
	
	static void qsort(int[] numbers, int left, int right){
		if (left<=right) {
			int center=numbers[(left+right)/2];
			int l=left;
			int r=right;
			while(l<=r){
				while(numbers[l]<center) l++;
				while(numbers[r]>center) r--;
				if(l<=r){
					int tmp=numbers[l];
					numbers[l]=numbers[r];
					numbers[r]=tmp;
					l++;
					r--;
				}
			}
			qsort(numbers, left, r);
			qsort(numbers, l, right);
		}
	}
}

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

bool check[1000001];
bool ok[1000001];

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

	int n,t;
	vector <int> a;

	memset(ok,true,sizeof(ok));
	memset(check,false,sizeof(check));
	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		a.push_back(t);
	}

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

	int res = 0;
	for(int i=0;i<n;i++)
	{
		bool flag = true;
		for(int j=1;j<=sqrt(a[i]);j++)
		{
			if(a[i]%j==0)
			{
				if(check[j]==true)
				{
					//cout << j << ' ' << a[i] << '\n';
					flag = false;
					break;
				}
				if(check[(a[i]/j)]==true)
				{
					//cout << a[i]/j << ' ' << a[i] << '\n';
					flag = false;
					break;
				}
			}
		}
		if(flag==false)
		{
			//cout << a[i] << '\n';
			ok[a[i]] = false;
		}
		check[a[i]] = true;
	}

	for(int i=0;i<n;i++)
	{
		if(ok[a[i]]==true)
		{
			res++;
		}
	}

	cout << res << '\n';

    return 0;
}

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

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

rans = 0
tmp = 1
for i in range(N):
    if A[i] == tmp:
        rans += 1
        tmp += 1

if rans == 0:
    print(-1)
else:
    print(N - rans)

Measured memory_bytes: 24988
//BISMILLAHIR RAHMANIR RAHEEM
//ALLAH IS WATCHING ME
#include<bits/stdc++.h>
#include<cstring>
#include<cmath>
#include<iterator>
#include<cstdlib>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test  long long t;cin >> t;while(t--)
#define ses   "\n"
#define whp   " "
#define mxi 1000000
#define REP(i,a,b) for(int i=a; i<b; i++)
#define rep0(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
# define INF 0x3f3f3f3f
//set <int, greater <int> > ::iterator it;
//vector<pair<int,int> >a;
//memset(arr,0,sizeof(hg));
//priority_queue <int, vector<int>, greater<int>> pq;
///  string single character erase-
///             s.erase(s.begin()+x); where s is st ring name
///               ans x is index;
typedef long long v99;
typedef unsigned long long ull;
using namespace std;
v99 fx[4]= {1,-1,0,0};
v99 fy[4]= {0,0,1,-1};

long double power(long double p,long double q)
{
    long double ans=pow(p,q);
    return ans;
}

v99 koita_ache(v99 n,v99 base)
{
    v99 kot=0;
    while(n)
    {
        n/=base;
        kot+=n/2;
    }
    return kot;
}
int main()
{
    //v99 k=1;
    //test
    //while(1)
    {
        v99 n;cin>>n;
        if(n&1)cout<<0<<ses;
        else cout<<koita_ache(n,5)<<ses;

        //cout<<min(ache_2,ache_5)<<ses;
    }
    return 0;
}

Measured memory_bytes: 3684
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> ipair;
typedef tuple<int, int, int> ituple;

// const int INF = INT_MAX;
// const ll INF = LLONG_MAX;
// const int MOD = ((int)1e9 + 7);
// const ld EPS = (1e-10);
#define PI acosl(-1)
#define MAX_N (100000 + 2)

bool edge[5][5];

void exec(){
  int a, b;

  for (int i = 0; i < 3; i++){
    cin >> a >> b;
    edge[a][b] = edge[b][a] = true;
  }

  VI v = {1, 2, 3, 4};
  bool result = false;

  do {
    bool is_ok = true;
    for (int i = 0; i < v.size() - 1; i++){
      if (edge[v[i]][v[i+1]] == false){
        is_ok = false;
        break;
      }
    }

    if (is_ok){
      result = true;
      break;
    }
  } while (std::next_permutation(v.begin(), v.end()));

  cout << (result ? "YES" : "NO") << endl;

}

void solve(){
  int t = 1;
  // scanf("%d", &t);
  for (int i = 0; i < t; i++){
    exec();
  }
}

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


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


void solve(long long K, long long A, long long B){
    for(int i=A; i <= B; i++){
        if(i % K == 0){
            cout << "OK" << endl;
            return;
        }
    }

    cout << "NG" << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(K, A, B);
    return 0;
}


Measured memory_bytes: 3760
#include <stdio.h>
#include <stdlib.h>
int dev(int a);
int main()
 
 {
 
   int n;
scanf("%d",&n);
 
 
dev(n);
 
 }
 
int dev(int a){
    int r,count;
while(a>0){
    r=a%10;
    if(r==7){
        count=1;;
        break;
    }else{
    count=0;
    a=a/10;
    }
 
}if(count==0)
printf("No");
else
    printf("Yes");
}

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

int main() {
  int k, x;
  scanf("%d %d", &k, &x);
  int end = x + k;
  x -= k - 1;
  for (int i = x; i < end; i++) {
    if (i > x)
      printf(" ");
    printf("%d", i);
  }
  puts("");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n, x;
    cin >> n >> x;
    int k = 2 * n - 1;
    int m = k / 2;
    if (x == 1 || x == k) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    if (n == 2) {
        for (int i = 0; i < k; i++) {
            cout << i + 1 << endl;
        }
        return 0;
    }
    bool use[k + 1] = {};
    int ans[k];
    if (x == k - 1) {
        ans[m - 2] = x - 2;
        ans[m - 1] = x + 1;
        ans[m] = x;
        ans[m + 1] = x - 1;
        use[x - 2] = true;
        use[x + 1] = true;
        use[x] = true;
        use[x - 1] = true;
    } else {
        ans[m - 2] = x + 2;
        ans[m - 1] = x - 1;
        ans[m] = x;
        ans[m + 1] = x + 1;
        use[x + 2] = true;
        use[x - 1] = true;
        use[x] = true;
        use[x + 1] = true;
    }
    int cur = 1;
    for (int i = 0; i < m - 2; i++) {
        while (use[cur]) cur++;
        ans[i] = cur;
        use[cur] = true;
    }
    for (int i = m + 2; i < k; i++) {
        while (use[cur]) cur++;
        ans[i] = cur;
        use[cur] = true;
    }
    for (int i = 0; i < k; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4592
//#define DEBUG
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std;

#define BSET(a, p) ((a) | (1ll << (p)))
#define BCHK(a, p) ((a) & (1ll << (p)))
#define BXOR(a, p) ((a) ^ (1ll << (p)));
#define BREM(a, p) (BCHK(a, p)?(BXOR(a, p)):(a))
#define BSHO(a, N) (bitset<N>(a))

#define fi first
#define sc second 
#define pb push_back


#ifdef DEBUG
    #define dbg(s) {s;}
    #define PRELUDE
#endif

#ifndef DEBUG 
    #define PRELUDE { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
    #define dbg(s)
    #define endl "\n"
#endif

#define int ll
#define i32 int32_t

#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update> 
// Ordered set docs:
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).

#define all(v) (v).begin(),(v).end()

typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;

// To remove randomization use 0 below:
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int ri(int x) { // from [0, n-1]
    return uniform_int_distribution<int>(0, x - 1)(rng);
}

inline ld rf() { // from [0, 1]
    return uniform_real_distribution<ld>(0, 1)(rng);
}

ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
} 

const ll mod = 1e9 + 7;

ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}

const int maxn = 1e6 + 7;

const ll inf = 1e9 + 7;
int n;
int arr[maxn];
int arr2[maxn];

int findAns(int co)
{
    /*for(int i=1;i<=co;i++)
    {
        cout<<arr[i]<<" ";
    }
    cout<<endl;*/
    if(co==1)
        return arr[1];
    if(co==2)
        return arr[1]^arr[2];
    int pval= 1;
    int val = 2;
    while(val<=co)
    {
        pval = val;
        val*=2;
    }
    int nco = co - pval + 1;
    int x = 0;
    for(int i=1;i<=pval;i++)
    {
        x^=arr[i];
    }
    arr2[1] = x;

    for(int i=2;i<=nco;i++)
    {
        pval++;
        x^=arr[i-1];
        x^=arr[pval];
        arr2[i] = x;
    }
    for(int i=1;i<=nco;i++)
    {
        arr[i] = arr2[i];
    }
    return findAns(nco);
}
void solve()
{
    int hasone = 0;
    cin>>n;
    char f;
    for(int i=1;i<=n;i++)
    {
        cin>>f;
        arr[i] = f - '0';
        arr[i]--;
        if(arr[i]==1)
            hasone = 1;
    }
    if(n==2)
    {
        cout<<abs(arr[2]-arr[1])<<endl;
        return;
    }
    int ans = findAns(n);
    //ans can be 2

    if(hasone==0 && ans==2)
    {
        cout<<2<<endl;
        return;
    }

    //ans = 0 or 1;
    ans = ans%2;
    cout<<ans<<endl;

}

i32 main() {
    //freopen("<file>.in", "r", stdin);
    //freopen("<file>.out", "w", stdout);
    
    PRELUDE;
    int t = 1;
    //cin>>t;
    while(t--)
        solve();
}


Measured memory_bytes: 13824
a,b,c = map(int,input().split())
cou = 0
if  a%2==0 and a==b and b==c and c==a :
  print(-1)
  exit()
while a%2==0 and b%2==0 and c%2==0:
  j=int(a//2)
  k=int(b//2)
  m=int(c//2)
  a += k+m
  b += j+m
  c += j+k
  cou += 1
print(cou)

Measured memory_bytes: 3064
N = int(input())

def fes(cul=0):
    if cul > N:
        return 0 
    counter = 0

    if "3" in str(cul) and "5" in str(cul) and "7" in str(cul):
        counter += 1
    counter += fes(cul * 10 + 3)
    counter += fes(cul * 10 + 5)
    counter += fes(cul * 10 + 7)

    return counter

print(fes())

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

#define maxn 100005
#define INF 0x3f3f3f3f
#define MINF 0x7fffffffffffffff
#define mod 1000000007
#define PI 3.14159365358
typedef long long ll;
using namespace std;

void slove()
{
	double n;
	cin >> n;
	cout.setf(ios::fixed);
	cout << setprecision(8) << 2 * n * PI;
}

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

	slove();

	return 0;
}

Measured memory_bytes: 3792
#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>;
int main()
{
    int n;
    int ans = 0;
    cin >> n;
    rep(i,n){
        int l,r;
        cin >> l >> r;
        ans += r-l +1;
    }
    cout << ans << endl;
return 0;
}

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



using namespace std;
//#define push_back pb
int main()
{
   int m;
  cin>>m;
  int d,c=0;
  cin>>d;
  for(int i=1;i<=m;i++)
  	for(int j=1;j<=d;j++)
  	    if((j/10)>=2 && (j%10)>=2)
  		{if(i==((j/10)*(j%10)))
  			c++; }
  		
cout<<c;

 return 0;
}

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

ll mod=1e9+7;

int main() {
    int n;
    cin >> n;
    vector<int> x(n),y(n);
    for (int i=0;i<n;i++) cin >> x[i] >> y[i];
    double ans=0;
    for (int i=0;i<n;i++) {
            for (int j=i+1;j<n;j++) {
                ans+=sqrt(1.0*(x[i]-x[j])*(x[i]-x[j])+1.0*(y[i]-y[j])*(y[i]-y[j]));
            }
        }
        ans=1.0*ans*2/n;

    cout << setprecision(12) << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
    
    public static void main(String[] args) throws IOException {
        String s = in.next();
        String ans = s.substring(0, 5)+" "+s.substring(6, 13)+" "+s.substring(14);
        println(ans);
        
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i = 0; i < arr.length; i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}

Measured memory_bytes: 21076
import math
def ip():return int(input())
def inp():return map(int,input().split())
def linp():return list(map(int,input().split()))

n=ip()
w=linp()
s=sum(w)//2
former=0
i=0
while former<s:
    former+=w[i]
    i+=1
if former==s:print(abs(sum(w)-2*s))
else:
    print(min(abs(sum(w)-2*former),abs(sum(w)-former+w[i-1]-(former-w[i-1]))))


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n;
    cin>>n;
    vector<pll> p(n);
    for (int i = 0; i < n; i++)
    {
        int a;
        cin>>a;
        p[i]=make_pair(a,i+1);
    }
    sort(all(p));
    for (int i = 0; i < n; i++)
    {
        if(i>0)cout<<" ";
        cout<<p[i].second;
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 2432
#include<stdio.h>
int  main() {
	int	a, b, h, c;
	scanf("%d", &a);//\nを入れるとなぜかうまくいかない
	scanf("%d", &b);
	scanf("%d", &h);
	c = (a + b)*h / 2;
	printf("%d\n", c);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll N, P, Q;
    cin>>N>>P>>Q;
    vector<ll>vec;
    ll sum = 0;
    for(ll i=0LL;i<N;i++){
        ll C;
        cin>>C;
        sum += C;
        vec.push_back(P*i+C);
    }
    sort(vec.begin(), vec.end());
    for(int i=1;i<vec.size();i++)vec[i]+=vec[i-1];
    ll ans = sum;
    for(ll k=1;k<=N;k++)ans=max(ans, sum+k*P*Q+P*k*(k-1)-vec[k-1]);
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 7088