akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

  private static void solve(int N) {
    Map<Integer, Integer> map = new HashMap<>();
    for (int x = 1; x * x < N; x++) {
      for (int y = 1; y * y < N && y * x < N; y++) {
        for (int z = 1; z * z < N && z * y < N; z++) {
          int val = x * x + y * y + z * z + x * y + y * z + z * x;
          map.put(val, map.getOrDefault(val, 0) + 1);
        }
      }
    }
    for (int i = 1; i <= N; i++) {
      int res = 0;
      if (map.containsKey(i)) {
        res += map.get(i);
      }
      System.out.println(res);
    }
  }

  public static void main(String[] args) {
    int N = scanner.nextInt();
    solve(N);
  }

  private static final Scanner scanner = new Scanner(System.in);
}


Measured memory_bytes: 57324
#include<bits/stdc++.h>
using namespace std;
#define DDight(N) (int)(log10((int)N) + 1)
int SumDDight(long long N)
{
    int ans  = 0;
    long long n = N;
    for(int i = 0;i < DDight(N);i++)
    {
        ans += n % 10;
        n /= 10;
    }
    return ans;
} 
int main()
{
    long long n;
    cin >> n;
    cout << (n % SumDDight(n) == 0 ? "Yes" : "No") << '\n';  
}



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

int main(void) {
	
	string S;
	long long int K,tmp;
	cin >> S >> K;
  	for(int i = 0; i < S.size(); i++) {
    	if(S[i] != '1') {
        	tmp = i;
         	break;
        }
    }
  
  	if(K <= tmp) {
    	cout << 1 << endl;
    }else {
    	cout << S[tmp] << endl;
    }
  
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>

using namespace std;

int dp[1<<16][16];

int main(){
  for(int n,m,l,s,t;cin>>n>>m>>l>>s>>t,n|m|l|s|t;){
    int d[323][323];
    for(int i=0;i<=n;i++){
      for(int j=0;j<=n;j++){
	d[i][j]=(i==j)?0:1e9;
      }
    }
    for(int i=0;i<m;i++){
      int a,b,c;
      cin>>a>>b>>c;
      d[a][b]=d[b][a]=c;
    }
    for(int i=0;i<=n;i++){
      for(int j=0;j<=n;j++){
	for(int k=0;k<=n;k++){
	  d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
	}
      }
    }
    int js[323],e[323];
    for(int i=0;i<l;i++){
      cin>>js[i]>>e[i];
    }
    fill(*begin(dp),*end(dp),1e9);
    for(int i=0;i<l;i++){
      dp[1<<i][i]=d[s][js[i]]+e[i];
    }
    int ans=0;
    for(int i=0;i<1<<l;i++){
      for(int j=0;j<l;j++){
	if(i>>j&1){
	  for(int k=0;k<l;k++){
	    if(j!=k&&i>>k&1){
	      dp[i][j]=min(dp[i][j],dp[i^1<<j][k]+d[js[k]][js[j]]+e[j]);
	    }
	  }
	  if(dp[i][j]<=t-d[s][js[j]]){
	    ans=max(ans,__builtin_popcount(i));
	  }
	}
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 5640
import Control.Applicative
import Control.Monad
import Data.Functor
import Data.List

readInts = map read . words <$> getLine :: IO [Int]

solve s
  | month x && month y = "AMBIGUOUS"
  | month x = "MMYY"
  | month y = "YYMM"
  | otherwise = "NA"
  where
    month c = let n = read c in n>=1 && n <= 12
    (x, y) = splitAt 2 s


main = getLine >>= putStrLn . solve


Measured memory_bytes: 508
#include <iostream>
using namespace std;
int main() {
int K, S, cnt = 0, tmp;
cin >> K >> S;
for (int x = 0; x <= K; ++x) {
        for (int y = 0; y <= K; ++y) {
                        tmp = S - (x + y); 
                if ( 0 <= tmp and tmp <= K) {
                        cnt++;
                }   
        }    
}
cout << cnt << endl;
}

Measured memory_bytes: 504
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=1e5+5;
const int mod=1e9+7;

int n,h[N],dp[N];
signed main(){
    FastIO;
    cin>>n;
    rep(i,1,n) cin>>h[i];
    rep(i,2,n){
        dp[i]=2e9;
        rep(j,1,2){
            if(i-j>0) dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x) cerr<<#x<<"="<<x<<endl;
#define forin(a,b) for(ll i=(a); i<(b); i++) 
#define forjn(a,b) for(ll j=(a); j<(b); j++)

int main()
{
	ll n;
	cin>>n;
	unordered_map<string, int> mp;
	mp["AC"] = 0;
	mp["WA"] = 0;
	mp["TLE"] = 0;
	mp["RE"] = 0;
	string st;
	while(n--)
	{
		cin>>st;
		mp[st]++;
	}
	cout<<"AC x "<<mp["AC"]<<endl;
	cout<<"WA x "<<mp["WA"]<<endl;
	cout<<"TLE x "<<mp["TLE"]<<endl;
	cout<<"RE x "<<mp["RE"]<<endl;
}

Measured memory_bytes: 3632
#include <stdio.h>

#define PI 3.141592653589

int main(void) {

	int i;
	double a,b,c;
	int ans =0;

	scanf("%lf",&a);


	printf("%f %f\n",PI * (double)a * (double)a,PI * (double)2 * (double)a);

	return 0;
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define DEBUG_MODE
#define endl '\n'
#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_ENDL endl << flush
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_ENDL 0
#define DEBUG_SEPARATOR_LINE 0
#endif
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "") << flush;
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }
template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL_S(s);
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL_S(s);
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

void init_io() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(30);
}

const ll MOD = 1e9 + 7;

int main() {
    init_io();
    ll N;
    cin >> N;
    string S;
    cin >> S;
    V<ll> cnt(26);
    for(char c : S) cnt[c - 'a']++;
    ll ans = 1;
    for(ll i = 0; i < 26; i++) (ans *= cnt[i] + 1) %= MOD;
    cout << (ans - 1 + MOD) % MOD << endl;
    return 0;
}


Measured memory_bytes: 512
n = int(input())
t = [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]
print(t[n-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
        using namespace std;
        #define rep(i,a,b) for(ll i =a; i<b;++i)
        #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        #define endl "\n"
        #define pb push_back
        #define F first
        #define S second
        #define print(a)       for(auto x : a) cout << x << " "; cout << endl
        #define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
        #define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl
        #define mk(x,y)  make_pair(x,y)
        typedef  long long  int ll;
        const int N = ( 2e5 + 5 );
        const int mod = 1e9+7;
        ll n,a[N],m,d,x,h,c[N];

ll pow_mod_m(ll a , ll n)
{
    if(!n)
        return 1;
    ll pt =  pow_mod_m(a,n/2);
    pt *= pt ; pt %= mod;
    if(n&1)
        pt *= a , pt %= mod;
    return pt;
}
/*
void dfs(ll u,ll pre)
{
    p[u] = pre;
    for(auto v : g[u])
        dfs(v,u);
}*/
bool comp(const pair<ll,ll> &p1 ,const pair<ll,ll> &p2)
{
    return (p1.first  < p2.first);
}


int main()
{
    IOS;
    int ts = 1;
 //   cin>>ts;
	while(ts--)
    {
            cin>>n>>d>>m;
            vector <pair<ll,ll> > v(n);
            vector <ll> q(n);
            rep(i,0,n){
                cin>>x>>h;
                v[i] = mk(x,h);
            }
            sort(v.begin(),v.end());
            ll ans = 0;
            ll j=  0;
            rep(i,0,n)
            {
                while( j< n and v[j].F <= v[i].F + 2*d)
                j++;
                ll need = max( (v[i].S - c[i]*m +m -1)/m , 0ll);
                ans += need;
                c[i] += need;
                c[j] -= need;
                c[i+1] += c[i];
            }
            cout<<ans<<endl;
    }
	return 0;
}


Measured memory_bytes: 6528
import math
countp = 0
a = int(input())
for j in range(a):
     n = int(input())
     if n > 1  :
         for i in range(2,math.floor(math.sqrt(n))+1 ): 
              if n % i == 0: 
                   break  
         else :
             countp += 1
            
print(countp)


Measured memory_bytes: 5672
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
  string s;
  cin >> s;
  if (s == "ABC")
  {
    cout << "ARC";
  }
  else
  {
    cout << "ABC";
  }

  return 0;
}

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int n, q; cin >> n >> q;
  vector<ll> a(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
  }
  reverse(a.begin(), a.end());

  vector<ll> sum(n+1), evensum(n+1);
  for(int i=0;i<n;++i) {
    sum[i+1] = sum[i] + a[i];
    evensum[i+1] = evensum[i] + (i % 2 == 0 ? a[i] : 0);
  }

  vector<ll> ths, vals;
  for(int i=0;i<(n-1)/2;++i) {
    ll th = (a[i+1] + a[i*2+2])/2 + 1;
    ll val = (sum[i+1] - sum[0]) + (evensum[n] - evensum[i*2+2]);
    ths.push_back(th);
    vals.push_back(val);
  }

  reverse(ths.begin(), ths.end());
  reverse(vals.begin(), vals.end());
  for(int i=0;i<q;++i) {
    ll x; cin >> x;
    int it = upper_bound(ths.begin(), ths.end(), x) - ths.begin();
    if(it == 0) cout << sum[(n+1)/2] - sum[0] << endl;
    else cout << vals[it-1] << endl;
  }
}


Measured memory_bytes: 5108
import sys
input = sys.stdin.readline

N, C = map(int, input().split())
sushi_array = [list(map(int, input().split())) for _ in range(N)]

# print(sushi_array)

left_max = 0
left_double_max = 0

left_array = [[0, 0] for _ in range(N+1)]

right_max = 0
right_double_max = 0

right_array = [[0, 0] for _ in range(N+1)]


left_sum = 0

for i, sushi in enumerate(sushi_array):
    left_sum += sushi[1]
    left_max = max(left_max, left_sum - sushi[0])
    left_double_max = max(left_double_max, left_sum - 2 * sushi[0])
    left_array[i+1][0] = left_max
    left_array[i+1][1] = left_double_max

right_sum = 0

for i, sushi in enumerate(sushi_array[::-1]):
    right_sum += sushi[1]
    right_max = max(right_max, right_sum - (C - sushi[0]))
    right_double_max = max(right_double_max, right_sum - 2 * (C - sushi[0]))
    right_array[N-i-1][0] = right_max
    right_array[N-i-1][1] = right_double_max

ans = 0

for left, right in zip(left_array, right_array):
    ans = max(ans, left[0]+right[1], left[1]+right[0])

print(ans)


Measured memory_bytes: 80476
let () =
  let open Queue in
  let (que : (string * int) Queue.t) = create () in
  let (n, q) = Scanf.scanf "%d %d\n" (fun n q -> (n, q)) in
  for _ = 0 to n - 1 do
    add (Scanf.scanf "%s %d\n" (fun s t -> s, t)) que;
  done;
  let cnt = ref 0 in
  while not (is_empty que) do
    let (s, t) = take que in
    let rest = t - q in
    if rest <= 0 then begin
      cnt := !cnt + t;
      Printf.printf "%s %d\n" s !cnt;
    end else begin
      add (s, rest) que;
      cnt := !cnt + q;
    end
  done

Measured memory_bytes: 12672
n,m = map(int,input().split())


li_num = [ list(map(int,input().split())) for i in range(m)]

invalid = False

#print(n)
#print(m)
#print(li_num)

if n == 1:
  li_ans = [0]
else:
  li_ans = [0] * n
  li_ans[0] = 1

arr = list(map(list, set(map(tuple, li_num))))
arr.sort(key=lambda x: x[0])

if n != 1 and [1,0] in arr:
  invalid = True

#print(arr)

if not invalid:
    arr_keta = [x[0] for x in arr]
    if len(arr_keta) != len(set(arr_keta)):
        invalid = True

if invalid:
  print(-1)
else:
  for i in arr:
    s = i[0] - 1
    li_ans[s] = i[1]
  ans_num = int("".join(map(str, li_ans)))
  print(ans_num)


Measured memory_bytes: 38384
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>

#define maxn 505

using namespace std;

inline int getint()
{
	int num=0,flag=1;char c;
	while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;
	while(c>='0'&&c<='9')num=num*10+c-48,c=getchar();
	return num*flag;
}

int n;
int p[maxn],f[maxn],a[maxn*maxn];
inline bool cmp(int x,int y){return p[x]<p[y];}

int main()
{
	while(~scanf("%d",&n))
	{
		bool flag=0;
		for(int i=1;i<=n;i++)p[i]=getint(),f[i]=i;
		sort(f+1,f+n+1,cmp);
		int now=1;
		for(int i=1;i<=n;i++)
		{
			a[p[f[i]]]=f[i];
			for(int j=1;j<f[i];j++)
			{
				while(a[now])now++;
				a[now]=f[i];
			}
			if(now>p[f[i]]){puts("No");flag=1;break;}
		}
		if(flag)continue;
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n-f[i];j++)
			{
				while(a[now])now++;
				if(now<p[f[i]]){puts("No");flag=1;break;}
				a[now]=f[i];
			}
			if(flag)break;
		}
		if(!flag)
		{
			puts("Yes");
			for(int i=1;i<=n*n;i++)printf("%d%c",a[i],i==n*n?10:32);
		}
	}
}

Measured memory_bytes: 2176
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a;
    string s;
    cin>>a>>s;
    //cout<<"a="<<a<<",s="<<s<<endl;
    if(a>=3200){
        cout<<s<<endl;
    }
    else{
        cout<<"red"<<endl;
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <vector>
#include <unordered_map> 
#include <iomanip>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (INT_MAX/3)
#define PSB push_back
#define PN 1000000007
typedef long long LL;
//#define int long long


//booooooooooooost
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;	//多倍長整数(mp::cpp_int)



int inv_mod(int a, int m)
{
	int b, x, u, q, tmp;

	b = m; x = 1; u = 0;
	while (b > 0) {
		q = a / b;
		tmp = u; u = x - q * u; x = tmp;
		tmp = b; b = a - q * b; a = tmp;
	}

	return (x < 0) ? m + x : x;
}



signed main() {

	int N;
	vector<int> A, SA;
	cin >> N;
	REP(i, N) {
		int tmp;
		cin >> tmp;
		A.PSB(tmp);
	}
	SA = A;
	sort(ALL(SA));

	int ans = 0;
	REP(i, N) {
		int l = 0, r = N, m;
		while (l <= r) {
			m = (l + r) / 2;
			if (SA[m] == A[i]) {
				ans += abs(m - i) % 2;
				break;
			}
			else if (SA[m] < A[i]) l = m + 1;
			else r = m - 1;
		}
	}
	cout << ans / 2 << endl;
	
	
	return 0;
}

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

bool isnp[10001];
int ans[10001];

int main(){
	for(int i = 2; i * i <= 10000; ++i){
		if( !isnp[i] ){
			for(int j = i * i; j <= 10000; j += i){
				isnp[j] = true;
			}
		}
	}

	vector<int> pr;
	for(int i = 2; i < 9999; ++i){
		if( !isnp[i] ) pr.push_back(i);
	}

	for(int i = 0; i < pr.size(); ++i){
		int sum = 0;
		for(int j = i; j < pr.size(); ++j){
			sum += pr[j];
			if( sum > 10000 ) break;
			++ans[sum];
		}
	}
	
	int n;
	while( scanf("%d", &n), n != 0 ){
		printf("%d\n", ans[n]);
	}
}

Measured memory_bytes: 1116
using System;
using System.Collections.Generic;
using System.Linq;

class Solution
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        int count = 0;
        for (int i = 0; i < n; i++)
        {
            if (array[i] == i + 1)
            {
                count++;
                if (i + 1 < n && array[i + 1] == i + 2)
                {
                    i++;
                }
            }
        }

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 19936
#include <iostream>
using namespace std;
int main() {
    long long x, n; cin >> n >> x;
    long long ans = n;
    n -= x;
    while (x > 0) {
        ans += 2 * x * (n/x);
        if (n % x == 0) ans -= x;
        long long t = x; x = n%x; n = t;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math


def binary(n):
    lst = []
    while n != 0:
        lst.append(n % 2)
        n = n // 2
    lst = lst + [0] * (31 - len(lst))
    return list(reversed(lst))


def calc(u, v):
    result = ""
    u_binary = binary(u)
    v_binary = binary(v)
    for i in range(31):
        if u_binary[i] == 1 and v_binary[i] == 1:
            result += "R"
        elif u_binary[i] == 0 and v_binary[i] == 0:
            result += "L"
        elif u_binary[i] == 1 and v_binary[i] == 0:
            result += "U"
        else:
            result += "D"
    return result


U = []
V = []
N = int(input())
even, odd = 0, 0

for p in range(N):
    x, y = map(int, input().split())
    U.append(x+y)
    V.append(x-y)
    if (x + y) % 2 == 0:
        even += 1
    else:
        odd += 1

if even >= 1 and odd >= 1:
    print(-1)

else:
    lst = [2 ** i for i in range(30, -1, -1)]
    if odd == 0:
        lst.append(1)
    print(len(lst))
    print(" ".join(map(str, lst)))
    for u, v in zip(U, V):
        u = (u + 2 ** 31 - 1) // 2
        v = (v + 2 ** 31 - 1) // 2
        print(calc(u, v)+"R" if odd == 0 else calc(u, v))


Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        string s = sc.Next();

        long nega = 0;
        long last = 0;
        foreach (var c in s)
        {
            if (c == '(')
            {
                last++;
            }
            else
            {
                last--;
            }
            nega = Math.Min(nega, last);
        }

        string answer = "";
        for (int i = 0; i < (nega * -1); i++)
        {
            answer += "(";
        }
        answer += s;
        for (int i = 0; i < last + (nega * -1); i++)
        {
            answer += ")";
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 27192
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int ll;

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...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    auto dp = make_v(s.size() + 1, t.size() + 1, 0LL);
    REP(i, 0, s.size()) {
        REP(j, 0, t.size()) {
            int add = s[i] == t[j];
            dp[i + 1][j + 1] = max({dp[i + 1][j + 1], dp[i + 1][j], dp[i][j + 1], dp[i][j] + add});
        }
    }

    string ans = "";
    int si = s.size(), ti = t.size();
    while (si != 0 && ti != 0) {
        int add = s[si - 1] == t[ti - 1];
        if (dp[si - 1][ti - 1] + add == dp[si][ti]) {
            if (add) {
                ans = s[si - 1] + ans;
            }
            si--;
            ti--;
        } else if (dp[si - 1][ti] == dp[si][ti]) {
            si--;
        } else {
            ti--;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
    int x,y,z,k; cin >> x >> y >> z >> k;
    lint a[1000], b[1000], c[1000];

    rep(i,x) cin >> a[i];
    rep(i,y) cin >> b[i];
    rep(i,z) cin >> c[i];
    priority_queue<lint, vector<lint>, less<lint>> hq;
    rep(i,x) {
        rep(j,y) {
            hq.push(a[i] + b[j]);
        }
    }
    lint d[3000];
    rep(i,min(k, x*y)) {
        d[i] = hq.top();
        hq.pop();
    }
    priority_queue<lint, vector<lint>, less<lint>> hq2;
    rep(i,min(k, x*y)) {
        rep(j,z) {
            hq2.push(d[i] + c[j]);
        }
    }
    rep(i,k) {
        cout << hq2.top() << endl;
        hq2.pop();
    }
}

Measured memory_bytes: 44120
import bisect

n = int(input())
a = list(map(int,input().split()))

# ni - nj = ai + aj (i>j)
# ai - ni = - aj - nj

a1 = sorted([a[i] - (i+1) for i in range(n)])
a2 = sorted([- a[i] - (i+1) for i in range(n)])
ans = 0
for i in range(n):
    left = bisect.bisect_left(a2, a1[i])
    right = bisect.bisect_right(a2, a1[i])
    ans += (right - left)
print(ans)

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


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

    ll ar[]={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};
    ll n;
    cin>>n;
    cout<<ar[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin

if __name__ == '__main__':

    L, R = [int(x) for x in stdin.readline().rstrip().split()]

    exist_0 = False
    mods = list()
    for i in range(R - L + 1):
        if (R - i) % 2019 == 0:
            exist_0 = True
            break

        mods.append((R - i) % 2019)

    if exist_0:
        print(0)
    else:
        min = 2018
        for i in range(len(mods)):
            for j in range(len(mods)):
                if i == j:
                    continue
                else:
                    tmp = (mods[i] * mods[j]) % 2019
                    if tmp < min:
                        min = tmp

        print(min)

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

int main(){

	const int N_MAX=1000000;
	int i,j,n[32],ni,max;
	int count[N_MAX];
	bool so[N_MAX];
	
	for(i=0;i<N_MAX;i++)
		so[i]=true;
	ni=0;
	max=0;
	while(cin>>n[ni])
		if(n[ni++]>max)
			max=n[ni-1];
	so[0]=so[1]=false;
	for(j=4;j<=max;j+=2)
			so[j]=false;
	for(i=3;i<=1000;i+=2){
		if(so[i]==0)continue;
		for(j=i*2;j<=max;j+=i)
			so[j]=false;
	}
	for(i=2;i<=max;i++){
		count[i] = count[i-1]+so[i];
	}
	for(i=0;i<ni;i++)
		cout << count[n[i]] << endl;

	return 0;
}

Measured memory_bytes: 6044
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, a) for (ll i = a; i >= 0; --i)
#define all(obj) begin(obj), end(obj)
#define rall(obj) rbegin(obj), rend(obj)
#define pb push_back
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    //
    //
    ll N, M;
    cin >> N >> M;
    double D[] = {1/2., 1/4., 1/8., 1/16., 1/32.};
    double d = D[M - 1];
    double t = 1900 * M + 100 * (N - M);
    double ans = 0;
    rep (i, 10000000) {
        ans += (i + 1) * t * d * pow(1 - d, i);
    }
    cout << (ll)round(ans) << endl;
}



Measured memory_bytes: 512
function main(arg) {
	var data = arg.trim().split("\n")[1].split(" ").map(Number)
	var t = data[0]
	var ans = 0
	for (var i = 0;i < data.length; i++) {
		if (data[i] >= t) {
			ans++
		}
		t = Math.max(data[i], t)
	}
	console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){
	int h,w;
	cin>>h>>w;
	char c[100][100];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>c[i][j];
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<c[i][j];
		}
		cout<<endl;
		for(int j=0;j<w;j++){
			cout<<c[i][j];
		}
		cout<<endl;
	}
}


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

int main() {
	int n;
	cin >> n;
	int m=n, s=0;

	while(m>9) {
		s += m%10;
		m /= 10;
	}

	s += m;

	if(n%s == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<queue>
#include<map> 
#include<bitset>
#include<vector>
using namespace std;
#define int long long
#define re register int
inline int read(){
    int x=0,ff=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')ff=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
    return x*ff;
}
int n;
int dfs(int i){
	if(i==1)return 1;
	return 1+2*dfs(i/2);
}
signed main(){
	int n;n=read();
	cout<<dfs(n)<<endl;
   	return 0;
}


Measured memory_bytes: 256
<?php
list($n, $k) = ints();
$A = ints();
for($i = 0; $i < $n; $i++){
  $sum = 0;
  for($j = $i; $j < $n; $j++){
    $sum+=$A[$j];
    $array[] = $sum;
  }
}
$v = 0;
for($m = 39; $m >= 0; $m--){
  $c = 0;
  $tmp = $v | 1<<$m;
  foreach($array as $a){
    if(($tmp & $a) == $tmp){
      ++$c;
    }
  }
  if($c >= $k)$v = $tmp;
}
printf("%d", $v);

function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}


Measured memory_bytes: 23156
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<int>A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<int>cnt(N);
    int l = 0,r = 0;
    int sum = 0,OR = 0;
    int ans = 0;
    while(r < N) {
        OR ^= A[r];
        sum += A[r];
        if(OR == sum) {
            ans+=r-l+1;
        }
        else {
            while(OR != sum) {
                OR ^= A[l];
                sum -= A[l];
                l++;
                if(OR == sum) {
                    ans+=r-l+1;
                }
            }
        }
        r++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 6300
#include<iostream>

int main() {

	int n;

	long long res=0;

	std::cin >> n;

	for (int i = 1; i <= n; i++) {
		if (i % 5 != 0 && i % 3 != 0)
			res += i;
	}

	std::cout << res << std::endl;

	return 0;
}

Measured memory_bytes: 3632
N = int(input())
a = [0]+[int(input()) for _ in range(N)]

cnt = [0]*(N+1)
now = 1
c = 0
while True:
    # 今ついてる箇所の確認
    cnt[now] += 1
    if cnt[now] > 1:
        print(-1)
        break

    # 次にアクセス
    now = a[now]
    c += 1
    if now == 2:
        print(c)
        break


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

int main() {
  int N,M;
  scanf("%d %d", &N,&M);
  long long A[N];
  for (int i = 0; i < N; ++i) {
    scanf("%lld", &A[i]);
  }
  vector<pair<long long,long long>> BC(M);
  for (int i = 0; i < M; ++i) {
    cin >> BC[i].second;
    cin >> BC[i].first;
  }

  sort(BC.begin(),BC.end(),greater<>());

  vector<long long> D;
  int count = 1;
  int ref = 0;

  for (int i = 0; i < N; ++i){
    if(count>BC[ref].second){
      count = 1;
      ref++;
    }
    if(ref>=M) break;
    D.push_back(BC[ref].first);
    // cout << BC[ref].first << endl;
    // cout << A[i] << endl;
    ++count;
  }
  for(int i=0;i<N;++i) D.push_back(A[i]);

  sort(D.begin(),D.end(),greater<>());
  
  long long ans = 0;
  for (int i = 0; i < N; ++i){
    ans += D[i];
    // cout << D[i] << endl;
  }

  cout << ans << endl;

}

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

int main(){
  int N, L;
  cin >> N >> L;
  vector<string> vec(N);
  for(int i = 0;i < N;i++){
  cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  for(int i = 0; i < N;i++){
  cout << vec.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256
def find(N,K):
    MOD = 10**9+7
    number = [1]*(K+1)
    for i in range(K,0,-1):
        number[i] = pow(K//i,N,MOD)
        for j in range(2,K+1):
            if i*j>K:
                break
            number[i] -= number[i*j]
            number[i] %= MOD
    ans = 0
    for k in range(1,K+1):
        ans += number[k]*k
        ans %= MOD
    return ans
N,K = list(map(int,input().strip().split()))
print(find(N,K))

Measured memory_bytes: 68764
def MAIN():
    n = int(input())
    ans = [[i, 0, 0] for i in range((n + 1))]
    G = [[] for _ in range((n + 1))]
    for _ in range(n):
        u, k, *v = map(int, input().split())
        G[u] = v
    cnt = 1
    def dfs(u):
        nonlocal ans
        if ans[u][1] != 0:
            return
        nonlocal cnt
        ans[u][1] = cnt
        cnt += 1
        for v in G[u]:
            dfs(v)
        ans[u][2] = cnt
        cnt += 1
    for i in range(1, n + 1):
        if ans[i][1] == 0:
            dfs(i)
        print(*ans[i])
MAIN()



Measured memory_bytes: 5656
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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; }





void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    double L; cin >> L;
    cout << setprecision(15) << L*L*L/27 << endl;
    
}



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



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

int BubbleSort( std::vector<int>& data ){
  bool flag = true;
  int cnt = 0;
  while(flag) {
    flag = false;
    for(int i = data.size() - 1; i >= 1; --i){
      if (data.at(i) < data.at(i - 1)) {
        std::swap(data[i], data[i - 1]);
        ++cnt;
        flag = true;
      }
    }
  }

  return cnt;
}

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

  std::vector<int> data(N);
  for(int i = 0; i < N; ++i)
    std::cin >> data[i];

  int cnt = BubbleSort(data);

  for(int i = 0; i < data.size() - 1; ++i)
    std::cout << data[i] << " ";
  std::cout << data.back() << std::endl;
  std::cout << cnt << std::endl;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef int Int;
typedef pair<Int, Int> pii;
typedef pair<Int, double> pid;
typedef pair<double, double> pdd;
typedef pair<Int, pii> pip;
typedef pair<pii, Int> ppi;
typedef pair<double, Int> pdp;
typedef vector<Int> veci;
typedef vector<double> vecd;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<pii> vecpii;
typedef vector<ppi> vecppi;
typedef vector<veci> mati;
typedef vector<vecll> matll;
typedef vector<vecd> matd;
#define PB(x) push_back(x)
#define EB(x) emplace_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (x).size()
#define CLR(x) memset(x,0,sizeof x)
#define pdebug() printf("%d\n",__LINE__)
#define REP(i, a, b) for(int i = (a);i <= (b);i++)
#define FORO(i, n) REP(i,0,(int)n-1)
#define FORI(i, n) REP(i,1,(int)n)
#define FORIT(i, t) for(auto i = t.begin();i != t.end();i++)
#define sqr(x) ((x)*(x))
#define dist(_a, _b) sqrt(sqr(_a.A-_b.A)+sqr(_a.B-_b.B))
#define norm(_a) sqrt(sqr(_a.A)+sqr(_a.B))
#define DEBUG 1
#if DEBUG
#define DUMP(a) do { std::cout << #a " = " << (a) << ", "; } while(false)
#define DUMPLN(a) do { std::cout << #a " = " << (a) << std::endl; } while(false)
#else
#define DUMP(a)
#define DUMPLN(a)
#endif
template<typename T, typename U>
inline void getMin(T &a, U b) { if (a > b) a = b; }
template<typename T, typename U>
inline void getMax(T &a, U b) { if (a < b) a = b; }
template<typename T>
vector<T> getVector(const int n) { return vector<T>(n); }
template<typename T>
vector<T> getVector(const int n, const T a) { return vector<T>(n, a); }
template<typename T>
vector<T> getEmptyVector() { return vector<T>(); }
template<typename T>
void appendAll(vector<T> &a, vector<T> b) { a.insert(a.end(), b.begin(), b.end()); }
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
// #define X first
// #define Y second
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const ll MOD = 1000000007;
const int MAXN = 1 << 17;
const int inf = 1 << 27;
const ll llinf = 1LL << 50;
const int NIL = -inf;
int popcount(int x) { return __builtin_popcount(x); }

const double EPS = 1e-6;
int N, K;
veci A;

int ceili(double x) {
    return int(ceil(x - EPS));
}

bool check(double d) {
    int cnt = 0;
    //DUMPLN(d);
    FORO(i, N) {
        if(double(A[i]) <= d) continue;
        cnt += floor((double)A[i] / d);
        //DUMP(A[i]); DUMPLN(cnt);
        if(cnt > K) return false;
    }
    return true;
}

double solve() {

    double l = 0, r = (double)*max_element(begin(A), end(A));
    while(r - l > EPS) {
        double mid = (l + r) * .5;
        //DUMP(l); DUMPLN(r);
        if(check(mid)) {
            r = mid;
        } else {
            l = mid;
        }
    }

    return r;
}

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

    cin >> N >> K;
    A.resize(N);
    FORO(i, N) cin >> A[i];

    cout << ceili(solve()) << endl;

    return 0;
}

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

int main() {
	long long X, K, D;
	cin >> X >> K >> D;
	X = abs(X);
	if (X/D >= K) cout << (X - K * D) << endl;
	else {
		K -= X / D;
		X %= D;
		if (K % 2 == 1) X = D - X;
		cout << X << endl;
	}
}




Measured memory_bytes: 3632
///I am Groot |*|
///19.09.2020>>08.55 PM
#include <iostream>
using namespace std;
int huhaha(int n)
{
    int rev=0;
    for(int i=n; i>0; i/=10)
    {
        rev=rev*10+i%10;
    }
    return rev;
}
int main()
{
    int x,y,cnt=0;
    cin>>x>>y;
    for(int i=x; i<=y; i++)
    {
        if(i==huhaha(i))
        {
            //cout<<x<<" ";
            cnt++;
        }
    }
    cout<<cnt;
}


Measured memory_bytes: 3604
import java.util.*
fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()
    val a = cin.nextInt()
    val b = cin.nextInt()

    if ((b-a)%2 == 0) {
        println("Alice")
    } else {
        println("Borys")
    }
}

Measured memory_bytes: 31656
#import numpy as np
#import functools
#import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm
#import collections as C #most_common
#import math


N = int(input())
#A,B= map(int,input().split())
#P = list(map(int,input().split()))
#S= str(input())

print(N+N**2+N**3)


Measured memory_bytes: 9136
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 99999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    int n;
    double ans;
    cin >> n;
    if(n%2 == 0){
        cout << 0.5 << endl;
    }else{
        ans = (double)(n/2 + 1)/(double)n;
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}


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

  vector<pair<pair<int,int>,int >> city;
  rep(i,m){
    int p,y;
    cin >> p >> y;
    city.push_back(make_pair(make_pair(p,y),i));
  }
  sort(all(city));
  rep(i,m){
    if(i == 0) city[i].first.second = 1;
    else if(city[i-1].first.first == city[i].first.first){

      city[i].first.second = city[i-1].first.second + 1;
    }else{
      city[i].first.second = 1;
    }
    //cout << city[i].first.second << endl;
  }

  rep(i,m){
    int tmp,tmp2;
    tmp = city[i].first.first;
    tmp2 = city[i].first.second;

    city[i].first.first = city[i].second;
    city[i].first.second = tmp;
    city[i].second = tmp2;

  }

  sort(all(city));

  rep(i,m){
    cout << std::setfill('0') << std::right << std::setw(6)  << city[i].first.second;
    cout << std::setfill('0') << std::right << std::setw(6)  << city[i].second << endl;

  }
  return 0;
}


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

#define lli long long int
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define INF 1000000007
#define endl "\n"

int main(){
	lli a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b;

	//system("pause");
}

Measured memory_bytes: 256
import sys
import numpy as np
from math import ceil
from collections import defaultdict as D

def S(): return sys.stdin.readline().rstrip().split(' ')
def Ss(): return list(S())
def I(): return _I(Ss())
def Is(): return list(I())
def _I(ss): return map(int, ss) if len(ss) > 1 else int(ss[0])

d = D(int)
n = I()
for _ in range(n):
  s = S()[0]
  d[s] += 1

for key in ['AC', 'WA', 'TLE', 'RE']:
  print('{} x {}'.format(key, d[key]))

Measured memory_bytes: 27136
import sys

for s in sys.stdin:
    w = float(s)
    if w <= 48:
        print 'light fly'
    elif w <= 51:
        print 'fly'
    elif w <= 54:
        print 'bantam'
    elif w <= 57:
        print 'feather'
    elif w <= 60:
        print 'light'
    elif w <= 64:
        print 'light welter'
    elif w <= 69:
        print 'welter'
    elif w <= 75:
        print 'light middle'
    elif w <= 81:
        print 'middle'
    elif w <= 91:
        print 'light heavy'
    else:
        print 'heavy'

Measured memory_bytes: 4240
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int main(){
  int l;
  string s,t;
  cin>>l>>s>>t;

  vector<string> v;
  rep(_,2){
    int m = s.size();
    int x = l/m;
    while( (l-x*m)%t.size() > 0 ) x--;

    stringstream str;
    rep(i,x) str << s;
    rep(i,(l-x*m)/t.size()) str << t;
    v.pb(str.str());
    swap(s,t);
  }
  sort(all(v));
  cout << v[0] << endl;

  return 0;
}


Measured memory_bytes: 1600
#if defined(LOCAL)
#include "C:\includes.hpp"
#include "C:\debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
    ios::sync_with_stdio(false);
  	cin.tie(0);
	int a, b;
	cin >> a >> b;
	cout << 6 - (a + b) << '\n';                     
	return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
		ll N;
	cin >> N;
	vecl(A);
	fx(N) {
		vecpl(A);
	}
	ll mask = 1;
	ll ans = 0;
	while(mask>0) {
		ll one = 0;
		fy(N) {
			if ((A[y]&mask)!=0) {
				one++;
			}
		}
		ans += (((one * (N - one))%MOD)*(mask%MOD))%MOD;
		ans %= MOD;
		mask <<= 1;
	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 6128