akhauriyash/Code-Regression huggingface dataset:
// Try AtCoder
// author: Leonardone @ NEETSDKASU
package main

import "fmt"

func main() {
    var n int
    fmt.Scan(&n)
    a := make([]int, n + 1)
    for i := range a[1:] {
        fmt.Scan(&a[i+1])
    }
    ans := 0
    p := 1
    for {
        ans++
        t := a[p]
        if t == 0 {
            ans = -1
            break
        }
        if t == 2 {
            break
        }
        a[p] = 0
        p = t
    }
    fmt.Println(ans)
}

Measured memory_bytes: 5504
/* 
 * Project: AtCoder Beginners Contest 113 A - Discount Fare
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/09
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

int x, y;

void solve() {

    int price = x + y/2;
    printf("%d\n", price);

}

int main() {

    scanf("%d", &x);
    scanf("%d", &y);

    solve();

}

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

typedef long long lint;
typedef pair<int, int> ii;

const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int n, a[100005];

int solve(){
	cin >> n;
	int cnt[4] = {};
	for(int i=0;i<n;i++) cin >> a[i], a[i] %= 4, cnt[a[i]]++;
	cnt[1] += cnt[3];
	int prev = 0;
	for(int i=0;i<n;i++){
		if(prev == 0){
			if(cnt[1] > 0) cnt[1]--, prev = 1;
			else if(cnt[2] > 0) cnt[2]--, prev = 2;
			else if(cnt[0] > 0) cnt[0]--, prev = 0;
			else return cout << "No" << endl, 0;
		}else if(prev == 1){
			if(cnt[0] > 0) cnt[0]--, prev = 0;
			else return cout << "No" << endl, 0;
		}else{
			if(cnt[2] > 0) cnt[2]--, prev = 2;
			else if(cnt[0] > 0) cnt[0]--, prev = 0;
			else return cout << "No" << endl, 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}


int main(){
	ios::sync_with_stdio(0);
	// int t; cin >> t; while(t--)
	solve();
	// cout << (solve() ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    vector<long long> x(n);
    vector<long long> y(n);
    vector<long long> z(n);
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>z[i];
    }
    long long ans=0;
    for(int i=0;i<8;i++){
        vector<long long> s(n);
        string tmp="";
        for(int j=0;j<3;j++){
            tmp+=(bool)(i&(1<<j))+'0';
        }
        for(int j=0;j<n;j++){
            long long sum=0;
            if(tmp[0]=='0')sum+=x[j];
            else sum-=x[j];
            if(tmp[1]=='0')sum+=y[j];
            else sum-=y[j];
            if(tmp[2]=='0')sum+=z[j];
            else sum-=z[j];
            s[j]=sum;
        }
        sort(s.begin(),s.end(),greater<long long>());
        long long sum=0;
        for(int j=0;j<m;j++){
            sum+=s[j];
        }
        ans=max(ans,sum);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int count = 0;
		char[] list = S.toCharArray();
		for(int i = 0; i < list.length; i++){
			for(int j = 0; j < list.length; j++){
				if(list[i] == list[j]){
					count += 1;
				}
			}
		}
		count -= list.length;
		if(count == 0){
				System.out.println("yes");
		}else{
				System.out.println("no");
		}
	}
}


Measured memory_bytes: 23252
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {

	private static final int N = 3;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(IntStream.range(0, N).mapToObj(i -> scanner.next().substring(0, 1).toUpperCase())
					.collect(Collectors.joining()));
		}
	}
}


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

void make_lunlun(int d, ll i, vector<ll> &all){
    if(d==11) return;
    all.push_back(i);
    if(i%10 == 0){
        make_lunlun(d+1,i*10+(i%10),all);
        make_lunlun(d+1,i*10+(i%10)+1,all);
    }
    else if(i%10 == 9){
        make_lunlun(d+1,i*10+(i%10)-1,all);
        make_lunlun(d+1,i*10+(i%10),all);
    }
    else{
        make_lunlun(d+1,i*10+(i%10)-1,all);
        make_lunlun(d+1,i*10+(i%10),all);
        make_lunlun(d+1,i*10+(i%10)+1,all);
    }
}

int main(){
    int k;
    cin >> k;
    vector<ll> lunlun;
    for(ll i=1; i<=9; i++){
        make_lunlun(1, i, lunlun);
    }
    sort(lunlun.begin(), lunlun.end());
    cout << lunlun.at(k-1) << endl;

    /*
    for(int i=0; i<15; i++){
        cout << lunlun.at(i) << endl;
    }
    */
}


Measured memory_bytes: 5364
import java.util.*;

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

        int number = sc.nextInt();

        int member[] = new int[number];
        for (int i = 0; i < number; i++){
            member[i] = sc.nextInt();
            if (i == 0){
                min = member[i];
                max = member[i];
            }

            if (i != 0 && min > member[i]){
                min = member[i];
            }

            if (i != 0 && max < member[i]){
                max = member[i];
            }
        }

        System.out.println(Math.abs(max - min));
    }
}

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

using namespace std;
#define rep(i,n) for (int i =0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;

int main() {
	int A, B, M;
	cin >> A >> B >> M;
	vector<int> a(A);
	vector<int> b(B);
	vector<int> x(M);
	vector<int> y(M);
	vector<int> c(M);
	rep(i, A)cin >> a[i];
	rep(i, B)cin >> b[i];
	rep(i, M)cin >> x[i] >> y[i] >> c[i];
	int mini = 100000000;
	rep(i, M)mini = min(mini, a[x[i]-1] + b[y[i]-1] - c[i]);
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	mini = min(mini, a[0] + b[0]);
	cout << mini;

}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int b, g;
int t[100000], v[100000];
long long bio[105][100005];
int main()
{
    cin >> b >> g;
    for(int i = 0; i < b; i++)
    {
    	cin >> t[i] >> v[i];
	}
	for(int i = 0; i <= 100000; i++)
	{
		bio[0][i] = 1000000005;
	}
	for(int i = 0; i <= b; i++)
	{
		bio[i][0] = 0;
	}
    for(int i = 1; i <= b; i++) 
    { 
        for(int w = 1; w <= 100000; w++) 
        { 
            if(v[i-1] <= w)
		    {
                bio[i][w] = min(t[i-1] + bio[i-1][w-v[i-1]],  bio[i-1][w]);
			}
            else
            {
                bio[i][w] = bio[i-1][w];
            }
        } 
    } 
	for(int i = 100000; i > 0; i--)
	{
		if(bio[b][i] <= g)
		{
			cout << i << endl;
			return 0;
		}
	}
	cout << 0 << endl;
}



Measured memory_bytes: 80128
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#define ll long long
#define str string
#define rtn return
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define db long double
#define MOD 1000000007
#define INF 1e18
#define EPS 1e-15
#define pll pair <ll, ll>
#define vi vector<ll>
#define vpll vector<pll>
#define value_at find_by_order
#define index_of order_of_key
#define fill(a,v) memset(a,v,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(ll i=0;i<n;++i)
#define per(i,n) for(ll i=n-1;i>=0;--i)
#define loop1(i, n) for (int i=1;i<=n;++i)
#define loop(i, begin, end) for (__typeof(end) i = (begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);std::cout.tie(NULL)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1 << " |";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif

template<class T> void remin(T &a, T b) {a = min(a, b);}
template<class T> void remax(T &a, T b) {a = max(a, b);}
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define N 100005

int n;
ll a[N], b[N], c[N];
ll dp[N][3];

int main() {
  FAST_IO;
  cin >> n;
  rep(i, n) cin >> a[i] >> b[i] >> c[i];
  dp[0][0] = a[0], dp[0][1] = b[0], dp[0][2] = c[0];
  loop(i, 1, n) {
    dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
    dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];
    dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];
  }
  ll ans = 0;
  rep(i, 3) remax(ans, dp[n-1][i]);
  cout << ans;
  rtn 0;
}


Measured memory_bytes: 4992
#include<stdio.h>

int main() {
	int i;
	int n;
	int b, f, r, v;
	int number[4][3][10] = { 0 };

	scanf("%d\n", &n);

	for (i = 0; i < n ; i++) {
		scanf("%d %d %d %d", &b, &f, &r, &v);
		number[b - 1][f - 1][r - 1] += v;
	}

	for (b = 0; b < 4 ;b++) {
		for (f = 0; f < 3; f++) {
			for (r = 0; r < 10; r++) {
				if (number[b][f][r] > 0) {
					printf(" %d", number[b][f][r]);
				}
				else {
					printf(" 0");
				}
			}
			printf("\n");
		}
		if (b < 3) {
			printf("####################\n");
		}
	}

	return 0;
}


Measured memory_bytes: 2108
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<cstdio>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	int n;
	cin>>n;
	int l[n];
	rep(i,n)cin>>l[i];
	sort(l,l+n);
	ll ans=0;
	//for(int i=0;i<n;i++)cout<<l[i]<<" ";cout<<"\n";
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			int x=lower_bound(l,l+n,l[i]+l[j])-l;
			int y=upper_bound(l,l+n,l[j]-l[i])-l;
			if(l[i]<l[i]+l[j])x--;
			if(l[i]<=l[j]-l[i])y--;
			if(l[j]<l[i]+l[j])x--;
			if(l[j]<=l[j]-l[i])y--;
			//x=max(0,x);
			//y=max()
			//cout<<x<<" "<<y<<" "<<l[i]+l[j]<<" "<<l[j]-l[i]<<"\n";
			ans+=(ll)(x-y);
		}
	}
	cout<<ans/3ll;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int dp[70][70][70];

int stt(int a, int b, int c)
{
    if(a == b && b == c)
        return 0;

    if(a > 60 || b > 60 || c > 60)
        return 1e5;

    if(dp[a][b][c] != -1)
        return dp[a][b][c];

    int ans = 1 + stt(a + 1, b + 1, c);
    ans = min(ans, 1 + stt(a, b + 1, c + 1));
    ans = min(ans, 1 + stt(a + 1, b, c + 1));
    ans = min(ans, 1 + stt(a + 2, b, c));
    ans = min(ans, 1 + stt(a, b + 2, c));
    ans = min(ans, 1 + stt(a, b, c + 2));

    return dp[a][b][c] = ans;
}

int main()
{
    mem(dp, -1);
    int a, b, c;
    cin >> a >> b >> c;

    cout << stt(a, b, c) << '\n';
    return 0;
}


Measured memory_bytes: 4944
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;

void solve() {
    int n, x;
    cin >> n >> x;
    vector<int> m(n);
    for(int i = 0; i < n; i++){
        cin >> m[i];
        x -= m[i];
    }
    sort(m.begin(), m.end());

    int counter = 0;
    while(true){
        if(x >= m[0]){
            x -= m[0];
            counter++;
        } else {
            break;
        }
    }
    cout << n+counter << endl;
}

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

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
// math.hのライブラリをリンクする必要がある
// gcc c.c -o c -lm

int main(int argc, char const *argv[]) {

    while (1) {
        int n, max=0;
        double ave, v_sum=0, V;

        scanf("%d", &n);
        
        if (n == 0) {
            break;
        }

        int s[n];
        
        for (int i=0; i<n; i++) {
            scanf("%d", &s[i]);
            max += s[i];
        }

        ave = (double)max/n;
        for (int i = 0; i < n; i++) {
            v_sum += (s[i] - ave) * (s[i] - ave);
        }

        V = sqrt((double)v_sum/n);
        printf("%10f\n", V);

    }

    return 0;
}


Measured memory_bytes: 2032
# -*- coding: utf-8 -*-
"""
Created on Mon Sep  7 17:11:27 2020

@author: liang
"""

N, M = map(int, input().split())

ans = [-1]*N
res = 0
for i in range(M):
    s, c = map(int, input().split())
    if s == 1 and c == 0 and N != 1:
        print(-1)
        break
    if ans[s-1] == -1 or ans[s-1] == c:
        ans[s-1] = c
    else:
        print(-1)
        break
else:
    if ans[0] == -1:
        ans[0] = 1
    if M == 0 and N == 1:
        ans[0] = 0
    ans = [0 if a == -1 else a for a in ans]
    #print(ans)
    for i in range(N):
        res += ans[-(i+1)]*10**i
    print(res)

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

#include <cstdio>
#include <cstdlib>
#include <cmath>

#include <iostream>

#include <string>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

const ll mod = 1000000007;

class mint{
public:
  ll x;
  mint(ll x=0) : x(x%mod){}
  mint& operator+=(const mint rhs){
    x += rhs.x;
    while(x >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint rhs){
    x -= rhs.x;
    while(x < 0) x += mod;
    return *this;
  }
  mint & operator*=(const mint rhs){
    (x *= rhs.x) %= mod;
    return *this;
  }
  mint operator+(const mint rhs) const {
    mint res(*this);
    return res += rhs;
  }
  mint operator-(const mint rhs) const {
    mint res(*this);
    return res -= rhs;
  }
  mint operator*(const mint rhs) const {
    mint res(*this);
    return res *= rhs;
  }
  bool operator>(const ll rhs) const {
    return x > rhs;
  }
  bool operator<(const ll rhs) const {
    return x < rhs;
  }
  bool operator>=(const ll rhs) const {
    return x >= rhs;
  }
  bool operator<=(const ll rhs) const {
    return x <= rhs;
  }
  bool operator==(const ll rhs) const {
    return x == rhs;
  }
  bool operator!=(const ll rhs) const {
    return x != rhs;
  }
  friend ostream& operator<<(ostream& os,const mint rhs){
    os << rhs.x;
    return os;
  }
};

#define rep(index,num) for(int index=0;index<num;++index)

struct Book{
  ll price;
  ll effect[12];
  Book(){
    price = 0;
    for(int i=0;i<12;i++) effect[i] = 0;
  }
  Book operator+=(const Book& rhs){
    price = price + rhs.price;
    for(int i=0;i<12;i++){
      effect[i] = effect[i] + rhs.effect[i];
    }
    return *this;
  }
};

int main(){
  ll N,M,X;
  std::cin >> N >> M >> X;
  Book book[N];

  Book tot;

  for(int i=0;i<N;i++){
    std::cin >> book[i].price;
    tot.price += book[i].price;
    for(int j=0;j<M;j++){
      std::cin >> book[i].effect[j];
      tot.effect[j] += book[i].effect[j];
    }
  }

  bool ret = true;
  for(int i=0;i<M;i++) if(tot.effect[i]<X) ret = false;
  if(!ret){
    std::cout << -1 << std::endl;
    return 0;
  }

  ll price = tot.price;
  for(int n=0;n<1<<N;n++){
    Book tmp;
    for(int i=0;i<N;i++){
      int flag = (n>>i)&0x1;
      if(flag == 1) tmp += book[i];
    }
    bool isOk = true;
    for(int i=0;i<M;i++) if(tmp.effect[i]<X) isOk = false;
    if(isOk) price = std::min(price,tmp.price);
  }
  if(ret) std::cout << price << std::endl;
  else std::cout << -1 << std::endl;

  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <utility>

using namespace std;

int main() {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    
    int ans = 10000000;
    for (int i = 0; i < ans; ++i) {
        if ((a&1) || (b&1) || (c&1)) {
            cout << i << "\n";
            return 0;
        }
        a /= 2; b /= 2; c /= 2;
        int d = a;
        a += b;
        b += c;
        c += d;
    }
    cout << "-1\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    int x, y;
    cin >> x >> y;
    rep (i, 0, 200) {
        if (4 * i + 2 * (x - i) == y && x - i >= 0) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}


Measured memory_bytes: 3628
import numpy as np
import heapq
n, maisuu = map(int, input().split())
a_map = map(int, input().split())
a_list = []
for a in a_map:
    heapq.heappush(a_list, -a)

for _ in range(maisuu):
    value = heapq.heappop(a_list)
    waribiki_value = int(value * 0.5)
    heapq.heappush(a_list, waribiki_value)
minus_sum = 0
for a in a_list:
    minus_sum += a
print(-minus_sum)

Measured memory_bytes: 23140
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		String s = sc.next();
		int total = 0;
		for (int i = 0; i < s.length() - 1; i++) {
			if (s.charAt(i) == s.charAt(i + 1))
				total++;
		}

		System.out.println(Math.min(total + 2 * k, n - 1));
		sc.close();
	}
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    vector<ll> a(N); rep(i, N) cin >> a[i];

    ll ans=0;
    rep(i, 60){
        ll n1=0, n0=0;
        rep(j, N){
            if(1 & (a[j] >> i)) n1++;
            else n0++;
        }

        ans = modint(modint(1LL<<i) * modint(n1) * modint(n0) + modint(ans));
    }

    cout << ans << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 6656
N, K = map(int, input().split())
V = list(map(int, input().split()))

vmax = 0
for l in range(0, K + 1):
	for r in range(0, K - l + 1):
		if N < l + r:
			break
		tv = V[:l] + V[N - r:]
		#print(tv)
		tv.sort()
		for n in range(min(len(tv), K - (l + r))):
			if tv[n] < 0:
				tv[n] = 0
		vmax = max(vmax, sum(tv))

print(vmax)


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

int main()
{
	string s;
	cin >> s;
	int ans = 0;
	if(s == "RSS" || s == "SRS" || s == "SSR" || s == "RSR") ans = 1;
	else if(s == "RRS" || s == "SRR") ans = 2;
	else if(s == "RRR") ans = 3;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

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

    vector<pair<int, int>> ab(n, make_pair(0, 0));
    for (int i = 0; i < n; i++) {
        cin >> ab[i].first >> ab[i].second;
    }

    sort(ab.begin(), ab.end());

    long long sum = 0;
    priority_queue<int> que;
    for (int i = m - 1, idx = 0; i >= 0; i--) {
        for (; idx < n && ab[idx].first <= m - i; idx++) {
            que.push(ab[idx].second);
        }

        if (que.empty()) {
            continue;
        }

        sum += que.top();
        que.pop();
    }

    cout << sum << endl;
}


Measured memory_bytes: 1660
#include<stdio.h>
#include<math.h>
int isprime(int);
int main(){
  int a,i,n,cnt=0;
  int x[10000];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&x[i]);
  for(i=0;i<n;i++){
    a=isprime(x[i]);
    if(a==1)cnt++;
  }
    printf("%d\n",cnt);
    return 0;
}
int isprime(int x){
  int i=3,r;
  if(x==2)return 1;
  if(x<2 || x%2==0)return -1;
  r=sqrt(x);
  while(i<=r){
    if(x%i==0)return -1;
    i = i+2;
  }
  return 1;
}



Measured memory_bytes: 2128
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, m;
int main() {
	cin >> n >> m;
	vector<int> x(m), y(m); vector<pair<int, int> > st(m);
	for (int i = 0; i < m; i++) cin >> x[i] >> y[i], y[i]--, st[i] = make_pair(x[i], y[i]);
	sort(st.begin(), st.end());
	for (int i = 0; i < m; i++) x[i] = st[i].first, y[i] = st[i].second;
	vector<vector<int> > ps(n - 1);
	for (int i = 0; i < m; i++) ps[y[i]].push_back(i);
	vector<int> pl(m, -1), pr(m, -1);
	for (int i = 0; i < m; i++) {
		if (y[i] >= 1) {
			int ptr = lower_bound(ps[y[i] - 1].begin(), ps[y[i] - 1].end(), i) - ps[y[i] - 1].begin() - 1;
			if (ptr >= 0) pl[i] = ps[y[i] - 1][ptr];
		}
		if (y[i] <= n - 3) {
			int ptr = lower_bound(ps[y[i] + 1].begin(), ps[y[i] + 1].end(), i) - ps[y[i] + 1].begin() - 1;
			if (ptr >= 0) pr[i] = ps[y[i] + 1][ptr];
		}
	}
	vector<int> dpl(m), dpr(m);
	for (int i = 0; i < m; i++) {
		if (pl[i] != -1) dpl[i] = dpl[pl[i]] + 1;
		if (pr[i] != -1) dpr[i] = dpr[pr[i]] + 1;
	}
	for (int i = 0; i < n; i++) {
		if (i) cout << ' ';
		int ret = -1;
		if (i <= n - 2 && ps[i].size()) ret = dpl[ps[i].back()] + dpr[ps[i].back()];
		if (i >= 1 && ps[i - 1].size()) ret = max(ret, dpl[ps[i - 1].back()] + dpr[ps[i - 1].back()]);
		cout << ret + 2;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 13192
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    int ans = 0;
    rep(i, 0, n){
        cin >> a[i];
        ans += a[i];
    }
    cout << ans - n << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP(i,m,n) for(ll i=m;i<(ll)(n);i++)
typedef pair<int,long long> pint;
typedef long long ll;
const ll mod= 1e9+7;
const ll  longinf = 1LL<<60;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

vector<int> v[101010],ans;
bool used[101010];

void dfs(int x){
  for(auto e:v[x]){
    if(!used[e]){
      ans.push_back(e);
      used[e]=true;
      dfs(e);
      break;
      }
    }
  }


int main(){
  int n;cin>>n;
  int m;cin>>m;
  rep(i,m){
    int x,y;cin>>x>>y;
    x--;y--;
    v[x].push_back(y);
    v[y].push_back(x);
    }
  used[0]=true;
  dfs(0);
  reverse(ans.begin(),ans.end());
  ans.push_back(0);
  dfs(0);
  cout<<ans.size()<<endl;
  for(auto e:ans)cout<<e+1<<" ";
  cout<<endl;
  return 0;
  }

Measured memory_bytes: 9720
#include <stdio.h>
#include <iostream>

int main(void) {
    int a,b,c,count = 0;
    scanf("%d%d%d",&a,&b,&c);
    
    for(int i = a; i <= b;i++){
        if (c%i == 0) count++;
    }
    printf("%d\n",count);
    return 0;
}


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

const int INF = (1 << 30) - 1;

/* マス(y,x)と辺を共有するマスは、(y,x+1), (y+1,x), (y,x-1), (y-1,x)
   の4つであるため、このような配列を用いて効率的に探索できる */
const int dy4[] = {0, 1, 0, -1}, dx4[] = {1, 0, -1, 0};

int main(){
    // 入力
    int h, w;
    cin >> h >> w;

    vector<string> a(h);
    for(int i = 0 ; i < h ; ++i){
        cin >> a[i];
    }

    // 幅優先探索
    queue< pair< pair<int, int>, int> > que;  // {{y座標, x座標}, コスト}
    vector< vector<int> > cost(h, vector<int>(w, INF));  // 最小コスト

    // 黒いマスをキューに入れる
    for(int i = 0 ; i < h ; ++i){
        for(int j = 0 ; j < w ; ++j){
            if(a[i][j] == '#'){
                que.push({{i, j}, 0});
                cost[i][j] = 0;
            }
        }
    }

    // 最小コストの更新が止まるまで探索
    while(!que.empty()){
        auto now = que.front();
        que.pop();
        if(cost[now.first.first][now.first.second] < now.second){
            continue;
        }
        cost[now.first.first][now.first.second] = now.second;
        for(int i = 0 ; i < 4 ; ++i){
            int ny = now.first.first + dy4[i], nx = now.first.second + dx4[i];
            if(0 <= ny && ny < h && 0 <= nx && nx < w && cost[ny][nx] > now.second + 1){
                cost[ny][nx] = now.second + 1;
                que.push({{ny, nx}, now.second + 1});
            }
        }
    }

    // 最小コストの最大値を求める
    int ans = 0;
    for(int i = 0 ; i < h ; ++i){
        for(int j = 0 ; j < w ; ++j){
            ans = max(ans, cost[i][j]);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 17296
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
ll a,b,c,d,e,i,j;
vector<ll>v;
cin>>a;
 
for(i=1;i<=a;i++)
{cin>>b;v.push_back(b);

}
    if(a==1){cout<<v[0]<<endl;return 0;}
e=__gcd(v[0],v[1]);
for(i=1;i<a;i++)
{
 e=__gcd(e,v[i]);
}
cout<<e<<endl;
}

Measured memory_bytes: 1400
// atcoder/abc133/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int color;
const int N = 1e5 + 5;
vector<int> g[N];

const lli mod = 1e9 + 7;

lli fact[N];

lli rec(int curr, int prev, lli p)
{
  // cout << curr+1 << ' ' << p << endl;

  lli x = p;
  lli q = color - (bool)curr - 1;
  each (next, g[curr]) {
    if (next == prev) continue;
    x *= (rec(next, curr, q)) % mod;
    x %= mod;
    --q;
  }
  return x;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  fact[0] = 1;
  for (lli i = 1; i < N; ++i) {
    fact[i] = (fact[i - 1] * i) % mod;
  }

  int n;
  while (cin >> n >> color) {
    fill(g, g + N, vector<int>());
    for (int i = 0; i < n - 1; ++i) {
      int a, b;
      cin >> a >> b;
      --a;
      --b;
      g[a].push_back(b);
      g[b].push_back(a);
    }
    cout << rec(0, 0, color) << endl;
    // cout << endl;
  }

  return 0;
}


Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int main() {
    string a, b;
    cin >> a >> b;
    int n = b.length();
    for (int i = 0; i < n; i++){
        if(i == n-1){
            cout << "Yes" << endl;
            break;
        }
        if(b[i] == a[i]){
            continue;
        }
        else{
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3624
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		
		String s=sc.next();
		char c1 = s.charAt(2);
	    char c2 = s.charAt(3);
	    char c3 = s.charAt(4);		
	    char c4 = s.charAt(5);
		
		if(c1==c2&&c3==c4) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		
		sc.close();
	}

}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

int main() {
    i32 n, m;
    cin >> n >> m;
    vector<i32> a(n);
    i32 t = 0;
    for (auto& e : a) {
        cin >> e;
        t += e;
    }

    i32 c = 0;
    for (auto& e : a) {
        if (e * 4 * m >= t) c++;
    }
    cout << (c >= m ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int  a,b;
	cin>>a>>b;
	if (a < b)
	cout<<"a < b"<<endl;
	if (a > b)
	cout<<"a > b"<<endl;
	if (a==b)
	cout<<"a == b"<<endl;
	return 0;
	
	 
}




Measured memory_bytes: 3000
#include<stdio.h>
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int i,cnt=0;
	for(i=a;i<=b;i++){
		if(c%i==0) cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}



Measured memory_bytes: 2048
/*input
10 998244353
10 9 8 7 5 6 3 4 2 1
*/
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;
int n, arr[maxn];
ll k;
int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k;
	for(int i = 0; i < n; i++)
		cin >> arr[i];
	ll ans = 0;
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < i; j++)
			if(arr[j] < arr[i])
				ans = (ans + k * (k - 1) / 2) % mod;
		for(int j = i + 1; j < n; j++)
			if(arr[j] < arr[i])
				ans = (ans + k * (k + 1) / 2) % mod;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#pragma optimization_level 3
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("sumsqr.in");ofstream out("sumsqr.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

ll x;

void check(ll d){
    ll B = -2000;
    if(d>3000) return;
    for(; B<2000; B++){
        ll A = B+d, pA = A*A*A*A*A, pB = B*B*B*B*B;
        //cout<<A<<" "<<B<<" "<<pA<<" "<<pB<<endl;
        if(pA-pB == x) cout<<A<<" "<<B, exit(0);
        if(pA-pB > 1e18) return;
    }
}

int main() {
    fast;
    cin>>x;
    for(ll q=1, g = sqrt(x); q<=g; q++){
        if(x%q) continue;
        check(q);
        check(x/q);
    }
    assert(0);
}

Measured memory_bytes: 3628
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
s = input()
q = int(input())
ks = list(map(int, input().split()))
ans = [None]*q
# DMC
for ind,k in enumerate(ks):
    ms = 1 if s[0]=="M" else 0
    cs = 1 if s[0]=="C" else 0
    mcs = 0
    j = 0
    val = 0
    for i in range(n):
        if s[i]!="D":
            if s[i]=="M":
                ms -= 1
                mcs -= cs
            elif s[i]=="C":
                cs -= 1
            continue
        if j<i:
            j = i
            ms = 0
            cs = 0
            mcs = 0
        while j+1<n and j+1-i<k:
            j += 1
            if s[j]=="M":
                ms += 1
            elif s[j]=="C":
                cs += 1
                mcs += ms
        val += mcs
#         print(i,ms,cs)
    ans[ind] = val
write("\n".join(map(str, ans)))

Measured memory_bytes: 70804
#include <iostream>
#include <string>

using namespace std;

int main() {
	int h, w;
	cin >> h >> w;
	int k = 0;
	for (int j = 0; j < h; ++j) {
		string line;
		cin >> line;
		for (int i = 0; i < w; ++i) {
			if (line[i] == '#') {
				if (i < k) {
					cout << "Impossible" << endl;
					goto end;
				} else {
					k = i;
				}
			}
		}
	}
	cout << "Possible" << endl;
end:
	return 0;
}

Measured memory_bytes: 384
(let ((o (read-line))
      (e (read-line)))
  (loop :for co :across o
        :for ce :across e
        :do (format t "~c~c" co ce))
  (when (> (length o) (length e))
    (format t "~c" (aref o (- (length o) 1))))
  (format t "~%"))


Measured memory_bytes: 15204
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        StringBuilder ans = new StringBuilder();
        ans.AppendLine(string.Empty.PadLeft(inpt[1] + 2, '#'));
        for (int i = 0; i < inpt[0];i++) {
            ans.AppendLine("#" + Reader.ReadLine() + "#");
        }
		ans.AppendLine(string.Empty.PadLeft(inpt[1] + 2, '#'));
        Console.Write(ans.ToString());
	}


	public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"

2 3
abc
arc

";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 13396
//-------All power is within you,you can do Anything and Everything.---------//
 
    #include <bits/stdc++.h>
    using namespace std;
  
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
 
    #define pb push_back
    #define MP make_pair
    #define F first
    #define S second
    #define int long long
    #define fo(i,a,b) for(int i=a;i<b;i++)
    #define rfo(i,b,a) for(int i=b;i>=a;i--)
    #define deb(x) cout<<#x<<" "<<x<<endl;
    #define mem( a, val ) memset(a, val, sizeof( a ) )
    #define deci( x ) cout<<fixed<<setprecision( x );
    #define bitcount( x ) __builtin_popcountll( x )
    #define endl "\n" 
 
    
    typedef vector<int> vi;
    typedef pair<int,int> pi; 
    
    const int MOD =  1000000007 ;
    const int MAX = 2e6 + 7;
    const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ V $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//  
    
    int i,j,k,t,n,q,l,r,mid;
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ F $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
    
    long double a,b,c;
    void solve()
    {
        cin>>a>>b>>c;
        int d=c-a-b;
        if(d>0 && d*d>4*a*b)
        {
            cout<<"Yes"<<endl;
        }
        else
            cout<<"No"<<endl;
 
    }
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
//                          GAME STARTS FROM HERE                            //
 
    int32_t main() 
      {
        
        // int start,stop=clock();
        // cout<<"time:"<<(stop-start)/double(CLOCKS_PER_SEC)*1000<<endl;
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        
        // cin>>t;while(t--)
        solve();
        
      return 0;
      }


Measured memory_bytes: 256
//CODE FES C

#include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i< (n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
int vx[4] = { 0,1,0,-1 };
int vy[4] = { 1,0,-1,0 };

string eng;
ll k;


signed main() {

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

	cin >> eng >> k;
	REP(i, eng.length()) {
		if (eng[i]!='a' && 'z' - eng[i] + 1 <= k) {
			k = k - 'z' + eng[i] - 1;
			eng[i] = 'a';
		}
	}
	
	k %= 26;

	eng[eng.length() - 1] += k;

	cout << eng << endl;

	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iomanip>

int main(void) {

	//long double x = 0.1234567890;
	//std::cout << x << std::endl;

	//test??¨
	//std::ifstream in("test.txt");
	//std::cin.rdbuf(in.rdbuf());

	double x1, y1, x2, y2;
	std::cin >> x1 >> y1 >> x2 >> y2;

	long double ans = sqrtl(pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0));
	
	std::cout << std::fixed << std::setprecision(8) << ans << std::endl;
}

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

int main() {
  int N, l, r, ans;
  cin >> N;
  
  for(int i = 0; i < N; i++){
    cin >> l >> r;
	ans+=r-l+1;
  }
  
  cout << ans << endl;
  return 0;
}


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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
using ll = long long;
using P = pair<int,int>;

// code starts
int main()
{
	int h,w,m;
	cin >> h >> w >> m;
	vector<int> hs(m);
	vector<int> ws(m);
	int i,j;
	rep(i,m)
	{
		cin >> hs[i] >> ws[i];
		hs[i]--;
		ws[i]--;
	}
	vector<vector<int>> hl(h);
	vector<vector<int>> wl(w);
	rep(i,m)
	{
		hl[hs[i]].emplace_back(ws[i]);
		wl[ws[i]].emplace_back(hs[i]);
	}
	multiset<int> ms;
	//vector<int> wcount(300001,0);
	rep(i,w)
	{
		//wcount[wl[i].size()]++;
		ms.insert(wl[i].size());
	}
	int ans = 0;
	rep(i,h)
	{
		int base = hl[i].size();
		queue<int> rev;
		rep(j,hl[i].size())
		{
			int now = wl[hl[i][j]].size();
			auto it = ms.find(now);
			ms.erase(it);
			ms.insert(now-1);
			rev.push(now-1);
		}
		auto ival = ms.end();
		ival--;
		int base2 = *ival;
		ans = max(ans,base+base2);
		while(!rev.empty())
		{
			int val = rev.front();
			rev.pop();
			auto it = ms.find(val);
			ms.erase(it);
			ms.insert(val+1);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 52524
#include <stdio.h>
#include <string.h>
int main(void){
    char s[11],ans[11]={'\0'};
    scanf("%s",s);
    for(int i=0;s[i]!='\0';i++){
        if(s[i]=='B')
            ans[strlen(ans)-1]='\0';
        else
            ans[strlen(ans)]=s[i];
    }
    printf("%s",ans);
}


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

using namespace std;
using ll = long long;
using ld = long double;

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
} comb(100005);

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }

    sort(a.begin(),a.end());
    mint ans=0;
    for(int i = k; i <= n; i++) {
        mint add=a[i-1];
        add*=comb(i-1,k-1);
        int j=i-k;
        mint dec=a[j];
        dec*=comb(n-j-1,k-1);
        ans+=add;
        ans-=dec;
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 5284
// ALDS1_5_A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

//#include "pch.h"
#include <iostream>
#include <vector>
using namespace std;
	int n;
	vector<int> A(21);
int solve(int i, int m) {
	if (m==0)
	{
		return true;
	}
	if (i>=n)
	{
		return false;
	}
	int res = solve(i + 1, m) || solve(i + 1, m - A.at(i));
	return res;
}
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A.at(i);
	}
	int q;
	cin >> q;
	vector<int>m(q);
	for (int j = 0; j < q; j++)
	{
		cin >> m.at(j);
		if (solve(0,m.at(j))==true)
		{
			cout << "yes" << endl;
		}
		else
		{
			cout << "no" << endl;
		}
	}
}



Measured memory_bytes: 3088
x = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())

print(x[K-1])

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
class BiOp {
public:
	ll operator()(ll a, ll b) const {
		return min(a, b);
	}
};

template<typename T, typename BiOp>
struct SegmentTree {
	vector<T> data;
	T e;
	BiOp op;
	int size;

	SegmentTree(int n, T e, BiOp op) : e(e), op(op) {
		size = 1;
		while (size < n) size *= 2;
		data.resize(2 * size - 1);
		for (int i = 0; i < 2 * size - 1; i++) data[i] = e;
	}

	void update(int k, T v) {
		k += size - 1;
		data[k] = v;
		while (k > 0) {
			k = (k - 1) / 2;
			data[k] = op(data[k * 2 + 1], data[k * 2 + 2]);
		}
	}

	T query(int a, int b, int k, int l, int r) const {
		if (b <= l || r <= a) return e;
		if (a <= l && r <= b) return data[k];
		return op(query(a, b, k * 2 + 1, l, (l + r) / 2), query(a, b, k * 2 + 2, (l + r) / 2, r));
	}

	T query(int a, int b) {
		return query(a, b, 0, 0, size);
	}

	T get(int i) {
		return data[i + size - 1];
	}
};
int b[200000];
vector<int> R[200000];
int main() {
	int N;
	cin >> N;
	int zero = 0;
	for (int i = 0; i < N; i++) {
		cin >> b[i];
		if (b[i] == 0) zero++;
	}
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int l, r;
		cin >> l >> r;
		l--; r--;
		R[l].push_back(r);
	}
	SegmentTree<ll, BiOp> seg(N + 1, INF, BiOp());
	for (int r : R[0]) seg.update(r, 0);
	ll x = (b[0] == 1) ? 1 : -1;
	seg.update(0, min(seg.get(0), x));
	for (int i = 1; i < N; i++) {
		for (int r : R[i]) {
			ll m = seg.query(i - 1, r + 1);
			seg.update(r, m);
		}
		x = (b[i] == 1) ? 1 : -1;
		seg.update(i, min(seg.get(i - 1) + x, seg.get(i)));
	}
	cout << zero + seg.get(N - 1) << endl;
}

Measured memory_bytes: 13824
#include <iostream>
using namespace std;
int main(void){
    int W,H,x,y,r;
    cin >> W;
    cin >> H;
    cin >> x;
    cin >> y;
    cin >> r;
    if(x-r>=0&&x+r<=W&&y-r>=0&&y+r<=H){
        cout << "Yes";
    }else{
        cout << "No";
    }
    cout << endl;
}


Measured memory_bytes: 3104