akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
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);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){

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

    int n;
    cin >> n;
    sint s;
    rep(i, n){
        int tmp;
        cin >> tmp;
        s.insert(tmp);
    }

    if(s.size()%2 == 0){
        ppp(s.size()-1);
    }
    else{
        ppp(s.size());
    }




    return 0;
}


Measured memory_bytes: 4992
//naveen mall
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto& i: a)
#define fl(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define rfl(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        forloop(n){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";cout<<"\n";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define PB                pop_back
#define endl              "\n"
#define copy(a,b)         copy(all(a),back_inserter(b));
#define section(a,b,w)    set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w)      set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define diff(a,b,w)       set_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define symdiff(a,b,w)    set_symmetric_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));

const long long INF64 = 1e18;




void solve()
 { 
   int n,W;
     cin>>n>>W;
     int v[n+1];int w[n+1];
     int mxv=0;
     fl(i,0,n-1)
       {
       	cin>>w[i];
   
       	cin>>v[i];
       	    	mxv+=v[i];
       }
   
 int dp[n+1][mxv+2];

dp[0][0]=0;
fl(i,0,n)
  fl(j,0,mxv)
     dp[i][j]=INF64;
     dp[0][0]=0;


 for(int i=0;i<n;i++)
 	  {
 	  	for(int j=0;j<=mxv;j++)
 	  		 {  if(v[i]<=j)
 	  		 	 dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
 	  		 	 else
 	  		 	 	dp[i+1][j]=min(dp[i][j],dp[i+1][j]);




 	  		 }
 	  }
 	//  cout<<mxv<<" ";
 	  int ans=0;
for(int i=0;i<=mxv;i++)
	  {  if(dp[n][i]<=W)
	  	     ans=max(ans,i);


	  	
	  }
cout<<ans;
      


 }



  








 



signed main()
{fast
	int t;
   //cin>>t;
	t=1;

	while(t--)
		 {
		 	solve();
		 }
}












Measured memory_bytes: 79104
#include<iostream>
using namespace std;
int main(){
  int N, X, M=0, min=1000, m;
  cin >> N >> X;
  for(int i=0;i<N;i++){
    cin >> m;
    M += m;
    if(m<min)min = m;
    X -= m;
  }
  cout << N + (X-(X%min))/min << endl;
  return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split(' '))
l = []
start = 0
end = n+1
count = 0

for i in range(m):
    l.append(list(map(int,input().split(' '))))

for i in l:
    if i[0] >= start:
        start = i[0]
    if i[1] <= end:
        end = i[1]
if start > end:
    print(0)
else:
    print(end-start+1)

Measured memory_bytes: 27044
//#include <bits/stdc++.h>
#include<iostream>
#include <iosfwd>
#include<limits.h>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <limits>
#include<stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include<string.h>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include<vector>
#include <chrono>
#include <random>
using namespace std;
using namespace std::chrono;
#define fr(i,j,n)   for(lli i=j;i<(n);++i)
#define bk(i,j,n)   for(lli i=j;i>=n;--i)
#define pb push_back
#define m_p make_pair
#define Fs first
#define Sc second
#define endl "\n"
#define MOD 1000000007
#define present(c,x)    ((c).find(x) != (c).end())
#define count1 __builtin_popcount
#define run ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define mem(p,v) memset(p,(lli)v,sizeof p);
#define ub upper_bound
#define lb lower_bound
typedef long long int lli;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<lli> vl;
typedef pair<lli,lli> pl;
inline lli max(lli a,lli b){ return a>b?a:b;}
inline lli min(lli a,lli b){ return a<b?a:b;}
void show(vector<lli> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(vector<int> v)
{
    fr(i,0,v.size())
    cout<<v[i]<<" ";
    cout<<endl;
}
void show(int a[], int arraysize)
{
    for (int i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(lli a[], lli arraysize)
{
    for (lli i = 0; i < arraysize; ++i)
        cout << a[i] << " ";
    cout<<endl;
}
void show(unordered_set<int> s)
{
    for (auto it = s.begin(); it != s.end(); it++)
    {
        cout << *it << " ";
    }
    cout<<endl;
}
void show(unordered_map<int,int> mp)
{
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        cout << it->first << " "<<it->second<<endl;
    }
    cout<<endl;
}


int main()
{
    lli t,n,k,ans;
    t=1;
    while(t)
    {
        lli a[5];
        fr(i,0,5)
        {
            cin>>a[i];
            if(a[i]==0)
                ans=i+1;
        }
        cout<<ans<<endl;
        t--;
    }
    return 0;
}



Measured memory_bytes: 3604
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    LL n;
    cin >> n;
    VI q;
    if (n == 0) {
        cout << 0 << endl;
        return;
    }
    REP(i,0,32) {
        //cerr << i << " " << n << endl;
        if (i % 2 == 1 && n <= 0) q.push_back(0);
        else if (i % 2 == 0 && n >= 0) q.push_back(0);
        else {
            if (i % 2 == 1) {
                //cerr << ((LL)pow((LL)2,(LL)(31-i)+2) - 1) / 3 - (LL)pow((LL)2,(LL)31-i) << endl;
                if (((LL)pow((LL)2,(LL)(31-i)+2) - 1) / 3 - (LL)pow((LL)2,(LL)31-i) < n) {
                    q.push_back(1);
                    n -= (LL)pow((LL)2,(LL)(31-i));
                } else q.push_back(0);
            } else {
                //cerr << ((LL)pow((LL)2,(LL)(31-i)+1) - 1) * -2 / 3 + (LL)pow((LL)2,(LL)31-i) << endl;
                if (((LL)pow((LL)2,(LL)(31-i)+1) - 1) * -2 / 3 + (LL)pow((LL)2,(LL)31-i) > n) {
                    q.push_back(1);
                    n -= (LL)pow((LL)-2,(LL)(31-i));
                } else q.push_back(0);
            }
        }
    }

    bool b = false;
    REP(i,0,q.size()) {
        //cerr << q[i];
        if (q[i] == 1) b = true;
        if (b) cout << q[i];
    }
    cout << endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <sstream>
#include <iterator>

using namespace std;

#define endl ("\n")
#define pi (3.141592653589)
#define mod 1000000007
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

int32_t main() 
{
    fast;
	string t;
    cin >> t;
    if ((t == "ABC") ? cout << "ARC" : cout << "ABC");
}




Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
int main(){
  int n, i, j, k, res = 0;
  char search[20],ring[20];
  scanf("%s", search);
  scanf("%d\n", &n);
  res = 0;
  for(i = 0;i < n;i++){
    scanf("%s", ring);
    int found = 0;
    for(j = 0;j < 10 && found == 0;j++){
      found = 1;
      for(k = 0;k < strlen(search);k++){
        if(search[k] != ring[(j + k) % 10]){
          found = 0;
          break;
        }
      }
    }
    if(found == 1)res++;
  }
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 596
//Try until you reach your goal
#include <bits/stdc++.h>
using namespace std;
# define ll long long
# define endl "\n"
# define str string
# define vll vector<ll>
# define pb push_back
# define mll map<ll,ll>
# define mp make_pair
# define ff first
# define ss second
# define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=LLONG_MIN;
    ll p=b*c;
    ans=max(p,ans);
    p=1;
    p=b*d;
    ans=max(ans,p);
    p=1;
    p=a*c;
    ans=max(p,ans);
    p=a*d;
    ans=max(p,ans);
    cout<<ans;
    return 0;
}

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

//#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

vector<pair<char,int>> runlength(string s) {
    vector<pair<char,int>> v;
    v.push_back({s[0],1});
    for(int i = 1; i < s.length(); i++){
        if(v.back().first == s[i]){
            v.back().second++;
        }else{
            v.push_back({s[i],1});
        }
    }
    return v;
}

signed main() {
    string s;
    cin >> s;
    auto v = runlength(s);
    cout << v.size()-1 << endl;
}

Measured memory_bytes: 1608
import std.stdio, std.conv, std.string, std.algorithm, std.math, std.array;

long n, a, b;

long solve() {
  return n/(a+b)*a + min(a, n%(a+b));
}

void main() {
  readf("%d %d %d", &n, &a, &b);
  writeln(solve());
}



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

int main(){
  int n,m;
  cin>>n>>m;
  
  vector<int>a(m);
  vector<int>b(m);
  
  rep(i,m)cin>>a[i]>>b[i];
  vector<int>city(n);
  rep(i,m){
    city[a[i]-1]++;
    city[b[i]-1]++;
  }
  
  rep(i,n)cout<<city[i]<<endl;
  return 0;
}

Measured memory_bytes: 3608
# n = int(input()) 
# t = [int(input()) for i in range(n)] 

N = int(input())
B = list(map(int, input().split()))
A = list(map(int, input().split()))
b = len(B)
count = 0
for i in range(N):
    if (A[i]==B[i]):
        count +=A[i]
    elif (A[i]>B[i]):
        count +=B[i]
        A[i]=A[i]-B[i]
        if (i<b and A[i]==B[i+1]):
            count +=A[i] 
            B[i+1]=0
        elif (i<b and A[i]>B[i+1]):
            count +=B[i+1]
            B[i+1]=0
        elif(i<b):
            p = B[i+1]-A[i]
            count +=A[i]
            B[i+1]=p
    else:
        p = B[i]-A[i]
        count +=A[i]

print(count)



# count = 0
#a, b= (int(i) for i in input().split())  




Measured memory_bytes: 19004
import math

x=1234

def divmod2(x,y):
    a=math.floor(x/y)
    b=x%y
    return x,y

def ksouwa(x):
    x=int(x)
    sen=math.floor(x/1000)
    hyaku=math.floor((x%1000)/100)
    juu=math.floor((x%100)/10)
    iti=math.floor(x%10)
    return sen+hyaku+juu+iti

def ksouwa2(x):
    int1=0
    x=str(x)
    len(x)
    for i in list(x):
        #print(i)
        int1=int(int1)+int(i)
    return int1

X,A,B=open(0).read().split()

X=int(X)

A=int(A)

B=int(B)

int1=0
int2=0

for i in range(X+1):
    if (ksouwa2(i)>=A) and (ksouwa2(i)<=B):
        int1=int1+1
        int2=int2+i

#print(int1)
print(int2)

Measured memory_bytes: 9180
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using static System.Math;

class P
{
    static void Main()
    {
        int[] ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < n; i++)
        {
            int[] sf = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (Max(sf[0], ab[0]) < Min(sf[1], ab[1]))
            {
                Console.WriteLine(1);
                return;
            }
        }
        Console.WriteLine(0);
    }
}


Measured memory_bytes: 8336
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<ll>
#define vvint vector<vint>
#define P pair<int,int>
#define INT_MAX 2147483647
using namespace std;
typedef long long ll;


int main(void) {
	set<int> s;
	int n; cin >> n;
	rep(i, n) {
		int x; cin >> x;
		if (s.count(x) == 1) {
			cout << "NO" << endl;
			return 0;
		}
		s.insert(x);
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 9600
#include <iostream>
using namespace std;
 
int main()
{
    int array[10];
    int i, j, tmp;
     
    for(i=0; i<10; i++){
        cin >> array[i];
    }
     
    for(i=0; i<9; i++){
        for(j=i+1; j<10; j++){
            if(array[i] < array[j]){
                tmp = array[i];
                array[i] = array[j];
                array[j] = tmp;
            }
        }
    }
     
    for(i=0; i<3; i++){
        cout << array[i] << "\n";
    }
     
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n == 1) {
        cout << "Hello World" << endl;
        return 0;
    } else {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 10;
int h, w, k, a[N][N], b[N][N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> h >> w >> k;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			char c;
			cin >> c;
			if (c == '#') a[i][j] = 1;
		}
	}
	int ans = 0;
	for (int i = 0; i < (1 << h); i++) {
		for (int j = 0; j < (1 << w); j++) {
			int res = 0;
			for (int x = 0; x < h; x++) {
				for (int y = 0; y < w; y++) {
					if ((i >> x & 1) || (j >> y & 1)) {
						b[x][y] = 0;
					}	else {
						b[x][y] = a[x][y];
					}
					res += b[x][y];
				}
			}
			if (res == k) ans++;
		}
	}
	cout << ans;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using namespace std;
typedef pair<long long,long long> ii;
typedef long long lint;

map<ii,int> pre;
int mod = 1000000007;
int P = 97;
int P2 = 101;

long long qexp(long long b, long long p){
    long long res = 1;
    while(p){
        if(p&1) res = (res * b) % mod;
        b = (b * b) % mod;
        p >>= 1;
    }
    return res;
}

int to(char c){
	return c - 'a' + 1;
}

int occur[28];


signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	int n; cin >> n;
	
	string arr[n];
	for(int i = 0;i < n;i++) cin >> arr[i];
	
	sort(arr,arr+n, [&](string a, string b){
		return sz(a) < sz(b);
	});
	
	int ans = 0;
	
	for(int i = 0;i < n;i++){
		string s = arr[i];
		//reverse(all(s));
		
		fill(occur,occur+28,0);
		
		for(int i = 0;i < sz(s);i++){
			occur[to(s[i])]++;
		}
		
		//cout << s << ":\n";
		//
		int hash1 = 0;
		int hash2 = 0;
		for(int i = sz(s)-1;i >= 0;i--){
			
			if(i >= 1){
				for(int j = 0;j < 28;j++){
					if(occur[j] == 0) continue;
					int H1 = hash1 * P + j;
					H1 %= mod;
					
					int H2 = hash2 * P2 + j;
					H2 %= mod;
					
					auto it = pre.find(ii(H1,H2));
					if(it != pre.end()) ans += it->second;
				}
			}
			
			occur[to(s[i])]--;
			
			hash1 *= P;
			hash2 *= P2;
			hash1 += to(s[i]);
			hash2 += to(s[i]);
			
			hash1 %= mod;
			hash2 %= mod;
			//cout << hash << " ";
		}
		//cout << "\n";
		pre[ii(hash1,hash2)]++;
		//cout << s << " " << ans << " " << hash <<  "\n";
	}
	
	cout << ans;
}



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

const int mod = 1e9 + 7 ;

int main()
{
    int n ;
    scanf("%d",&n) ;
    long long int a[n] , sum = 0 ;
    for(int i = 0 ; i < n ; ++i) scanf("%lld",&a[i]) ;
    for(int i = 0 ; i < 60 ; ++i)
    {
        long long int pos = 0 ;
        for(int j = 0 ; j < n ; ++j)
        {
            if(a[j]%2) ++pos ;
            a[j]/=2 ;
        }
        long long low = pos*(n-pos)%mod ;
        for(int j = 0 ; j < i ; ++j) low = (low*2)%mod ;
        sum = (sum+low)%mod ;
    }
    printf("%lld\n",sum) ;
}


Measured memory_bytes: 2560
import java.util.*;

import static java.lang.System.*;

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

        // キー文字で降順
        Map<Integer, Integer> cnts = new TreeMap<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer t1, Integer t2) {
                if (t1.compareTo(t2) > 0) {
                    return -1;
                } else if (t1.compareTo(t2) == 0) {   //すでに存在していたら上書き
                    return 0;
                }
                return 1;
            }
        });

        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();

            int cnt = 1;
            if (cnts.containsKey(a)) {
                cnt += cnts.get(a);
            }
            cnts.put(a, cnt);
        }

        int l1 = 0;
        int l2 = 0;
        for (Map.Entry e : cnts.entrySet()) {
            int length = (int) e.getKey();
            int num = (int) e.getValue();

            if (num >= 4 && l1 == 0) {
                l1 = l2 = length;
                break;
            }

            if (num >= 2) {
                if (l1 == 0) {
                    l1 = length;
                    continue;
                } else {
                    l2 = length;
                    break;
                }
            }
        }

        out.println((long) l1 * l2);
    }
}

Measured memory_bytes: 64316
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N, A, B, C = map(int, input().split())
Ls = [None] * N
for n in range(N):
    Ls[n] = int(input())

ans = 1e9
group = [0, 1, 2, 3]
for comb in product(group, repeat=N):
    c = Counter()
    tmp = 0
    for i, group_idx in enumerate(comb):
        if group_idx == 3:
            continue
        if c[group_idx] != 0:
            tmp += 10
        c[group_idx] += Ls[i]
    if c[0] == 0 or c[1] == 0 or c[2] == 0:
        continue
    tmp += abs(c[0] - A)
    tmp += abs(c[1] - B)
    tmp += abs(c[2] - C)
    ans = min(ans, tmp)
print(ans)


Measured memory_bytes: 6476
import java.util.*;

public class Main {
    public static void main(String args[]) {
        int[][] cards = new int[4][13];

        for (int x = 0; x < 4; x++) {
            for (int y = 0; y < 13; y++) {
                cards[x][y] = 1;
            }
        }

        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();


        for (int i = 0; i < n; i++) {
            String mark = scn.next();
            int num = scn.nextInt();
            int m;

            switch (mark) {
                case "S":
                    m = 0;
                    break;
                case "H":
                    m = 1;
                    break;
                case "C":
                    m = 2;
                    break;
                default:
                    m = 3;
                    break;
            }

            cards[m][num - 1] = 0;

        }

        for (int l = 0; l < 4; l++) {
            for (int j = 0; j < 13; j++) {
                if (cards[l][j] == 1) {
                    String mark2;
                    switch (l) {
                        case 0:
                            mark2 = "S";
                            break;
                        case 1:
                            mark2 = "H";
                            break;
                        case 2:
                            mark2 = "C";
                            break;
                        default:
                            mark2 = "D";
                            break;
                    }
                    System.out.println(mark2 + " " + (j + 1));
                }
            }

        }

        scn.close();

    }


}


Measured memory_bytes: 26384
import math

n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
# print(xy)
sum = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        sum += math.sqrt((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2)
# print(sum)

k = sum * 2 * (n - 1) / math.factorial(n)
# k = sum * math.factorial(n - 1) / n
print(sum*2/n)


Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
    int x,sum=0,i;
    scanf("%d",&x);
    for(i=1;i<1000000000;i++){
        sum+=i;
        if(x<=sum){
            sum=i;
            break;
        }
    }
    printf("%d\n",sum);
   }

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

int main() {
  int N, K, a; 
  a=1;//表示されている整数
  cin >> N >> K;
  for(int i=0; i<N; i++){
    if(a<=K){
      a*=2;
    }
    else{
      a+=K;
    }
  }
  cout << a << endl;
}


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

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

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

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

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      ab: usize,
      bc: usize,
      ca: usize,
    }
    let mut a = [ab, bc, ca];
    a.sort();
    println!("{}", (a[0] * a[1]) /2);
}


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

typedef long long LL;
const int M=2e5+5;
int n;
int c[M];
vector<int> g[M];

LL ans[M];
LL sz[M];
LL cnt[M];

void dfs(int u,int fa)
{
	int nc=c[u];
	int cntu=cnt[nc];
	for(int v:g[u])
	{
		if(v==fa) continue;
		cnt[nc]=0;
		dfs(v,u);
		LL tmp=sz[v]-cnt[nc];
		ans[nc]-=tmp*(tmp-1)/2+tmp;
		sz[u]+=sz[v];
	}
	sz[u]++;
	cnt[nc]=cntu+sz[u];
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&c[i]);
	int u,v;
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&u,&v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	for(int i=1;i<=n;i++)
		ans[i]=1LL*n*(n-1)/2+n;
	dfs(1,0);
	for(int i=1;i<=n;i++)
	{
		LL tmp=sz[1]-cnt[i];
		//cout<<cnt[i]<<endl;
		ans[i]-=tmp*(tmp-1)/2+tmp;
	}
	for(int i=1;i<=n;i++)
		printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 38836
class UnionFind:
  def __init__(self, n: int):
    self.parent = list(range(n))
    self.size = [1] * n
    self.rank = [1] * n
    
  def find(self, i: int) -> int:
    if self.parent[i] != i:
      self.parent[i] = self.find(self.parent[i])
    return self.parent[i]
  
  def unite(self, i: int, j: int):
    ri = self.find(i)
    rj = self.find(j)
    if ri != rj:
      if self.rank[ri] < self.rank[rj]:
        self.parent[ri] = rj
        self.size[rj] += self.size[ri]
      else:
        self.parent[rj] = ri
        self.size[ri] += self.size[rj]
        if self.rank[ri] == self.rank[rj]:
          self.rank[ri] += 1


n, m, k = map(int, input().split())

n_friend = [1 for _ in range(n)]
block = [[] for _ in range(n)]
friendship = UnionFind(n)

for _ in range(m):
  a, b = map(int, input().split())
  n_friend[a-1] += 1
  n_friend[b-1] += 1
  friendship.unite(a-1, b-1)
  
for _ in range(k):
  c, d = map(int, input().split())
  block[c-1].append(d-1)
  block[d-1].append(c-1)
  
for i in range(n):
  r = friendship.find(i)
  cand = friendship.size[r] - n_friend[i]
  for j in block[i]:
    if r == friendship.find(j):
      cand -= 1
  print(cand, end=' ')

Measured memory_bytes: 25836
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define c1 __builtin_popcount
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS

vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
int32_t main()
{
IOS
int n,k;
cin>>n>>k;
int g;
vector<int> v(n);
FOR(i,0,n) {
    cin>>v[i];
    g = v[i];
}
FOR(i,0,n) g = __gcd(g,v[i]);
bool ans = false;
FOR(i,0,n) {
    if(v[i]<k) continue;
    else if(v[i]%g == k%g) ans = true;
}
if(ans) cout<<"POSSIBLE";
else cout<<"IMPOSSIBLE";
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

Measured memory_bytes: 1024
if __name__ == '__main__':
    A =[]
    B = input()
    A = B.split()

    a = int(A[0])
    b = int(A[1])
    c = int(A[2])
    k = int(A[3])

    if a > k:
        print(k)
    elif (a+b) > k:
        print(a)
    else:
        ans = 2*a-k+b
        print(ans)

Measured memory_bytes: 8956
import sys
s = input()
n = len(s)
for i in range(n-1):
  if s[i] == s[i+1]:
    print(i+1, i+2)
    sys.exit()
for i in range(n-2):
  if s[i] == s[i+2]:
    print(i+1, i+3)
    sys.exit()
print(-1, -1)

Measured memory_bytes: 3188
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

#define INF 1e9
 
int main() {
  int n, ma, mb;
  scanf("%d %d %d", &n, &ma, &mb);
  vi a(n), b(n), c(n);
  rep (i, n) {
    scanf("%d %d %d", &a[i], &b[i], &c[i]);
  }
  if (n == 1) {
    if (ma * b[0] == mb * a[0]) {
      printf("%d\n", c[0]);
    } else {
      printf("-1\n");
    }
    return 0;
  }
  vvi p1(201, vi(201, INF)), p2(201, vi(201, INF));
  int mid1 = n/2;
  int mid2 = n - mid1;
 
  rep (i, (1 << mid1)) {
    int aa = 0;
    int bb = 0;
    int cost = 0;
    rep (j, mid1) {
      if (((i >> j)&1) == 1) {
        aa += a[j];
        bb += b[j];
        cost += c[j];
      }
    }
    p1[aa][bb] = min(p1[aa][bb], cost);
  }
  rep (i, (1 << mid2)) {
    int aa = 0;
    int bb = 0;
    int cost = 0;
    rep (j, mid2) {
      if (((i >> j)&1) == 1) {
        aa += a[j + mid1];
        bb += b[j + mid1];
        cost += c[j + mid1];
      }
    }
    p2[aa][bb] = min(p2[aa][bb], cost);
  }
 
  int ans = INF;
  rep (i, 201) {
    rep (j, 201) {
      if (p1[i][j] == INF) {
        continue;
      }
      FOR (r, 1, 401) {
        int ra = ma * r;
        int rb = mb * r;
        int i2 = ra - i;
        int j2 = rb - j;
        if (i2 < 0 || j2 < 0) {
          continue;
        }
        if (i2 > 200 || j2 > 200) {
          break;
        }
        if (p2[i2][j2] == INF) {
          continue;
        }
        ans = min(ans, p1[i][j] + p2[i2][j2]);
      }
    }
  }
  if (ans != INF) {
    printf("%d\n", ans);
  } else {
    printf("-1\n");
  }
 
  return 0;
}

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

using namespace std;

typedef long long int ll;

int main(){
    ll n,i;
    cin>>n;
    vector<ll>a(n),cost(n);
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    cost[0] = 0;
    cost[1] = abs(a[1] - a[0]);
    cost[2] = min(abs(a[2]-a[0]),abs(a[2]-a[1])+cost[1]);
    for(i=3;i<n;i++){
        cost[i] = min((abs(a[i] - a[i-1]) + cost[i-1]), (abs(a[i]-a[i-2]) + cost[i-2]));
    }
    cout<<cost[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

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

using namespace std;

typedef pair<int, int> P;


const int N = 101;
P to[N][N];
map<P, P> par;

void init(){
	rep(i, N) rep(j, N) par[MP(i, j)] = MP(i, j);
}

P find(P p){
	if(par[p] == p) return p;
	return par[p] = find(par[p]);
}

void unite(P p, P q){
	p = find(p);
	q = find(q);
	par[p] = q;
}

int main(){
	int n;
	while(cin >> n, n){
		init();
		rep(i, n){
			rep(j, n){
				int x, y;
				cin >> x >> y;
				unite(MP(i, j), MP(y, x));
			}
		}
		set<P> s;
		rep(i, n) rep(j, n){
			s.insert(find(MP(i, j)));
		}
		cout << s.size() << endl;
	}

	return 0;
}

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

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

int main() {
  int A, B, C; cin>>A>>B>>C;
  int S=gcd(A, B);
  if(C%S==0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  // cout<<S<<endl;
}


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

int64_t M = 1000000007;
vector<int64_t> fac(100001);		//n! (mod M)
vector<int64_t> ifac(100001);		//k!^{M-2} (mod M)

int64_t mpow(int64_t x, int64_t n) {
	int64_t ans = 1;
	while (n != 0) {
		if (n & 1) {
			ans = ans * x % M;
		}
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}

int64_t comb(int64_t n, int64_t k) 
{
	if (n == 0 && k == 0) {
		return 1;
	} else if (n < k || n < 0) {
		return 0;
	}
	int64_t temp = ifac.at(k) * ifac.at(n - k) % M;
	return temp * fac.at(n) % M;
}

int main()
{
	int64_t n, k;
	cin >> n >> k;
	vector<int64_t> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
	}

	fac.at(0) = 1;
	ifac.at(0) = 1;
	for (int64_t i = 0; i < n; i++) {
		fac.at(i + 1) = fac.at(i) * (i + 1) % M;
		ifac.at(i + 1) = ifac.at(i) * mpow(i + 1, M - 2) % M;
	}

	sort(a.begin(), a.end());
	int64_t ans = 0;
	for (int64_t i = 0; i < n; i++) {
		if (i < k - 1) {
			ans -= a.at(i) * comb(n - 1 - i, k - 1) % M;
		} else if (k - 1 <= i && i <= n - k) {
			ans += a.at(i) * comb(i, k - 1) % M;
			ans -= a.at(i) * comb(n - 1 - i, k - 1) % M;
		} else if (n - k < i) {
			ans += a.at(i) * comb(i, k - 1) % M;
		}
		ans %= M;
	}

	cout << ans << endl;
}


Measured memory_bytes: 2560
n = int(input())
a = list(map(int,input().split()))

cnt = [0 for _ in range(n)]
cnt_max = [0 for _ in range(n)]
cnt_mini = [0 for _ in range(n)]

for i in a:
    cnt[i - 1]+=1

for i in range(n):
    cnt_max[i] = cnt[i] * (cnt[i] - 1) // 2
    if cnt[i]!=0:
        cnt_mini[i] = (cnt[i] - 1) * (cnt[i] - 2) // 2

s = sum(cnt_max)
for i in range(n):
    print(s - cnt_max[a[i]-1] + cnt_mini[a[i]-1])

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

int div_2(int x) {
    int ret = 0;
    while (x % 2 == 0) {
        ret++;
        x /= 2;
    }
    return ret;
}

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int ans = 999999999;
    for (int i = 0; i < n; i++) {
        ans = min(ans, div_2(a[i]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<map>
//#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb emplace_back
#define mp make_pair
#define MOD (int) 1e9+7
#define for0(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define endl "\n"
#define bits(n) __builtin_popcount(n)
#define ini(a, i) memset(a, i, sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t;
	// cin >> t;
	t  = 1;
	while (t--)
	{
		ll n;
		cin >> n;
		ll arr[n];
		ll ans = 0;
		for (ll i = 0; i < n; i++)
		{
			cin >> arr[i];
			ans = ans ^ arr[i];
		}
		for (ll i = 0; i < n; i++)
		{
			cout << (ans ^ arr[i]) << " ";
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 5208
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

map<int, int> res;

vector<int> divisor(int n) {
	vector<int> res;
	for(int i = 1; i * i <= n; i++) {
		if(n % i == 0) {
			res.push_back(i);
			if(i != n / i) res.push_back(n / i);
		}
	}
	return res;
}

//map<int, int> prime_factor(int n) {
void prime_factor(int n) {
	for(int i = 2; i * i <= n; i++) {
		while(n % i == 0) {
			++res[i];
			n /= i;
		}
	}
	if(n != 1) res[n]++;
	//return res;
}

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

	int mod = 1e9 + 7;
	int N;
	cin >> N;
	ll rsl = 1;

	rep(i, 2, N + 1) {
		prime_factor(i);
	}

	for(map<int, int>::iterator it = res.begin(); it != res.end(); it++) {
		//cout << it->first << " " << it->second << endl;
		(rsl *= (it->second + 1)) %= mod;
	}


	cout << rsl << endl;

}


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define ALL(a) (a).begin(), (a).end()
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}


int main(void){
  ll N, A, B, W, H, C, D, Q, X, Y;
  string s, t;
  cin >> A >>  B >>  C >>  X >>  Y;
  ll AB = 2*C;
  int inf = 1e+5;
  ll ans=1e+11, ans_now;
  rep(i, inf+1){
    ans_now = 0;
    ans_now += AB *(ll)i;
    ans_now += max(X-(ll)i, (ll)0) * A;
    ans_now += max(Y-(ll)i, (ll)0) * B;
    ans = min(ans_now, ans);
  }
  cout << ans << endl;
  

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
#include <list>
#include <deque>
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll MOD = 1000000007;
ll INF = 1LL << 60;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) {return a / GCD(a, b) * b;}
vector<ll> prime(1001,0);

void prime_fact(ll N)
{
    for(ll a = 2; N >= a * a; a++)
    {
        if(N % a != 0) continue;
        ll ex = 0;
        while(N % a == 0)
        {
            N/= a;
            ex++;
        }
        prime[a] += ex;
    }
    if(N != 1) prime[N] += 1;
    return;
}

int main()
{
    ll N;
    cin >> N;
    for(ll i = 1; i <= N; i++)
    {
        prime_fact(i);
    }
    ll ans = 1;
    for(int i = 0; i < 1001; i++)
    {
        if(prime[i] != 0)
        ans = ans % MOD * (prime[i] + 1) %MOD;
    }
    cout << ans << endl;
}


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

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

int main(){
    int n;
    cin >> n;
    int d[n];
    rep(i,n){
        cin >> d[i];
    }
    int total = 0;
    rep(i,n){
        int sum = 0;
        rep(j,n){
            if(i==j)continue;
            sum += d[j];
        }
        total += d[i] * sum;
    }

    cout << total / 2  << endl;

    return 0;
}

Measured memory_bytes: 256
H = int(input())

import sys
sys.setrecursionlimit(10**9)
cnt = 0
def f(x):
    global cnt
    if x == 1:
        cnt += 1
        return

    else:
        x //= 2
        cnt += 1

        f(x)

f(H)
ans = 0
for x in range(cnt):
    ans += 2**x


print(ans)


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

li = [[] for _ in range(3)]

for i in range(n):
    if s[i] == 'R':
        li[0].append(i)
    elif s[i] == 'G':
        li[1].append(i)
    else:
        li[2].append(i)

ans = 0

for i in li[0]:
    for j in li[1]:
        if i > j:
            sub1 = i - j
            if i + sub1 < n:
                if s[i + sub1] == 'B':
                    ans += 1
            if j - sub1 >= 0:
                if s[j - sub1] == 'B':
                    ans += 1
        else:
            sub1 = j - i
            if j + sub1 < n:
                if s[j + sub1] == 'B':
                    ans += 1
            if  i- sub1 >= 0:
                if s[i - sub1] == 'B':
                    ans += 1
        if (i + j) % 2 == 0 and s[(i+j)//2] == 'B':
            ans += 1

print(len(li[0])*len(li[1])*len(li[2])-ans)


Measured memory_bytes: 74700
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main() {

	int N, i;
	cin >> N >> i;
	cout << N - i + 1 << endl;


	return(0);
}

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

using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = (int) x; i < (int)n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = (int) n; i > (int)x; i--)
#define rrep(i,n) RREP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
#define SZ(x) ((int)(x).size())

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main (){

  int n ,m ;
  long x;
  vi  a,b,c,d;

  cin >>n >>m;
  rep(i,n){
    cin>>x;
    a.push_back(x);
    cin>>x;
    b.push_back(x);
  }
  rep(j,m){
    cin>>x;
    c.push_back(x);
    cin >> x;
    d.push_back(x);
  }
  rep(i,n){
    long ans = 2000000000;
    int ck = -1;
    rep(j,m){
      if(ans > abs(a[i]-c[j])+abs(b[i]-d[j])){
        ck =j;
        ans = abs(a[i]-c[j])+abs(b[i]-d[j]);
      }
    }
    P(ck+1);
  }
 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

ll gcd(ll c, ll d){
    ll a = max(c,d), b = min(c,d);
    while(b != 0){
        ll div = a % b;
        a = b;
        b = div;
    }
    return a;
}

ll count(ll a, ll c, ll d){ 
    ll lcm = c * d / gcd(c, d);
    return a - a / c - a / d + a / lcm;
}

int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll ans = count(b, c, d) - count(a-1, c, d);

    cout << ans << endl;

}

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

int main()
{
  double r, S, C, pi=3.141592653589;

  cin >> r;
  S = r*r*pi;
  C = 2*r*pi;

  printf("%.6lf %.6lf", S, C);
  return 0;
}

Measured memory_bytes: 1240