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

#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPS(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const ll INF = 1e+18;
const ll MOD = 1e+9+7;

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


int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N; cin >> N;
    vl A(N); REP(i, N) cin >> A[i];
    vl sum(N+1); REP(i, N) sum[i+1] += sum[i] + A[i];
    int x = 0, y = 2;
    ll ans = INF;
    for(int i = 2; i < N-1; i++)
    {
        while(sum[i]-sum[x]>sum[x])x++;
        while(sum[N]-sum[y]>sum[y]-sum[i])y++;
        for(int j = 0; j < 2; j++)
        {
            for(int k = 0; k < 2; k++)
            {
                ll a, b, c, d;
                a = sum[x-j]; b = sum[i]-sum[x-j];
                c = sum[N]-sum[y-k]; d = sum[y-k]-sum[i];
                ll ma = max(a, max(b, max(c, d)));
                ll mi = min(a, min(b, min(c, d)));
                chmin(ans, ma-mi);
            }
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 3456
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
#if DEBUG
            ReadLine();
#endif
        }

        void Solve(ConsoleInput cin)
        {
            String s = cin.Read;


            long bNum = 0;
            long result = 0;

            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'B')
                {
                    bNum++;
                }
                else
                {
                    result += bNum;
                }
            }

            Console.WriteLine(result);
        }

        class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;

            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }

            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }

            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 13344
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
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(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int n;
vector<int> G[MAX];
int dp[MAX][2];

void dfs(int v, int pv){
    if((int)G[v].size() == 1){
        dp[v][0] = 0;
        dp[v][1] = 1;
        return;
    }
    else if((int)G[v].size() == 2){
        for(int nv: G[v])if(nv != pv){
            dfs(nv, v);
            if(dp[nv][0] == 0){
                dp[v][0] = 0;
                dp[v][1] = 1;
            }
            else{
                dp[v][1] = dp[nv][1];
            }
        }
        return;
    }
    int sum = 0, diff_min = mod;
    for(auto nv: G[v])if(nv != pv){
        dfs(nv, v);
        sum += dp[nv][1];
        chmin(diff_min, dp[nv][0] - dp[nv][1]);
    }
    dp[v][1] = min(sum, sum + diff_min);
    return;
}

int main(){
    scanf("%d", &n);
    rep(i, n-1){
        int a, b;
        scanf("%d%d", &a, &b);
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int maxd = -1, sv;
    rep(i, n)if(chmax(maxd, (int)G[i].size())) sv = i;
    if(maxd <= 2){
        printf("%d\n", 1);
        return 0;
    }

    rep(i, n)rep(j, 2) dp[i][j] = mod;
    dfs(sv, -1);
    printf("%d\n", dp[sv][1]);
}

Measured memory_bytes: 15884
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=10000000;


int main(){
    int D,G;
    cin >> D >> G;
    G/=100;
    int p[D],c[D];
    for(int i=0;i<D;i++){
        cin >> p[i] >> c[i];
        c[i]/=100;
    }
    int ans=INF;
    for(int bit=0;bit<(1<<D);bit++){
        vector<int> v;
        int k=-1;
        for(int i=0;i<D;i++){
            if(bit&(1<<i)) v.pb(i);
            else k=i; 
        }
        int sum=0,t=0;
        for(int i=0;i<v.size();i++){
            sum+=(v[i]+1)*p[v[i]]+c[v[i]];
            t+=p[v[i]];
        }
        if(G<=sum){
            ans=min(ans,t);
            continue;
        }
        for(int i=0;i<p[k];i++){
            if(G<=sum){
                ans=min(ans,t);
                break;
            }
            sum+=k+1;
            t++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
if (n-n%100)/100==1:
    n+=800
else:
    n-=800

if (n%100-(n%100)%10)/10==1:
    n+=80
else:
    n-=80

if n%10==1:
    n+=8
else:
    n-=8
print(n)




Measured memory_bytes: 9052
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  
  int a;
  string s;
  cin>>a>>s;
  if(a<3200)cout<<"red";
  else cout<<s;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    int odd = 0, four = 0;
    for(const auto& x : a) {
        if(x & 1) odd++;
        if(x % 4 == 0) four++;
    }
    bool f = false;
    f |= four >= odd;
    f |= (odd+four == n) && (odd == four+1);
    cout << (f ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define pr_arr(name, a, b) \
  for (int i = (a); i < (b); i++) { \
    for (int j = (a); j < (b); j++) {\
      if (j > (a)) printf(" "); \
      printf("%lld", name[i][j]); \
    }\
    printf("\n");\
  }\

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;
static const long long int MOD = 1000000007;

ll ans;
ll N;
ll c[65];

int main(void) {
    scanf("%lld", &N);
    rep(i, 0, N) {
      ll A;
      scanf("%lld", &A);
      rep(j, 0, 60) {
        if ((A>>j) & 1LL) c[j]++;
      }
    }
    
    ll b = 1LL;

    rep(i, 0, 60) {
      ans += ((b%MOD)*((c[i]*(N-c[i]))%MOD))%MOD;
      ans %= MOD;
      b *= 2LL;
    }
   

  
    printf("%lld\n", ans);

	return 0;
}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

struct pos {
    int x;
    int y;
} typedef p;

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

    vector<p> stu(n+1);
    for (int i = 1; i <= n; i++) {
        cin >> stu[i].x >> stu[i].y;
    }

    vector<p> check(m+1);
    for (int i = 1; i <= m; i++) {
        cin >> check[i].x >> check[i].y;
    }

    for (int i = 1; i <= n; i++) {
        int minDst = 1e9;
        int minCheck = 0;
        for (int j = 1; j <= m; j++) {
            int difX = abs(stu[i].x - check[j].x);
            int difY = abs(stu[i].y - check[j].y);
            int dif = difX + difY;
            if (dif < minDst) {
                minDst = dif;
                minCheck = j;
            }
        }
        cout << minCheck << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INFTY 10000000000
typedef long long int ll;
const int MOD=1000000007;
using Graph = vector<vector<int>>;
using ipair = pair<ll,ll>;
bool operator< (const ipair a, const ipair b){return a.first < b.first;};
#define rep(i,n) for (ll i = 0; i < (n); ++i)
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main(){
    int n,k;cin>>n>>k;
    vector<int> p(n);
    rep(i,n)cin>>p[i];
    sort(p.begin(),p.end());
    int sum = 0;
    rep(i,k)sum += p[i];
    cout<<sum << endl;
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  
  for(int i=0; i<26; i++){
    char x = i+'a';
    ll front=-100;
    for(int j=0; j<s.size(); j++){
      if(s[j]==x){
        if(j-front<=2){
          cout << front+1 << " " << j+1 << endl;
          return 0;
        }
        else{
          front=j;
        }
      }
    }
  }
  cout << -1 << " " << -1 << endl;
}
  
  
  


Measured memory_bytes: 512
import copy
s=list()

N,M=map(int,raw_input().split())
n=[[0 for i in range(N)] for j in range(N)]
for i in range(M):
        a,b=map(int,raw_input().split())
        n[a-1][b-1]=1
        n[b-1][a-1]=1
arrived=[0 for i in range(N)]

arrived[0]=1
def solve(s,arrived):
        narrived=copy.deepcopy(arrived)
        global n
        global N
        op=False
        ans=0
        for i in range(N):
                arrived=copy.deepcopy(narrived)
                if(s[i]==1 and arrived[i]!=1):
                        op=True
                        arrived[i]=1
                        ans+=solve(n[i],arrived)
        
        if(sum(arrived)==N and op==False):
                return 1
        elif(op==False):
                return 0
        return ans
                        
print(solve(n[0],arrived))


Measured memory_bytes: 2696
n = int(input())
import sys

total = 0 

dicts = {}
dicts[1] = 1 
dicts[2] = 3 
dicts[0] = 0 
if n == 1:
    print(1)
    sys.exit()

if n == 2:
    print(3)
    sys.exit()
 
def dfs(jk):  
    global total
    global dicts
    if jk in dicts:
        return dicts[jk]
    
    if jk not in dicts:
        half = int(jk //2 )
        new = dfs(half) + dfs(half) + 1
        dicts[jk] = new 
        return new 
    
dfs(n)
#print(dicts)
print(dicts[n])





Measured memory_bytes: 38384
/*
h s, d't skp th si tll i's sved
 * ABC141 E
 * ABC145 D
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
int k;
cin>>k;
string ans="Yes";
while(b<=a)
{
b*=2;
k--;
}
if(k<0)
{
ans="No";
}
else
{
while(c<=b)
{
c*=2;
k--;
}
if(k<0)
{
ans="No";
}
}
cout<<ans<<endl;
}

Measured memory_bytes: 3580
n = gets.chomp
thismonth = []
lastmonth = []
until n.empty?
 x = n.split(",")
 a = x[0].to_i
 lastmonth << a
 n = gets.chomp
end

n = gets
until n.nil?
 x = n.split(",")
 a = x[0].to_i
 thismonth << a
 n = gets
end

customer = []
lastmonth.each do |k|
 if thismonth.include?(k)
   if customer.include?(k)
   else
      customer << k
   end
 end
end


qq = lastmonth.push(thismonth)
allcus = qq.flatten

customer2 = customer.sort
if customer.length >= 1
 customer2.each do |t|
  count = allcus.count(t)
  puts "#{t} #{count}"
 end
end


Measured memory_bytes: 6848
import java.sql.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int start = scan.nextInt();
		
		int[] cost = new int[m];
		for (int i = 0; i < cost.length; i++) {
			cost[i] = scan.nextInt();
		}
		
		int countA = 0;
		int countB = 0;
		
		for (int i = 0; i < cost.length; i++) {
			if (cost[i] < start) {
				countA++;
			} else {
				countB++;
			}
		}
		
		System.out.println(Math.min(countA, countB));
	}
}

Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
typedef pair<int ,int> P;
int inf = 100000000;

int main(){
    int64_t n;
    cin >> n;
    
    for(int64_t i=sqrt(n);i>0;i--){
        for(int64_t j=n/i;i*j <= n;j++){
            if(i*j == n) {
                cout << i+j-2 << endl;
                return 0;
            }
        }
    }
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main()
{
    int a;
  cin >> a;
cout << "ABC" << a << endl;
    return 0;
}


Measured memory_bytes: 256
mycode = r'''
# distutils: language=c++
# cython: language_level=3
# cython: boundscheck=False
# cython: wraparound=False
# cython: infer_types=True
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。

# define 
ctypedef long long LL

# 読み込みはpython側で行う
import numpy as np
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.readline #文字列読み込む時はこっち

def ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)

cdef LL i,j,k,_



# 桁DPか！？と思ったけど、制約が小さかった
cdef LL N,A,B,a,ans
N,A,B=ints()
# これはpythonで楽に実装できることを利用しよう
ans=0
for a in range(1,N+1):
    s=sum(map(int,str(a))) #pythonはこういう処理が楽なところが神っすよね
    if A<=s<=B:
        ans += a
print(ans)


'''

import sys
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    import os
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode


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

vector<int> seen;
vector<vector<int>> g;
void dfs(int x){
  if(seen[x]) return ;
  seen[x] = 1;
  for (int nx : g[x]){
    dfs(nx);
  }
}

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> a(m), b(m);
  rep(i, m){
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
  }
  
  int ans = 0;
  rep(i, m){
    g.assign(n, vector<int>());
    rep(j, m){
      if (i == j) continue ;
      g[a[j]].pb(b[j]);
      g[b[j]].pb(a[j]);
    }
    seen.assign(n, 0);
    dfs(0);
    rep(j, n){
      if(seen[j] == 0){
        ans++;
        break ;
      }
    }
  }
  cout << ans << endl;
}

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

bool isprime[100005];
int sigma[100005];
int main() {
	for (int i = 2; i * i <= 100000; i++)
		if (!isprime[i])
			for (int j = i * i; j <= 100000; j += i)
				isprime[j] = true;
	for (int i = 3; i <= 100000; i++)
		if (!isprime[i] && !isprime[(i + 1) / 2])
			sigma[i]++;
	for (int i = 1; i <= 100000; i++)
		sigma[i] += sigma[i - 1];
	int T;
	cin>>T;
	while (T--) {
		int l, r;
		cin>>l>>r;
		cout<< sigma[r] - sigma[l - 1] <<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mp make_pair
const int maxn = 4e5+5;
const int MOD = 1e9+7;
#define mod(x) x % MOD
#define INF 0x3f3f3f3f

int a[maxn];
int dp[maxn][2];

int main(){
    int n,k;
    while(~scanf("%d %d", &n, &k)){
        for(int i = 1;i <= n;i++){
            scanf("%d", a + i);
        }
        for(int i = 1;i <= k ;i++){
            for(int j = 1;j <= n;j++){
                if(i - a[j] >= 0){
                    if(dp[i][1] == 0) dp[i][1] = !dp[i-a[j]][0];
                    else dp[i][1] = dp[i][1];
                    if(dp[i][0] == 0) dp[i][0] = !dp[i-a[j]][1];
                    else dp[i][0] = dp[i][0];
                }
            }
        }
        if(dp[k][1] == 1){
            puts("First");
        }
        else{
            puts("Second");
        }
    }    
    return 0;
}

Measured memory_bytes: 3072
import math

N,D = list(map(int,input().split()))
points = [list(map(int,input().split())) for i in range(N)]

all_d = []

for i in range(N-1):
  for j in range(N-1-i):
    nijo = []
    nijo_sum = 0
    for k in range(D):
      nijo.append((points[i][k]-points[i+j+1][k])**2)
    for k in range(D):
      nijo_sum += nijo[k]
    all_d.append(math.sqrt(nijo_sum))

  
count = 0
for i in range(len(all_d)):
  if (all_d[i]%1) == 0:
    count += 1
print(count)

  

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

int main(){
	string s;
	string fnt,bhd;
	int Q;
	int rev=0;
	char C;
	int T;
	cin >> s;
	cin >> Q;
	for(int i=0; i<Q; i++){
		cin >> T;
		switch(T){
			case 1: rev = 1-rev; break;
			case 2: 	
				cin >> T >> C;
				if(T+rev==1) fnt = C+fnt;
				else if(T+rev==2) bhd = bhd+C;
				else if(T+rev==3) fnt = C+fnt;
				break;
			default: break;
		}
	}
	s = fnt + s + bhd;
	if(rev==1)reverse(s.begin(), s.end()); 
	cout << s << endl;
}

Measured memory_bytes: 1512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n;
  cin >> s;
  bool ok = true;
  if (n%2!=0){
    ok = false;
  }
  REP(i,n/2){
    if (s[i]!=s[i+n/2]){
      ok = false;
    }
  }

  if (ok)cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256
#pragma region
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define vd vector<double>
#define vs vector<string>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define rev(i, n) revi(i, n, 0)
#define each(i, n) for(auto&& i: n)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size()) 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define dump(x) cerr << #x << " = " << x <<endl
#define gcd __gcd
int lcm(int a, int b){return a / gcd(a, b) * b;}
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);
int dig(int n){return (int)(log10(n) + 1);}
void solve();
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	solve();
}
#pragma endregion

void solve() {
    int N; string S;
	cin >> N >> S;
	vector<vector<char>> v;
	rep(i, 10) rep(j, 10) rep(k, 10) {
		char ci = '0'+i;
		char cj = '0'+j;
		char ck = '0'+k;
		v.pb({ci, cj, ck});
	}
	int ans = 0;
	each(e, v) {
		int f = 0;
		each(i, S) {
			if (f == 0 && i == e[0]) f = 1;
			else if (f == 1 && i == e[1]) f = 2;
			else if (f == 2 && i == e[2]) f = 3;
		}
		if (f == 3) ans++;
	}
	cout << ans << endl;

}

Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	int N,AC=0,WA=0,TLE=0,RE=0;
	cin >> N;
	string S;
	for (int i = 0; i < N; i++)
	{
		cin >> S;
		if (S == "AC")
		{
			AC++;
		}
		else if (S == "WA")
		{
			WA++;
		}
		else if (S == "TLE")
		{
			TLE++;
		}
		else if (S == "RE")
		{
			RE++;
		}
	}
	cout << "AC x " << AC << endl;
	cout << "WA x " << WA << endl;
	cout << "TLE x " << TLE << endl;
	cout << "RE x " << RE << endl;
}


Measured memory_bytes: 3604
n = int(input())
h = list(map(int, input().split()))

if n == 2:
    print(abs(h[1] - h[0]))
    exit()

c = [0, abs(h[1] - h[0])]

i = 2

while i < n:
    temp = c[1]
    c[1] = min(c[0] + abs(h[i] - h[i-2]), c[1] + abs(h[i] - h[i-1]))
    c[0] = temp
    i += 1

print(c[1])



Measured memory_bytes: 13928
#include<bits/stdc++.h>
#define N 3
using namespace std;
typedef unsigned long long ull;
bool im[1010][1010],pa[110][110];
int w,h,p,ans;
vector<ull> used;

void ppp(){
 ull a=0;
 ull roll[1001][1001]={};
 for(int i=0;i<p;i++)
   for(int j=0;j<p;j++)a=a*N+pa[i][j];
 for(int i=0;i<used.size();i++)
   if(used[i]==a)return;
 used.push_back(a);
 for(int j=0;j<h;j++){
   ull b=0,g=1;
   for(int i=0;i<p;i++)b=b*N+im[j][i],g*=N;
   roll[j][p-1]=b;
   for(int i=p;i<w;i++){
     b=b*N+im[j][i]-im[j][i-p]*g;
     roll[j][i]=b;
   }
 }
 for(int j=p-1;j<w;j++){
   ull b=0,g=1,n=1;
   for(int i=0;i<p;i++)n*=N;
   for(int i=0;i<p;i++)b=b*n+roll[i][j],g*=n;
   if(b==a)ans++;
   for(int i=p;i<h;i++){
     b=b*n+roll[i][j]-roll[i-p][j]*g; 
     if(b==a)ans++;
   }
 }
}

void ch(){
 bool npa[110][110];
 for(int i=0;i<p;i++)
   for(int j=0;j<p;j++)npa[i][j]=pa[j][p-i-1];
 for(int i=0;i<p;i++)
   for(int j=0;j<p;j++)pa[i][j]=npa[i][j];
}

void ch1(){
 for(int i=0;i<p;i++)
   for(int j=0;j<p/2;j++)swap(pa[i][j],pa[i][p-j-1]);
}

int main(){
 int D[256];
 for(int i='A';i<='Z';i++)D[i]=i-'A';
 for(int i='a';i<='z';i++)D[i]=i-'a'+26;
 for(int i='0';i<='9';i++)D[i]=i-'0'+52;
 D['+']=62,D['/']=63;
 while(cin>>w>>h>>p,w){
   string s;
   used.clear();
   for(int i=0;i<h;i++){
     cin>>s;
     for(int j=0;j<s.size();j++){
	int t=D[s[j]];
	int a=6;
	while(a--)im[i][j*6+a]=t%2,t/=2;
     }
   }
   for(int i=0;i<p;i++){
     cin>>s;
     for(int j=0;j<s.size();j++){
	int t=D[s[j]];
	int a=6;
	while(a--)pa[i][j*6+a]=t%2,t/=2;
     }
   }
   ans=0;
    for(int i=0;i<4;i++){
     ppp();
     ch1();
     ppp();
     ch1();
     ch();
   }
   cout<<ans<<endl;
 }

 return 0;
}

Measured memory_bytes: 10056
#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define int long long
#define rep(i,N) for(int i=0;i<N;i++)

signed main(){
  string s,ss,sss;
  cin>>s>>ss>>sss;
  char S=toupper(s[0]);
  char SS=toupper(ss[0]);
  char SSS=toupper(sss[0]);
  cout<<S<<SS<<SSS<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
long mod=1e9+7;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
int N;
vector<int>G[2<<17];
long ans=0;
pair<long,long>dfs(int u,int p)
{
	vector<pair<long,long> >X;
	for(int v:G[u])
	{
		if(v!=p)
		{
			pair<long,long>p=dfs(v,u);
			X.push_back(p);
		}
	}
	if(X.empty())
	{
		return make_pair(0L,1L);
	}
	long sum=0;
	long prod=1;
	long w[3]={1,0,0};
	for(pair<long,long>p:X)
	{
		prod=prod*(p.second+1)%mod;
		w[2]=(w[2]*(p.second+1)+w[1]*p.second)%mod;
		w[1]=(w[1]+w[0]*p.second)%mod;
	}
	for(pair<long,long>p:X)
	{
		long now=prod*power(p.second+1,mod-2)%mod;
		sum+=now*p.first%mod+(now-1)*p.first%mod;
		sum=(sum%mod+mod)%mod;
	}
	sum+=w[2];sum%=mod;
	(ans+=sum)%=mod;
	pair<long,long>ret=make_pair(sum,(prod+prod-1+mod)%mod);
	for(pair<long,long>p:X)
	{
		(ret.first+=p.first+p.second)%=mod;
	}
	return ret;
}
main()
{
	cin>>N;
	for(int i=1;i<N;i++)
	{
		int u,v;cin>>u>>v;
		u--,v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs(0,-1);
	cout<<ans*power(power(2,N),mod-2)%mod<<endl;
}


Measured memory_bytes: 33024
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    A[i] = A[i]-i-1
A.sort()
import bisect
z = bisect.bisect_left(A,0)
ans = sum(A[z:])-sum(A[:z])
if z > N-z:
    p = 0
    while z>N-z:
        b = A[z-1]
        ans += (N - 2*z) * (p-b)
        p = b
        z = bisect.bisect_left(A,b)
elif N > 2*bisect.bisect_right(A,0):
    z = bisect.bisect_right(A,0)
    p = 0
    while N-z>z:
        b = A[z]
        ans += (2*z - N) * (b-p)
        p = b
        z = bisect.bisect_right(A,b)
print(ans)

Measured memory_bytes: 30812
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>

using namespace std;


int main()
{
	string S;
	int ans;
	int cnt_0 = 0;
	int cnt_1 = 0;

	cin >> S;

	for (int si = 0; si < S.length(); si++){
		if (S[si] == '0') cnt_0++;
		if (S[si] == '1') cnt_1++;
	}

	ans = min(cnt_0, cnt_1) * 2;

	printf("%d\n", ans);


	return 0;
}



Measured memory_bytes: 512
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Tree = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n;
	cin >> n;
	string s;
	cin >> s;

	ll ans = 0;
	rep(i, n-2){
		string t = s.substr(i, 3);
		if(t == "ABC") ans++;
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int a[305][305];
pi q1[305 * 305];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int h, w, d;
	cin >> h >> w >> d;
	rep(i, h) rep(j, w){
		cin >> a[i][j];
		q1[a[i][j]] = mp(i, j);
	}
	vector<pi> cnt[305 * 305];
	repn(i, 1, (h * w) + 1){
		int md = i % d;
		cnt[md].pb(q1[i]);
	}
	vi cnt1[305 * 305];
	rep(i, d){
		cnt1[i].pb(0);
		repn(j, 1, cnt[i].size()){
			int cur = cnt1[i][j - 1] + abs(cnt[i][j].fi - cnt[i][j - 1].fi) +  abs(cnt[i][j].se - cnt[i][j - 1].se);
			cnt1[i].pb(cur);
		}	
	}
	int q;
	cin >> q;
	rep(i, q){
		int l, r;
		cin >> l >> r;
		int md = l % d;
		if(md){
			int one = (r + (d - md)) / d;
			int two = (l + (d - md)) / d;
			one--, two--;
			cout << (one > 0 ? cnt1[md][one] : 0) - (two > 0 ? cnt1[md][two] : 0) << endl;
		}
		else{
			int one = r / d;
			int two = l / d;
			one--, two--;
			cout << (one > 0 ? cnt1[md][one] : 0) - (two > 0 ? cnt1[md][two] : 0) << endl;
		}
	}
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;

//DONT WASTE YOUR TIME
//prove yourself
//remember....fuck ps&&as hard....show them your are better then them
//Be confident.....dont lose hope.......You can do it.....
//dimaag  khoob h tere meh ....bas concentration ki kami h
//CONCENTRATE
//A,B,C dimaag nhi ...observation h .....zyaada mat sochna unme.....bas observe karna dhyaan se aur implement kar daal jitni jaldi ho sake

//capture it

const ll N= 1e6+55,mod = 1e9+7;

int main() {
 	//freopen("task.in","r",stdin);freopen("task.out","w",stdout);
	string s;
	cin>>s;
	ll i,j;
	for(i=1;i<s.size();i++){
		if(s[i]=='C' && s[i-1]=='A'){
			cout<<"Yes\n";
			return 0;
		}
	}
	cout<<"No\n";
}

Measured memory_bytes: 256
class PriorityQueue
    attr :size

    def initialize
        @size = 0
        @heap = []
    end

    def push(x)
        i = @size
        @size += 1
        while i > 0
            p = (i-1)/2
            break if(@heap[p] <= x)
            @heap[i] = @heap[p]
            i = p
        end
        @heap[i] = x
    end

    def top
        @heap[0]
    end

    def pop
        return nil if empty?

        ret = @heap[0]

        @size -= 1
        x = @heap[@size]
        @heap[@size] = nil

        i = 0
        while i*2+1 < @size
            a = i * 2 + 1
            b = i * 2 + 2

            a = b if b < @size && @heap[b] < @heap[a]

            break if @heap[a] >= x

            @heap[i] = @heap[a]
            i = a
        end
        @heap[i] = x

        ret
    end

    def empty?
        @size == 0
    end

    def print
        p @heap
    end
end

N=gets.to_i
a=gets.chomp.split.map(&:to_i)

pq = PriorityQueue.new
sum = 0
max_1 = []
0.upto(2*N-1) do |i|
    pq.push(a[i])
    sum += a[i]
    if pq.size > N
        min = pq.pop
        sum -= min
    end
    max_1[i] = sum
end

pq = PriorityQueue.new
sum = 0
max_2 = []

0.upto(2*N-1) do |i|
    pq.push(-a[3*N-1-i])
    sum += -a[3*N-1-i]
    if pq.size > N
        min = pq.pop
        sum -= min
    end
    max_2[3*N-1-i] = -sum
end

ans = -Float::INFINITY
((N-1)...(2*N)).each do |i|
    s = max_1[i] - max_2[i+1]
    ans = s if s > ans
end

#p max_1
#p max_2
p ans

Measured memory_bytes: 31672
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
typedef pair<int,int> pii;
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
// const int MOD = 998244353;
const int MOD = 1000000007;
vector<pair<int,int>> G[100100];
int ans[100010] = {};
int used[100100] = {};
void dfs(int n,int c){
	used[n] = 1;
	int nc = 1;
	for(auto p:G[n]){
		if(!used[p.fi]){
			if(c == nc)nc++;
			ans[p.se] = nc;
			dfs(p.fi,nc);
			nc++;
		}
	}
	return;
}
/*----------------------------------------------------------------*/
signed main(){

	int n;
	cin >> n;

	rep(i,n-1){
		int a,b;
		cin >> a >> b;
		a--;b--;
		G[a].pb(MP(b,i));
		G[b].pb(MP(a,i));
	}

	int maxi = 0;
	int id = -1;
	rep(i,n){
		if(chmax(maxi,int(G[i].size()))){
			id = i;
		}
	}
	cout << maxi << endl;

	dfs(id,-1);
	rep(i,n-1)cout << ans[i] << endl;

	





	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=gnu++17 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_b
// rm -r -f test;oj dl https://abc146.contest.atcoder.jp/tasks/abc146_d

Measured memory_bytes: 14440
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List as List


solve :: Integer -> [Integer] -> Integer
solve _ [] = 0
solve t [x] = t
solve t (x1:x2:xs) = n + (solve t (x2:xs))
    where
        n = min t (x2 - x1)

main :: IO()
main = do
    (n:t:_) <- map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine
    arr <- map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine
    print $ solve t arr   


Measured memory_bytes: 14460
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>

using namespace std;

int ar[100][2];
int n;
int counter = 0;
bool works = false;

int main () {

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> ar[i][0] >> ar[i][1];
    }
    for (int i = 0; i < n; i++) {
        if (ar[i][0]==ar[i][1]) {
                counter ++;
                if (counter == 3) {
                    works = true;
                    break;
                }
            }
            else {
                counter = 0;
            }
    }

    if (works) {
        cout << "Yes";
    }
    else {
        cout <<"No";
    }

}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
int n;
int h[110];
int migi(int i){
    if(i==n) return i-1;
    if(h[i]==0) return i-1;
    else return migi(i+1);
}
int hidari(int j){
    if(j==-1) return 0;
    if(h[j]==0) return j+1;
    else return hidari(j-1);

}
int main(){
    cin>>n;
    //cout<<"kkkk"<<endl;
    rep(i,n) cin>>h[i];
    int max=0;
    int b=0;
    int yari=0;
    while(1){
        int cntt=0;
        for(int i=0;i<n;i++){
            if(h[i]==0) cntt++;
        }
        if(cntt==n) break;
        max=0;
        b=0;
        for(int i=0;i<n;i++){
            if(h[i]>=max){
                max=h[i];
                b=i;
            }
        }
        int l=hidari(b);
        int r=migi(b);
        for(int i=l;i<=r;i++){
            h[i]--;
        }
        yari++;
    }
    cout<<yari<<endl;
    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 1e18+1
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll n;
    //rl(n);
    cin>>n;
    map<ll,ll> mp;
    ll ct=0;

    fr(i,1,n+1)
    {
        ll x;
        cin>>x;
        
        ct+=mp[i-x];
        
        mp[i+x]+=1;
    }
    cout<<ct<<endl;
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 26412
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>

using namespace std;


void print(vector<int> v){
	//ベクタの先頭から順番にアクセス
	vector<int>::iterator it;
	for(it=v.begin();it!=v.end();it++){
		cout<<*it<<" ";
	}
	cout<<endl;
}
int main(){
	/*int A[]={1,1,2,2,2,4,5,5,6,8,8,8,10,15};
	int *pos;
	int idx;

	pos =lower_bound(A,A+14,3);
	idx=distance(A,pos);
	cout<<idx+1<<"番目に"<<" "<<*pos<<endl;
	*/
	int n;
	int s[100000];
	int q;
	int t[50000];
	int cnt=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i];
	}

	cin>>q;
	for(int i=0;i<q;i++){
		cin>>t[i];
		if(*(lower_bound(s,s+n,t[i])) == t[i])cnt++;

	}
	cout<<cnt<<endl;

	return 0;
}


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


namespace my_originalprogram
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = x[0];
            int b = x[1];
            int c = x[2];
            if (a < b && b < c)
            {
                Console.WriteLine(a+" "+b+" "+c);
            }
            if (a < c && c < b)
            {
                Console.WriteLine(a+" "+c+" "+b);
            }
            if (b <a && a < c)
            {
                Console.WriteLine(b + " " + a+" " + c);
            }
            if (b<c && c<a)
            {
                Console.WriteLine(b + " " + c + " " + a);
            }
            if (c < a && a < b)
            {
                Console.WriteLine(c + " " + a + " " + b);
            }
             if (c < b && b < a)
            {
                Console.WriteLine(c + " " + b + " " + a);
            }
             if (a == b && b < c)
            {
                Console.WriteLine(a + " " + b + " " + c);
            }
             if (a == b && b > c)
            {
                Console.WriteLine(c + " " + a + " " + b);
            }
             if (a == c && c < b)
            {
                Console.WriteLine(a + " " + c + " " + b);
            }
             if (a == c && b < c)
            {
                Console.WriteLine(b + " " + a + " " + c);
            }
            if (b == c && b < a)
            {
                Console.WriteLine(b + " " + c + " " + a);
            }
            if (b == c && a < b)
            {
                Console.WriteLine(a + " " + b + " " + c);
            }

        }
    }
}


Measured memory_bytes: 16404
#include <bits/stdc++.h>
#define nl '\n'

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

vector <pair<ll,ll>> pf(ll n) {
	vector <pair<ll,ll>> ans;
	for (ll a = 2; a * a <= n; a++) {
		if (n % a != 0) continue;
		ll tmp = 0;
		while (n % a == 0) {
			tmp ++;
			n /= a;
		}
		ans.push_back({a,tmp});
	}
	if (n > 1) ans.push_back({n,1});
	return ans;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	setprecision(10);
	cout << fixed;
	ll n, ans = 0;
	cin >> n;
	const auto &a = pf(n);
	for (auto p : a) {
		for (int i = 1; i * (i+1) / 2 <= p.second; i++) {
			ans ++;
		}
	}
	cout << ans << nl;
}

Measured memory_bytes: 3652
N = int(input())
 
sum = 0
ro = 1
for n in range(1,N+1):
    num = int(N/n)
    if num == 1:
        record = n
        break
    s = int(((1+num)*num)/2)
    sum += ro*s
    ro += 1


sum += int(((record+N)*(N-record+1))/2)
print(sum)

Measured memory_bytes: 8932
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main()
{
	vector<int>vec;
	int n; cin >> n;
	for(int i=0;i<2*n;i++){
		int a; cin >> a;
		vec.pb(a);
	}
	sort(vec.begin(),vec.end());
	int ret = 0;
	for(int i=0;i<vec.size();i+=2){
		ret += vec[i];
	}
	cout << ret << endl;
}

Measured memory_bytes: 256
import std.stdio;
import std.range;
import std.array;
import std.algorithm;
import std.string;
import std.conv;
import std.typecons;
import std.math;

void main(){
    int[] tasks = readln().chomp().split().map!(to!int).array();
    solve(tasks).writeln();
}

int solve(int[] tasks){
    int result;
    int[] costs = [abs(tasks[0] - tasks[1]), abs(tasks[1] - tasks[2]), abs(tasks[2] - tasks[0])];
    int maxCost = costs.sort!("a > b").array()[0];
    result = costs.sum() - maxCost;

    return result;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

const int MAX_N = 100000, MAX_Q = 50000;
int n, q, s[MAX_N], ti;

int binarySearch(int key) {
  int left = 0;
  int right = n;
  int mid;
  while (left < right) {
    mid = (left + right) / 2;
    if (key == s[mid]) return 1;
    if (key > s[mid])
      left = mid + 1;
    else if (key < s[mid])
      right = mid;
  }
  return 0;
}

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

  int sum = 0;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    scanf("%d", &ti);
    if (binarySearch(ti)) sum++;
  }
  printf("%d\n", sum);

  return 0;
}

Measured memory_bytes: 3028
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str;
		String stack;
		char temp;
		int i;
		int flag;

		while(true){
			str = sc.nextLine();
			if(".".equals(str)) break;

			i = 0;
			flag = 0;
			stack = " ";

			for(int j=0; j<str.length(); j++){
				temp = str.charAt(j);
				if(temp == '['){
					stack += "[";
					i++;
				}else if(temp == '('){
					stack += "(";
					i++;
				}else if(temp == ']'){
					if(!stack.endsWith("[")){
						flag = 1;
						break;
					}else{
						stack = stack.substring(0, i);
						i--;
					}
				}else if(temp == ')'){
					if(!stack.endsWith("(")){
						flag = 1;
						break;
					}else{
						stack = stack.substring(0, i);
						i--;
					}
				}
			}

			if(flag!=0 || i!=0){
				System.out.println("no");
			}else{
				System.out.println("yes");
			}
		}
	}
}

Measured memory_bytes: 54900
#include <iostream>
#include <sstream>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <queue>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ul;
typedef pair<int,int> P;
#define X first
#define Y second

void go() {
	int n;
	cin >> n;
	set<int> t;
	for(;n--;) {
		int x;
		cin >> x;
		t.insert(x);
	}
	cout << t.size() << endl;

}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	// int t; cin >> t; for(;t--;)
	go();
	return 0;
}



Measured memory_bytes: 256
import copy

n = int(input())
p = int(input().replace(" ", ""))
q = int(input().replace(" ", ""))

def hoge(numbers, s, n_list):

    for i in range(len(numbers)):
        copy_numbers = copy.deepcopy(numbers)
        ss = s+copy_numbers.pop(i)
        if len(copy_numbers) > 0:
            hoge(copy_numbers, ss, n_list)
        else:
            n_list.append(int(ss))

n_list = []
for i in range(n):
    number_list = [str(i) for i in range(1, n+1)]
    s = number_list.pop(i)
    hoge(number_list, s, n_list)

n_list.sort()

ans = abs((n_list.index(p) + 1) - (n_list.index(q) + 1))
print(ans)


Measured memory_bytes: 5168
fn read_ls<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main(){
    let lst : Vec<i32> = read_ls();
    let (a, b) = (lst[0], lst[1]);

    if a < b {
        println!("a < b");
    }else if a > b{
        println!("a > b");
    }else{
        println!("a == b");
    }
}




Measured memory_bytes: 5028
def cost_a(i)
    disc = (i/5)*5
    normal = i%5
    380*(normal+0.8*disc)
end
def cost_b(i)
    disc = (i/4)*4
    normal = i%4
    550*(normal+0.85*disc)
end
def cost_c(i)
    disc = (i/3)*3
    normal = i%3
    850*(normal+0.88*disc)
end

while s=STDIN.gets
    n=s.to_i
    exit 0 if n==0

    min = 10000000000000
    for a in 0..n/200 do
        for b in 0..(n-a*200)/300 do
            next if (n-a*200-b*300)%500!=0 
            c = (n-a*200-b*300)/500
            cost = (cost_a(a)+cost_b(b)+cost_c(c)).to_i
            min = cost if min > cost
        end
    end
    print min,"\n"
end

Measured memory_bytes: 6116