akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int ans;
int H , W;
char m[100][100];

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

void solve(int y, int x){
	char co = m[y][x];
	m[y][x] = '.';

	for (int i = 0; i < 4; i++){
		int ny = y + dy[i], nx = x + dx[i];
		if (m[ny][nx] == co&&ny >= 0 && ny < H&&nx >= 0 && nx < W){
			solve(ny, nx);
		}
	}
}

int main(){
	while (cin >> H >> W&&H + W){
		ans = 0;
		REP(i, H)REP(j, W)cin >> m[i][j];
		REP(i, H){
			REP(j, W){
				if (m[i][j] != '.'){
					solve(i, j);
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1632
A, A_v = map(int, input().split())
B, B_v = map(int, input().split())
Ts = int(input())

# AがBより常に左にいることにする
if A > B:
    A, B = B, A

if A + A_v * Ts >= B + B_v * Ts:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 9172
#include <cstdio>
int main() {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	bool judge = false;
	for (int i = 1; i <= b; i++) {
		if ((a*i) % b == c) judge = true;
	}
	if (judge) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    string s;
    cin >> s;
    ll K;
    cin >> K;
    ll after_day=5000000000000000;
    int ans=1;
    int size=s.size();
    if(size>K) size=K;
    for(int i=0; i<size; i++){
        if(s[i]!='1'){
            ans=int(s[i])-'0';
            break;
        }
    }
    cout << ans;
    return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    string s;cin >> s;
    vector<int> a(n+1, 0), b(n+1, 0);
    inc(i, 0, n){
        if(s[i] == 'E'){
            a[i+1] = a[i]+1;
            b[i+1] = b[i];
        }else{
            a[i+1] = a[i];
            b[i+1] = b[i]+1;
        }
    }
    int ans = n;
    inc(i, 0, n){
        //cout << a[i] << " " << a[n]-a[i+1] << "  ";
        //cout << b[i] << " " << b[n]-b[i+1] << endl;
        ans = min({ans, b[i]+a[n]-a[i+1]});
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

int main() {
  llong N, M;

  cin >> N >> M;
  if (N == M) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}

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

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

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

	int count = 0;
	for (int i = 0; i < n - 2; i++)
	{
		int min_num = min({ p.at(i),p.at(i + 1),p.at(i + 2) });
		int max_num = max({ p.at(i),p.at(i + 1),p.at(i + 2) });
		if (p.at(i + 1) != min_num && p.at(i + 1) != max_num)
		{
			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
#define VI vector<int>
#define VL vector<LL>
#define VII vector< vector<int> >
#define VLL vector< vector<LL> >
#define VS  vector<string>
#define VSS vector< vector<string> >
#define PII pair<int,int>
#define PIS pair<int,string>
#define PSI pair<string,int>
#define PLL pair<LL,LL>
const LL MOD = 1000000007;
const LL INF = 1e16;
LL facctorialMethod(int k);
int main(){
    LL n,x,t;
    cin >> n >> x >> t;
    LL n_make,n_time;
    n_make = (n / x);
    if(n%x > 0){
        n_make = 1 + n_make;
    }
//    cout << "n_make :" << n_make << endl;
    n_time = n_make * t;
    cout << n_time << endl;


    return 0;
}

LL facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i){
        sum *= i;
    }
    return sum;
}


Measured memory_bytes: 3564
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

template <class T, class T2>
void group(T &xs, vector<pair<int, T2> > &result) {
  int i=0, j;
  while (i<xs.size()) {
    j=i;
    while (j < xs.size() and xs[j] == xs[i]) j++;
    result.push_back({ j-i, xs[i] });
    if (j==i) i++;
    i=j;
  }
}

int main() {
  int n, k; cin >> n >> k;
  vector<int> A(n);
  loop(i,0,n) cin >> A[i];
  sort(A.begin(), A.end());
  vector<pair<int, int> > G;
  group(A, G);
  
  sort(G.begin(), G.end());
  int cnt = 0;
  int m = G.size();
  for (auto &&g: G) {
    if (m <= k) break;
    m--;
    cnt += g.first;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 6016
# coding: utf-8
import numpy as np
import math
a, b, h, m = map(int,input().split())

theta_long = (0.5 * ((h*60)+m) ) % 360
theta_short = (6 * m ) % 360

theta = min(abs(theta_long-theta_short),360-abs(theta_long-theta_short))
#print(theta)
#math.sin(math.radians(30))
x_2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(theta))

print(math.sqrt(x_2))

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


int main(){
  vector<int> prime;
  prime.push_back(2);
  for (int i = 3; i <= 100000; i += 2){
    for (int j = 0; j < prime.size(); j++){
      if (i % prime[j] == 0) break;
      if (j == prime.size() - 1) prime.push_back(i);
    }

  }
  int u[100001];
  for (int i = 0; i <= 100000; i++){
    u[i] = 0;
  }
  for (int i = 0; i < prime.size(); i++){
    u[prime[i]]++;
    if (prime[i] * 2 - 1  <= 100000) u[prime[i] * 2 - 1]++;
  }
  int s[100001];
  s[0] = 0;
  for (int i = 0; i < 100000; i++){
    s[i+1] = s[i] + (u[i+1] / 2);
  }

  int q, r, l;
  cin >> q;
  for (int i = 0; i < q; i++){
    scanf("%d %d", &l, &r);
    printf("%d\n", s[r] - s[l-1]);
  }

  return 0;
}

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

int main()
{
	int l;

	cin >> l;

	while (l) {
		int t = 0, r = -1;

		for (int i = 0; i < 12; i++) {
			int m, n;
			cin >> m >> n;

			t += m - n;

			if (t >= l && r < 0)
				r = i + 1;
		}

		if (r > 0)
			cout << r << endl;
		else
			cout << "NA" << endl;

		cin >> l;
	}

	return 0;
}


Measured memory_bytes: 3016
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int e = int.Parse(Console.ReadLine());
            int k = int.Parse(Console.ReadLine());

            if(e-a > k)
                Console.WriteLine(":(");
            else
                Console.WriteLine("Yay!");
        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
	  	Scanner scanner = new Scanner(System.in);
	  	int  a = scanner.nextInt();
	  	int  b = scanner.nextInt();
	  	int  c = scanner.nextInt();
        int  n = 0;
        
		for (int i = a ; i <= b; i ++) {
			if(c % i == 0)
    			n ++;
        }
        System.out.println(n);
        
        scanner.close();
  }
}


Measured memory_bytes: 26420
#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() {
  ll n, m;
  cin >> n >> m;
  vector<vector<int>> edges(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    edges.at(a).push_back(b);
    edges.at(b).push_back(a);
  }

  // 幅優先探索を行う
  queue<int> q;
  vector<bool> checked(n, false);
  vector<int> sign(n, -1);

  q.push(0);
  checked.at(0) = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int x : edges.at(u)) {
      if (checked.at(x)) continue;
      q.push(x);
      checked.at(x) = true;
      sign.at(x) = u;
    }
  }

  cout << "Yes" << endl;
  for (int i = 1; i < n; i++) {
    cout << sign.at(i) + 1 << endl;
  }
  return 0;
}

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

int main() {
    long long n;
    cin >> n;
    string s;
    while ( n > 0 ) {
        s = (char) ('a' + (n - 1) % 26) + s;
        n -= (n - 1) % 26;
        n /= 26;
    }
    cout << s << endl;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

const int MAXN = 1009;
int n,m,d;
int mat[MAXN][MAXN];
int ans[MAXN][MAXN];
int ADD;

int cal(int x,int y){
	if(x%2==1){
		if(y%2==1)
			return 1;
		else
			return 2;
	}
	else{
		if(y%2==1)
			return 3;
		else
			return 4;
	}
}

int locx(int x,int y){
	if((x+y-1)%d==0){
		return (x+y-1)/d;
	}
	else
		return (x+y-1)/d+1;
}

int locy(int x,int y){
	if((y-x+m)%d==0)
		return (y-x+m)/d;
	else
		return (y-x+m)/d+1;
}

void COLOR(){
	int i,j;
	for(i=1;i<=(n+m)/d+1;i++){
		for(j=1;j<=(n+m)/d+1;j++){
			mat[i][j]=cal(i,j);
		}
	}
}

void REMAP(){
	int i,j;
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			ans[i][j]=mat[locx(i,j)][locy(i,j)];
		}
	}
}

char GETCHAR(int x){
	if(x==1)return 'R';
	if(x==2)return 'G';
	if(x==3)return 'Y';
	if(x==4)return 'B';
}

void OUT(){
	int i,j;
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			printf("%c",GETCHAR(ans[j][i]));
		}
		puts("");
	}
}

void solve(){
	COLOR();
	REMAP();
	OUT();
}

int main(){
	scanf("%d%d%d",&n,&m,&d);
	solve();
	return 0;
}

Measured memory_bytes: 8320
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

  int a, b;
  cin >> a >> b;

  ll ans = lcm(a, b);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <functional>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

#define deg_to_rad(deg) (((deg)/360)*2*M_PI)

/*
二部探索で最適値を求める
(lo, hi) の間に最適値があるとする。
最大化のとき lo は必ず ok となる値とする。
最小化のとき hi は必ず ok となる値とする。
*/
double continuous_binary_search(
    double lo,
    double hi,
    function<bool(double)> is_ok,
    bool is_maximize,
    double eps
){
    while(hi - lo > eps){
        const double mid = (hi + lo) / 2.0;
        if(is_maximize){
            if(is_ok(mid)){
                lo = mid;
            }else{
                hi = mid;
            }
        }else{
            if(is_ok(mid)){
                hi = mid;
            }else{
                lo = mid;
            }
        }
    }
    return lo;
}


int main(){
    double a, b, x;
    cin >> a >> b >> x;

    double ans = continuous_binary_search(
        0, 90,
        [&](double mid) -> bool {
            const double rad = deg_to_rad(mid);
            const double rad2 = M_PI / 2 - rad;
            const double aheight = sin(rad) * a;
            const double bheight = sin(rad2) * b;
            double vol = 0;
            if(aheight >= bheight){
                const double aheight2 = bheight / cos(rad2);
                vol = aheight2 * a * b / 2.0;
            }else{
                const double y = aheight / tan(rad2);
                const double z = aheight / sin(rad2);
                vol = (
                    a * a * z / 2.0 + a * (a * cos(rad) + y) * (bheight - aheight)
                );
            }
            return (vol >= x);
        }, true, 1e-8
    );
    printf("%.8f\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <cstring>
using namespace std;
#define MAXH 101
#define MAXW 101
#define INF 1000
#define MAXN 100001

int X, Y, A, B, C;
int p[MAXN], q[MAXN], r[MAXN];

int main(){
    cin >> X >> Y >> A;
    printf("%d %d %d\n", A, X, Y);
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      int n; cin>>n;
      double a[n];
      for(int i = 0 ; i < n ; i++)
        cin>>a[i];
      sort(a,a+n);
      for(int i = 1; i < n ; i++)
      {
        a[0]+=a[i];
        a[0]/=2;
      }
      cout<<a[0]<<endl;
      
      return 0;
    }

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

using namespace std;

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

  int n, k;
  cin >> n >> k;
  vector<int> c(n), p(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
    --p[i];
  }
  for (int i = 0; i < n; ++i) cin >> c[i];
  long long ans = -1e18;
  for (int i = 0; i < n; ++i) {
    int j = i, cnt = 0;
    long long cur = 0;
    vector<long long> pr = {0};
    do {
      cur += c[p[j]];
      pr.push_back(cur);
      ans = max(ans, cur);
      j = p[j];
      ++cnt;
    } while (j != i and cnt < k);
    if (k / cnt) {
      for (int it = 1; it <= cnt; ++it) {
        ans = max(ans, (k / cnt - 1) * cur + pr[it]);
      }
    }
    for (int it = 0; it <= k % cnt; ++it) {
      if (it or (k / cnt)) {
        ans = max(ans, (k / cnt) * cur + pr[it]);
      }
    }
  }
  cout << ans;

  return 0;
}


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

#define ll long long int
#define absdiff(a,b) (a>b)?a-b:b-a
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define endl "\n"
const ll ll_MAX = 19223372036859;
const ll MOD = 1000000007;
ll fast_expo(ll x,ll p){if(p==0) return 1;
    else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} 
    else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
ll gcd(ll a,ll b){if(a==0||b==0) return a+b;  
    else return gcd(b%a,a); }

int main()
{
    ll t_c; t_c = 1;
    // cin >> t_c;
    for(ll t_i=0; t_i<t_c; ++t_i){
        ll n; cin >> n;
        ll mat[n][n];
        for(ll i=0; i<n; ++i){
            for(ll j=0; j<n; ++j)
                cin >> mat[i][j];
        }

        ll dp[1ll<<n]{};
        dp[0] = 1;
        for(ll i=0; i<(1ll<<n); ++i){
            ll cnt = 0,temp = i;
            while(temp){
                cnt++;
                temp = temp&(temp-1);
            }
            for(ll j=0; j<n; ++j){
                if(((i&(1ll<<j)) == 0) && mat[cnt][j] == 1){
                    dp[i|(1ll<<j)] = (dp[i|(1ll<<j)]+dp[i])%MOD;
                }
            }
        }
        cout << dp[(1ll<<n)-1];
    }   
    return 0;
}

Measured memory_bytes: 16640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep1(k,n){
        string str = to_string(k);
        if(str.size()%2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3780
a = int(input())
wordli = dict()
go = True
for i in range(a):
	word = input()
	if i == 0:
		wordli[word] = 1
		temp = word
	else:
		if word not in wordli and word[0] == temp[-1]:
			wordli[word] = 1
			temp = word
		else:
			print ('No')
			go = False
			break

if go == True:
	print ('Yes')

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

using namespace std;
typedef long long ll;

int solve1(int x, int y){
    int ans = INT_MAX;
    if(x < y){
        ans = abs(y-x);
    }
    int tmp = 0;
    if(abs(x) >= abs(y)){
        if(x > 0){
            tmp++;
            tmp += abs(abs(x) - abs(y));
            if(y > 0) tmp++;
        }
        else{
            tmp += abs(abs(x) - abs(y));
            if(y > 0) tmp++;
        }
    }
    else{
        if(x < 0){
            tmp++;
            tmp += abs(abs(x) - abs(y));
            if(y < 0) tmp++;
        }
        else{
            tmp = abs(abs(x)-abs(y));
            if(y < 0) tmp++;
        }
    }

    ans = min(ans, tmp);
    return ans;
}

// 何回か押す -> 最後に押すか決めるのパターン
int solve2(int x, int y){
    int ans = INT_MAX-1;
    if(x <= -abs(y)){
        ans=min(ans, abs(-abs(y)-x) + (y > 0));
    }
    if(x <= abs(y)){
        ans=min(ans, abs(abs(y)-x) + (y < 0));
    }
    return ans;
}

int main(){

    int x, y;
    cin >> x >> y;
    cout << min(solve2(x,y), solve2(-x,y)+1) << endl;

    return 0;
}


Measured memory_bytes: 256
while line = gets do
  x1, y1, x2, y2, x3, y3, xp, yp = line.split.map(&:to_f)
  gx = (x1 + x2 + x3) / 3.0
  gy = (y1 + y2 + y3) / 3.0
  def c(x1, y1, x2, y2, x, y)
      (y2 - y1) * (x - x1) - (x2 - x1) * (y - y1)
  end
  s1 = c(x1, y1, x2, y2, gx, gy) * c(x1, y1, x2, y2, xp, yp)
  s2 = c(x2, y2, x3, y3, gx, gy) * c(x2, y2, x3, y3, xp, yp)
  s3 = c(x3, y3, x1, y1, gx, gy) * c(x3, y3, x1, y1, xp, yp)
  if s1 > 0 && s2 > 0 && s3 >0 then
    puts "YES"
  else
    puts "NO"
  end
end

Measured memory_bytes: 6144
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] list = str.split(" ");
		int a = Integer.parseInt(list[0]);
		int b = Integer.parseInt(list[1]);
		int c = Integer.parseInt(list[2]);

		if( (a+b) == c){
			System.out.print("Yes");
		}else if( (b+c) == a){
			System.out.print("Yes");
		}else if( (c+a) == b){
			System.out.print("Yes");
		}else{
			System.out.print("No");
		}

	}

}


Measured memory_bytes: 20692
void main() {
	alias Edge = Tuple!(int, "s", int, "g");
	auto ip = readAs!(int[]), N = ip[0], M = ip[1];
	ulong cnt;
	Edge[] edges;

	foreach(i; 0..M) {
		auto ip2 = readAs!(int[]), a = ip2[0], b = ip2[1];
		edges ~= Edge(a-1, b-1);
	}

	/*
		それぞれの辺について、実際に一本ずつ抜いてみる。
		その辺の始点と終点がつながっていない場合、その辺は橋。
	*/

	foreach(i; edges) {
		auto uft = new UnionFind!int(N);
		foreach(j; edges) {
			if(i!=j) uft.unite(j.s, j.g);
		}
		if(!uft.same(i.s, i.g)) cnt++;
	}
	cnt.writeln;
}

class UnionFind(T) {
	T[] arr;
	this(ulong n) {
		arr.length = n;
		arr[] = -1;
	}
	T root(T x) {
		return arr[x] < 0 ? x : root(arr[x]);
	}
	bool same(T x, T y) {
		return root(x) == root(y);
	}
	bool unite(T x, T y) {
		x = root(x);
		y = root(y);
		if(x == y) return false;
		if(arr[x] > arr[y]) swap(x, y);
		arr[x] += arr[y];
		arr[y] = x;
		return true;
	}
	T size(T a) {
		return -arr[root(a)];
	}
}


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

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main() {
	int H, W;
	cin >> H >> W;
	vector<vector<char>> Map(H, vector<char>(W));
	for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> Map[i][j];
	long long now = 0, ans = 0;
	while (now < H * W) {
		long long black = 0, white = 0;
		queue<pair<long long, char>> Q;
		Q.push({ now,  (Map[now / W][now % W] == '#' ? '.' : '#') });
		while (!Q.empty()) {
			auto p = Q.front();
			int y = p.first / W, x = p.first % W;
			char before = p.second;
			Q.pop();
			if (Map[y][x] == 'x' || Map[y][x] == before) continue;
			(Map[y][x] == '.' ? white : black)++;
			before = Map[y][x];
			Map[y][x] = 'x';
			if (y > 0 && Map[y - 1][x] != 'x') Q.push({ y * W + x - W, before });
			if (y < H - 1 && Map[y + 1][x] != 'x') Q.push({ y * W + x + W, before });
			if (x > 0 && Map[y][x - 1] != 'x') Q.push({ y * W + x - 1, before });
			if (x < W - 1 && Map[y][x + 1] != 'x') Q.push({ y * W + x + 1, before });
		}
		ans += black * white;
		while (now < H * W && Map[now / W][now % W] == 'x') now++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
N, M = map(int, input().split())
student = [list(map(int, input().split())) for _ in range(N)]
cp = [list(map(int, input().split())) for _ in range(M)]

idou = []
for a, b in student:
  idousaki = -1
  nearest = 1000000000
  for i, xy in enumerate(cp):
    d = abs(xy[0]-a) + abs(xy[1]-b)
    if d < nearest:
      nearest = d
      idousaki = i+1
      
  idou.append(idousaki)
  
for i in idou:
  print(i)


Measured memory_bytes: 3064
#include<cstdio>
#include<queue>
#include<vector>
#include<iostream>
using namespace std;
int d[10005], visited[10005];
vector<pair<int, int>> G[10005];
int n, INFTY = (1<<30);
priority_queue<pair<int, int>> Q;
void dijkstra()
{
  for(int i=0; i<n; i++)
  {
    d[i] = INFTY; visited[i] = 0;
  }
  d[0] = 0;
  Q.push(make_pair(0, 0));
  while(!Q.empty())
  {
    int c = Q.top().first;
    int v = Q.top().second;
    Q.pop();
    //if(d[v] < -c) break;
    visited[v] = 1;
    for(int i=0; i<G[v].size(); i++)
    {
      pair<int, int> p = G[v][i];
      int u = p.second, cost = p.first;
      if(visited[u]==0 && d[u] > cost + d[v])
      {
        d[u] = cost + d[v];
        Q.push(make_pair(-d[u], u));
      }
    }
  }
  for(int i=0; i<n; i++)
  {
    printf("%d %d\n", i, d[i]);
  }
}
int main()
{
  scanf("%d", &n);
  int u, v, c, k;
  for(int i=0; i<n; i++)
  {
    scanf("%d%d", &u, &k);
    for(int j=0; j<k; j++)
    {
      scanf("%d%d", &v, &c);
      G[u].push_back(make_pair(c, v));
    }
  }
  dijkstra();
  return 0;
}



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

using ll = long long;

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

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

int main() {
    ll N;  cin >> N;
    cout << lcm(2, N) << endl;
}


Measured memory_bytes: 3592
class BinaryTree:
    class Node:
        def __init__(self, num, left_child, right_child):
            self.id = num
            self.left_child = left_child
            self.right_child = right_child
            
    def __init__(self, n):
        self.nodes = [None] * n
        self.root_id = int(n * (n - 1) / 2)

    def add_node(self, i_s):
        num, left_child, right_child = map(int, i_s.split())
        self.nodes[num] = BinaryTree.Node(num, left_child, right_child)
        if left_child != -1:
            self.root_id -= left_child
        if right_child != -1:
            self.root_id -= right_child

    def preorder_walk(self):
        print('Preorder')
        root_node = self.nodes[self.root_id]
        def _pre_walk(node):
            print(' {0}'.format(node.id), end = '')
            if node.left_child != -1:
                _pre_walk(self.nodes[node.left_child])
            if node.right_child != -1:
                _pre_walk(self.nodes[node.right_child])
        _pre_walk(root_node)
        print('')

    def inorder_walk(self):
        print('Inorder')
        root_node = self.nodes[self.root_id]
        def _in_walk(node):
            if node.left_child != -1:
                _in_walk(self.nodes[node.left_child])
            print(' {0}'.format(node.id), end = '')
            if node.right_child != -1:
                _in_walk(self.nodes[node.right_child])
        _in_walk(root_node)
        print('')

    def postorder_walk(self):
        print('Postorder')
        root_node = self.nodes[self.root_id]
        def _post_walk(node):
            if node.left_child != -1:
                _post_walk(self.nodes[node.left_child])
            if node.right_child != -1:
                _post_walk(self.nodes[node.right_child])
            print(' {0}'.format(node.id), end = '')
        _post_walk(root_node)
        print('')


n = int(input())

BT = BinaryTree(n)

for i in range(n):
    BT.add_node(input())

BT.preorder_walk()
BT.inorder_walk()
BT.postorder_walk()

Measured memory_bytes: 7744
#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>
//#define LOCAL
#define be(n) n.begin(), n.end()
using namespace std;
typedef long long ll;
set<ll>a, b;


int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll n;
cin>>n;
for(ll i=0;i<n;i++){
    ll v;
    cin>>v;
    a.insert(v);
}

ll m;
cin>>m;
for(ll i=0;i<m;i++){
    ll v;
    cin>>v;
    b.insert(v);
}
set<ll>c;
set_union(be(a), be(b), inserter(c, c.begin()));
for(set<ll>::iterator it=c.begin();it!=c.end();it++){
    cout<<*it<<endl;
}

#ifdef LOCAL
fin.close();
#endif // LOCAL
}



Measured memory_bytes: 40572
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <algorithm>
#include <functional>
#include <assert.h>
#include <iomanip>
using namespace std;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
typedef long long ll;

int main() {
    int n, T;
    while(~scanf("%d %d", &n, &T)) {
        int ans = INF;
        for(int i = 0; i < n; ++i) {
            int c, t;
            scanf("%d %d", &c, &t);
            if(t <= T) {
                ans = min(ans, c);
            }
        }

        if(ans == INF) printf("TLE\n");
        else printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

ll N;
//---------------------------------------------------------------------------------------------------
void labo(int n) {
    vector<int> v;
    rep(i, 0, n) v.push_back(i + 1);
    do {
        int tot = 0;
        rep(i, 0, n) tot += (i + 1) % v[i];
        printf("%d", tot);
        rep(i, 0, n) printf(" %d", v[i]);
        printf("\n");
    } while (next_permutation(all(v)));
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    ll ans = (N - 1) * N / 2;
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 100001
using namespace std;
typedef long long ll;
ll n,A[N],B[N];
int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>A[i]>>B[i];
    
  ll ans=0;
  for(int i=n-1;i>=0;i--)ans+=(B[i]-(A[i]+ans)%B[i])%B[i];
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1792
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());

    let (n, a, b): (usize, usize, usize) = (io.read(), io.read(), io.read());
    let mut cmb = 1i64;
    let mut nca = 0i64;

    for i in 1..b + 1 {
        cmb *= (n - i + 1) as i64;
        cmb %= MOD;
        cmb *= mod_inv(i as i64, MOD);
        cmb %= MOD;
        if i == a {
            nca = cmb;
        }
    }
    io.writeln((mod_pow(2, n as i64, MOD) - 1 - cmb - nca + 2 * MOD) % MOD);
}
fn mod_inv(a: i64, m: i64) -> i64 {
    let (_, x, _) = extgcd(a as i64, m as i64);
    ((m as i64 + x) as i64 % m) % m
}
fn extgcd(a: i64, b: i64) -> (i64, i64, i64) {
    if b == 0 {
        (a, 1, 0)
    } else {
        let (gcd, x, y) = extgcd(b, a % b);
        (gcd, y, x - (a / b) * y)
    }
}
fn mod_pow(x: i64, n: i64, m: i64) -> i64 {
    let mut res = 1;
    let mut x = x % m;
    let mut n = n;
    while n > 0 {
        if n & 1 == 1 {
            res = (res * x) % m;
        }
        x = (x * x) % m;
        n >>= 1;
    }
    res
}

static MOD: i64 = 1000000007;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  if (a-b == b-c)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define INF 2e9
#define IMAX 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long llong;

// AGC041-B
int main()
{
	llong N, M, V, P;
	cin >> N >> M >> V >> P;
	int A[N] = {};

	REP(idx, N) {
		cin >> A[idx];
	}
	sort(A, A + N);

	llong border = A[N-P];

	llong under = border;
	llong alldif = 0;
	llong limitdif = M * (N-V);
	llong ans = N;
	for (llong idx = N-P-1; idx >= 0; idx--) {
		if (A[idx] < under) {
			if (border - A[idx] > M) {
				ans = N - idx - 1;
				break;
			}
			alldif += (under - A[idx]) * (N-P-idx);
			under = A[idx];
			if (alldif > limitdif) {
				ans = N - idx - 1;
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
var
	a,b,c,f:int64;
	n,i:Longint;
begin
	read(n);
	for i:=1 to n do begin
		read(a,b);
		c:=trunc(sqrt(a*b));
		if a<>b then f:=1 else f:=0;
		writeln((a*b-f)div c+c-2);
	end;
end.


Measured memory_bytes: 128
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

class Dinic:
    def __init__(self,v, inf =10**10):
        self.v = v
        self.inf = inf
        self.G = [[] for _ in range(v)]
        self.level = [-1]*v
        self.ite = [0]*v
    def add_edge(self, fr, to, cap):
        self.G[fr].append([to,cap,len(self.G[to])])
        self.G[to].append([fr,0,len(self.G[fr])-1])
    def bfs(self,s):
        self.level = [-1]*self.v
        self.level[s] = 0
        Q = deque()
        Q.append(s)
        while Q:
            v = Q.popleft()
            for i in range(len(self.G[v])):
                e = self.G[v][i]
                if e[1]>0 and self.level[e[0]]<0:
                    self.level[e[0]] = self.level[v]+1
                    Q.append(e[0])

    def dfs(self,v,t,f):
        if v==t:
            return f
        for i in range(self.ite[v],len(self.G[v])):
            self.ite[v] = i
            e = self.G[v][i]
            if e[1]>0 and self.level[v]<self.level[e[0]]:
                d = self.dfs(e[0],t,min(f,e[1]))
                if d>0:
                    e[1] -= d
                    self.G[e[0]][e[2]][1] += d
                    return d
        return 0

    def max_flow(self,s,t):
        flow = 0
        while True:
            self.bfs(s)
            if self.level[t]<0:
                return flow
            self.ite = [0]*self.v
            f =self.dfs(s,t,self.inf)
            while f>0:
                flow+= f
                f = self.dfs(s,t,self.inf)

V, E = MAP()
D = Dinic(V)
for _ in range(E):
	u, v, c = MAP()
	D.add_edge(u, v, c)
ans = D.max_flow(0, V-1)
print(ans)



Measured memory_bytes: 7280
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;

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

int main(){
	int N,A,r;
	cin>>N>>A;
	r=N%500;
	if(A>=r)cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256
def printYN(c): print("Yes") if c else print("No")


n, m = [int(w) for w in input().split()]
a = [int(w) for w in input().split()]
total = sum(a)

choice = [t for t in a if t >= total / (4 * m)]
# print([t for t in a if t >= total / (4 * m)])

printYN(len(choice) >= m)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
 
#define ll unsigned long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define mod 1000000007
#define inf 9999999999999999ll
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    vi a(n);
    for(ll i=0;i<n;i++)
        cin>>a[i];
    sort(a.rbegin(),a.rend());
    ll sum=0;
    for(ll i=0;i<min(n,k);i++)
    {
        a[i]=0;
    }
    for(ll i=0;i<n;i++)
    {
        sum+=a[i];
    }
    cout<<sum<<"\n";
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct P {
    bool operator<(const P &p) const {
        return b < p.b;
    }
    int a, b;
};

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

    int n, m;
    cin >> n >> m;

    vector<P> p(n);
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        p[i] = { a, b };
    }
    sort(p.begin(), p.end(), [&](const P &p0, const P &p1) {
        return p0.a < p1.a;
    });

    priority_queue<P> pq;

    int r = 0, i = 0;
    for (int j = 1; j <= m; j++) {
        while (i < n && p[i].a <= j) pq.push(p[i++]);
        if (pq.empty()) continue;
        P t = pq.top(); pq.pop();
        r += t.b;
    }

    cout << r << endl;

    return 0;
}

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

using namespace std;

const long long int MOD=1e9+7;

struct z_o {
    long long int zero_num;
    long long int one_num;
};

int main() {
    int N;
    cin >> N;
    vector<long long int> A(N);
    vector<z_o> count;
    z_o init={0, 0};
    count.assign(60, init);
    for(int n=0; n<N; n++) {
        cin >> A[n];
        for(int i=0; i<60; i++) {
            if(A[n] & ((long long int)1<<i)) {
                count[i].one_num++;
            } else {
                count[i].zero_num++;
            }
        }
    }
    
    long long int ans=0;
    for(int n=0; n<N; n++) {
        for(int i=0; i<60; i++) {
            if(A[n] & ((long long int)1<<i)) {
                ans += (count[i].zero_num * (((long long int)1<<i)%MOD))%MOD;
                ans %= MOD;
            } else {
                ans += (count[i].one_num * (((long long int)1<<i)%MOD))%MOD;
                ans %= MOD;
            }
        }
    }
    
    ans %= MOD;
    
    if(ans%2!=0) {
        ans += MOD;
    }
    cout << (ans/2)%MOD << endl;


    return 0;
    
}

Measured memory_bytes: 2560
package main

import "fmt"

func main() {
    var n int
    fmt.Scan(&n)
    b := 0.0
    for i := 0; i < n; i ++ {
        var a int
        fmt.Scan(&a)
        b += 1.0 / float64(a)
    }
    fmt.Println(1.0 / b)
}


Measured memory_bytes: 512
/**
*    created: 17.05.2020 21:02:58
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int inf =1000000000;

int main() {
    int k;
    cin >> k;
    string s;
    cin >> s;
    int n = s.size();
    if(n<=k){
        cout << s << endl;
    }else{
       // cout << 11 << endl;
        string ans;
       // cout << "k+3:" <<k+3<< endl;
        /*rep(i,k+3){
            if(i<=k-1)
                ans[i] = s[i];
            else
                ans[i] = '.';
            cout << i << endl;
        }*/
        ans = s.substr(0, k);
        ans += "...";
        //rep(i, ans.size()) cout << ans[i];
        //cout << endl;
        cout << ans << endl;
    }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using vi = vector<int>;
using vll = vector<ll>;
ll fast_exp(ll base,ll e){
    ll r=1;
    while(e>0){
        if(e%2)r=(r*base);
        base=base*base;
        e/=2;
    }
    return r;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    vector<vi> matrix(n,vi(3,0));
    for(int i=0;i<n;i++)for(int j=0;j<3;j++)cin>>matrix[i][j];
    vector<vi> dp(n,vi(3,0));
    dp[0][0]=matrix[0][0];dp[0][1]=matrix[0][1];dp[0][2]=matrix[0][2];
    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
            if(j==0){
                dp[i][j]+=matrix[i][j];
                dp[i][j]+=max(dp[i-1][1],dp[i-1][2]);
            }
            else if(j==1){
                dp[i][j]+=matrix[i][j];
                dp[i][j]+=max(dp[i-1][0],dp[i-1][2]);
            }
            else if(j==2){
                dp[i][j]+=matrix[i][j];
                dp[i][j]+=max(dp[i-1][0],dp[i-1][1]);
            }
        }
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;

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 ll long long
#define pll pair<ll, ll>
using namespace std;
const ll maxn = 1e6 + 7;
const ll mod = 1e9 + 7;
ll a[maxn], q, t, n, m, k, ans;
priority_queue<ll> pr;
void sol()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i ++)
    {
        cin >> k;
        pr.push(k);
    }
    for(int i = 1; i <= m; i ++)
    {
        t = pr.top();
        pr.pop();
        pr.push(t / 2);
    }
    ans = 0;
    while(!pr.empty())
    {
        ans += pr.top();
        pr.pop();
    }
    cout << ans;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    sol();
}


Measured memory_bytes: 1400
N = int(raw_input())
count = 0

A_str = raw_input().split()
A = map(int, A_str)

def merge(left, right):
    global count
    sorted_list = []
    l_index = 0
    r_index = 0

    while l_index < len(left) and r_index < len(right):
        count += 1
        if left[l_index] <= right[r_index]:
            sorted_list.append(left[l_index])
            l_index += 1
        else:
            sorted_list.append(right[r_index])
            r_index += 1

    if len(left) != l_index:
        sorted_list.extend(left[l_index:])
        count += len(left[l_index:])
    if len(right) != r_index:
        sorted_list.extend(right[r_index:])
        count += len(right[r_index:])

    return sorted_list 

def mergeSort(A):
    
    if len(A) <= 1:
        return A

    mid = len(A) // 2
    left = A[:mid]
    right = A[mid:]

    left = mergeSort(left)
    right = mergeSort(right)

    return list(merge(left, right))

print ' '.join(map(str, mergeSort(A)))
print count

Measured memory_bytes: 90728
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int a, b, c;
  int k;
  int f;
  int max;
	
	cin >> a >> b >> c;
  cin >> k;
	
  for (int i = 0; i < k; i++) {
    max = a;
    f = 1;
    if (max < b) {
      max = b;
      f = 2;
    }
    if (max < c) {
      max = c;
      f = 3;
    }

    if (f == 1) {
      a *= 2;
    }
    else if (f == 2) {
      b *= 2;
    }
    else {
      c *= 2;
    }
  }


  cout << a + b + c << endl;

	return 0;
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    ll countEven = 0, countOdd = 0;
    REP(i, N)
    {
        ll a;
        cin >> a;
        if (a % 2 == 0)
        {
            countEven++;
        }
        else
        {
            countOdd++;
        }
    }
    
    string ans;
    if (countOdd % 2 == 0)
    {
        ans = "YES";
    }
    else
    {
        ans = "NO";
    }
    

    cout << ans << endl;
}


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

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

  string s;

  cin >> s;

  int count = 0;
  for (int i = 0; i < 3; i++) {
    count += s[i] == '1' ? 1 : 0;
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");

        for (int i = 0; i < 3; i++) {
            if (n[i].equals("1")) n[i] = "9";
            else if (n[i].equals("9")) n[i] = "1";
        }

        System.out.println(String.format("%s%s%s", n[0], n[1], n[2]));
    }
}

Measured memory_bytes: 26960
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-02-22 21:00:09
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

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

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

    return 0;
}


Measured memory_bytes: 256