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

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

using ll = long long;

template <class T>
class Stack {
 private:
  const int __max_size = 300;
  int __top = -1;
  T* data;

 public:
  Stack();
  virtual ~Stack();
  bool isEmpty() const;
  bool isFull() const;
  void push(T x);
  void pop();
  const T* top() const;
};

template <class T>
Stack<T>::Stack() {
  data = new T[__max_size];
}

template <class T>
Stack<T>::~Stack() {
  delete data;
}

template <class T>
bool Stack<T>::isEmpty() const {
  if (__top == -1) {
    return true;
  } else {
    return false;
  }
}

template <class T>
bool Stack<T>::isFull() const {
  if (__top == __max_size - 1) {
    return true;
  } else {
    return false;
  }
}

template <class T>
void Stack<T>::push(T x) {
  if (!isFull()) {
    __top++;
    data[__top] = x;
  }
}

template <class T>
void Stack<T>::pop() {
  if (!isEmpty()) {
    __top--;
  }
}

template <class T>
const T* Stack<T>::top() const {
  if (!isEmpty()) {
    return &data[__top];
  } else {
    return nullptr;
  }
}

int main() {
  Stack<int> s;
  char c[100];
  int v1, v2;

  while (scanf("%s", c) != EOF) {
    if (c[0] == '+') {
      v2 = *s.top();
      s.pop();
      v1 = *s.top();
      s.pop();
      s.push(v1 + v2);
    } else if (c[0] == '-') {
      v2 = *s.top();
      s.pop();
      v1 = *s.top();
      s.pop();
      s.push(v1 - v2);
    } else if (c[0] == '*') {
      v2 = *s.top();
      s.pop();
      v1 = *s.top();
      s.pop();
      s.push(v1 * v2);
    } else {
      s.push(std::atoi(c));
    }
  }

  std::cout << *s.top() << std::endl;

  return 0;
}



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

int main() {
    int N;
    cin >> N;
    int ans = 0;

    rep(i, N) {
        int a;
        cin >> a;
        if (a % 2 == 1 && (i+1) % 2 == 1) {
            ans++;
        } 
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
/*
Author:Fuad Ashraful Mehmet
University of Asia Pacific
AtCoder Beginner Contest 155
Date:16 Feb 2020
*/
#include<bits/stdc++.h>
using namespace std;


int n,m,q,len;
const int N=1e6+5;


int main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    
    bool flag=true;

    cin>>n;
    int x;
    int p=333;

    for(int i=1;i<=n;++i)
    {
        cin>>x;
        if(!flag)continue;
        if(x%2==0)
        {
            if(x%3==0||x%5==0)
            {
              p++;
            }
            else flag=false;
        }
    }

    if(flag)cout<<"APPROVED"<<endl; else cout<<"DENIED"<<endl;
    return 0;
}

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

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  
  ll count = 0;
  for (int i = 0; i < N-1; i++) {
    if (A[i] > 1) {
      count += A[i] / 2;
      A[i] %= 2;
    }
    if (A[i] == 1 && A[i+1] > 0) {
      count++;
      A[i+1] -= 1;
    }
  }
  count += A[N-1] / 2;
  
  cout << count << endl;
}

Measured memory_bytes: 1024
/*
 * FileName:     fibonacci_number
 * CreatedDate:  2020-05-01 00:08:21 +0900
 * LastModified: 2020-05-01 00:15:20 +0900
 */

#include <stdio.h>
#include <string.h>
long int fib(int n,long int *dp){
    if(dp[n]!=0){
        return dp[n];
    }
    if(n==0||n==1){
        return 1;
    }
    else{
        dp[n]=fib(n-1,dp)+fib(n-2,dp);
        return dp[n];
    }
}
int main(void){
    int n;
    scanf("%d",&n);
    long int dp[n+1];
    memset(dp,0,sizeof(dp));
    printf("%ld\n",fib(n,dp));
    return 0;
}



Measured memory_bytes: 2052
#include <stdio.h>
int min(int a, int b){
	if (a < b)return a;
	else return b;
}
int i, j;
int main(){
  int h,n;
  scanf("%d %d", &h, &n);
  int a[1003], b[1003];
	for (i = 0; i < n; i++)
		scanf("%d %d", &a[i], &b[i]);
	int dp[10004];
  for (i = 0; i < 10004; i++)
		dp[i] = 1000000009;
  dp[0]=0;

  for(i=0;i<n;i++){
    for(j=0;j<h;j++){
      dp[min(h, j+a[i])]=min(dp[min(h, j+a[i])], dp[j]+b[i]);
    }
  }
  printf("%d\n", dp[h]);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{ int a,b,c,s,m,h;
    scanf("%d %d %d",&a,&b,&c);
    if(a>b)
    { s=b;
        m=a;
    }
    else{
        m=b;
        s=a;
        
    }
    if(m>c)
    { h=m;
        
        if(s>c){
            m=s;
            s=c;}
        else{m=c;}}
    else{h=c;}
    printf("%d %d %d\n",s,m,h);
    return 0;
    
        }


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

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

    //処理
    sort(vec.begin(), vec.end(), greater<int>());

    int alice = 0;
    int bob = 0;

    for(int i = 0; i < N; i++) {
        if(i % 2 == 0) {
            alice += vec.at(i);
        } else {
            bob += vec.at(i);
        }
    }

    cout << (alice - bob) << endl;
}

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

int bynary_search(int x){
  long long l=0,r=(1e9);
  r+=1;
  while(l<r){
    long long m=(l+r)/2;
    if(m*(m+1)/2>=x)r=m;
    else l=m+1;
  }
  return l;
}

int main(){
  int x;
  cin>>x;
  if(x<0)x*=-1;
  cout<<bynary_search(x)<<endl;
  return 0;
}


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

int main(){
	int n;
	cin>>n;
	vector<int>arr1(n+1,0);
	vector<int>arr2(n+1,0);
	for(int i=1; i<=n; i++){
		cin>>arr1[i];
		arr1[i]+=arr1[i-1];
	}
	for(int i=1; i<=n; i++){
		cin>>arr2[i];
		arr2[i]+=arr2[i-1];
	}
	int mx = 0;
	for(int i=1; i<=n; i++){
		int curr = arr1[i]+arr2[n]-arr2[i-1];
		mx = max(mx,curr);
	}
	cout<<mx;
}

Measured memory_bytes: 3160
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
  int a[3][3];
  int n, b,c[3][3]={0},count;
 
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      scanf("%d",&a[i][j] );
    }
  }
  scanf("%d",&n );
 
  for(int k=0; k<n; k++)
  {
    scanf("%d",&b);
    for(int i=0; i<3; i++){
      for(int j=0; j<3; j++){
        if(a[i][j] == b)
          c[i][j] = 1;
      }
    }
  }
 
  if(c[0][0]+c[1][1]+c[2][2]==3||c[0][2]+c[1][1]+c[2][0]==3){
      puts("Yes");
      return 0;
    }
 
  for(int i=0;i<3;i++){
      if(c[i][0]+c[i][1]+c[i][2]==3||c[0][i]+c[1][i]+c[2][i]==3){
        puts("Yes");
        return 0;
      }
    }
 
    puts("No");
 
    return 0;
}

Measured memory_bytes: 1648
s = input()
ret = True
c_num = 0
for i, char in enumerate(s):
    if i == 0 and char != 'A':
        # print(1)
        ret = False
        break
    elif i == 0 and char == 'A': continue
    if not char.islower():
        if 2 <= i <= len(s)-2:
            if char == 'C':
                c_num += 1
            else:
                # print(2)
                ret = False
                break
        else:
            # print(3, i)
            ret = False
            break
    
# print(c_num)
if c_num != 1:
    ret = False
    
print('AC' if ret else 'WA')

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

using namespace std;
typedef long long LL;

int main(){
	LL N, A, B;
	cin >> N >> A >> B;
	cout << N/(A+B)*A+min(A,N%(A+B)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>

int main()
{
    int N, T;
    std::cin >> N >> T;

    int min = 9999;
    for (int i = 0; i < N; ++i) {
        int c, t;
        std::cin >> c >> t;

        if (t <= T && c < min) {
            min = c;
        }
    }

    if (min == 9999) {
        std::printf("TLE\n");
    } else {
        std::printf("%d\n", min);
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n; cin >>  n;
    int a = 1;
    int v[n];
    for(int i=0  ; i<n ;  i++){
    //入力をします
    	cin >> v[i];
    }
    for(int i =0; i<n; i++){
        if(a != 2){
            a = v[a-1];
        }else{
            cout << i <<endl;
            break;
        }
        if(a !=2 && i ==n-1){
            cout << -1 << endl;
        }
    }
    
}

Measured memory_bytes: 1016
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
#define int long long

const int MAX_N = 100010;




signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	map<int, int>mp;
	rep(i, n) {
		int a; cin >> a;
		mp[a]++;
	}
	int ans = 0;
	for (int i = 1; i <= 100000; i++) {
		chmax(ans, mp[i - 1] + mp[i] + mp[i + 1]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
// make pair, tuple
// make pair, tuple
// 
// __gcd(int, int);
// lcm = a * b / __gcd(a, b);
// 
// bool isPrime(int n){
//       if(n <= 1)return false;
//       if(n <= 3)return true;
//       if(n % 2 == 0 || n % 3 == 0)return false;
//       for(int i = 5;i * i <= n;i += 6){
//             if(n % i == 0 || n % (i + 2) == 0)return false;
//       }
//       return true;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }
// 
// #Count leading & trailing zero of an integer bits
// __builtin_clz(n);
// __builtin_clzll(n);
//
// #Count 1s bits of an integer
// __builtin_popcount(n);
// __builtin_popcountll(n);
//
// #Error checking
// assert(n == 3);
// 
// #Error Printing
// cerr << "Some thing";

int main(){
    int w,h;cin >> w >> h;
    int x,y;cin >> x >> y;
    printf("%.6f ", double(w) * double(h) / 2.0);
    if(x + x == w && y + y == h)cout << '1';
    else cout << '0';
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func gcd(x, y int) int {
	if x < y {
		x, y = y, x
	}
	for y > 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}

func main() {
	a, _ := strconv.Atoi(input())
	b, _ := strconv.Atoi(input())
	fmt.Println(lcm(a, b))
}


Measured memory_bytes: 640
A,B,C,D = gets.chomp.split(' ').map{|n| n.to_i}

ans = Array.new(100,0)

def time_cal(ans, start_sec, end_sec)
  (start_sec...end_sec).each do |i|
    ans[i] += 1
  end
  ans
end

ans = time_cal(ans, A, B)
ans = time_cal(ans, C, D)
puts ans.count(2)


Measured memory_bytes: 1788
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3612
import java.util.Scanner;
import java.util.stream.IntStream;

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

        sc.nextInt();
        String S = sc.next();

        System.out.println(solve(S));

        sc.close();
    }

    static int solve(String S) {
        return IntStream.range(0, S.length())
                .map(endIndex -> (int) IntStream.rangeClosed('a', 'z').filter(
                        ch -> S.substring(0, endIndex).indexOf(ch) >= 0 && S.substring(endIndex).indexOf(ch) >= 0)
                        .count())
                .max().getAsInt();
    }
}

Measured memory_bytes: 27092
r, c = map(int, input().split())
sheet = []

for i in range(r):
    sheet.append(list(map(int, input().split())))
    sheet[i].append(sum(sheet[i]))

for i in range(r):
    print(" ".join(list(map(str, sheet[i]))))

c_sum = []
for j in range(c+1):
    sum = 0
    for i in range(r):
        sum += sheet[i][j]
    c_sum.append(sum)

print(" ".join(list(map(str, c_sum))))



Measured memory_bytes: 5700
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

s = ins()
k = inn()
n = len(s)
t = [ord(c)-ord('a') for c in s]
for i in range(n):
    if t[i]>0 and k>=26-t[i]:
        k -= 26-t[i]
        t[i] = 0
if k>0:
    t[n-1] = (t[n-1]+k)%26
print(''.join([chr(t[i]+ord('a')) for i in range(n)]))


Measured memory_bytes: 4980
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n, d, x;
vi a;

int main()
{
    cin >> n;
    cin >> d >> x;
    a.resize(n+1); rrep(i, n) cin >> a[i];

    int ans = x;
    rrep(j, n){
        rrep(i, d){
            if((i - 1) % a[j] == 0) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int N;
  int X;
  int T;
  int count;
  int time;
  scanf("%d",&N);
  scanf("%d",&X);
  scanf("%d",&T);
  count=N/X;
  if(N%X!=0){
    count=count+1;
  }
  time=T*count;
  printf("%d",time);
}

Measured memory_bytes: 1724
/*==============================================*\
Codeforces ID:    mdshihab
 Atcoder ID :   mdshihab                                                 |
Name:     Md. Shihabul Minhaz                     |
Study:      CSE, JKKNIU                           |
Address:  Trishal, Mymensingh, Bangladesh         |
                                                  |
 mail:   mdshihabul20171@gmail.com                |
 FB  :   fb.com/mdshihabul.minhaz.7               |
 github: Shihabulminhaz                           |
stopstalk :  mdshihab                             |
                                                  |
@uthor   Md. Shihabul Minhaz (shihab)             |
\*===============================================*/


#include<bits/stdc++.h>
using namespace std;
#define fi(a) scanf("%d",&a);
#define fli(a) scanf("%ld",&a);
#define fll(a) scanf("%lld",&a);
#define pi(a) printf("%d\n",a);
#define ppi(i,a) printf("Case %d: %d\n",i,a);
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void FI()
{
#ifndef ONLINE_JUDGE
    freopen("C:\\Users\\SHIHAB\\Desktop\\input.in","r",stdin);
#endif // ONLINE_JUDGE
}
//ll arr[10000000];
int main()
{
    fast
    FI(); /// skip this line for compile
    ///brute force solution
    /*
    ll n,l,j=0,ans=1;
    ll sum=0;
    cin >> n;

    for(ll i=1;i<=n;i++){
        for(ll j=i;j<=n;j+=i){
            arr[j]++;
        }
    }

    for(ll i=1;i<=n;i++){
        sum+=i*arr[i];
    }
    cout << sum << endl;*/

    /// optimize solution
    ll cnt,ans=0,sum,n;
    cin >> n;
    for(ll i=1;i<=n;i++){
        cnt = n/i;
        sum = (cnt+1) * cnt/2;
        ans+=sum*i;
    }
    cout << ans << endl;
    return 0;
}


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

#define ll long long
#define MOD 1000000007
using namespace std;

ll f(int mask, vector<vector<int>> &compat, vector<ll> &dp) {
    int k = __builtin_popcount(mask);   // no. of men already assigned
    // base case: all men assigned
    if (k >= compat.size()) {
        return 1;
    }
    if (mask != 0 and dp[mask] != -1)
        return dp[mask];

    ll res = 0;
    for (int j = 0; j < compat.size(); j++) {
        if (!(mask & (1 << j))) {
            if (compat[k][j]) {
                // if jth woman is compatible with kth man
                int newmask = (mask | (1 << j));
                res = ((res % MOD) + (f(newmask, compat, dp) % MOD)) % MOD;
            }
        }
    }
    dp[mask] = res % MOD;
    return dp[mask];
}

int main() {
    int N;
    cin >> N;
    vector<vector<int>> compat(N, vector<int>(N, 0));
    for (int i = 0; i < N; i++)
        for (int j = 0; j < N; j++)
            cin >> compat[i][j];

    vector<ll> dp(1 << N, -1);

    cout << f(0, compat, dp) % MOD;
    return 0;
}

Measured memory_bytes: 16640
/*
        @uthor: Kashish Gilhotra
        user: CodeChef, CodeForces, HackerEarth, HackerRank, SPOJ: kashish001
*/

#include <bits/stdc++.h>
using namespace std;
  
#define int long long int 
typedef vector<int> vi;
typedef vector<pair<int, int>> vpi;
typedef vector<vi> vvi;
const int mod = 1e9 + 7; 

#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define debug(...) cerr << "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " 
#define EB emplace_back
#define ALL(v) v.begin(), v.end() 
#define size(v) (int)v.size() 
#define endl "\n"
#define UMO unordered_map
#define USO unordered_set
#define TC int t; cin >> t; while (t--) 

void Panda() {
    int n;
    cin >> n;
    for(int i = 0;  i< n; i++) cout << "ACL";
    cout << endl;
}
  
int32_t main() {
 
    FAST;

    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout); 
    
    Panda();

    return 0; 
} 

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

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

ll INF=LLONG_MAX;

int const mxn=3e5+5;
ll a[mxn];

void multi(ll &a, ll b){
	a%=MOD; b%=MOD; a*=b; a%=MOD;
	return;
}
void add(ll &a, ll b){
	a%=MOD; b%=MOD; a+=b; a%=MOD;
	return;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	map<int,ii>mp;
	for(int i=0; i<n; i++){
		cin >> a[i];
		for(int j=60; j>=0; j--){
			if((a[i]/(1LL<<j))%2)mp[j].se++;
			else mp[j].fi++;
		}
	}
	ll ans = 0;
	for(int j=60; j>=0; j--){
		ll cur = (1LL<<j)%MOD;
		multi(cur,ll(mp[j].fi)*ll(mp[j].se)%MOD);
		add(ans,cur);
	}
	cout << ans << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 2560
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
int ai[105],bi[105];    
int main()
{
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=a;i++)
        cin>>ai[i]>>bi[i];
    int max1=1<<a,ant=10000000;
    for(int i=0;i<max1;i++)
    {
        int cnt=0,rr=b;
        for(int j=a-1;j>=0;j--)
        {
            if(i&(1<<j))
            {
                int tem=ai[j+1]*(j+1)*100+bi[j+1];
                if(tem>=rr)
                {
                    if(ai[j+1]*(j+1)*100>=rr)
                    {
                        if(rr%((j+1)*100)==0)
                            cnt+=rr/((j+1)*100);
                        else
                            cnt+=rr/((j+1)*100)+1;
                    }
                    else {
                        cnt+=ai[j+1];
                    }
                    rr-=tem;
                    break;
                }
                else
                {
                    rr-=tem;
                    cnt+=ai[j+1];
                }
            }
        }
        if(rr<=0)
        ant=min(ant,cnt);
    }
    cout<<ant<<endl;
    return 0;
}
    

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

using namespace std;

int main(){
  int K, N;
  cin >> K >> N;
  
  vector<int> d(N);
  vector<int> a(N);
  for(int i=0; i<N; i++)cin >> a[i];
  for(int i=1; i<N; i++) d[i] = a[i] - a[i-1]; 
  d[0] = K - a[N-1] + a[0];
  
  auto it = std::max_element(d.begin(), d.end());
  int maxD = *it;
  
  cout << K - maxD;
  return 0;
}

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

int main() {
  int X;
  scanf("%d", &X);
  vector<bool> expo(X + 1);

  expo[1] = 1;
  for (int b = 2; b <= X; b++) {
    int v = b * b;
    while (v <= X) {
      expo.at(v) = true;
      v *= b;
    }
  }

  for (int i = X; i >= 1; i--) {
    if (expo.at(i)) {
      cout << i << endl;
      return 0;
    }
  }
}



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

int main(){
    ll X; cin >> X;
    ll ans = 0, sum = 0;
    for(int t = 1; t < 1e9; t++){
        sum += t;
        if(X <= sum){
            cout << t << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
for i in range(Y // 10000 + 1):
  for j in range((Y - 10000 * i) // 5000 + 1):
    if 10000 * i + 5000 * j == Y - 1000 * (N - i - j) and N - i - j >= 0:
      print(i, j, N - i - j)
      exit()
print(-1, -1, -1)

Measured memory_bytes: 40812
n = int(input())
c = []
dp = [0]*3
# for i in range(n):
#     c.append(list(map(int, input().split())))
for i in range(n):
    c = list(map(int, input().split()))
    new_dp = [0]*3
    for j in range(3):
        for k in range(3):
            if j != k:
                new_dp[k] = max(new_dp[k], dp[j] + c[k])
    dp = new_dp[:]
print(max(dp))


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
    int A,B;
    cin>>A>>B;
    if((A==1||B==1)&&(A==2||B==2)){
        cout<<"3";
    }
    else if((A==2||B==2)&&(A==3||B==3)){
        cout<<"1";
    }
    else cout<<"2";
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

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

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

int main() {
	ll n,c;cin>>n>>c;
	ll x[MAX],v[MAX];
	rep(i,n) cin>>x[i]>>v[i];
	ll d1[MAX+1],d1r[MAX+1],d1m[MAX+1],d2[MAX+1],d2r[MAX+1],d2m[MAX+1];
	d1[0]=d1r[0]=d1m[0]=d2[0]=d2r[0]=d2m[0]=0LL;
	d1[1]=v[0]-x[0];
	for(int i=2;i<=n;i++) d1[i]=d1[i-1]+v[i-1]-(x[i-1]-x[i-2]);
	for(int i=1;i<=n;i++) d1r[i]=d1[i]-x[i-1];
	for(int i=1;i<=n;i++) d1m[i]=max(d1[i],d1m[i-1]);
	d2[1]=v[n-1]-(c-x[n-1]);
	for(int i=2;i<=n;i++) d2[i]=d2[i-1]+v[n-i]-(x[n-i+1]-x[n-i]);
	for(int i=1;i<=n;i++) d2r[i]=d2[i]-(c-x[n-i]);
	for(int i=1;i<=n;i++) d2m[i]=max(d2[i],d2m[i-1]);
	ll ans[10];
	ans[0]=0LL;
	for(int i=0;i<=n;i++) ans[0]=max(ans[0],d1[i]);
	ans[1]=0LL;
	for(int i=0;i<=n;i++) ans[1]=max(ans[1],d2[i]);
	ans[2]=0LL;
	for(int i=1;i<=n-1;i++) ans[2]=max(ans[2],d1r[i]+d2m[n-i]);
	ans[3]=0LL;
	for(int i=1;i<=n-1;i++) ans[3]=max(ans[3],d2r[i]+d1m[n-i]);
	sort(ans,ans+4);
	cout<<ans[3]<<endl;
}


Measured memory_bytes: 6528
/*
                         -------------Shuvo's code-----_______
                        /''''''''''(______O] ----------____  \______/]_
     __...---'"""\_ --''        Metropolitan university     ___________@ -> ->  -> - --  - -- - ---- ->>
 |'''                   ._   _______________=---------"""""""
 |                ..--''|   l L |_l   |
 |          ..--''      .  /-___j '   '
 |    ..--''           /  ,       '   '
 |--''                /           `    \
                      L__'         \    -
                                    -    '-.
                                     '.    /
                                       '-./
*/

///   ------------ Bismillah hirrahman nirrahim ----------   ///

#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long
#define sc(n) scanf("%I64d", &n);
#define pr(n) printf("%I64d\n", n);
#define prr(n, m) printf("%I64d %I64d\n", n, m);
#define prrr(n, m, p) printf("%I64d %I64d %I64d\n", n, m, p);
#define lp(i,s,n) for(long long  i = s; i<n; i++)
#define pl(n) for(long long i=n-1; i>=0; i--)
#define  ars(arr,s,e) sort(arr+s,arr+n);
#define pb push_back
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)

long long int mx = 1e18;
long long int mn = -1e18;
using namespace std;

vector < ll > v;
map < string, ll > mp;

int main()
{
    FastRead;
    ll p,q,r,s,t,i, j,ii,a, b, x,len, sum, jj, n;
    cin >> n >> a >> b;



    if((b-a) % 2 == 1)
    {
        cout << "Borys" << endl;
    }
    else cout << "Alice" << endl;
}



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

int a, b, c, d;

void print()
{
	
}
int main()
{
	cin >> a >> b >> c >> d;
	while (a > 0 && c > 0)
	{
		c -= b;
		if (c <= 0)
		{
			cout << "Yes" << endl;
			break;
		} 
		a -= d;
		if (a <= 0)
		{
			cout << "No" << endl;
			break;
		}
	}

	return 0;
}


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

using namespace std;

int main()

{

    long double x,y=100;

    long long int k;

    int ans=0;

    cin>>x;

   while(y<x)

   {

      k=y*0.01;

      y+=k;

       ans++;

   }

   cout<<ans;



}

Measured memory_bytes: 3724
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();

        String[] nk = line.split(" ");
        int N = Integer.parseInt(nk[0]);
        int K = Integer.parseInt(nk[1]);

        String[] diceStr = sc.nextLine().split(" ");
        Double[] dice = new Double[N];
        for(int i = 0; i < diceStr.length ; i++) {
        	dice[i] = Double.parseDouble(diceStr[i]);
        }
        sc.close();

        for(int i = 0; i < dice.length; i++) {
        	dice[i] = (dice[i]+1)/2;
        }

        double max = 0.0000;
        for(int i =0; i < K; i++) {
        	max += dice[i];
        }
        double comp1 = max ;
        for(int i =0; i < dice.length-K;i++ ) {
        	comp1 = (comp1 + dice[i+K]-dice[i]);
        	if(max < comp1) {
        		max = comp1;
        	}
        }

        System.out.println(max);

	}

}

Measured memory_bytes: 62264
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i = 0; i<N ;i++){
    	A[i] = sc.nextInt();
    }
    Arrays.sort(A);
    int x = 1;
    for(int i = 0; i<N-1; i++){
    	if(A[i] != A[i+1]){
    		x++;
    	}
    }
    if(x%2 == 1){
    	System.out.println(x);
    }else{
    	System.out.println(x-1);
    }
  }
}

Measured memory_bytes: 32260
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(ll n,ll m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];

int main() {
    FAST;
    long long n,a[3000005],b[3000005],l,r;
	cin>>n;
	
	for(int i=1;i<=n;i++)
	   cin>>a[i]>>b[i];
	   
	sort(a+1,a+n+1);
	
	sort(b+1,b+n+1);
	   
	
	if(n%2==1)
	{
		l=b[(n+1)/2];
		r=a[(n+1)/2];
	}
	else
	{
		l=(b[n/2]+b[n/2+1]);
		r=(a[n/2]+a[n/2+1]);
	}
	
	cout<<l-r+1;
	  
	return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(ll n, ll m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 13796
#include<iostream>
#include<cmath>
//#define e 0.00000000001
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  double e = 0.0000000001;
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
    if(abs((b[1]-a[1])*(d[0]-c[0])-(d[1]-c[1])*(b[0]-a[0]))<e) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h> 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
typedef long long ll;
using namespace std;
int main(){
  int n,k,r,s,p;
  string t;
  cin>>n>>k>>r>>s>>p>>t;
  ll l=0;
  vector<int> a(n,0);
  rep(i,k){
    if(t[i]=='r'){a[i]=p;}
    if(t[i]=='s'){a[i]=r;}
    if(t[i]=='p'){a[i]=s;}}
  for(int i=k;i<n;i++){
    if(t[i]==t[i-k]&&a[i-k]!=0){a[i]=0;}
    else{
    if(t[i]=='r'){a[i]=p;}
    if(t[i]=='s'){a[i]=r;}
    if(t[i]=='p'){a[i]=s;}}}
  rep(i,n){l+=a[i];}
  cout<<l<<endl;
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace proconRCO2017
{
    class Program
    {
        static void Main(string[] args)
        {
            // var string =
            var input = Console.ReadLine();
            var expected = "AKIHABARA";
            var answer = "";
            var inputIndex = 0;
            var expectedIndex = 0;
            for (var i = 0; i < expected.Length; i++)
            {
                if (inputIndex <= input.Length - 1 && input[inputIndex] == expected[expectedIndex])
                {
                    answer += input[inputIndex];
                    inputIndex++;
                }
                else
                {
                    answer += 'A';
                }
                expectedIndex++;
            }

            if (answer == expected && input.Length <= expected.Length)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

Measured memory_bytes: 13140
def is_prime(n):
  if n==1: return False
  
  for i in range(2, int(n**0.5)+1):
    if n % i == 0:
      return False
    
  return True

x = int(input())
j = 0
while is_prime(x+j)==False:
  j += 1
print(x+j)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
#define _GLIBCXX_DEBUG


int main(){
  int N;
  int AA=0,AB=0,AC=0,BA=0,BB=0,BC=0,CA=0,CB=0,CC=0;
  vector<int> A1(3),A2(3),A3(3);
  for(int i=0;i<3;i++) cin>>A1[i];
  for(int i=0;i<3;i++) cin>>A2[i];
  for(int i=0;i<3;i++) cin>>A3[i];
  cin>>N;
  vector<int> B(N);
  for(int i=0;i<N;i++) cin>>B[i];
  for(int i=0;i<N;i++){
    if(B[i]==A1[0]) AA=1;
    if(B[i]==A1[1]) AB=1;
    if(B[i]==A1[2]) AC=1;
    if(B[i]==A2[0]) BA=1;
    if(B[i]==A2[1]) BB=1;
    if(B[i]==A2[2]) BC=1;
    if(B[i]==A3[0]) CA=1;
    if(B[i]==A3[1]) CB=1;
    if(B[i]==A3[2]) CC=1;
  }
  
  //tate
  if(AA&&BA&&CA){
    cout<<"Yes"<<endl;
        return 0;
  }
  if(AB&&BB&&CB){
    cout<<"Yes"<<endl;
        return 0;
  }
  if(AC&&BC&&CC){
    cout<<"Yes"<<endl;
        return 0;
  }
  //yoko
  if(AA&&AB&&AC){
    cout<<"Yes"<<endl;
        return 0;
  }
  if(BA&&BB&&BC){
    cout<<"Yes"<<endl;
        return 0;
  }
  if(CA&&CB&&CC){
    cout<<"Yes"<<endl;
        return 0;
  }
  //naname
  if(AA&&BB&&CC){
    cout<<"Yes"<<endl;
        return 0;
  }
  if(AC&&BB&&CA){
    cout<<"Yes"<<endl;
        return 0;
  }
  
 else cout<<"No"<<endl;
  
}


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

int main(){
  while(1){
    int data[101],i,j,k,result;
    int N,K; cin >> N >> K;
    if( N == 0 && K == 0 ) break;

    for( i = 0; i < N; i++ ) cin >> data[i];
  
    int maxv = -1;
    for( i = 0; i <= N-K; i++ ) {
      result = 1;
      for( j = i; j < i+K; j++ ){
	result *= data[j];
      }
      maxv = max( result,maxv);
    }
    
    int maxv2 = -1;
    int result2;
    for( i = 0; i < N; i++ ){
      for( j = 0; j < N; j++ ){
	if( i != j ){
	  swap( data[i],data[j] );
	  for( k = 0; k <= N-K; k++ ) {
	    result2 = 1;
	    for( int l = k; l < k+K; l++ ){
	      result2 *= data[l];
	      
	    }
	    maxv2 = max( result2,maxv2 );
	  }
	  swap( data[i],data[j] );
	}
      }
    }

    int ans = maxv2 - maxv;

    if( ans >= 0 ) cout << ans << endl;
    else cout << "NO GAME" << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int di[] = {1, 0, 0, -1}, dj[] = {0, 1, -1, 0};

int h, w;
vector<vector<int>> field, copyf;
bool flag;

pair<int, int> dfs(int i, int j) {
    vector<pair<int, int>> nxt;
    queue<pair<int, int>> q;
    int cur = field[i][j]; field[i][j] = 0; q.emplace(i, j);
    int cnt_x = 0, cnt_w = 0, xL = w, xR = 0;
    while (!q.empty()) {
        auto p = q.front(); q.pop();
        int i = p.first, j = p.second;
        cnt_x += j; cnt_w++;
        if (copyf[i - 1][j] && copyf[i - 1][j] != cur) {
            xL = min(xL, j); xR = max(xR, j + 1);
        }
        for (int k = 0; k < 4; k++) {
            int ni = i + di[k], nj = j + dj[k];
            if (ni <= 0 || ni >= h + 1 || nj < 0 || nj >= w) continue;
            if (field[ni][nj] == cur) {
                field[ni][nj] = 0; q.emplace(ni, nj);
            } else {
                if (k == 0 && field[ni][nj]) nxt.emplace_back(ni, nj);
            }
        }
    }
    for (auto p : nxt) if (field[p.first][p.second]) {
        auto res = dfs(p.first, p.second);
        cnt_x += res.first;
        cnt_w += res.second;
    }
    double M = 1.0 * cnt_x / cnt_w + 0.5;
    if (not(xL < M && M < xR)) flag = false;
    return {cnt_x, cnt_w};
}

int main() {
    while (cin >> w >> h, w) {
        flag = true;
        field.assign(h + 1, vector<int>(w, 0));
        copyf.assign(h + 1, vector<int>(w, 0));
        for (int i = 0; i < h; i++) {
            string s; cin >> s;
            for (int j = 0; j < w; j++) if ('1' <= s[j] && s[j] <= '9') {
                copyf[h - i][j] = field[h - i][j] = s[j] - '0';
            }
        }
        for (int j = 0; j < w; j++) copyf[0][j] = -1;
        for (int j = 0; j < w; j++) if (field[1][j]) {
            dfs(1, j);
            break;
        }
        puts(flag ? "STABLE" : "UNSTABLE");
    }
    return 0;
}


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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
typedef vector<LL> V;
    namespace _DSU{
    int cnt=0;
    int mem[2][412345];
    int* get(){
        return mem[cnt++];
    }
}
class UF{
private:
    int *par,*rank;
    int find(int x){
	if (par[x] == x) return x;
	else return par[x] = find(par[x]);
    }
public:
    UF(int n,int *par,int *rank) :par(par),rank(rank){
	REP(i,n)par[i] = i,rank[i] = 0;
    }
    UF(int n):UF(n,_DSU::get(),_DSU::get()){}
    bool unite(int x, int y){
	x = find(x);y = find(y);
	if (x == y)return false;
	if (rank[x] < rank[y]) par[x] = y;
	else{
	    par[y] = x;
	    if (rank[x] == rank[y])rank[x]++;
	}
	return true;
    }
    bool same(int x, int y){
	return find(x) == find(y);
    }
};
LL X[112345];
LL Y[112345];
typedef pair<int,int> P;
typedef pair<LL,P> E;
int main(){
    int N;
    cin>>N;
    map<LL,vector<int>> x,y;
    REP(i,N){
        int a,b;
        cin>>a>>b;
        x[a].pb(i);
        y[b].pb(i);
    }
    int M=0;
    int K=0;
    for(auto &it:x)X[M++]=(it.fi);
    for(auto &it:y)Y[K++]=(it.fi);
    UF uf(N+M+K);

    M=0;
    for(auto &it:x){
        for(auto &j:it.se)uf.unite(N+M,j);
        M++;
    }
    K=0;
    for(auto &it:y){
        for(auto &j:it.se)uf.unite(N+M+K,j);
        K++;
    }

    
    vector<E> e;
    FOR(i,1,M)e.pb(E(X[i]-X[i-1],P(N+i-1,N+i)));
    FOR(i,1,K)e.pb(E(Y[i]-Y[i-1],P(N+M+i-1,N+M+i)));
    sort(ALL(e));
    LL res=0;
    for(auto &it:e){
        if(uf.unite(it.se.fi,it.se.se))
            res+=it.fi;
    }
    cout<<res<<endl;
    
    return 0;
}


Measured memory_bytes: 32624
m, d = map(int, input().split())

counter = 0
index = 1
while index <= m:
    index2 = 10
    while index2 <= d:
        dL = list(str(index2))
        d1 = int(dL[0])
        d10 = int(dL[1])
        if d1 >= 2 and d10>=2 and d1*d10 == index:
            counter+=1
        index2+=1
    index+=1
print(counter)

Measured memory_bytes: 3060
import math
N,K = map(int, input().split())
ret = 0.0
for i in range(1,N+1):
    # print(i, math.ceil(math.log2(K/i)), ret)
    log_2_K_n = math.ceil(math.log2(K/i))
    ret += (1/N)*((0.5)**log_2_K_n if i < K else 1)
    # if ret > 1: print(ret)
    
print(ret)

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

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout<<fixed<<setprecision(10);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  string s;cin>>s;
  rep(i,0,s.size()){
    s[i]=((s[i]-'A')+n)%26+'A';
  }
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 256
/**************/
/* Author : Mahmoud Tarek
/*************/

#include <bits/stdc++.h>
#define dbg(v) cerr << #v << " = " << v ;

using namespace std ;

int main(){
  string st ;
  int k ;
  cin >> st >> k ;
  set < deque < char > > in ;
  deque < char > ck ;
  for( int i = 1 ; i <= min( (int)st.size() , 100 ) ; i++ ){
     ck.clear() ;
     for( int j = 0 ; j < i ; j++ ){
        ck.push_back( st[ j ] ) ;
     }
     int j = i ;
     if( j <= st.size() ){
         while( j <= st.size() ){
            in.insert( ck ) ;
            ck.pop_front() ;
            ck.push_back( st[ j ] ) ;
            j++;/*
            for( auto c : ck ){
                cout << c << " " ;
            }
            cout << "\n" ;*/
         }
     } else in.insert( ck ) ;
  }

  int j = 1 ;
  for( auto i : in ){
        if( j == k ){
        for( auto c : i ){
            cout << c ;
        }
        cout << "\n" ;
        return 0 ;
        }
        j++ ;
  }

}




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

int pri[1010],wai[1010],dp[2][1010];
int main(){
	int W,N,cas=0;
	while(true){
		cas++;
		cin>>W;
		if(W==0) break;
		cin>>N;
		for(int i=1;i<=N;i++){
			scanf("%d,%d",&pri[i],&wai[i]);
		}
		fill(dp[0],dp[0]+W+1,0);
		fill(dp[1],dp[1]+W+1,0);
		int in=0,ou=1;
		for(int i=1;i<=N;i++){
			for(int j=0;j<=W;j++) dp[ou][j]=dp[in][j];
			for(int j=0;j<=W;j++){
				if(j+wai[i]<=W){
					dp[ou][j+wai[i]]=max(dp[ou][j+wai[i]],dp[in][j]+pri[i]);
				}
			}
			swap(in,ou);
		}
		int res=0,cnt=0;
		for(int i=0;i<=W;i++){
			if(res<dp[in][i]){
				res=dp[in][i];
				cnt=i;
			}
		}
		cout<<"Case "<<cas<<":"<<endl<<res<<endl<<cnt<<endl;
	}
	return 0;
}

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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}


int main()
{
	fastio;
	ll l,r,d,i;
	cin>>l>>r>>d;
	ll ans=0;
	for(i=l;i<=r;i++)
	{
		if(i%d==0)
			ans++;
	}
	cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

int main() {
    #ifdef LOCAL
    assert(freopen("e.in", "r", stdin));
    #else
    #endif
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x = abs(a - c);
    int y = abs(b - d);
    cout << x + y - __gcd(x, y) << '\n';
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;  //整数の個数
  cin >> N;  //入力
  int num = 0;  //2で割る回数
  int A[N];  //整数の配列
  
  bool flag = true;  //二で割る演算がN回成功したか
  
  //整数を入力する
  for (int i = 0; i < N; i++){
  	cin >> A[i];
  }
  
  //前回二で割る演算が成功したときのみ、このループに入る
  while(flag){
    //0~N番目までについてループする
    for (int i = 0; i < N; i++){
      if (A[i] % 2 == 0){
        A[i] /= 2;
      } else {
        flag = false;
        break;
      }
    }
    if (flag){
      num += 1;
    }
  }
  
  //出力
  cout << num << endl;
}

Measured memory_bytes: 256
N=int(input())
List=[list(map(int,input().split())) for i in range(N)]
ans='Yes'
for j in List:
  if (j[1]+j[2]) > j[0]:
    ans='No'
  else:
    if j[0]%2 == 0:
      if (j[1]+j[2])%2 == 1:
        ans='No'
    else:
      if (j[1]+j[2])%2 == 0:
        ans='No'
print(ans)

Measured memory_bytes: 27380
n,k=map(int,input().split())
x=list(map(int,input().split()))

l_x=sorted([abs(i) for i in x if i<0])
r_x=[i for i in x if i>=0]

ans=10**12
for r_num in range(k+1):
  l_num=k-r_num
  if l_num>len(l_x) or r_num>len(r_x):
    continue
  if l_num==0: #右片道
    ans=min(ans,r_x[r_num-1])
  elif r_num==0: #左片道
    ans=min(ans,l_x[l_num-1])
  elif l_x[l_num-1]<=r_x[r_num-1]: #左往復右片道
    ans=min(ans,l_x[l_num-1]*2+r_x[r_num-1])
  else: #右往復左片道
    ans=min(ans,l_x[l_num-1]+(r_x[r_num-1])*2)

print(ans)

Measured memory_bytes: 14384