akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
typedef long long   ll;
typedef long double ld;
const int N  = 5e5+10;
const ll mod = 1e9+7;
const ll inf = 1e18;
 
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr) 
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define iceil(n,x)      ((n)+(x)-1)/(x)
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;    }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll modinv(ll n)    { ll ans=powm(n,mod-2); return ans; }
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }
ll choose2(ll n)   { ll ans=(n*(n-1))/2; return ans;  }
ll dist2(ll x1,ll y1,ll x2,ll y2){ ll ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return ans;}

vector<ll>g[N];
ll cnt[N];
ll ans[N];

void dfs(ll v,ll par)
{
	for(auto u:g[v])
	{
		if(u==par)
			continue;
		ans[u]+=ans[v];
		dfs(u,v);
	}
}

int main()
{
	fast
	ll n,q;
	cin>>n>>q;

	ll a,b;

	forn(i,0,n-1)
	{
		cin>>a>>b;
		g[a].pb(b);
		g[b].pb(a);
	}
	ll p,x;
	forn(i,0,q)
	{
		cin>>p>>x;
		cnt[p]+=x;
	}
	forn(i,1,n+1)
		ans[i]=cnt[i];
	dfs(1,-1);
	forn(i,1,n+1)
	cout<<ans[i]<<" ";

	return 0;
}

Measured memory_bytes: 36864
from collections import defaultdict


def get_divisor(n: int) -> list:
    divisor = []
    for i in range(1, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            divisor.append(i)
            if n // i != i:
                divisor.append(n // i)
    # divisor.sort() # if you want sorted divisors
    return divisor


n = int(input())

d0 = get_divisor(n)
ans0 = 0  # n自身
for di in d0:
    if di == 1:
        continue
    x = n // di
    while x % di == 0:
        x = x // di
    if x % di == 1:
        # print(di)
        ans0 += 1

d1 = get_divisor(n - 1)
ans1 = len(d1) - 1

ans = ans0 + ans1
# print(n - 1, ':', d1)
# print(n, ':', d0)
print(ans)


Measured memory_bytes: 3564
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var str = IO.GetIntList();
            var ans = str.Sum() > 21 ? "bust" : "win";
            Console.WriteLine(ans);
        }

    }

    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13268
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)


function main()
    N = readline() |> parseInt
    count = 0
    for i in 1:N
        if i%5!=0 && i%3!=0
            count += i
        end
    end
    println(count)
end

main()

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


int BSort(int A[], int N) {
  int i, j, cnt;
  bool flag;
  cnt =0;
  flag = 1;
  for(i=0; flag; i++){
      flag = 0;
      for(j = N-1; j > i; j--){
        if(A[j] < A[j-1]){
          swap(A[j], A[j-1]);
          flag = 1;
          cnt++;
        }
      }
    }

    return cnt;
  }

int main(){
  int cnt, N, A[100];
  
  cin >> N;
  for(int i=0; i<N; i++) {cin >> A[i];}

  cnt = BSort(A, N);
  
  for(int i = 0; i < N; i++){
    cout << A[i];
    if(i != N-1){
      cout << " "; }
    }
      cout << endl;
    cout << cnt << endl;
  }

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	string ans="Yes";
	for(int i=0;i<a.length();i++)
	{
		if(a[i]!=b[i])
		{
			ans="No";
			break;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
signed main(){
	
	int n,v[1111],c[1111];
	cin>>n;
	int ans=0;
	rep(i,n)cin>>v[i];
	rep(i,n)cin>>c[i];
	rep(i,n){
		if(v[i]>c[i])ans+=v[i]-c[i];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    lli n;
    cin>>n;
    lli i,a[n],b[n];
    
    for(i=0;i<n;i++) cin>>a[i]>>b[i];
    sort(a,a+n);
    sort(b,b+n);
    
    if(n%2) cout<<b[n/2]-a[n/2]+1;
    else    cout<<b[n/2-1]+b[n/2]-a[n/2-1]-a[n/2]+1;
    return 0;
}

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

int main()
{
int a,b;
scanf("%d%d",&a,&b);
int i=0;
int mini=0;
if(b==1)
    i=0;
else
{

while(mini < b)
{
    i++;
    mini=a*i;
    mini=mini-(i-1);

}}
printf("%d\n",i);
}


Measured memory_bytes: 128
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
d = [0] * (10 ** 5 + 1)
for x in a:
    d[x] += 1
q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    s += (c - b) * d[b]
    d[c] += d[b]
    d[b] = 0
    print(s)


Measured memory_bytes: 83392
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


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

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

    auto gcd = [&](int a, int b) {
        while (a != 0) {
            b %= a;
            swap(a, b);
        }
        return b;
    };

    auto g = gcd(a, b);

    for (int i = g, j = 0; i > 0; --i) {
        if (g % i == 0) {
            if (++j == k) {
                cout << i << "\n";
                break;
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 384
//CODEFORCES:-
    //coded by AMAN BHARTI NIT PATNA
    //ECE 2K18
    #include<bits/stdc++.h>
    using namespace std;

    //#define home
    #define TASK "soln"
    #define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
    #define pb push_back
    #define pp pop_back
    #define ll long long int
    #define ull unsigned long long
    #define br cout<<endl;
    #define fo for(int i=0;i<n;i++)
    #define foo for(int i=1;i<=n;i++)
    #define rep(i,a,n) for(int i=a;i<n;i++)
    #define mod 1000000007
    ll gcd(ll a,ll b);
    ll power(ll a,ll b);
    ll powerwithmod(ll a,ll b);
    ll nCr(ll n,ll r);
    ll fact(ll n);


    void solve(){
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        ll ans1 = max(a*c,b*d);
        ll ans2 = max(a*d,b*c);
        ll ans = max(ans1,ans2);
        cout<<ans;
        br;
    }

    int main(){
         #ifdef home
            assert(freopen(TASK".in","r",stdin));
            assert(freopen(TASK".out","w",stdout));
        #endif

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

        // int t;
        // cin>>t;
        // while(t-->0)
        solve();

        #ifdef home
            eprintf("Time: %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
        #endif

        return 0;
    }

    ll gcd(ll a,ll b) {if(b==0)return a;return gcd(b,a%b);}
    ll powerwithmod(ll a,ll b) {ll res=1;while(b>0){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return res%mod;}
    ll power(ll a,ll b) {ll res=1;while(b>0){if(b&1)res=(res*a);a=(a*a);b>>=1;}return res;} 
    ll nCr(ll n, ll r){return fact(n) / (fact(r) * fact(n - r));} 
    ll fact(ll n){ll res = 1;for(ll i = 2; i <= n; i++)res = res * i;return res;}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
void fun(vector<int> h,int N,int K){
	vector<int> memo(N);
	memo[0]=0;
	memo[1]=abs(h[0]-h[1]);
	for(int i=2;i<N;i++){
		memo[i]=abs(h[i]-h[i-1])+memo[i-1];
		for(int j=2;j<=K;j++){
			if(i-j<0){
				break;
			}
			memo[i]=min(memo[i],memo[i-j]+abs(h[i]-h[i-j]));
		}
		
	}
	cout<<memo[N-1]<<endl;
	
}
int main(){
	int N,K;
	cin>>N>>K;
	vector<int> h(N);
	for(int i=0;i<N;i++){
		cin>>h[i];
	}
	fun(h,N,K);
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

int main(){
	vector<int> v;
	v.push_back(1);
		v.push_back(2);
			v.push_back(3);
	int a,b;cin>>a>>b;
	for(int x:v)
	if(x!=a&&x!=b)cout<<x;
}

Measured memory_bytes: 888
require 'pp'

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

A, B, C, D = gets_i_list
E = C.lcm(D)

total = 0
total += (B / C) - ((A-1) / C)
total += (B / D) - ((A-1) / D)
total -= (B / E) - ((A-1) / E)

n = B - A + 1
# m = (B/C + B/D - B/E) - ((A-1)/C + (A-1)/D - (A-1)/E)
puts n - total


Measured memory_bytes: 2172
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>
#include <ctime>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define sys system("pause")
#define ls rt<<1
#define rs rt<<1|1
const int maxn=3e2+10;
const int N=2e5+10;
using namespace std;
int id(int l,int r){return l+r|l!=r;}
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}
int n,m,k,t;
void add(ll &x,ll y){x+=y;if(x>=mod)x-=mod;}
ll dp[2][maxn][maxn];
vector<pii>qu[maxn];
int main()
{
    int i,j;
    scanf("%d%d",&n,&m);
    rep(i,1,m)
    {
        int x,y,z;
        scanf("%d%d%d",&x,&y,&z);
        qu[y].pb(mp(x,z));
    }
    dp[0][0][0]=1;
    int now=0;
    rep(i,1,n)
    {
        now^=1;
        memset(dp[now],0,sizeof(dp[now]));
        rep(j,0,i-1)
        {
            rep(k,0,i-1)
            {
                add(dp[now][j][k],dp[now^1][j][k]);
                add(dp[now][i-1][j],dp[now^1][j][k]);
                add(dp[now][i-1][k],dp[now^1][j][k]);
            }
        }
        rep(j,0,i-1)
        {
            rep(k,0,i-1)
            {
                for(auto x:qu[i])
                {
                    int li=x.fi,cnt=x.se;
                    int num=1;
                    if(j>=li)num++;
                    if(k>=li)num++;
                    if(num!=cnt)dp[now][j][k]=0;
                }
            }
        }
    }
    ll ret=0;
    rep(i,0,n-1)rep(j,0,n-1)add(ret,dp[now][i][j]);
    printf("%lld\n",ret);
    return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
int main(void){
  int r,d,x;
  cin >> r >> d >> x;
  int ans = x;
  rep(i,10){
    ans = (r * ans) - d;
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;

using ll = long long;

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

const double EPS = 1e-5;
const int MOD = 1e9+7;

const int N = 1e3;
int p[N]; //backet

int n;

int prime_judge(int num){
  //numが2であった場合
  if(num == 2){
    return 1;
  }

  //numが偶数であった場合
  if(num % 2 == 0){
    return 0;
  }

  //numが奇数であった場合
  for(int j = 3; j < sqrt(num); j = j + 2){
    if(num % j == 0){
      return 0;
    }
  }
  return 1;
}


int main(){
  int n;
  ll res = 1;

  cin >> n;
  //2 ~ nについて
  rep(i,2,n+1){
    //それ以下の数の素数を求める
    int j = 2;
    int num = i;
    while(num > 1){
      if(num % j == 0){
        if(prime_judge(j) == 1){
          p[j]++;
          num = num / j;
          //cout << num << endl;
        }
      }else{
        j++;
      }
    }
  }

  rep(i,2,n + 1){
    (res *=(p[i] + 1)) %= MOD;
  }
  /*
  repn(i,n+1){
    cout << i << " " << p[i] << endl;
  }
  */

  cout << res << endl;

  return 0;


}


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

int main(void){
    int i,j,k,l;
    int flag;
    char str[5000];
    
    while(1){
        flag=0;
        memset(str,'\0',sizeof(str));
        
        if(fgets(str,sizeof(str),stdin)==NULL)break;
        
        while(1){
            for(i=0;i<strlen(str);i++){
                if(str[i]<='z'&&str[i]>='a'){
                    if(str[i]!='z'){
                        str[i]++;
                    }else{
                        str[i]='a';
                    }
                }
            }
            for(i=0;i<strlen(str);i++){
                if(str[i]=='t'){
                    if(str[i+1]=='h'){
                        if(str[i+2]=='e'){
                            flag=1;
                            break;
                        }
                        else if(str[i+2]=='i'){
                            if(str[i+3]=='s'){
                                flag=1;
                                break;
                            }
                        }
                        else if(str[i+2]=='a'){
                            if(str[i+3]=='t'){
                                flag=1;
                                break;
                            }
                        }
                    }
                }
            }
            if(flag==1){
                printf("%s",str);
                break;
            }
        }
    }
    return(0);
}

Measured memory_bytes: 524
#include<iostream>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<deque>
#include<array>
#include<map>
#include<tuple>
#include<algorithm>


#define REP(i,a,b) for(int i = (a); i < b; ++i)
#define inf 1e9+10
#define MOD 1000000007

using ll = long long;
using ull = unsigned long long;
using namespace std;

// Reference https://qiita.com/ofutonfuton/items/c17dfd33fc542c222396

struct UnionFind {
    vector<int> par, rank; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2、rank：ランク（木の高さ）

    UnionFind(int N) : par(N),rank(N) { //最初は全てが根であるとして初期化、ランクは1で初期化
        for (int i = 0; i < N; i++) par[i] = i, rank[i] = 1;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if (rank[rx] < rank[ry]) { // xとyの根が同じでない(=同じ木にない)時
            par[rx] = ry; // xの根rxをランクの高いyの根ryにつける
        }
        else {
            par[ry] = rx;// yの根ryをランクの高い場合xの根rxにつける、同じならばrxのランクを高くする
            if (rank[rx] == rank[ry]) rank[rx]+=rank[ry];
        }
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        return root(x) == root(y);
    }
};

inline ll modpow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

inline ll mod(ll val, ll m) {
    ll res = val % m;
    if (res < 0) res += m;
    return res;
}

int main() {

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

    int k;

    cin >> k;

    string s = "ACL";

    REP(i, 0, k) {
        cout << s;
    }

    return 0;
}

Measured memory_bytes: 3596
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int[] a= new int[5];
        for(int i=0;i<5;++i){
            a[i]=sc.nextInt();
        }
        int temp=a[0];
        int r=0;
        for(int i=1;i<5;++i){
            if(a[i]%10<temp%10 && a[i]%10!=0){
                r+=temp-temp%10+10;
                temp=a[i];
            }else if(a[i]%10==0){
                r+=a[i]-a[i]%10;
            }else{
                r+=a[i]-a[i]%10+10;
            }
        }
        System.out.println(r+temp);
    }
}


Measured memory_bytes: 25172
using System;
using System.Linq;
public class c
{
  public static void Main()
  {
    int a=int.Parse(Console.ReadLine());
    int b=int.Parse(Console.ReadLine());
    int c=int.Parse(Console.ReadLine());
    int d=int.Parse(Console.ReadLine());
    if(a>b)a=b;
    if(c>d)c=d;
    Console.WriteLine(a+c);
  }
}

Measured memory_bytes: 11092
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define  all(v)            v.begin(), v.end()
#define  sz(x)             (long long)x.size()
#define  debug(x)          cout << '>' << #x << ':' << x << endl;
#define  debug2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define  rep(i,n)          for(int i = 0; i <  n ; i++)
#define  reps(i,n)         for(int i = 1; i <= n ; i++)
#define  make_unique(v)    sort(all(v));v.erase(unique(all(v)), v.end());
#define  REMOVE(v,a)       v.erase(remove(v.begin(),v.end(), a), v.end());
#define  pb                push_back
#define  eb                emplace_back
#define  mp                make_pair
#define  endl              '\n'
#define  fi                first
#define  se                second
#define  ajs(a)            (a<0)?(-1*a):a

using namespace std;
typedef long long          ll;
typedef vector<long long>  vll;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;

const ll MOD = 1e9+7;
const double PI  = acos(-1.0);
const double EPS = (1e-10);
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = { -1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = { -1, 0, 1, 1, 1, 0, -1, -1};
bool cmp(int X, int Y) {return X > Y;}
int dcp(double A, double B){return fabs(A-B)<=EPS ? 0 : A<B ? -1:1;}

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m=MOD){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){if(b<0){return 0;}ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}


const int N = 1e6 + 5;
vi adj[N];
ll vis[102][102];



int main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n;cin>>n;
ll l[n+1];
reps(i,n){cin>>l[i];}
l[0] = 0;
sort(l+1,l+n+1);
ll ans = 0;
for(ll i = 1 ; i<=(n-2) ; i++){
	for(ll j = i+1 ; j<=(n-1);j++){
		for(ll k = j+1 ; k<=n ; k++){
			if(l[i] != l[j] && l[j]!=l[k] && l[i]!=l[k]){
				if(l[i] + l[j] > l[k]){
					ans++;
					}
				
				}
			
			}
		}
	}

cout<<ans;
}



	
	




		



Measured memory_bytes: 27096
#include<stdio.h>

int main() {
	char s[3];
	int i, n = 0;
	scanf("%s", s);
	for (i = 0; i < 3; i++) {
		if (s[i] == 'a') {
			n = n + 1;
			break;
		}
	}
	for (i = 0; i < 3; i++) {
		if (s[i] == 'b') {
			n = n + 2;
			break;
		}
	}
	for (i = 0; i < 3; i++) {
		if (s[i] == 'c') {
			n = n + 3;
			break;
		}
	}
	if (n == 6)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

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

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MX = 0; //最大値

ll dp[MX][MX];
inline void chmax(ll& a, ll b) {
  a = max(a, b);
}

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define PB push_back

int main(){
    int N, Y;
    cin >> N >> Y;
 
    int x, v, i;
    
    for (x = N; x >= 0; x--) {
        for (v = N - x; v >= 0; v--) {
            i = N - x - v;
            if (10000 * x + 5000 * v + i * 1000 == Y) {
                goto OK;
            }
        }
    }
    x = v = i = -1;
OK:
    cout << x << " " << v << " " << i << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
using ll = long long;


int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++) cin >> a[i];
    sort(a.begin(),a.end());
    for(ll j=a[1];j>=1;j--){
        if(a[0]%j==0||a[1]%j==0){
            int cnt=0,flag=1;
            for(ll i=0;i<n;i++){
                if(a[i]%j!=0){
                    cnt++;
                    if(cnt>=2){
                        flag=0;
                        break;
                    }
                }
            }
            if(flag==1){
                cout << j << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Mx 2000001
#define inf 1e15
const L MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,
q,q1,q2,q3,q4,r,s,t,u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,cnt,lim;
char str[Mx];
int main()
{
    scanf("%lld%s",&n,str);
    lim=strlen(str);
    for(L i=0;i<lim;i++){
        if(i>=n){
            str[i]='.';
            str[i+1]='.';
            str[i+2]='.';
            str[i+3]='\0';
            break;
        }
    }
    printf("%s\n", str);
    return 0;
}
/// empty() lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 3772
#include "bits/stdc++.h"
//#define int long long
#define range(i, a, b) for(int i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int MOD = 1e9 + 7, INF = 1e9;
using vi = vector <int>;
using vvi = vector <vi>;
//g++ -std==c++14

signed main(){
	int n, m;
	cin >> n >> m;
	vi c(m);
	rep(i, m)cin >> c[i];
	
	vi va(n + 1, INF);
	va[0] = 0;
	
	rep(i, m){
		rep(j, n + 1){
			if(va[j] == INF || j + c[i] > n)continue;
			va[j + c[i]] = min(va[j + c[i]], va[j] + 1);
		}
	}

	cout << va[n] << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1e10; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int N,A,B;
ll arr[MX];

bool f(ll K) {
    ll res = 0;
    FOR(i,1,N+1) {
        ll rem = arr[i]-(K*B);
        if (rem > 0) res += (rem/(A-B))+bool(rem%(A-B));
    }
    return res > K;
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> N >> A >> B;

    FOR(i,1,N+1) cin >> arr[i];

    int lo = 0, hi = INF;
    while(abs(lo-hi) > 1) {
        int mid = (lo+hi)/2;
        if (f(mid)) lo = mid;
        else hi = mid;
    }

    cout << hi << "\n";
}


Measured memory_bytes: 1024
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 1010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, m, X1, Y1, X2, Y2, d[MAXN][MAXN];
char ch[MAXN][MAXN];

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

bool isValid(int x, int y) {
    return x >= 1 && x <= n && y >= 1 && y <= m && ch[x][y] != '#'; 
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    cin >> X1 >> Y1;
    cin >> X2 >> Y2;
    FOR(i,1,n)
        FOR(j,1,m) cin >> ch[i][j];

    FOR(i,1,n) FOR(j,1,m) d[i][j] = 1000000000;
    d[X1][Y1] = 0;
    deque<II> q;
    q.push_front(II(X1, Y1));
    while (!q.empty()) {
        II r = q.front();
        q.pop_front();
        FOR(i,0,3) {
            int u = r.FI + dx[i], v = r.SE + dy[i];
            if (isValid(u, v) && d[u][v] > d[r.FI][r.SE]) {
                d[u][v] = d[r.FI][r.SE];
                q.push_front(II(u, v));
            }
        }
        FOR(i,-2,2)
            FOR(j,-2,2) {
                int u = r.FI + i, v = r.SE + j;
                if (isValid(u, v) && d[u][v] > d[r.FI][r.SE] + 1) {
                    d[u][v] = d[r.FI][r.SE] + 1;
                    q.push_back(II(u, v));
                }
            }
    }
    if (d[X2][Y2] == 1000000000) d[X2][Y2] = -1;
    cout << d[X2][Y2];
    return 0;
}


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

using namespace std;

typedef long long ll;

const ll INF = 1000000000000000000;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    ll F[100][5][2];
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < 5; ++j)
            for (int k = 0; k < 2; ++k)
                cin >> F[i][j][k];
    ll P[100][11];
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < 11; ++j)
            cin >> P[i][j];
    ll odp = -INF;
    for (int i = 0; i < (1 << 5); ++i)
    {
        for (int j = 0; j < (1 << 5); ++j)
        {
            if (i == 0 && j == 0)
                continue;
            int profit = 0;
            for (int k = 0; k < n; ++k)
            {
                int wsp = 0;
                for (int l = 0; l < 5; ++l)
                    if ((i & (1 << l)) > 0 && F[k][l][0] == 1)
                        ++wsp;
                for (int l = 0; l < 5; ++l)
                    if ((j & (1 << l)) > 0 && F[k][l][1] == 1)
                        ++wsp;
                profit += P[k][wsp];
            }
            if (profit > odp)
                odp = profit;
        }
    }
    cout << odp;
    return 0;
}


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

using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main()
{
    string s;
    cin >> s;

    reverse(s.begin() ,s.end());
    
    for (int i = 0; i < 4; i++) 
    {
        reverse(divide[i].begin() ,divide[i].end());
    }

    bool can = true;

    for (int i = 0; i < s.size();)
    {
        bool can2 = false;
        
        for (int j = 0; j < 4; ++j)
        {
            string d = divide[j];

            if (s.substr(i, d.size()) == d)
            {
                can2 = true;

                i += d.size(); 
            }
        }

        if (!can2)
        {
            can = false;
            break;
        }
    }
    
    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N; cin >> N;
  string S;
  int size;
  bool flag = true;
  vector<string> str(N);
  for (int i = 0; i < N; i++) {
    cin >> str.at(i);
  }
  for (int i = 0; i < N-1; i++) {
    if (str.at(i).back() != str.at(i+1).front()) {
      flag = false;
    }
  }
  sort(str.begin(), str.end());
  for (int i = 0; i < N-1; i++) {
    if (str.at(i) == str.at(i + 1)) {
      flag = false;
    }
  }
 
 
  if (flag) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

public class Main {
	public static void main(String[] args) {
		int num = 0;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			num = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println("ABC" + num);
	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
const int INF=1001001001;

int main() {
  int H,W,K;
  cin>>H>>W>>K;
  vector<string>s(H);
  for(int i=0;i<H;i++){
    cin>>s[i];
  }
  vector<vector<int>>a(H,vector<int>(W));
  int k=1;
  int cnt=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      a[i][j]=k;
    }
    if(s[i].find('#')!=string::npos){cnt++;}
    if(cnt>=1&&i+1<=H-1&&s[i+1].find('#')!=string::npos){cnt=0;k++;}
  }

  vector<vector<int>>ans(H,vector<int>(W));
  int g=0;
  for(int p=1;p<=k;p++){
    int cnt=0;
    for(int j=0;j<W;j++){
      for(int i=0;i<H;i++){
        if(a[i][j]==p){
          if(s[i][j]=='#'){cnt++;}
          if(cnt>=2){g++;cnt=1;}
        }
      }
      for(int i=0;i<H;i++){
        if(a[i][j]==p){ans[i][j]=a[i][j]+g;}
      }
    }  
  }

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cout<<ans[i][j];
      if(j<W-1){cout<<" ";}
    }cout<<endl;
  }
  return 0;
}

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

// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }



};

const int MOD = 1000000007;
using mint = Fp<MOD>;

int main() {
  ll n,a,b;
  cin >>n>>a>>b;
  mint x = 2 ;

  mint ans = modpow(x,n);
  mint bunbo = 1;mint bunshi =1;
  rep(i,a){
    bunbo *= i+1;
    bunshi *= n-i;
  }
  ans -= (bunshi/bunbo);

  bunbo =1;bunshi =1;
  rep(i,b){
    bunbo *= i+1;
    bunshi *= n-i;
  }
  ans -= bunshi/bunbo;
  ans -=1;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)

# Bellman-Ford法
# ベルマンフォード法

N, M = map(int, input().split())
#EDGES = [[] for _ in range(N+1)]
EDGES = []

for _ in range(M):
    a, b, c = map(int, input().split())
    EDGES.append((a, b, -c))

INF = 10 ** 18
d = [INF] * (N+1)
d[1] = 0

ans = 0
for k in range(N):
    update = False
    for i in range(M):
        a, b, c = EDGES[i]
        if d[a] != INF and d[b] > d[a] + c:
            d[b] = d[a] + c
            update = True

            if k == N-1 and b == N:
                print('inf')
                exit()

    if not update:
        break

print(-d[N])


Measured memory_bytes: 3312
import math

a, b, x = input().split()

a = int(a)
b = int(b)
x = int(x)

h = x/(a**2)

if h > b/2:
    print(math.degrees( math.atan2(b-h, a/2) ))
else:
    print(math.degrees( math.atan2(b, 2*a*h/b) ))

Measured memory_bytes: 3064
/*Ankon Ghosh
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
///#include <ext/pb_ds/detail/standard_policies.hpp>*/
///using namespace __gnu_pbds;
using namespace std;
using ll=long long;
#define inf 1e16
#define MAX 100005
#define mod 998244353
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) printf("Case %lld: ",i)
#define setpre(number) cout<<fixed<<setprecision(10)<<number<<endl
#define pf(a) printf("%lld ",a)
#define pff(a,b) printf("%lld %lld\n",a,b)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll i=x;i<=y;i++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p make_pair
#define ff first
#define ss second
#define p_b push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define output freopen("output.txt","w",stdout)
map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp1;
vector<pair<ll,ll> >v,vpp,vp1;
vector<ll>v1,v2,fin;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb,mb1;
ll a,b,c,n,d,e,f,ta,sum=0,cnt=0,m,l,req,sz,maxi,k;
priority_queue<ll>pq;
string str;
ll table[6100+10][6100+10];
ll arr[100+10];
void calc()
{
    memset(arr,0,sizeof arr);
    arr[3]=1;
    arr[4]=2;
    for(ll i=5; i<=100; i++)
    {
        if(i%2==1)
            arr[i]=arr[i-1]+2;
        else
            arr[i]=arr[i-1]+1;
    }
}
int main()
{
    fast;
    cin>>n>>k;
    for(ll i=2; i<=n; i++)
    {
        v.p_b({1LL,i});
    }
    ll x=n-2;
    ll tot=((x)*(x+1))/2;
    if(k>tot)
    {
        cout<<-1<<endl;
        return 0;
    }

    for(ll i=2; i<n; i++)
    {
        for(ll j=i+1; j<=n; j++)
        {
            if(tot!=k)
            {
                v.p_b({i,j});
                tot--;
            }
        }
    }
    ll l=v.size();
    cout<<l<<endl;
    for(ll i=0; i<l; i++)
        cout<<v[i].ff<<" "<<v[i].ss<<endl;
    return 0;
}

Measured memory_bytes: 3756
import java.util.Scanner;

public class Main 
{

	public static void main(String[] args) 
	{
		int n;
		int w;
		int h;
		Scanner sc = new Scanner(System.in);
		
		while(true)
		{
			n = sc.nextInt();
			if(n == 0)return;
			w = sc.nextInt();
			h = sc.nextInt();
			boolean[][] field = new boolean[w][h];
			
			for(int i = 0; i < n; i++)
			{
				int x = sc.nextInt()-1;
				int y = sc.nextInt()-1;
				field[x][y] = true;
			}
			int s = sc.nextInt();
			int t = sc.nextInt();
			
			int ans = 0;
			for(int x1 = 0; x1 <= w-s; x1++)
			{
				for(int y1 = 0; y1 <= h-t; y1++)
				{
					int count = 0;
					for(int x = x1; x <= x1+s-1; x++)
					{
						for(int y = y1; y <= y1+t-1; y++)
						{
							if(field[x][y])count++;
						}
					}
					ans = Math.max(ans, count);
				}
			}
			
			System.out.println(ans);
		}

	}

}



Measured memory_bytes: 43300
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")

#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;

#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

inline void setin(string s) {
	freopen(s.c_str(), "r", stdin);
}

inline void setout(string s) {
	freopen(s.c_str(), "w", stdout);
}

template <typename T> inline T range(T l, T r) {
	return uniform_int_distribution <T>(l, r)(rng);
}

template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}
 
template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}

const int inf = 2e9;
const int mod = 998244353;
const int N = 2e5 + 15;
const int L = 29;
int n, a[N], b[N];
int ans;
int pw[L + 2];

main() {
	for(int i = 0; i <= L + 1; ++i)
		pw[i] = 1 << i;
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	// setin("input.txt");
	cin >> n;
	for(int i = 1; i <= n; ++i)
		cin >> a[i];
	for(int i = 1; i <= n; ++i)
		cin >> b[i];
	for(int j = L; j; --j) {
		for(int i = 1; i <= n; ++i) {
			b[i] &= pw[j] - 1;
			a[i] &= pw[j] - 1;
		}
		sort(b + 1, b + 1 + n);
		int cur = 0;
		for(int i = 1; i <= n; ++i) {
			int x = a[i];
			cur ^= upper_bound(b + 1, b + 1 + n, pw[j] - 1 - x) - lower_bound(b + 1, b + 1 + n, pw[j - 1] - x);
			cur ^= upper_bound(b + 1, b + 1 + n, pw[j + 1] - 1 - x) - lower_bound(b + 1, b + 1 + n, pw[j] + pw[j-1] - x);
		}
		if(cur & 1)
			ans |= pw[j-1];
	}
	cout << ans << endl;
	return 0;
}


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

#define FOR(i, j, k) for(int i=j ; i<k ; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

    int N; cin >> N;
    int x = N;
    int ans = 0;
    while (x > 0) {
        ans += x % 10;
        x /= 10;
    }
    if (N % ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

int func(char a, char b, const vector<tuple<int, int, char>> v) {
  int px, py, ret;
  px = py = ret = INT_MAX / 10;
  for (auto [x, y, u] : v) {
    if (x != px) {
      px = x;
      py = INT_MAX;
    }
    if (u == a) {
      py = y;
    }
    if (u == b && py != INT_MAX) {
      ret = min(ret, abs(y - py));
    }
  }
  return ret;
}

int main() {
  int N;
  cin >> N;
  vector<tuple<int, int, char>> v;
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    char u;
    cin >> u;
    v.push_back(make_tuple(x, y, u));
  }
  int ans = INT_MAX;
  sort(v.begin(), v.end());
  ans = min(ans, func('U', 'D', v) * 5);
  for (auto &[x, y, u] : v) {
    swap(x, y);
  }
  sort(v.begin(), v.end());
  ans = min(ans, func('R', 'L', v) * 5);
  for (auto &[y, x, u] : v) {
    y -= x;
  }
  sort(v.begin(), v.end());
  ans = min(ans, func('U', 'L', v) * 10);
  ans = min(ans, func('R', 'D', v) * 10);
  for (auto &[y, x, u] : v) {
    y += x + x;
  }
  sort(v.begin(), v.end());
  ans = min(ans, func('R', 'U', v) * 10);
  ans = min(ans, func('D', 'L', v) * 10);
  if (ans > INT_MAX / 10)
    cout << "SAFE" << endl;
  else
    cout << ans << endl;
}


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

using namespace std;

int v[1000][1000];

int color[10000];

int parent [1000];

int _time_;

int dt[10000];

int ft[10000];

int cycle_count;

int component_count;

void dfs_visit(int vertex,int n)
{


    color[vertex]=1;
    _time_+=1;
    dt[vertex]=_time_;
    int i;
    for (i=0;i<=n;++i){

        if (v[vertex][i]==1){

            if (color[i]==0){

                parent[i]=vertex;
                dfs_visit(i,n);

            }
            else if (color[i]==1)++cycle_count;

        }
    }
    color[vertex]=2;
    _time_+=1;
    ft[vertex]=_time_;

}


void dfs (int n)
{
   int i,j,k;
   for (i=0;i<=n;++i){

      color[i]= 0;
      parent[i]=-1;
      dt[i]=0;
      ft[i]=0;

   }
   _time_=0;
   for (i=0;i<=n;++i){

      if (color[i]==0){


         dfs_visit(i,n);

      }

   }

}


int main()
{
    int t,i,j,n,e,x,y,k;

    cycle_count = 0;

        cin>>n>>e;//n must start from 0
        for (j=0;j<=n;++j){

            for (k=0;k<=n;++k){

                v[j][k]=0;

            }
        }
        for (j=1;j<=e;++j){

            cin>>x>>y;
            v[x][y]=1;
            //v[y][x]=1;

        }

        dfs(n);

    if (cycle_count!=0)cout<<1<<endl;
    else cout<<0<<endl;

    return 0;

}



Measured memory_bytes: 3528
#include <iostream>
#include<iomanip>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#include<cstdlib>
#define INF 1001001001001001001
#define MAX 2001001

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

using namespace std;

int main() {
	string s;
	cin >> s;
	int ans = 0;
	rep(i, 0, s.size()) {
		ans += s[i]-'0';
		ans %= 9;
	}
	if (ans == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3696
A, B, C = gets.chomp.split(" ").map(&:to_i)

if A >= B && B >= C
  puts A * 10 + B + C
elsif A >= C && C >= B
  puts A * 10 + C + B
elsif B >= A && B >= C
  puts B * 10 + A + C
elsif B >= C && C >= A
  puts B * 10 + C + A
elsif C >= A && C >= B
  puts C * 10 + A + B
elsif C >= B && B >= A
  puts C * 10 + B + A
end

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;

void solve() {
	int n, k; cin >> n >> k;
	vector<int> v(n);
	for (int i = 0; i < n; i++)cin >> v[i];
	sort(v.begin(), v.end());
	int ans = accumulate(v.begin(), v.begin() + k , 0);
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// int t; cin >> t;
	// while (t--)
	solve();

}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define fs first
#define sc second

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main()
{
   int n; cin>>n;
   rep(i,n)
   {
      int r,t;
      cin>>r>>t;
      int a=r/100,b=t/30;
      if(r%100==0 && t%30==0) cout<<a+5*b<<endl;
      else if(r%100==0) cout<<a+5*b<<" "<<a+5*(b+1)<<endl;
      else if(t%30==0) cout<<a+5*b<<" "<<a+1+5*b<<endl;
      else cout<<a+5*b<<" "<<a+1+5*b<<" "<<a+5*(b+1)<<" "<<a+1+5*(b+1)<<endl;
   }
   return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <sstream>
#include <vector> 
#include <algorithm>
#include <string>
#include <map>
#include <stack>
#include <queue>
using namespace std;

typedef map<string, string> StringMap;

int main() {
    int N;
    int p;
    int sum_time = 0;

    queue<StringMap> q;
    
    cin >> N >> p;

    vector<string> vec(N);

    for (int i = 0; i < N; i++) {
        string tmp_name;
        int tmp_value;
        StringMap tmp_map;
        ostringstream oss;

        cin >> tmp_name >> tmp_value;

        oss << tmp_value;

        tmp_map["name"] = tmp_name;
        tmp_map["value"] = oss.str();

        q.push(tmp_map);
    }

    while(!q.empty()) {
        StringMap f = q.front();
        int time;
        istringstream(f["value"]) >> time;

        // cout << "time:" << time << endl;

        if(time > p) {
            ostringstream tmp_oss;
            tmp_oss << time - p;
            f["value"] = tmp_oss.str();
            q.push(f);
            q.pop();

            sum_time += p;
            
        } else {
            sum_time += time;
            
            if(q.size() == 1) {
                cout << f["name"] << " " << sum_time << endl;
            } else {
                cout << f["name"] << " " << sum_time << endl;
            }

            q.pop();
        }

        // break;
    }

    return 0;
}



Measured memory_bytes: 21644
n = int(input())
s = input()

rs = {}
gs = {}
bs = {}

for i, e in enumerate(s):
  if e == 'R':
    rs[i] = ''
  if e == 'G':
    gs[i] = ''
  if e == 'B':
    bs[i] = ''
    
saidai = len(rs) * len(gs) * len(bs)
if saidai == 0:
  print('0')
else:
  a = max(bs.keys())
  b = min(bs.keys())
  for i in rs.keys():
    for j in gs.keys():
      mi = i if i < j else j
      ma = j if i < j else i
      p = [mi - (ma - mi), mi + (ma - mi)/2, ma + (ma - mi)]
      for e in p:
        if e%1 != 0 or e < b or e > a:
          continue
        if e in bs:
          saidai -= 1
  print(int(saidai))


Measured memory_bytes: 9304
#https://atcoder.jp/contests/abc147/submissions/12994515を見た

import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
mod = 10**9+7
m2 = [1 for i in range(60)]
for i in range(1,60):
    m2[i] = (m2[i-1]*2)%mod

ans = 0
for i in range(60):
    ni = np.count_nonzero(a&1)
    ans = (ans+ni*(n-ni)%mod*m2[i])%mod
    a >>= 1

print(ans)


Measured memory_bytes: 62804