akhauriyash/Code-Regression huggingface dataset:
using System;
class Program
{
    static void Main(string[] args)
    {
        string S = Console.ReadLine();
        int length = S.Length;
        int[] ct = new int[length];
        int sw = 0;
        int r = 0;
        int ls = 0;
        for (var i = 0; i < length; i++)
        {
            if (sw == 0)
            {
                if (S[i] == 'R')
                {
                    r++;
                }
                else
                {
                    r++;
                    ct[i-1] += (r + 0) / 2;
                    ct[ i ] += (r + 1) / 2;
                    sw = 1;
                    r = 0;
                    ls = i;
                }
            }
            else
            {
                if (S[i] == 'L')
                {
                    r++;
                }
                else
                {
                    ct[ls-1] += (r + 1) / 2;
                    ct[ ls ] += (r + 0) / 2;
                    sw = 0;
                    r = 1;
                }
            }
        }
        if (sw == 1)
        {
            ct[ls-1] += (r + 1) / 2;
            ct[ ls ] += (r + 0) / 2;
        }
        Console.Write(ct[0].ToString());
        for (var i = 1; i < length; i++)
        {
            Console.Write(" "+ct[i].ToString());
        }
    }
}


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

namespace ABC134D
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] ainput = Console.ReadLine().Split(' ');
            int[] a = new int[N];
            for (int i = 0; i < N; i++) a[i] = int.Parse(ainput[i]);
            int M = 0;
            List<int> b = new List<int>();
            int[] hako = new int[N];
            for(int i = N - 1; i >= 0; i--)
            {
                if (i > (N / 2)-1)
                {
                    if (a[i] == 1)
                    {
                        M += 1;
                        b.Add(i + 1);
                        hako[i] = 1;
                    }
                    //Console.WriteLine("a");
                }
                else
                {
                    int temp = i*2 + 1;
                    int bai = 0;
                    while (temp <= N-1)
                    {
                        bai += hako[temp];
                        temp += i + 1;
                    }
                    bai %= 2;
                    hako[i] = Math.Abs(a[i] - bai);
                    if (hako[i] == 1)
                    {
                        M += 1;
                        b.Add(i + 1);
                    }
                }
            }
            Console.WriteLine(M);
            if (b.Count > 0)
            {
                Console.WriteLine(string.Join(" ", b));
            }
        }
    }
}


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

lst = [0]*1000
sm = 0
first = [False]*10
second = [False]*100
for i in s:
    i = int(i)
    for j in range(100):
        if not second[j]:
            continue
        tmp = 10*j + i
        if lst[tmp] == 0:
            sm +=1
            lst[tmp]+=1

    for j in range(10):
        if first[j]:
            tmp = 10*j + i
            if not second[tmp]:
                second[tmp] = True

    if not first[i]:
        first[i] = True

print(sm)


Measured memory_bytes: 9208
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_lim=(n); i<i##_lim; ++i)
#define FOR(i, a, b) for (int i=(a), i##_lim=(b); i<i##_lim; ++i)
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;

int main()
{
    int A, P;
    cin >> A >> P;

    cout << ((P+A*3)/2) << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n = 0;
  long long a = 0, b = 0;
  cin >> n >> a >> b;
  vector<long long> x(n);
  for (int i=0; i<n; i++) {
    cin >> x.at(i);
  }
  long long ans = 0;
  for (int i=1; i<n; i++) {
    long long dif = x.at(i) - x.at(i-1);
    if (dif * a <= b) {
      ans += dif * a;
    } else {
      ans += b;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int R = sc.nextInt();
    if(R < 1200){
        System.out.println("ABC");
    }
    else if(R < 2800){
        System.out.println("ARC");
    }
    else{
        System.out.println("AGC");   
    }
  }
}

Measured memory_bytes: 23636
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int> A(N + 1); rep(i, 0, N + 1) {
		cin >> A[i];
	}
	vector<int> B(N); rep(i, 0, N) {
		cin >> B[i];
	}

	int ans = 0;
	rep(i, 0, N) {
		int x = min(A[i], B[i]);
		A[i] -= x;
		B[i] -= x;
		ans += x;
		x = min(A[i + 1], B[i]);
		A[i + 1] -= x;
		B[i] -= x;
		ans += x;
	}
	cout << ans << endl;

	return 0;
}

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

#define int long long
#define endl "\n"
#define Endl "\n"
#define in(n) int n;cin>>n;
#define take(v,n) vector<int> v(n);for(int i=0;i<n;i++)cin>>v[i];
#define print(v,n) for(int i=0;i<n;i++)cout<<v[i]<<" ";cout<<endl;
#define all(v) v.begin(), v.end()


void fastio()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

void solve()
{
	string s;
	cin >> s;
	int cnt = 0, maxi = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'R')cnt++;
		else {maxi = max(cnt, maxi); cnt = 0;}

	}
	cout << max(cnt,maxi);
}

int32_t main()
{
	//fastio();

	solve();
	return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define pii pair<ll,pi >
#define ppi pair<pi,ll>
#define ppp pair<pi,pi >
#define ex(str,a,b) str.substr((int)(a),min((int)str.size()-a,(int)(b-a+1))) 
#define all(X) X.begin(),X.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   __builtin_popcount(n) : no. of set bits in n.
*/

const int M = (1<<20)+5;
const int md = 1e9+7;

priority_queue<ll,vector<ll >,greater<ll > > pq;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

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

	ll n,i,u,v,ans = 0;

	cin >> n;
	for(i=1;i<=n;++i)
	{
		v = (n-i+1)*(n-i+2);
		ans += v/2;
	}

	for(i=1;i<n;++i)
	{
		cin >> u >> v;
		if(u>v)
			swap(u,v);
		ans -= u*(n-v+1);
	}

	cout << ans << "\n";
}
	

Measured memory_bytes: 3628
n = int(input())
a = list(map(int, input().split()))
money = 1000
stock = 0
for i in range(n - 1):
    if a[i] < a[i + 1]:
        buy = money // a[i]
        money -= buy * a[i]
        stock += buy
    if a[i] > a[i + 1]:
        money += stock * a[i]
        stock = 0
money += stock * a[n - 1]
print(money)


Measured memory_bytes: 9196
#include <iostream>
#include <iomanip>
#include <cmath>

double round3(double d)
{
    return floor(d * 1000.0 + 0.5) / 1000.0;
}

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

    for (int i = 0; i < n; ++i) {
        double x1, y1, x2, y2, x3, y3;
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

        double p = ((x1*x1-x2*x2+y1*y1-y2*y2)*(y1-y3)-(x1*x1-x3*x3+y1*y1-y3*y3)*(y1-y2))/(2*(x1-x2)*(y1-y3)-2*(x1-x3)*(y1-y2));
        double q = ((x1*x1-x2*x2+y1*y1-y2*y2)*(x1-x3)-(x1*x1-x3*x3+y1*y1-y3*y3)*(x1-x2))/(2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
        double r = sqrt((x1 - p) * (x1 - p) + (y1 - q) * (y1 - q));

        std::cout << std::fixed << std::setprecision(3) << round3(p) << " " << round3(q) << " " << round3(r) << std::endl;
    }
}

Measured memory_bytes: 1288
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>

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

    int a = x / 500;
    int b = (x - a * 500) / 5;
    
    std::cout << a * 1000 + b * 5 << std::endl;

    return 0;
}

Measured memory_bytes: 3604
#root:根
#find:根を考える
#rank:木の深さ
#size:size[i]:iを根とするグループのサイズ

def find(x):
    if root[x] == x:
        return x
    else:
        return find(root[x])

def unite(x,y):
    x = find(x)
    y = find(y)    
    if x != y:
        if rank[x] < rank[y]:
            root[x] = y
            size[y] += size[x]
        else:
            root[y] = x
            size[x] += size[y]
            if rank[x]==rank[y]:
                rank[x] += 1

def same(x,y):
    return find(x) == find(y)

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

root = [0]*n
for i in range(n):
    root[i] = i
rank = [1]*n
size = [1]*n

edge = [[int(i)-1 for i in input().split()] for i in range(m)]
edge = edge[::-1]

res = []
for i in range(m):
    r1 = find(edge[i][0])
    r2 = find(edge[i][1])
    if r1 == r2:
        res.append(0)
    else:
        res.append(size[r1]*size[r2])
        unite(r1,r2)
        
ans = 0
for i in range(m):
    ans += res[m-1-i]
    print(ans)

Measured memory_bytes: 28668
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n):
    s=list(map(int,input().split()))
    a.append(s[0])
    b.append(s[1])
c=zip(a,b)
d=sorted(c)
#print(d)
#print(d[0][1])
yen=0
btl=0
for i in range(n):
    if d[i][1]+btl<m:
        yen+=d[i][0]*d[i][1]
        btl+=d[i][1]
    elif d[i][1]+btl>=m:
        yen+=d[i][0]*(m-btl)
        btl=m
    if btl==m:
        print(yen)
        exit()

Measured memory_bytes: 24340
#include <bits/stdc++.h>
  
using namespace std;
  
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))
  
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;
  
#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))
  
int F()
{
    char ch;
    int x, a;
    while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
    if (ch == '-') ch = getchar(), a = -1;
    else a = 1;
    x = ch - '0';
    while (ch = getchar(), ch >= '0' && ch <= '9')
        x = (x << 1) + (x << 3) + ch - '0';
    return a * x;
}
  
int n, L[210], ans;
  
int main()
{
    gi(n);
    for (int i = 1; i <= (n << 1); ++i) gi(L[i]);
    sort(L + 1, L + 2 * n + 1);
    for (int i = 1; i <= (n << 1); i += 2) ans += L[i];
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int S,a,b,c,d,j;
  int count;
  int h,w;
  int check=0;
  string e;
  int map[12][12];
  while(1){
  for(int i=0;i<12;i++){
  for(j=0;j<12;j++){
	map[i][j]=2;
      }
    }
    cin>>e;
    if(e[0]=='#') break;
    w=0;
    h=0;
    for(int i=0;i<e.size();i++){
      if('0'<=e[i] && e[i]<='9'){
	S=e[i]-'0';
	for(j=0;j<S;j++){
	  map[h][w]=0;
	  w++;
	}
      }
	if(e[i]=='b'){
	  map[h][w]=1;
	  w++;
	}
	if(e[i]=='/'){
	  w=0;
	  h++;
	}
    }
    /* for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cout<<map[i][j];
      }
      cout<<endl;
      }*/
    cin>>a>>b>>c>>d;
    map[a-1][b-1]=0;
    map[c-1][d-1]=1;
    /*    for(int i=0;i<9;i++){
      for(int j=0;j<9;j++){
	cout<<map[i][j];
      }
      cout<<endl;
      }*/
    rep(i,12){
      count=0;
      for(j=0;j<12;j++){
	if(map[i][j]==0){
	  count++;
	  if(i!=0 && j==0) cout<<"/";
	}
	else if(map[i][j]==2){
	  if(count!=0) cout<<count;
	  count=0;
	  break;
	}
	else{
	  if(i!=0 && j==0) cout<<"/";
	  if(count!=0) cout<<count;
	  cout<<"b";
	  count=0;
	}
      }
      if(j==0) break;
    }
    cout<<endl;
  }
  return 0;
}



Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
#include<queue>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000001;
const long long LINF = 1e18;
const int MAX = 510000;

int main() {
	int n;
	string s;
	int p;
	cin >> n;
	map< pair<string, int>, int> a;
	vector<pair<string, int>> score(n);
	for (int i = 0; i < n; i++) {
		cin >> s >> p;
		score.at(i).first = s;
		score.at(i).second = -p;
		a[score.at(i)] = i;
	}
	sort(score.begin(), score.end());
	for (int i = 0; i < n; i++) {
		cout << a[score.at(i)] + 1 << endl;
	}
		return 0;
}

Measured memory_bytes: 3644
import sys
debug_mode = False
# debug_mode変数がTrueの時はファイル読み込み
# Falseの時は入力を読み込む(提出時)

# ファイルを読み込み、各行が格納された変数を返す
def readInput():
    lines = []
    if debug_mode:
        f = open('input.txt', 'r', encoding='utf-8')
        lines = f.readlines()
    else:
        for line_input in sys.stdin:
            lines.append(line_input)
    # 末尾の改行コードを削除する
    return list(map(lambda x:x.rstrip(), lines))

def main(lines):
    cake_list = lines[0].split()
    success = True
    for cake in cake_list:
        if 16 / int(cake) < 2:
            success = False
            break
    if success:
        print('Yay!')
    else:
        print(':(')
main(readInput())

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(ll i=0; i < n; i++)
#define reps(i, n) for(ll i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

int main() {
  ll n; cin >> n;
  ll ans=0;
  map<string,int> st;
  rep(i,n){
    string s;cin >> s;sort(ALL(s));
    if(st.count(s)==0){
      st[s]=1;
    }else {
      ans+=st[s];
      st[s]++;
    }
  }

  cout << ans;
}

Measured memory_bytes: 11136
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define NUM 1000000007
string ward,magic;
vector<vector<int> > dp;
int solve(int,int);
int main(){
    cin>>ward>>magic;
    dp.resize(ward.size());
    for(int i=0;i<ward.size();++i){
        dp[i].resize(magic.size());
        for(int j=0;j<magic.size();++j){
            dp[i][j]=-1;
        }
    }
    cout<<solve(0,0)<<endl;
    return 0;
}

int solve(int place,int use){
    if(use==magic.size()){
        return 1;
    }
    if(place==ward.size()){
        return 0;
    }
    if(dp[place][use]>=0){
        return dp[place][use];
    }
    
    
    int res = 0;
    res=solve(place+1,use);
    if(ward[place]==magic[use]){
        res+=solve(place+1,use+1);
    }
    res%=NUM;
    return dp[place][use]=res;
}

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

using namespace std;

int main()
{
    priority_queue<double> Q;
    int N, M;
    cin >> N >> M;
    double value;
    for(int i=0;i<N;i++){
        cin >> value;
        Q.push(value);
    }

    for(int i=0;i<M;i++){
        value = Q.top(); 
        Q.pop();
        Q.push(value / 2);
    }

    long long sum=0;
    for(int i=0;i<N;i++){
        value = Q.top();
        Q.pop();
        sum += (long long)value;
    }

    cout << sum << endl;
}

Measured memory_bytes: 1400
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

vector<char> pos1[11];

struct card {
	char c;
	int value;
};

template<typename T>vector<T> BubbleSort(vector<T> c, int n) {
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j >= i + 1; j--) {
			if (c[j].value < c[j - 1].value) {
				swap(c[j], c[j - 1]);
			}
		}
	}
	return c;
}

template<typename T>vector<T> SelectionSort(vector<T> c, int n) {
	for (int i = 0; i < n; i++) {
		int minj = i;
		for (int j = i; j < n; j++) {
			if (c[j].value < c[minj].value) {
				minj = j;
			}
		}
		swap(c[i], c[minj]);
	}
	return c;
}

void print(vector<card> v) {
	int pos2[11] = {};
	bool isstable = true;
	REP(i, v.size()) {
		if (i)cout << " ";
		cout << v[i].c << v[i].value;
		if (pos1[v[i].value][pos2[v[i].value]] == v[i].c) {
			pos2[v[i].value]++;
		}
		else {
			isstable = false;
		}
	}
	cout << endl;
	cout << (isstable ? "Stable" : "Not stable") << endl;
}

int main() {
	int n;
	cin >> n;
	vector<card> v;
	REP(i, n) {
		char c;
		int num;
		cin >> c >> num;
		pos1[num].emplace_back(c);
		v.emplace_back(card{ c,num });
	}
	vector<card> ansb = BubbleSort<card>(v, n);
	print(ansb);
	vector<card> anss = SelectionSort<card>(v, n);
	print(anss);
}


Measured memory_bytes: 3152
import java.util.*

fun main(args: Array<String>) {
    val reader = Scanner(System.`in`)
    var N = reader.nextInt()
    var K = reader.nextInt()
    var priceList = mutableListOf<Int>()
    repeat(N){
        priceList.add(reader.nextInt())
    }
    priceList.sort()
    var result = 0L
    repeat(K){
        result += priceList[it]
    }
    println(result)
}

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

template<typename T> inline void chmin(T &a, T b){
	if(a > b) a = b;
}

int main() {
	
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	rep(i, n) cin >> h[i];
	
	ll inf = 1LL << 60;
	vector<ll> dp(n, inf);
	
	dp[0] = 0;
	for(int i=1; i<n; i++){
		for(int j=1; j<=k; j++){
			if(i >= j) chmin(dp[i], dp[i-j] + abs(h[i]-h[i-j]));
		}
	}
	cout << dp[n-1] << endl;
	return 0;
}

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

//https://atcoder.jp/contests/aising2019/tasks/aising2019_c

int h, w, dx[] = { 1, 0, -1, 0 }, dy[] = { 0, 1, 0, -1 };
long long c[2], ans = 0;
bool b[400][400], visited[400][400];
void dfs(int x, int y) {
	c[b[x][y]]++;
	for (int i = 0; i < 4; i++) {
		int nx = x + dx[i];
		int ny = y + dy[i];
		if (nx < 0 || nx >= h || ny < 0 || ny >= w)
			continue;
		if (visited[nx][ny] || b[nx][ny] == b[x][y])
			continue;
		visited[nx][ny] = 1;
		dfs(nx, ny);
	}
}

int main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < w; j++)
			b[i][j] = s[j] == '#';
	}
	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++) {
			if (visited[i][j])
				continue;
			visited[i][j] = 1;
			c[0] = 0, c[1] = 0;
			dfs(i, j);
			ans += c[0] * c[1];
		}
	cout << ans << endl;
}


Measured memory_bytes: 8064
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

vl offset(48, 0);

vl countOneEachBit(ll n){
    ll d = 0;
    ll cp_n = n;
    while(cp_n > 0){
        cp_n = floor(cp_n/2); 
        d++;
    }
    vl ans(48, 0);
    rep(i, 0, d){
        ll p = (n - offset[i]) / (1LL << i);
        ll q = (n - offset[i]) % (1LL << i);
        if(i == 0){
            if(ll(floor((p+1))/2) % 2 == 1){
                ans[i] = 1;
            }
            continue;
        }
        if(p % 2 == 0){
            if(q % 2 == 1){
                ans[i] = 1;
            }
        }
    }
    return ans;
}

int main(){
    ll A, B; cin >> A >> B;
    rep(i, 0, 48){
        offset[i] = (1LL << i) - 1;
    }
    vl count1 = countOneEachBit(B);
    vl count2 = countOneEachBit(A-1);
    ll ans = 0;
    rep(i, 0, 48){
        ll s = 1LL << i;
        if((count1[i] + count2[i]) % 2 > 0) ans += (1LL << i);
    } 
    cout << ans << endl; 
}


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

using namespace std;
using ll = long long;

int const NMAX = 1e7 + 11;

int f[NMAX];

int main(void)
{
    int n;
    cin >> n;

    fill(f, f + n + 1, 2);
    f[1] = 1;
    for (ll i = 2; i <= n; ++i)
    {
        for (ll j = i; j * i <= n; ++j)
        {
            if (i == j)
                f[i * j] += 1;
            else
                f[i * j] += 2;
        }
    }

    ll ans = 0;
    for (ll i = 1; i <= n; ++i)
    {
        ans += i * f[i];
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 42668
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define powerof2 ()
#define mp make_pair
#define pi acos(-1)
using ll = long long;
const ll M = 1000000007;
const ll M1= 998244353;
using vl = vector<ll>;
using pll =  pair<ll,ll>;
ll power(ll x,ll y){
	if(y==0)
		return 1;
	ll res=power(x,y/2);
	res=(res*res);
	if(y&1)
		res=(res*x);
	return res;
}
 
ll powermod(ll x,ll y,ll mod){
	if(y==0)
		return 1;
	ll res=powermod(x,y/2,mod);
	res=(res*res)%mod;
	if(y&1)
		res=(res*x)%mod;
	return res;
}
/*ll binarysearch(ll va)
{
	ll n=1;
	ll l=va+1,u=n;
	ll st=num.order_of_key(va);
	while(l+1<u)
	{
		m=(l+u)/2;
		ll in=num.order_of_key(m);
		if(in-st==m-va)
		{
			l=m;
		}
		else
		{
            u=m;
		}
	}
	if(num1.find(l)==num1.end())
		return l;
	return u;
}*/
void solve(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	ll ans=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++) ans += a[i]*a[j];
	}
	cout<<ans<<"\n"; 
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
 
    for(int i=1;i<=t;i++)
    {//cout<<"Case #"<<i<<": ";
    solve();}
    return 0;
}

Measured memory_bytes: 3652
fn main() {
    let x: i32 = read();
    let a: i32 = read();
    let b: i32 = read();

    if x+a < b {
        println!("dangerous");
    } else if  x >= b {
        println!("delicious");
    } else {
        println!("safe");
    }
}

// 以下関数

use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub const MOD: u64 = 10e9 as u64 + 7;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}

pub fn abs(n: i32) -> i32 {
    if n >= 0 {
        n
    } else {
        -n
    }
}

pub fn max(n: i32, m: i32) -> i32 {
    if n >= m {
        n
    } else {
        m
    }
}

pub fn min(n: i32, m: i32) -> i32 {
    if n <= m {
        n
    } else {
        m
    }
}

Measured memory_bytes: 4352
#include <stdio.h>

void output(int A[], int N) {
	int i;
	
	for (i = 0; i < N; i++) {
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N) {
	int i, j;
	int tmp;
	
	for (i = 1; i < N; i++) {
		tmp = A[i];
		j = i - 1;
		
		while (j >= 0 && A[j] > tmp) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = tmp;
		output(A, N);
	}
}

int main(void) {
	int N;
	int A[100];
	int i;
	
	scanf("%d", &N);
	
	for (i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}
		
	output(A, N);
	insertionSort(A, N);

	return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int a;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> a;
	int ans = a + a * a + a * a * a;
	cout << ans << endl;
}







Measured memory_bytes: 3540
s = list(map(int, input()))
n = len(s)
if s[0]==0 or s[-1] == 1 or any(s[i]!=s[i] for i in range(n//2)):
    print(-1)
    exit()
G = [[] for i in range(n)]
cur = 0
for i in range(n-1):
    G[cur].append(i+1)
    G[i+1].append(cur)

    if s[i]:
        cur = i+1

root = n//2
from collections import deque
size = [1]*n
ans = [0]*n
edges = []
def bfs1(root):
    rev = [(root, -1)]
    for i in range(n):
        cur, par = rev[i]
        for to in G[cur]:
            if to != par:
                rev.append((to, cur))
    for i in reversed(range(1,n)):
        cur, par = rev[i]
        size[par] += size[cur]
        ans[size[cur]] = 1
        ans[n-size[cur]] = 1
        edges.append([cur+1, par+1])
bfs1(0)

if any(ans[i+1]!=s[i] for i in range(n-1)):
    print(-1)
    exit()

for i in edges:
    print(*i)


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

int main() {
    long long a;
    string bStr;
    cin >> a >> bStr;

    long long b = (bStr[0] - '0') * 100 + (bStr[2] - '0') * 10 + bStr[3] - '0';
    long long result = a * b / 100;

    cout << result;
}


Measured memory_bytes: 3620
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;



int main(int argc, char* argv[])
{
    char str[1005]={0};
    scanf("%s", str);

    int q;
    scanf("%d", &q);

    int i;
    for(i=0; i<q; i++) {
        char str0[10]={0};
        int a,b;
        scanf("%s %d %d", str0, &a, &b);
        
        if(strcmp(str0, "print")==0) {
            char str2[1005]={0};
            strncpy(str2, str+a, b-a+1);
            printf("%s\n", str2);
        }
        else if(strcmp(str0, "reverse")==0) {
            vector<char> z;
            int k;
            for(k=a; k<=b; k++) {
                z.push_back(str[k]);
            }
            reverse(z.begin(), z.end());
            int tmp=0;
            for(k=a; k<=b; k++,tmp++) {
                str[k]=z[tmp];
            }
        }
        else {
            char strp[1005]={0};
            scanf("%s", strp);
            int tmp=0;
            int k;
            for(k=a; k<=b; k++,tmp++) {
                str[k]=strp[tmp];
            }
        }
    }

    return 0;
}



Measured memory_bytes: 2708
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};


int main() {
    int N; cin>>N;
    vector<int> P(N);
    for(int i=0;i<N;++i) cin>>P[i];
    int mini=N+10;
    int cnt=0;
    for (int i = 0; i < N; ++i) {
        if(mini>P[i]) ++cnt;
        mini=min(mini,P[i]);
    }

    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 1024
k = int(input())
l = [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(l[k-1]) 

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const ll dy[4] = {1, 0, -1, 0};
const ll dx[4] = {0, 1, 0, -1};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n, m;
	cin >> n >> m;
	int x;
	cin >> x;
	int c[n];
	int p[n][m];
	rep(i, n) {
		cin >> c[i];
		rep(j, m) cin >> p[i][j];
	}
	int ans = inf;
	rep(bit, 1 << n) {
		vector<int> now(m);
		int cost = 0;
		rep(i, n) {
			if ((bit >> i) & 1) {
				cost += c[i];
				rep(j, m) { now[j] += p[i][j]; }
			}
		}
		bool check = 0;
		rep(i, m) {
			if (now[i] < x) {
				check = 1;
				break;
			}
		}
		if (check == 0) ans = min(ans, cost);
	}
	if (ans == inf)
		cout << "-1" << endl;
	else
		cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3612
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList <Integer> a = new ArrayList<>();
        ArrayList <Integer> b = new ArrayList<>();
        ArrayList <Integer> c = new ArrayList<>();
        
        for(int i=0; i<n; i++){
            a.add(sc.nextInt());
        }
        
        if(n%2 == 0){
        for(int i=0; i<n; i++){
            if(i%2 ==0){
            b.add(a.get(i));
            }else{
            c.add(a.get(i));
            }
        }
        
        Collections.reverse(c);
        
        for(int i=0;i<c.size(); i++){
            System.out.print(c.get(i)+" ");
        }
        for(int i=0;i<b.size(); i++){
            System.out.print(b.get(i)+" ");
        }
        }else{
        for(int i=0; i<n; i++){
            if(i%2 == 0){
            b.add(a.get(i));
            }else{
            c.add(a.get(i));
            }
        }
        Collections.reverse(b);
        
        for(int i=0;i<b.size(); i++){
            System.out.print(b.get(i)+" ");
        }
        for(int i=0;i<c.size(); i++){
            System.out.print(c.get(i)+" ");
        }
        }

    }
}

Measured memory_bytes: 69632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int ans = c-(a-b);
  if(ans>0){
    cout << ans << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}

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

int main() {
  int N, K; cin >> N >> K;
  int H[N]; for (int i = 0; i < N; i++) cin >> H[i];
  int num;
  for (int i = 0; i < N; i++)
    if (H[i] >= K) num++;
  cout << num << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<math.h>

int main(void) {

  int n, v;

  scanf("%d", &n);

  if (n>=1000) {
    printf("error\n");
    return 0;
  }

  v = n%10;

  if (v == 3) {
    printf("bon\n");
  } else if ((v==0)||(v==1)||(v==6)||(v==8)) {
    printf("pon\n");
  } else {
    printf("hon\n");
  }

  return 0;
}


Measured memory_bytes: 1664
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

a, b, c, d = getNM()
x = [a, b]
y = [c, d]

ans = []
for i in range(2):
    for j in range(2):
        ans.append(x[i] * y[j])

ans.sort()
print(ans[-1])

Measured memory_bytes: 78120
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,*A = map(int, read().split())
    
    X = 0
    for a in A:
        X ^= a

    ans = []
    for a in A:
        ans.append(a ^ X)

    print(*ans)


if __name__ == "__main__":
    main()


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

int main(){
  int n;
  int t = 0;
  cin >> n;
  for (int i=0; i<n; i++){
    int l,r;
    cin >> l >> r;
    t += (r-l+1);
    if (t > 100000){
      t = 100000;
      break;
    }
  }
  cout << t << endl;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/abc118/tasks/abc118_b

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <bitset>


using namespace std;
int main(){
	int n,m,ans;
	cin>>n>>m;
	vector<int> a(0);
	ans=0;

	for(int i=0; i<n; i++){
		int k;
		cin>>k;
		for(int j=0; j<k; j++){		
			int box;
			cin>>box;
			a.push_back(box);
		}
	}
	
	for(int i=1; i<m+1; i++){
		if(count(a.begin(),a.end(),i)==n) ans+=1;
	}
	cout<<ans<<endl;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

int n, a;

int main(int argc, char **argv) {
	cin >> n;
	set<int> s;
	REP(i, n) {
		cin >> a;
		if (s.count(a)) s.erase(a);
		else s.insert(a);
	}
	cout << s.size() << endl;
	return 0;
}


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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

fn main() {
    input! {
    n: usize,
    q: usize,
    ab: [(usize, usize); n - 1],
    px: [(usize, usize); q]
    }
    let mut g = vec![vec![]; n];
    let mut sx = vec![0; n];
    let mut ans = vec![-1; n];
    for i in ab {
        let (a, b) = (i.0 - 1, i.1 - 1);
        g[a].push(b);
        g[b].push(a);
    }
    for i in px {
        let (p, x) = (i.0 - 1, i.1);
        sx[p] += x;
    }
    dfs(0, 0, &g, &sx, &mut ans);
    for i in ans {
        print!("{} ", i);
    }
}

fn dfs(v: usize, p: usize, g: &Vec<Vec<usize>>, sx: &Vec<usize>, ans: &mut Vec<i64>) {
    if ans[v] >= 0 {return}
    let np = p + sx[v];
    ans[v] = np as i64;
    for &i in &g[v] {
        dfs(i, np, g, sx, ans)
    }
}



Measured memory_bytes: 33276
def num2(n):
  ans=0
  while n%2==0:
    ans+=1
    n//=2
  return ans
N=int(input())
l=[[i,num2(i)] for i in range(1,N+1)]
l.sort(key=lambda x:x[1],reverse=True)

print(l[0][0])

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

template <class T>
using V = vector<T>;

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

	int k, x;
	int min, max;

	cin >> k >> x;

	min = x - k + 1;
	max = x + k - 1;

	if (min < -100000) min = -100000;
	if (max > 100000) max = 100000;

	for (int i = min; i <= max; i++)
		cout << i << " ";
	
	cout << "\n";

	return 0;
}

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

int gcd(int a, int b){
	for (int c; a != 0; ) { c = a; a = b % a; b = c; }
	return b;
}
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	a = abs(a - c);
	b = abs(b - d);
	cout << a + b - gcd(a, b) << endl;
	return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


#define int ll

class CSentou {
public:
        int N,T;
void solve(std::istream& cin, std::ostream& cout) {
    cin >> N >> T;
    int temp;
    cin >> temp;
    ll sum = 0;
    _for(i,N-1){
        int t;
        cin >> t;
        sum += min(t,temp+T) - temp;
        temp = t;
    }
    cout << sum + T<< endl;
}
};


#undef int
int main() {
	CSentou solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Y(): print("Yes"); return
def N(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N,L = IL()
S = SLs(N)

S.sort()

print(*S,sep="")


Measured memory_bytes: 38384
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

int main(){
 ll n; cin>>n;
  if(n==1){
  cout<<"Hello World"<<endl; return 0;
  }
  else{
  ll a,b; cin>>a>>b;
    cout<<a+b<<endl; return 0;
  }
}

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

typedef long long ll;

int n;
int a[105], b[105];

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

  cin >> n;
  for (int i = 1; i < n; i++) cin >> b[i];

  for (int i = 2; i <= n; i++) a[i] = min(b[i - 1], b[i]);

  a[1] = b[1];
  a[n] = b[n - 1];

  int sum = 0;
  for (int i = 1; i <= n; i++) sum += a[i];
  cout << sum << endl;
  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int[][] c = new int[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				c[i][j] = scan.nextInt();
			}
		}
		boolean F = false;
		int A = 0;
		int B = 0;
		int C = 0;
		A = c[0][0]+c[1][0]+c[2][0];
		B = c[0][1]+c[1][1]+c[2][1];
		C = c[0][2]+c[1][2]+c[2][2];
		for (int i = 0; i < 4; i++) {
			if ((A-i) % 3 == 0 && (B-i) % 3 == 0 && (C-i) %3 == 0) {
				F = true;
			}
		}
		if (F) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define uptil(a, b, i) for(int i = (a), b_ = (b); i < b_; ++i)
#define upto(a, b, i) for(int i = (a), b_ = (b); i <= b_; ++i)
#define downtil(a, b, i) for(int i = (a), b_ = (b); i > b_; --i)
#define downto(a, b, i) for(int i = (a), b_ = (b); i >= b_; --i)
#define times(n, i) uptil(0, n, i)
#define rtimes(n, i) downto((n)-1, 0, i)

#define sp <<" "
#define ln <<"\n"
#define size(v) ((int)(v).size())
template<class T> using vec=vector<T>;
template<class T> using vvec=vec<vector<T>>;

void solve() {
  int N;cin>>N;
  vec<int> D(N);
  times(N, i) cin >> D[i];
  sort(D.begin(), D.end());
  cout << D[N / 2] - D[N / 2 - 1] ln;
}

signed main() {
  // cin.tie(0);
  cout << fixed << setprecision(20);
  cerr << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 1024