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

int main(){
    int N;
    double A[100];
    double sum = 0.0;
    cin >> N;
    for(int i=0;i<N;i++) cin >> A[i];
    for(int i=0;i<N;i++){
        sum += 1/A[i];
    }
    cout << 1/sum;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
const double PI =3.141592653589793238463;
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
	cout<<n*2*PI;
    return 0;
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

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

    int k, q;
    cin >> k >> q;
    Vl d(k);
    for (int i = 0; i < k; i++) {
        cin >> d[i];
    }

    Vl m(q), x(q), n(q);
    for (int i = 0; i < q; i++) {
        cin >> n[i] >> x[i] >> m[i];
    }

    Vl dm(k);
    Vl coeffs(k);
    for (int i = 0; i < q; i++) {
        ll out = 0;
        ll a_last = x[i] % m[i];
        for (int j = 0; j < k; j++) {
            dm[j] = d[j] % m[i];
        }
        for (int j = 0; j < k; j++) {
            if (j <= (n[i] - 1) % k - 1)
                coeffs[j] = (n[i] - 1) / k + 1;
            else
                coeffs[j] = (n[i] - 1) / k;
        }
        for (int j = 0; j < k; j++) {
            if (dm[j] == 0) out += coeffs[j];
            a_last += dm[j] * coeffs[j];
        }
        out += a_last / m[i];
        cout << n[i] - 1 - out << "\n";
    }

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 3005;

int main() {
   ll ans = 0;
   int n;
   cin >> n;
   vector <int> a(n);
   for(int i=0; i<n; i++) scanf("%d", &a[i]);
   sort(a.begin(), a.end());
   for(int i=0; i<n; i++) {
      for(int j=i+1; j<n; j++) {
         for(int k=j+1; k<n; k++) {
            if(a[i] < a[j] && a[j] < a[k] && a[i] + a[j] > a[k]) ans++;
         }
      }
   }
   cout << ans << endl;
}


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

using namespace std;

#define ll long long int

const int N = (int)1e5+15;
const ll inf = (ll)1e15+15;

ll dp[105][N];
ll wt[105];
ll val[105];
ll n,w;

ll solve(int idx, ll left) {
    if (idx > n || left <= 0) {
        return 0;
    }
    if (dp[idx][left] != -1) {
        return dp[idx][left];
    }

    ll ans = -inf;
    
    ans = max(ans,solve(idx+1,left));
    if (left - wt[idx] >= 0) {
        ans = max(ans, solve(idx + 1,left - wt[idx]) + val[idx]);
    }
    return dp[idx][left] = ans;
}

int main() {
    
    scanf("%lld %lld",&n, &w);
    for (int i = 1; i <= n; i++) {
       scanf("%lld %lld",wt + i, val + i);
    }

    memset(dp,-1,sizeof(dp));
    ll ans =  solve(1, w);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 82304
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
typedef long double LD;

int main()
{
	LL N;
	in >> N;
	std::vector<LD>x(N), y(N);
	rep(i, N) in >> x[i] >> y[i];

	std::vector<int>index(N);
	rep(i, N) index[i] = i;

	LD ans = 0;
	do
	{
		LD res = 0;
		rep(i, N - 1) res += std::sqrt((x[index[i]] - x[index[i + 1]]) * (x[index[i]] - x[index[i + 1]]) + (y[index[i]] - y[index[i + 1]]) * (y[index[i]] - y[index[i + 1]]));
		ans += res;
	} while (std::next_permutation(index.begin(), index.end()));
	for (LL i = 1; i <= N; ++i) ans /= i;

	out << std::fixed << std::setprecision(10);
	out << ans << std::endl;
}


Measured memory_bytes: 256
n = int(input().strip())
h = [None] + list(map(int, input().strip().split()))
h[0] = h[1]
cost = [0] * (n + 1)
for i in range(2, n + 1):
    cost1 = cost[i - 1] + abs(h[i] - h[i - 1])
    cost2 = cost[i - 2] + abs(h[i] - h[i - 2])
    cost[i] = min(cost1, cost2)
print(cost[n])

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

int main(){
 int r,g,b;
  cin >> r >> g >> b;
  int d = 100*r;
  int e = 10*g;
  int f = d + e + b;
  if(f % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
}


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

int fall(vector<vector<int>>&fi, vector<vector<int>>&pi,int fall_l) {
	int fall_u = 0;
	for (; fall_u < fi.size() - pi.size(); ++fall_u) {
		bool ok = true;
		for (int i = 0; i < pi.size(); ++i) {
			for (int j = 0; j < pi[i].size(); ++j) {
				if (pi[i][j]) {
					if (fi[fall_u + i+1][fall_l + j])ok = false;
				}
			}
		}
		if (!ok) {
			break;
		}
	}
	for (int i = 0; i < pi.size(); ++i) {
		for (int j = 0; j < pi[i].size(); ++j) {
			if (pi[i][j]) {
				fi[fall_u + i][fall_l + j] = true;
			}
		}
	}
	int delline = 0;
	for (int i = fall_u + pi.size() - 1; i >= fall_u; --i) {
		while (all_of(fi[i].begin(), fi[i].end(), [](const int a) {return a == 1; })) {
			transform(fi[i].begin(), fi[i].end(), fi[i].begin(), [](const int a) {return false; });
			rotate(fi.begin(), fi.begin() + i, fi.begin() + i+1); 
			delline += 1;
		}
	}
	return delline;
}

int main() {
	int N;
	while (cin>>N,N) {
		int sum = 0;
		vector<vector<int>>field(5*N, vector<int>(5));
		while(N--){
			int d, p, q; cin >> d >> p >> q; q--;
			sum += p;
			vector<vector<int>>pino(d == 1 ? 1 : p, vector<int>(d == 2 ? 1 : p, 1));
			sum -= fall(field, pino, q) * 5;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int main(){
  int N,A,countA[500001],ans=0;
  vector<int> v;
  FOR(i,0,500001){
    countA[i] = 0;
  }
  cin >> N;
  FOR(i,0,N){
    cin >> A;
    countA[A]++;
  }
  FOR(i,0,500001)if(countA[i] > 1)ans += countA[i] - 1;
  cout << N - ((ans+1)/2)*2 << endl;
}


Measured memory_bytes: 2176
d[1999],f,l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",d[f],d[l]);t>T?T=t,l=i:0){for(;d[i+=2]&&strcmp(d[i],w););t=strlen(d[i]=w);++d[i+1]>d[f+1]?f=i:0;}}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

int gcd(int a,int b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
int lcm(int a,int b)
{return a*b/gcd(a,b);}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{
  cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;
}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
ll INF=10e12;
//------------------------------------------------------------
ll A,B,C,K,ans=0;
void solve() {
  cin>>A>>B>>C>>K;

  if(A>=K) print(K);
  else if(A+B>=K) print(A);
  else print(A-(K-A-B));

  return;
}


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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        a: usize,
        b: usize,
    }
    if a % 2 == 0 || b % 2 == 0 {
        println!("No");
    } else {
        println!("Yes");
    }
}


Measured memory_bytes: 4352
#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>
 
using namespace std;

bool binsearch(int p, int ary[], int first, int last){
    int middle = (last+first)/2;
    if(first >= last){
        return (p == ary[last]) ? true:false;
    }
    if(p < ary[middle]){
        return binsearch(p, ary, first, middle-1);
    }else if(p > ary[middle]){
        return binsearch(p, ary, middle+1, last);
    }else{
        return true;
    }
}

int main(){
    int n, t;
    int N[100000], T[50000];
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &N[i]);
    }
    cin >> t;
    for(int i=0; i<t; i++){
        cin >> T[i];
    }

    int cnt = 0;
    for(int i=0; i<t; i++){
        if(binsearch(T[i], N, 0, n-1)) cnt++;
    }
    cout << cnt;
    cout << endl;
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

ll solve(ll O, ll I, ll J, ll L)
{
    ll ans = 2 * O;
    ans += 4 * (I / 2); I %= 2;
    ans += 4 * (J / 2); J %= 2;
    ans += 4 * (L / 2); L %= 2;
    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    ll I, O, T, J, L, S, Z;
    cin >> I >> O >> T >> J >> L >> S >> Z;

    ll ans = solve(O, I, J, L);
    if (I > 0 && J > 0 && L > 0) {
        ans = max(ans, solve(O, I-1, J-1, L-1) + 6);
    }

    cout << ans / 2 << endl;
}

Measured memory_bytes: 256
// 5/14
// 過去問ガリガリ
#include <bits/stdc++.h>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

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

    vector<int> A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    // rep(i, N) {
    //     printf("A[%d], B[%d] = %d, %d\n", i, i, A[i], B[i]);
    // }

    int ans;

    if (N % 2 == 1) {
        // printf("odd");
        int m = (N + 1) / 2;

        int mmin = A[m - 1];
        int mmax = B[m - 1];

        ans = mmax - mmin + 1;
    } else {
        // printf("even");
        int m = N / 2;

        int mmin = A[m - 1] + A[m];
        int mmax = B[m - 1] + B[m];

        ans = mmax - mmin + 1;
    }

    cout << ans << endl;
}


Measured memory_bytes: 4844
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
using namespace std;
bool compare(pair<int,int> &a,pair<int,int> &b){
    return a.first < b.first || (a.first == b.first && a.second > b.second);
}
int main(){
    int N;
    cin >> N;
    vector<pair<int,int> > line(N*2);
    REP(i,N){
        int A,B;
        cin >> A >> B;
        line[i*2] = pair<int,int>(A,1);
        line[i*2+1] = pair<int,int>(B,-1);
    }
    int ans = 0;
    int sum = 0;
    sort(ALL(line),compare);
    REP(i,N*2){
        sum += line[i].second;
        ans = max(sum,ans);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4412
use proconio::input;
use proconio::marker::Usize1;

#[proconio::fastout]
pub fn main() {
    input! {
    n:usize,
    m:usize,
    q:usize,
    abcd:[(Usize1,Usize1,usize,usize);q],
    }
    let mut acd: Vec<Vec<(usize, usize, usize)>> = vec![Default::default(); n];
    for (a, b, c, d) in abcd.into_iter() {
        acd[b].push((a, c, d));
    }
    let mut a = vec![1; n];
    let ans = rec(&mut a, &acd, 1, 0, n, m);
    println!("{}", ans);
}

pub fn rec(a: &mut Vec<usize>, acd: &Vec<Vec<(usize, usize, usize)>>, cur: usize, point: usize, n: usize, m: usize) -> usize {
    if cur == n {
        return point;
    }
    if cur == 0 {
        unreachable!();
    }
    let mut ans = point;
    for i in a[cur - 1]..=m {
        a[cur] = i;
        let np: usize = acd[cur].iter()
            .filter(|&(ab, cb, _db)| i - a[*ab] == *cb)
            .map(|&(_ab, _cb, db)| db)
            .sum();
        if i == a[cur - 1] || np != 0 {
            ans = std::cmp::max(ans,
                                rec(a, acd, cur + 1, point + np, n, m));
        }
    }
    ans
}


Measured memory_bytes: 2216
l1=input().split(" ")
n=int(l1[0])
a=int(l1[1])
b=int(l1[2])
c=a+b
q=n//c
mod=n%c
sub_b=0
#print(q)
#print(l1)
if l1[1]=="0":
    print("0")
else:
    if mod<a:
        sub_b=mod
    else:
        sub_b=a
    b_c=sub_b+a*q
    print(b_c)


Measured memory_bytes: 3060
import scala.io.StdIn._
object Main {
	def main(args :Array[String]) = {
		var mtrl = readLine.split(" ").map(_.toInt)
		if (mtrl(0)==mtrl(1))  println("a == b") 
		else if (mtrl(0)>mtrl(1))  println("a > b") 
		else  println("a < b") 	
	}
	
}

Measured memory_bytes: 43488
#include"bits/stdc++.h"
using namespace std;
int main(){
	int n,m;
	cin>>n;
	for(int i=1;i<=9;i++){
		if(n%i==0&&1<=n/i&&n/i<=9){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
}

Measured memory_bytes: 256
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Scanner;

/**
 *
 * @author cs18097
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int point = sc.nextInt();
        int wnum = sc.nextInt();
        int win[] = new int[n];
        for(int i = 0;i<wnum;i++){
            win[sc.nextInt()-1]++;
        }
        for(int i = 0;i<n;i++){
            if(point + win[i] > wnum) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
    
}


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

#define LL long long

const int maxN = 5005;

int n;
int cnt[maxN + 1], a[maxN + 1], pos[maxN + 1];
LL A, B;
LL f[maxN + 1][maxN + 1];

int main()
{
	scanf("%d", &n);
	scanf("%lld %lld", &A, &B);
	for(int i = 1; i <= n; i++) 
	{
		scanf("%d", &a[i]);
		pos[ a[i] ] = i;
	}
	for(int i = 1; i <= n; i++)
	{
		for(int j = a[i] + 1; j <= n; j++)
			if(pos[j] <= i) cnt[j] ++;
		for(int j = 1; j <= n; j++)
			if(pos[j] <= i)
			{
				if(!cnt[j]) f[i][j] = f[i][j - 1];
				else f[i][j] = min(f[i][j - 1] + A, f[ pos[j] - 1 ][j] + B * cnt[j]);
			}
			else f[i][j] = f[i][j - 1];
	}
	printf("%lld", f[n][n]);
	return 0;
}


Measured memory_bytes: 195840
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<queue>
using namespace std;
const int N=2e5+10;
struct Tree
{
    struct edge{int next,to;}a[N<<1];
    int head[N],cnt;
    void link(int x,int y)
        {
            a[++cnt]=(edge){head[x],y};head[x]=cnt;
            a[++cnt]=(edge){head[y],x};head[y]=cnt;
        }
}A,B;
int n,p1,p2,dep[N],dis[N],fr[N],vis[N],ans;
queue<int> Q;
void bfs1()
{
    memset(dis,-1,sizeof(dis));
    if(dep[p1]) Q.push(p1);dis[p1]=0;
    while(!Q.empty())
    {
        int x=Q.front();Q.pop();vis[x]=1;
        for(int i=A.head[x];i;i=A.a[i].next)
        {
            int R=A.a[i].to;
            if(dis[R]==-1)
            {
                dis[R]=dis[x]+1;
                if(dis[R]<dep[R]) Q.push(R);
                else if(dis[R]==dis[R]) vis[R]=1;
            }
        }
    }
}
void bfs2()
{
    memset(dep,-1,sizeof(dep));
    Q.push(p2);dep[p2]=0;
    while(!Q.empty())
    {
        int x=Q.front();Q.pop();
        for(int i=B.head[x];i;i=B.a[i].next)
        {
            int R=B.a[i].to;
            if(dep[R]==-1) dep[R]=dep[x]+1,fr[R]=x,Q.push(R);
        }
    }
}
int Dis(int x,int y)
{
    if(dep[x]<dep[y]) swap(x,y);
    if(fr[x]==fr[y]||x==y||fr[x]==y) return 0;
    if(fr[fr[x]]==y) return 0;
    return 1;
}
int main()
{
    cin>>n>>p1>>p2;
    for(int i=1,x,y;i<n;i++) scanf("%d%d",&x,&y),A.link(x,y);
    for(int i=1,x,y;i<n;i++) scanf("%d%d",&x,&y),B.link(x,y);
    bfs2();bfs1();
    for(int x=1;x<=n;x++)
        for(int i=A.head[x];i;i=A.a[i].next)
            if(vis[x]&&vis[A.a[i].to]&&Dis(x,A.a[i].to))
                puts("-1"),exit(0);
    for(int i=1;i<=n;i++) if(vis[i]) ans=max(dep[i],ans);
    cout<<ans*2<<endl;
}


Measured memory_bytes: 12032
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<map>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    int n,r;
    cin >> n >> r;
  	if(n<10){
      cout << r + 100*(10-n);
      return 0;
    }
  	else
      cout << r;
	
    return 0;
}


Measured memory_bytes: 256
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	double r = 0;
	cin >> r;
	cout << r * 2 * M_PI << endl;
}


Measured memory_bytes: 3800
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int n;cin>>n;
    vector<long long> a(n,0);
    for(int i=0;i<n;i++) cin>>a[i];
    map<long long,int> ht;
    long long ans=0;
    for(int i=n-1;i>=0;i--){
        long long curr=i+1+a[i];
        if(ht.find(curr)!=ht.end()){
            ans+=ht[curr];
        }

        curr=i+1-a[i];
        if(ht.find(curr)!=ht.end()){
            ht[curr]++;
        }
        else{
            ht.insert({curr,1});
        }
    }
    cout<<ans<<"\n";
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    return 0;
}

Measured memory_bytes: 16244
#include <iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

#define vi vector<int>
#define vvi vector<vi>
#define rpt(i,x) for (int i = 0; i < x; i++)
#define fti(i,f,t) for (int i = f; i <= t; i++)
#define fte(i,f,t) for (int i = f; i < t; i++)
#define rptws(i,x,s) for (int i = 0; i < x; i += s)
#define llrpt(i,x) for (long long i = 0; i < x; i++)
#define llfti(i,f,t) for (long long i = f; i <= t; i++)
#define llfte(i,f,t) for (long long i = f; i < t; i++)


int main () {
    int n;
    cin>>n;
    int arr[4] = {0};

    rpt(i, n) {
        string s;
        cin>>s;

        if (s == "AC") arr[0]++;
        else if (s == "WA") arr[1]++;
        else if (s == "TLE") arr[2]++;
        else if (s == "RE") arr[3]++;
    }

    cout<<"AC x "<<arr[0]<<"\n";
    cout<<"WA x "<<arr[1]<<"\n";
    cout<<"TLE x "<<arr[2]<<"\n";
    cout<<"RE x "<<arr[3];
    return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    int N, M;
    cin >> N >> M;
    cout << (100 * N + 1800 * M) * pow(2, M) << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num::clamp;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize,
        a: [u64; n]
    }

    let mut all_xor = 0;
    for &v in &a {
        all_xor ^= v;
    }
    for v in a {
        let ans = v ^ all_xor;
        println!("{}", ans);
    }
}


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

using namespace std;

using ll = long long;

constexpr char newl = '\n';
constexpr ll INF = 1e18;

//1-indexであることに注意
template <typename T>
struct BIT {
    int n;
    vector<T> data;
    int n_msb;

    BIT(int n) : n(n), data(n + 1, 0) {
        n_msb = 1;
        while (n_msb <= n) n_msb <<= 1;
        n_msb >>= 1;
    }

    T sum(int i) {
        T s = 0;
        while (i > 0) {
            s += data[i];
            i -= i & -i;
        }
        return s;
    }

    void add(int i, T x) {
        while (i <= n) {
            data[i] += x;
            i += i & -i;
        }
    }

    // sum(i) >= val となる最小のiを返す
    // ただし、sum(i)は広義単調増加すると仮定
    int lower_bound(T val) {
        if (val <= 0) return 0;

        int res = 0;
        for (int k = n_msb; k > 0; k >>= 1) {
            if (res + k <= n && data[res + k] < val) {
                val -= data[res + k];
                res += k;
            }
        }
        return res + 1;
    }
};

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

    int n;
    cin >> n;

    vector<ll> x(n), y(n), p(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> p[i];
    }

    const int geta = 10000;

    vector<ll> memo(1 << n, INF);
    memo[0] = 0;
    BIT<ll> bx(geta * 2 + 1), by(geta * 2 + 1);
    for (int i = 1; i < (1 << n); i++) {
        ll w = 0;
        for (int j = 0; j < n; j++) {
            if (i >> j & 1) {
                bx.add(x[j] + geta + 1, p[j]);
                by.add(y[j] + geta + 1, p[j]);
                w += p[j];
            }
        }

        ll midx = bx.lower_bound(w / 2) - geta - 1;
        ll midy = by.lower_bound(w / 2) - geta - 1;

        ll costx = 0, costy = 0;
        for (int j = 0; j < n; j++) {
            if (i >> j & 1) {
                costx += abs(x[j] - midx) * p[j];
                costy += abs(y[j] - midy) * p[j];
                bx.add(x[j] + geta + 1, -p[j]);
                by.add(y[j] + geta + 1, -p[j]);
            }
        }

        memo[i] = min(costx, costy);
        // cerr << i << ": " << memo[i] << newl;
    }

    vector< vector<ll> > dp(n + 1, vector<ll>(1 << n, INF));
    for (int i = 0; i < (1 << n); i++) {
        dp[0][i] = 0;
        for (int j = 0; j < n; j++) {
            if (i >> j & 1) {
                dp[0][i] += min(abs(x[j]), abs(y[j])) * p[j];
            }
        }
    }

    cout << dp[0][(1 << n) - 1] << newl;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < (1 << n); j++) {
            for (int k = j; ; k = (k - 1) & j) {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][k] + memo[j ^ k]);
                if (!k) break;
            }
        }

        cout << dp[i + 1][(1 << n) - 1] << newl;
    }

    return 0;
}


Measured memory_bytes: 8132
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b){
	if(b==0)return a;
	return gcd(b,a%b);
}
long long lcm(long long a,long long b){
	return a*b/gcd(a,b);
}
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a*b/gcd(a,b);
}
int main(){
  int n,x,out;
  cin>>n>>x;
  for(int i=0;i<n;i++){
    int in;
    cin>>in;
    if(i==0)out=abs(in-x);
    else out=gcd(abs(in-x),out);
  }
  cout<<out<<endl;
}


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

int main()
{
    int n;
    cin >> n;
    vector<double> a(n);
    rep(i, n) cin >> a[i];
    double ans = 0.0;
    rep(i, n) ans += 1.0 / a[i];
    ans = 1.0 / ans;
    printf("%.10f\n", ans);
    return 0;
}

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

using namespace std;

const int MAX_N = 1e5 + 5;

int n, m;

bool visisted[MAX_N];

vector <int> g[MAX_N];

int deg[MAX_N];

int dp[MAX_N];

void dfs(int u) {
  visisted[u] = 1;
  for (int v : g[u]) {
    dp[v] = max(dp[v], 1 + dp[u]);
    --deg[v];
    if (visisted[v] == 0 && deg[v] == 0) {
      dfs(v);
    }
  }
}

int main() {
  // dp[u] = the maximum path that ends in u
  // If we get to 0 at deg[u], then that is the optimal point to dfs(u)
  // Of course, dp[v] = 1 + dp[u]
  int u, v, ans;
  cin >> n >> m;
  while (m --) {
    cin >> u >> v;
    g[u].push_back(v);
    ++deg[v];
  }
  for (int i = 1; i <= n; ++i) {
    if (visisted[i] == 0 && deg[i] == 0) {
      dfs(i);
    }
  }
  ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans = max(ans, dp[i]);
  }
  cout << ans << "\n";
  return 0;
}


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

using ll=long long;
const ll MOD=1000000007;

int main() {
  string s;
  cin >> s;
  int k=s.size();
  int cnt=0;
  for(int i=0;i<k;i++){
    if(s[i]!=s[k-1-i]){
      cnt++;
      s[i]=s[k-i-1];
    }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#ユークリッドの互除法

def euclid(m,n):
    # m > n となるように入れ替え
    if m < n:
        m, n = n, m
    while n != 0:
        m, n = n, m % n
    return m


num = int(input('')) #input()で入力を受け取ってint()で数字型に変換します。
ans_sum = 0

for a in range(1,num+1):
    for b in range(1,num+1):
        gcd_ab = euclid(a,b)
        for c in range(1,num+1):
            ans_sum = ans_sum + euclid(gcd_ab,c)

ans_sum = ans_sum

print(ans_sum)




Measured memory_bytes: 9196
use proconio::*;

fn main() {
    input! {
        c: [[i64; 3]; 3],
    };

    let mut ans = false;

    'outer: for a1 in 0..=100 {
        for a2 in 0..=100 {
            for a3 in 0..=100 {
                let b1_1 = c[0][0] - a1;
                let b2_1 = c[0][1] - a1;
                let b3_1 = c[0][2] - a1;
                let b1_2 = c[1][0] - a2;
                let b2_2 = c[1][1] - a2;
                let b3_2 = c[1][2] - a2;
                let b1_3 = c[2][0] - a3;
                let b2_3 = c[2][1] - a3;
                let b3_3 = c[2][2] - a3;

                if b1_1 == b1_2
                    && b1_3 == b1_1
                    && b2_1 == b2_2
                    && b2_3 == b2_1
                    && b3_1 == b3_2
                    && b3_3 == b3_1
                    && b1_1 <= 100
                    && 0 <= b1_1
                    && b2_1 <= 100
                    && 0 <= b2_1
                    && b3_1 <= 100
                    && 0 <= b3_1
                {
                    ans = true;
                    break 'outer;
                }
            }
        }
    }

    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 2184
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;
const ll MOD = 1000000007;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


ll mpow(ll x, ll n){//繰り返し二乗法 計算量O(logN)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans * x % MOD;
        x = x * x % MOD;
        n  = n >> 1;
    }
    return ans;
}

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



int main(){
    int A, B;
    cin >> A >> B;
    if(A <= 9 && B <= 9)cout << A * B << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
char str[100100] = {0};
int main(){
	int N,K;
	scanf("%d%d",&N,&K);
	scanf("%s",str+1);
	int now = 0,n = 1;
	int ans = 0;
	int tmp = 0;		
	if(str[1] == '0')now++;		
	for(int i = 1,j = 2;i <= N;i++){
		while(j <= N && now <= K){
			if(str[j] == '0'){
				if(str[j-1] == '0'){j ++ ;}
				else {
					now++;j++;
					if(now > K){now--;j--;break;}
				}
			}
			else{
				j++;
			}
		}
		ans = max(ans,j-i);
		if(str[i] == '0'){now--;}
		while(str[i] == str[i+1])i++;
	} 
	printf("%d\n",ans);
	return 0;
} 

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

int main(int argc, char const* argv[])
{
  int a,b,ans=0;
  cin >> a >> b;
  for (int i=0;i<2;i++){
    if (a>b){
      ans+=a;
      a--;
    } else {
      ans+=b;
      b--;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define LEN 100000

struct Process
{
  char name[11];
  int time;
};

int que[LEN];
int head = 0, tail = 0;

void enqueue(int a) {
  que[tail] = a;
  if (tail == LEN - 1)
    tail = 0;
  else
    tail++;
}

int dequeue() {
  int n = head;
  if (head == LEN - 1)
    head = 0;
  else
    head++;
  return que[n];
}

int main(void) {
  struct Process p[LEN];
  int n, q;
  int i;
  int time = 0;
  int deal;

  scanf("%d %d", &n, &q);
  for (i = 0; i < n; i++) {
    scanf("%s %d", p[i].name, &p[i].time);
    enqueue(i);
  }

  while(head != tail) {
    deal = dequeue();
    if (p[deal].time <= q) {
      time += p[deal].time;
      printf("%s %d\n", p[deal].name, time);
    }
    else {
      time += q;
      p[deal].time -= q;
      enqueue(deal);
    }
  }

  return 0;
}



Measured memory_bytes: 2904
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int x, n; cin >> x >> n;
	map<int, bool> vis;
	vector<int> p(n); for (int i = 0; i <= n - 1; i++) cin >> p[i], vis[p[i]] = true;

	int val = INT_MAX, ans = INT_MAX;
	for (int i = x; i >= -x; i--) {
		if (vis.find(i) == vis.end()) {
			if (abs(x - i) < val) {
				val = abs(x - i);
				ans = i;
			}
			else if (abs(x - i) == val) {
				if (i < ans) {
					val = abs(x - i);
					ans = i;
				}
			}
		}
	}

	for (int i = x; i <= 2 * x; i++) {
		if (vis.find(i) == vis.end()) {
			if (abs(x - i) < val) {
				val = abs(x - i);
				ans = i;
			}
			else if (abs(x - i) == val) {
				if (i < ans) {
					val = abs(x - i);
					ans = i;
				}
			}
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3656
import sys
import collections

def set_debug(debug_mode=False):
    if debug_mode:
        fin = open('input.txt', 'r')
        # fout = open('output.txt', 'w')

        sys.stdin = fin
        # sys.stdout = fout


if __name__ == '__main__':
    # set_debug(True)

    n = int(input())

    res = list(map(int, input().split()))
    nei = collections.defaultdict(list)
    for i, x in enumerate(res, 2):
        nei[x].append(i)

    q = collections.deque()
    q.append(1)

    count = [0] * (len(res)+1)

    while q:
        for _ in range(len(q)):
            cur = q.popleft()
            for x in nei[cur]:
                count[cur-1] += 1
                q.append(x)
                
    for x in count:
        print(x)

Measured memory_bytes: 125460
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;

int dp[11000];

int main(){
  int N;
  cin>>N;
  cout<<N*800-N/15*200<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include<algorithm> 
#include <cassert>
#include <string>
//#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 9, M = 1e7, OO = 0x3f3f3f3f, eps = 0.001;
#define IO() assert(freopen("in.in", "rt", stdin)), assert(freopen("out.out", "wt", stdout))
#define ll long long int
#define FastIO() ios::sync_with_stdio(false), cin.tie(0);
void printar(int arr[], int n){
    for(int i = 0; i < n; i++)
    {
        cout << arr[i] << " ";
    }
    cout << endl;
}
// template <typename... T>
// void debug(T &... args)
// {
//     ((cerr << args << " "), ...);
//     cerr << endl;
// } 
// struct COMPARE { 
//   bool operator()(pair<string,ll> const& P1, pair<string,ll> const& P2) 
//     { 
        
//         return P1.first < P2.second;
//     }  
// };
// priority_queue<pair<string,ll>,vector<pair<string,ll>>,COMPARE >pq;


int main()
{     
    // IO();
    FastIO();
    int a, b; cin >> a >> b;
    b--;
    a--;
    cout << a * b;
    return 0;
    
}

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

int main() {
  int k;
  string s;
  cin >> k >> s;
  if (s.size() <= k) cout << s << endl;
  else {
    string ans = s.substr(0,k);
    ans += "...";
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){
  CIN(n,k);M s;REP(i,n){CIN(ss);s[ss]++;}
  V v;FOREACH(xx,s)v.pb(xx.second);
  sort(ALL(v));
  int ans=0;
  if(s.size()<=k){COUT(ans);return 0;}
  REP(i,s.size()-k)ans+=v[i];
  COUT(ans);

  return 0;
}


Measured memory_bytes: 10748
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

ans = 0

for i in range(60):
    cnt = 0
    for a in A:
        cnt += a>>i&1
    ans += cnt*(N-cnt)*2**i
    ans %= mod
    # print(ans)
print(ans)


Measured memory_bytes: 122936
#include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(register int i = (a), i##_end_ = (b); i <= i##_end_ ; ++i)
#define drep(i, a, b) for(register int i = (a), i##_end_ = (b); i >= i##_end_ ; --i)
#define clear(a, b) memset((a), (b), sizeof(a))
typedef long long LL;
int read() {
	int x = 0, flag = 1;
	char ch = getchar();
	while(!isdigit(ch)) {
		if(ch == '-') flag = -1;
		ch = getchar();
	}
	while(isdigit(ch)) {
		x = (x << 3) + (x << 1) + (ch - 0x30);
		ch = getchar();
	}
	return flag * x;
}
 
#define Maxn 200009
int _Stack[Maxn], top;
char s[Maxn];
int main() {
#ifdef Qrsikno
	freopen("c.in","r",stdin);
	freopen("c.out","w",stdout);
#endif
	scanf("%s", s);
	rep(i, 0, strlen(s) - 1) {
		if(s[i] == 'S') _Stack[++top] = 1;
		if(s[i] == 'T') _Stack[++top] = 2;
		if(top >= 2 && _Stack[top] == 2 && _Stack[top - 1] == 1)
			top -= 2;
	}
	printf("%d\n", top);
	return 0;
}

Measured memory_bytes: 1152
#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, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int N;
	cin >> N;
	vector<int> f(N + 1);
	FOR(i, 1, N + 1) {
		for (int j = i; j <= N; j += i) {
			f[j]++;
		}
	}
	ll res = 0;
	FOR(k, 1, N + 1) {
		res += (ll)k * f[k];
	}
	cout << res << endl;

	return 0;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    double a, b, x;
    cin >> a >> b >> x;

    double ans;

    if (a*a*b <= 2.0*x) {
        ans = atan2(2.0*(a*a*b-x)/(a*a), a);
    } else {
        ans = atan2(b, (2.0*x)/(a*b));
    }

    cout << fixed << setprecision(10) << ans * 180.0 / PI << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    int q;
    bool f = true;
    cin >> s >> q;

    deque<char> dq{};
    for (auto c: s){
        dq.push_back(c);
    }
    for(int i=0; i<q; i++){
        int t;
        cin >> t;
        if (t == 1){
            f = !f;
        } else {
            int x;
            char c;
            cin >> x >> c;
            (x == 1 && f || x == 2 && !f?dq.push_front(c) : dq.push_back(c));
        }
    }
    if(f){
        while(!dq.empty()){
            cout << dq.front();
            dq.pop_front();
        }
    }else{
        while(!dq.empty()){
            cout << dq.back();
            dq.pop_back();
        }
    }
    cout << endl;
}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int A1, A2, A3; 
	cin >> A1 >> A2 >> A3;
	int ans = max({A1, A2, A3}) - min({A1, A2, A3});
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
s=int(raw_input())
f=lambda x:(x/2)*(x%2==0)+(3*x+1)*(x%2==1)
r=[s]
map(lambda x:r.append(f(r[-1])),xrange(1,300))
for i in xrange(300,1,-1):
  try:
    s=r[:i].index(r[i])
    rs=i+1
  except:
    pass
print rs


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

vector<pair<long, long> > s;

int main(){
  long N;
  cin >> N;
  for(long i=1; i<=N; i++){
    long A; cin >> A;
    pair<long, long> p = make_pair(A, i);
    s.push_back(p);
  }
  sort(s.begin(), s.end());
  for(long i=0; i<N; i++){
    cout << s[i].second << ' ';
  }
  cout << endl;
  return 0;
}

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

#define     FasterIO        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     bug(a,b)        cout<<a<<"\t"<<b<<"\n";
#define     Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";
#define     precision(a,b)  fixed<<setprecision(a)<<b
#define     lp(i,a,b)       for(int i=a;i<b;i++)
#define     Endl            "\n"
#define     tab             "\t"
#define     reset(a,b)      memset(a,b,sizeof(a));
#define     sf(a)           scanf(" %d", &a);
#define     sfl(a)          scanf(" %lld", &a);
#define     srt(a)          sort(a.begin(),a.end());
#define     ALL(a)          a.begin(),a.end()
#define     pb(a)           push_back(a)
#define     pi              2*acos(0.0)

typedef long long int ll;
typedef unsigned long long int ull;

const int sz=1e5+9 , infP=INT_MAX , infN=INT_MIN ,mod=1e9+7, eps=1e-9;


void ini(){

    return;
}

int dp[3005][3005];

void solve(){
    ll n , m, k, l, r;
    string s,t,ans="";
    cin>>s>>t;
    n=s.size(),m=t.size();

    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i==0 || j==0){
                dp[i][j]=0;
                continue;
            }
            if(s[i-1]==t[j-1])dp[i][j]=dp[i-1][j-1]+1;
            dp[i][j]=max(dp[i][j],max(dp[i-1][j],dp[i][j-1]));
        }
    }

/*
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            cout<<dp[i][j]<<"  "; 
                 cout<<Endl;
    }*/

    int curI=n,curJ=m;
    while(curI>0 && curJ>0){
        if(dp[curI][curJ]==dp[curI-1][curJ]){
            curI--;
            continue;
        }
        if(dp[curI][curJ]==dp[curI][curJ-1]){
            curJ--;
            continue;
        }
        curI--,curJ--;
        ans+=s[curI];

    }

    reverse(ALL(ans));
    cout<<ans<<Endl;
}

int main(){
    FasterIO;
    #ifndef ONLINE_JUDGE
        freopen("input.in","r",stdin);
        freopen("output.in","w",stdout);
    #endif
    // ini();
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}


Measured memory_bytes: 38880
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	int n, m;
	cin >> n >> m;
	if (n==m) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define int long long
    using namespace std;
     
    signed main()
    {
            int N,M; cin>>N>>M;
            int ans;
            if(N>=2 and M>=2) ans=(N-2)*(M-2);
            else{
                    if(N==1 and M==1) ans=1;
                    else ans=max(N,M)-2;
            }
            cout<<ans<<endl;
    }

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <iomanip>

using namespace std;
typedef long long ll;
const int maxn=1e6+111;

int arr[maxn];
int dp[maxn];
int main(){
    int n;
    scanf("%d",&n);
    dp[1]=0;
    for(int i=1;i<=n;++i){
        scanf("%d",arr+i);
        if(i==2) dp[2]=abs(arr[2]-arr[1]);
        if(i>2){
            dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
        }
    }
    printf("%d\n",dp[n]);
    return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, k; cin >> n >> k;

    ll tmp = 1;

    ll cnt = 0;
    while(tmp <= n){
        cnt++;
        tmp *= k; 
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256